Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions flutter/lib/consts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ const String kOptionDirectxCapture = "enable-directx-capture";
const String kOptionAllowRemoteCmModification = "allow-remote-cm-modification";
const String kOptionEnableUdpPunch = "enable-udp-punch";
const String kOptionEnableIpv6Punch = "enable-ipv6-punch";
const String kOptionAllowSyncClipboardBetweenSessions =
"allow-sync-clipboard-between-sessions";
const String kOptionEnableTrustedDevices = "enable-trusted-devices";
const String kOptionShowVirtualMouse = "show-virtual-mouse";
const String kOptionVirtualMouseScale = "virtual-mouse-scale";
Expand Down
9 changes: 9 additions & 0 deletions flutter/lib/desktop/pages/desktop_setting_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,15 @@ class _GeneralState extends State<_General> {
kOptionEnableIpv6Punch,
isServer: false,
),
Tooltip(
message: translate('sync-clipboard-between-sessions-tip'),
child: _OptionCheckBox(
context,
'Sync clipboard between sessions',
kOptionAllowSyncClipboardBetweenSessions,
isServer: false,
),
),
],
];

Expand Down
24 changes: 24 additions & 0 deletions src/client/io_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1462,6 +1462,18 @@ impl<T: InvokeUiSession> Remote<T> {
!lc.disable_clipboard.v && !lc.view_only.v
};
if clipboard_allowed {
#[cfg(all(
feature = "flutter",
not(any(target_os = "android", target_os = "ios"))
))]
if self.handler.is_text_clipboard_required()
&& crate::clipboard::is_sync_clipboard_between_sessions_enabled()
{
let mut msg = Message::new();
msg.set_clipboard(cb.clone());
let session_id = self.handler.lc.read().unwrap().session_id;
crate::flutter::send_clipboard_msg_to_other_sessions(msg, session_id);
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
update_clipboard(vec![cb], ClipboardSide::Client);
#[cfg(target_os = "ios")]
Expand All @@ -1485,6 +1497,18 @@ impl<T: InvokeUiSession> Remote<T> {
!lc.disable_clipboard.v && !lc.view_only.v
};
if clipboard_allowed {
#[cfg(all(
feature = "flutter",
not(any(target_os = "android", target_os = "ios"))
))]
if self.handler.is_text_clipboard_required()
&& crate::clipboard::is_sync_clipboard_between_sessions_enabled()
{
let mut msg = Message::new();
msg.set_multi_clipboards(_mcb.clone());
let session_id = self.handler.lc.read().unwrap().session_id;
crate::flutter::send_clipboard_msg_to_other_sessions(msg, session_id);
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
update_clipboard(_mcb.clipboards, ClipboardSide::Client);
#[cfg(target_os = "ios")]
Expand Down
11 changes: 11 additions & 0 deletions src/clipboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ pub const CLIPBOARD_NAME: &'static str = "clipboard";
pub const FILE_CLIPBOARD_NAME: &'static str = "file-clipboard";
pub const CLIPBOARD_INTERVAL: u64 = 333;

pub const OPTION_ALLOW_SYNC_CLIPBOARD_BETWEEN_SESSIONS: &str =
"allow-sync-clipboard-between-sessions";

#[cfg(all(feature = "flutter", not(any(target_os = "android", target_os = "ios"))))]
pub fn is_sync_clipboard_between_sessions_enabled() -> bool {
hbb_common::config::option2bool(
OPTION_ALLOW_SYNC_CLIPBOARD_BETWEEN_SESSIONS,
&hbb_common::config::LocalConfig::get_option(OPTION_ALLOW_SYNC_CLIPBOARD_BETWEEN_SESSIONS),
)
}

// This format is used to store the flag in the clipboard.
const RUSTDESK_CLIPBOARD_OWNER_FORMAT: &'static str = "dyn.com.rustdesk.owner";

Expand Down
16 changes: 16 additions & 0 deletions src/flutter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1422,10 +1422,26 @@ pub fn update_file_clipboard_required() {

#[cfg(not(target_os = "ios"))]
pub fn send_clipboard_msg(msg: Message, _is_file: bool) {
send_clipboard_msg_impl(msg, _is_file, None);
}

// `except_session_id` is the session the content came from, to avoid sending it back.
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub fn send_clipboard_msg_to_other_sessions(msg: Message, except_session_id: u64) {
send_clipboard_msg_impl(msg, false, Some(except_session_id));
}

#[cfg(not(target_os = "ios"))]
fn send_clipboard_msg_impl(msg: Message, _is_file: bool, except_session_id: Option<u64>) {
for s in sessions::get_sessions() {
if !s.is_default() {
continue;
}
if let Some(except_session_id) = except_session_id {
if s.lc.read().unwrap().session_id == except_session_id {
continue;
}
}
#[cfg(feature = "unix-file-copy-paste")]
if _is_file {
if crate::is_support_file_copy_paste_num(s.lc.read().unwrap().version)
Expand Down
2 changes: 2 additions & 0 deletions src/lang/ar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,5 +761,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Continue", "متابعة"),
("Browser didn't open? Use the url below to sign in.", "لم يفتح المتصفح؟ استخدم الرابط أدناه لتسجيل الدخول."),
("Lock canvas", "قفل اللوحة"),
("Sync clipboard between sessions", "مزامنة الحافظة بين الجلسات"),
("sync-clipboard-between-sessions-tip", "النص أو الصور المنسوخة في جلسة بعيدة واحدة تُرسَل أيضًا إلى حافظة جلساتك المتصلة الأخرى."),
].iter().cloned().collect();
}
2 changes: 2 additions & 0 deletions src/lang/be.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,5 +761,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Continue", "Працягнуць"),
("Browser didn't open? Use the url below to sign in.", "Браўзер не адкрыўся? Скарыстайцеся спасылкай ніжэй, каб увайсці."),
("Lock canvas", "Заблакіраваць палатно"),
("Sync clipboard between sessions", "Сінхранізаваць буфер абмену паміж сеансамі"),
("sync-clipboard-between-sessions-tip", "Тэкст або відарысы, скапіяваныя ў адным аддаленым сеансе, таксама адпраўляюцца ў буфер абмену іншых вашых падключаных сеансаў."),
].iter().cloned().collect();
}
2 changes: 2 additions & 0 deletions src/lang/bg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,5 +761,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Continue", "Продължи"),
("Browser didn't open? Use the url below to sign in.", "Браузърът не се отвори? Използвайте URL адреса по-долу, за да се впишете."),
("Lock canvas", "Заключване на платното"),
("Sync clipboard between sessions", "Синхронизиране на клипборда между сесиите"),
("sync-clipboard-between-sessions-tip", "Текст или изображения, копирани в една отдалечена сесия, се изпращат и към клипборда на другите ви свързани сесии."),
].iter().cloned().collect();
}
2 changes: 2 additions & 0 deletions src/lang/ca.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,5 +761,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Continue", "Continua"),
("Browser didn't open? Use the url below to sign in.", "No s'ha obert el navegador? Utilitzeu l'URL de sota per iniciar la sessió."),
("Lock canvas", "Bloca el llenç"),
("Sync clipboard between sessions", "Sincronitza el porta-retalls entre sessions"),
("sync-clipboard-between-sessions-tip", "El text o les imatges copiats en una sessió remota també s'envien al porta-retalls de les altres sessions connectades."),
].iter().cloned().collect();
}
2 changes: 2 additions & 0 deletions src/lang/cn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,5 +761,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Continue", "继续"),
("Browser didn't open? Use the url below to sign in.", "浏览器未打开?请使用下方网址登录。"),
("Lock canvas", "锁定画布"),
("Sync clipboard between sessions", "在会话间同步剪贴板"),
("sync-clipboard-between-sessions-tip", "在一个远程会话中复制的文本或图片也会发送到其他已连接会话的剪贴板。"),
].iter().cloned().collect();
}
2 changes: 2 additions & 0 deletions src/lang/cs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,5 +761,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Continue", "Pokračovat"),
("Browser didn't open? Use the url below to sign in.", "Neotevřel se prohlížeč? Pro přihlášení použijte URL níže."),
("Lock canvas", "Zamknout zobrazení"),
("Sync clipboard between sessions", "Synchronizovat schránku mezi relacemi"),
("sync-clipboard-between-sessions-tip", "Text nebo obrázky zkopírované v jedné vzdálené relaci se odešlou i do schránky ostatních připojených relací."),
].iter().cloned().collect();
}
2 changes: 2 additions & 0 deletions src/lang/da.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,5 +761,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Continue", "Fortsæt"),
("Browser didn't open? Use the url below to sign in.", "Åbnede browseren ikke? Brug URL'en nedenfor til at logge ind."),
("Lock canvas", "Lås lærred"),
("Sync clipboard between sessions", "Synkroniser udklipsholder mellem sessioner"),
("sync-clipboard-between-sessions-tip", "Tekst eller billeder, der kopieres i én fjernsession, sendes også til udklipsholderen i dine andre forbundne sessioner."),
].iter().cloned().collect();
}
2 changes: 2 additions & 0 deletions src/lang/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,5 +761,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Continue", "Weiter"),
("Browser didn't open? Use the url below to sign in.", "Hat sich der Browser nicht geöffnet? Melden Sie sich über die untenstehende URL an."),
("Lock canvas", "Sichtfeld sperren"),
("Sync clipboard between sessions", "Zwischenablage zwischen Sitzungen synchronisieren"),
("sync-clipboard-between-sessions-tip", "In einer Remote-Sitzung kopierter Text oder kopierte Bilder werden auch an die Zwischenablage Ihrer anderen verbundenen Sitzungen gesendet."),
].iter().cloned().collect();
}
2 changes: 2 additions & 0 deletions src/lang/el.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,5 +761,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Continue", "Συνέχεια"),
("Browser didn't open? Use the url below to sign in.", "Δεν άνοιξε το πρόγραμμα περιήγησης; Χρησιμοποιήστε τον παρακάτω σύνδεσμο για να συνδεθείτε."),
("Lock canvas", "Κλείδωμα καμβά"),
("Sync clipboard between sessions", "Συγχρονισμός προχείρου μεταξύ συνεδριών"),
("sync-clipboard-between-sessions-tip", "Κείμενο ή εικόνες που αντιγράφονται σε μία απομακρυσμένη συνεδρία αποστέλλονται και στο πρόχειρο των άλλων συνδεδεμένων συνεδριών σας."),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/en.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,5 +275,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("id_whitelist_caveat_tip", "The ID is reported by the connecting client. This whitelist reduces exposure and does not replace the password or 2FA."),
("whitelist_cidr_tip", "CIDR notation is supported, e.g. 192.168.1.0/24"),
("Your ip is blocked by the peer", "Your IP is blocked by the peer"),
("sync-clipboard-between-sessions-tip", "Text or images copied in one remote session are also sent to the clipboard of your other connected sessions."),
].iter().cloned().collect();
}
2 changes: 2 additions & 0 deletions src/lang/eo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,5 +761,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Continue", "Daŭrigi"),
("Browser didn't open? Use the url below to sign in.", "Ĉu la retumilo ne malfermiĝis? Uzu la suban ligilon por ensaluti."),
("Lock canvas", "Ŝlosi kanvason"),
("Sync clipboard between sessions", "Sinkronigi poŝon inter seancoj"),
("sync-clipboard-between-sessions-tip", "Teksto aŭ bildoj kopiitaj en unu fora seanco ankaŭ sendiĝas al la poŝo de viaj aliaj konektitaj seancoj."),
].iter().cloned().collect();
}
2 changes: 2 additions & 0 deletions src/lang/es.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,5 +761,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Continue", "Continuar"),
("Browser didn't open? Use the url below to sign in.", "¿No se abrió el navegador? Usa la URL de abajo para iniciar sesión."),
("Lock canvas", "Bloquear lienzo"),
("Sync clipboard between sessions", "Sincronizar portapapeles entre sesiones"),
("sync-clipboard-between-sessions-tip", "El texto o las imágenes copiados en una sesión remota también se envían al portapapeles de tus otras sesiones conectadas."),
].iter().cloned().collect();
}
2 changes: 2 additions & 0 deletions src/lang/et.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,5 +761,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Continue", "Jätka"),
("Browser didn't open? Use the url below to sign in.", "Brauser ei avanenud? Sisselogimiseks kasuta allolevat URL-i."),
("Lock canvas", "Lukusta lõuend"),
("Sync clipboard between sessions", "Sünkrooni lõikelaud seansside vahel"),
("sync-clipboard-between-sessions-tip", "Ühes kaugseansis kopeeritud tekst või pildid saadetakse ka teiste ühendatud seansside lõikelauale."),
].iter().cloned().collect();
}
2 changes: 2 additions & 0 deletions src/lang/eu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,5 +761,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Continue", "Jarraitu"),
("Browser didn't open? Use the url below to sign in.", "Nabigatzailea ez da ireki? Erabili beheko URLa saioa hasteko."),
("Lock canvas", "Blokeatu oihala"),
("Sync clipboard between sessions", "Sinkronizatu arbela saioen artean"),
("sync-clipboard-between-sessions-tip", "Urruneko saio batean kopiatutako testua edo irudiak konektatutako beste saioen arbelera ere bidaltzen dira."),
].iter().cloned().collect();
}
2 changes: 2 additions & 0 deletions src/lang/fa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,5 +761,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Continue", "ادامه"),
("Browser didn't open? Use the url below to sign in.", "مرورگر باز نشد؟ برای ورود از نشانی زیر استفاده کنید."),
("Lock canvas", "قفل کردن صفحه"),
("Sync clipboard between sessions", "همگام‌سازی کلیپ‌بورد بین نشست‌ها"),
("sync-clipboard-between-sessions-tip", "متن یا تصاویری که در یک نشست راه دور کپی می‌شوند به کلیپ‌بورد سایر نشست‌های متصل شما نیز ارسال می‌شوند."),
].iter().cloned().collect();
}
2 changes: 2 additions & 0 deletions src/lang/fi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,5 +761,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Continue", "Jatka"),
("Browser didn't open? Use the url below to sign in.", "Eikö selain avautunut? Kirjaudu sisään alla olevan osoitteen kautta."),
("Lock canvas", "Lukitse näkymä"),
("Sync clipboard between sessions", "Synkronoi leikepöytä istuntojen välillä"),
("sync-clipboard-between-sessions-tip", "Yhdessä etäistunnossa kopioitu teksti tai kuvat lähetetään myös muiden yhdistettyjen istuntojen leikepöydälle."),
].iter().cloned().collect();
}
2 changes: 2 additions & 0 deletions src/lang/fr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,5 +761,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Continue", "Continuer"),
("Browser didn't open? Use the url below to sign in.", "Le navigateur ne s’est pas ouvert ? Utilisez l’URL ci-dessous pour vous connecter."),
("Lock canvas", "Verrouiller la vue"),
("Sync clipboard between sessions", "Synchroniser le presse-papiers entre les sessions"),
("sync-clipboard-between-sessions-tip", "Le texte ou les images copiés dans une session distante sont également envoyés au presse-papiers de vos autres sessions connectées."),
].iter().cloned().collect();
}
2 changes: 2 additions & 0 deletions src/lang/ge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,5 +761,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Continue", "გაგრძელება"),
("Browser didn't open? Use the url below to sign in.", "ბრაუზერი არ გაიხსნა? შესასვლელად გამოიყენეთ ქვემოთ მოცემული ბმული."),
("Lock canvas", "ტილოს დაბლოკვა"),
("Sync clipboard between sessions", "გაცვლის ბუფერის სინქრონიზაცია სესიებს შორის"),
("sync-clipboard-between-sessions-tip", "ერთ დაშორებულ სესიაში დაკოპირებული ტექსტი ან სურათები ასევე იგზავნება თქვენი სხვა დაკავშირებული სესიების გაცვლის ბუფერში."),
].iter().cloned().collect();
}
2 changes: 2 additions & 0 deletions src/lang/gu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,5 +761,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Continue", "ચાલુ રાખો"),
("Browser didn't open? Use the url below to sign in.", "બ્રાઉઝર ખૂલ્યું નથી? લોગિન કરવા માટે નીચે આપેલ URL નો ઉપયોગ કરો."),
("Lock canvas", "કેનવાસ લોક કરો"),
("Sync clipboard between sessions", "સત્રો વચ્ચે ક્લિપબોર્ડ સિંક કરો"),
("sync-clipboard-between-sessions-tip", "એક રિમોટ સત્રમાં કૉપિ કરેલ ટેક્સ્ટ કે છબીઓ તમારા અન્ય જોડાયેલા સત્રોના ક્લિપબોર્ડ પર પણ મોકલવામાં આવે છે."),
].iter().cloned().collect();
}
2 changes: 2 additions & 0 deletions src/lang/he.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,5 +761,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Continue", "המשך"),
("Browser didn't open? Use the url below to sign in.", "הדפדפן לא נפתח? השתמש בכתובת שלמטה כדי להתחבר."),
("Lock canvas", "נעל לוח ציור"),
("Sync clipboard between sessions", "סנכרן לוח בין סשנים"),
("sync-clipboard-between-sessions-tip", "טקסט או תמונות שהועתקו בסשן מרוחק אחד נשלחים גם ללוח של שאר הסשנים המחוברים שלך."),
].iter().cloned().collect();
}
2 changes: 2 additions & 0 deletions src/lang/hi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,5 +761,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Continue", "जारी रखें"),
("Browser didn't open? Use the url below to sign in.", "ब्राउज़र नहीं खुला? लॉगिन करने के लिए नीचे दिए गए URL का उपयोग करें।"),
("Lock canvas", "कैनवास लॉक करें"),
("Sync clipboard between sessions", "सत्रों के बीच क्लिपबोर्ड सिंक करें"),
("sync-clipboard-between-sessions-tip", "एक रिमोट सत्र में कॉपी किए गए टेक्स्ट या चित्र आपके अन्य जुड़े सत्रों के क्लिपबोर्ड पर भी भेजे जाते हैं।"),
].iter().cloned().collect();
}
Loading
Loading