mirror of
https://github.com/localsend/localsend.git
synced 2026-06-23 04:10:07 +00:00
wip
This commit is contained in:
@@ -83,7 +83,7 @@ class _SetupSignalingConnection extends AsyncGlobalAction {
|
||||
version: protocolVersion,
|
||||
deviceModel: deviceInfo.deviceModel,
|
||||
deviceType: deviceInfo.deviceType.toRustDeviceType(),
|
||||
fingerprint: security.certificateHash,
|
||||
token: security.certificateHash,
|
||||
),
|
||||
onConnection: (c) {
|
||||
connection = c;
|
||||
@@ -125,6 +125,7 @@ class _SetupSignalingConnection extends AsyncGlobalAction {
|
||||
offer: message.field0,
|
||||
settings: ref.read(settingsProvider),
|
||||
favorites: ref.read(favoritesProvider),
|
||||
key: ref.read(securityProvider),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -186,7 +187,7 @@ extension ClientInfoExt on ClientInfo {
|
||||
version: version,
|
||||
port: -1,
|
||||
https: false,
|
||||
fingerprint: fingerprint,
|
||||
fingerprint: token,
|
||||
alias: alias,
|
||||
deviceModel: deviceModel,
|
||||
deviceType: deviceType?.toDeviceType() ?? DeviceType.desktop,
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:collection/collection.dart';
|
||||
import 'package:common/model/dto/file_dto.dart' as dart_model;
|
||||
import 'package:common/model/file_status.dart';
|
||||
import 'package:common/model/session_status.dart';
|
||||
import 'package:common/model/stored_security_context.dart';
|
||||
import 'package:dart_mappable/dart_mappable.dart';
|
||||
import 'package:localsend_app/model/persistence/favorite_device.dart';
|
||||
import 'package:localsend_app/model/state/server/receive_session_state.dart';
|
||||
@@ -40,6 +41,7 @@ class WebRTCReceiveService extends ReduxNotifier<WebRTCReceiveState> {
|
||||
final WsServerSdpMessage _offer;
|
||||
final SettingsState _settings;
|
||||
final List<FavoriteDevice> _favorites;
|
||||
final StoredSecurityContext _key;
|
||||
|
||||
WebRTCReceiveService({
|
||||
required String signalingServer,
|
||||
@@ -48,12 +50,14 @@ class WebRTCReceiveService extends ReduxNotifier<WebRTCReceiveState> {
|
||||
required WsServerSdpMessage offer,
|
||||
required SettingsState settings,
|
||||
required List<FavoriteDevice> favorites,
|
||||
required StoredSecurityContext key,
|
||||
}) : _signalingServer = signalingServer,
|
||||
_stunServers = stunServers,
|
||||
_connection = connection,
|
||||
_offer = offer,
|
||||
_settings = settings,
|
||||
_favorites = favorites;
|
||||
_favorites = favorites,
|
||||
_key = key;
|
||||
|
||||
@override
|
||||
WebRTCReceiveState init() {
|
||||
@@ -73,6 +77,7 @@ class AcceptOfferAction extends AsyncReduxAction<WebRTCReceiveService, WebRTCRec
|
||||
final controller = await state.connection.acceptOffer(
|
||||
stunServers: notifier._stunServers,
|
||||
offer: state.offer,
|
||||
privateKey: notifier._key.privateKey,
|
||||
);
|
||||
|
||||
controller.listenStatus().listen((status) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use crate::frb_generated::StreamSink;
|
||||
use bytes::Bytes;
|
||||
use flutter_rust_bridge::{frb, DartFnFuture};
|
||||
use localsend::crypto::token::SigningTokenKey;
|
||||
use localsend::model::discovery::DeviceType;
|
||||
use localsend::model::transfer::FileDto;
|
||||
pub use localsend::webrtc::signaling::{
|
||||
@@ -13,7 +14,6 @@ pub use localsend::webrtc::webrtc::{
|
||||
use std::collections::HashSet;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use localsend::crypto::token::SigningTokenKey;
|
||||
use tokio::sync::{mpsc, oneshot, Mutex};
|
||||
use tokio::time;
|
||||
use uuid::Uuid;
|
||||
@@ -27,15 +27,13 @@ pub struct ProposingClientInfo {
|
||||
|
||||
impl ProposingClientInfo {
|
||||
fn sign(&self, signing_key: &SigningTokenKey) -> anyhow::Result<ClientInfoWithoutId> {
|
||||
Ok(
|
||||
ClientInfoWithoutId {
|
||||
alias: self.alias.clone(),
|
||||
version: self.version.clone(),
|
||||
device_model: self.device_model.clone(),
|
||||
device_type: self.device_type.clone(),
|
||||
token: localsend::crypto::token::generate_token_timestamp(&signing_key)?,
|
||||
}
|
||||
)
|
||||
Ok(ClientInfoWithoutId {
|
||||
alias: self.alias.clone(),
|
||||
version: self.version.clone(),
|
||||
device_model: self.device_model.clone(),
|
||||
device_type: self.device_type.clone(),
|
||||
token: localsend::crypto::token::generate_token_timestamp(&signing_key)?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +74,7 @@ pub async fn connect(
|
||||
interval.tick().await;
|
||||
|
||||
loop {
|
||||
let _ = managed_connection.send_update(info)
|
||||
let _ = managed_connection.send_update(info).await;
|
||||
|
||||
interval.tick().await;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user