patch: add has_file_clipboard
field to PeerInfo
Signed-off-by: ClSlaid <cailue@bupt.edu.cn>
This commit is contained in:
parent
79f6b5c181
commit
80200a9983
@ -104,6 +104,7 @@ message PeerInfo {
|
|||||||
// Use JSON's key-value format which is friendly for peer to handle.
|
// Use JSON's key-value format which is friendly for peer to handle.
|
||||||
// NOTE: Only support one-level dictionaries (for peer to update), and the key is of type string.
|
// NOTE: Only support one-level dictionaries (for peer to update), and the key is of type string.
|
||||||
string platform_additions = 12;
|
string platform_additions = 12;
|
||||||
|
bool has_file_clipboard = 13;
|
||||||
}
|
}
|
||||||
|
|
||||||
message LoginResponse {
|
message LoginResponse {
|
||||||
|
@ -1706,7 +1706,10 @@ impl<T: InvokeUiSession> Remote<T> {
|
|||||||
fn check_clipboard_file_context(&self) {
|
fn check_clipboard_file_context(&self) {
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
target_os = "windows",
|
target_os = "windows",
|
||||||
all(feature = "unix-file-copy-paste", target_os = "linux")
|
all(
|
||||||
|
feature = "unix-file-copy-paste",
|
||||||
|
any(target_os = "linux", target_os = "macos")
|
||||||
|
)
|
||||||
))]
|
))]
|
||||||
{
|
{
|
||||||
let enabled = *self.handler.server_file_transfer_enabled.read().unwrap()
|
let enabled = *self.handler.server_file_transfer_enabled.read().unwrap()
|
||||||
|
@ -1019,6 +1019,13 @@ impl Connection {
|
|||||||
let mut pi = PeerInfo {
|
let mut pi = PeerInfo {
|
||||||
username: username.clone(),
|
username: username.clone(),
|
||||||
version: VERSION.to_owned(),
|
version: VERSION.to_owned(),
|
||||||
|
has_file_clipboard: cfg!(any(
|
||||||
|
target_os = "windows",
|
||||||
|
all(
|
||||||
|
feature = "unix-file-copy-paste",
|
||||||
|
any(target_os = "linux", target_os = "macos")
|
||||||
|
)
|
||||||
|
)),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -153,6 +153,13 @@ pub fn new() -> GenericService {
|
|||||||
|
|
||||||
fn displays_to_msg(displays: Vec<DisplayInfo>) -> Message {
|
fn displays_to_msg(displays: Vec<DisplayInfo>) -> Message {
|
||||||
let mut pi = PeerInfo {
|
let mut pi = PeerInfo {
|
||||||
|
has_file_clipboard: cfg!(any(
|
||||||
|
target_os = "windows",
|
||||||
|
all(
|
||||||
|
feature = "unix-file-copy-paste",
|
||||||
|
any(target_os = "linux", target_os = "macos")
|
||||||
|
)
|
||||||
|
)),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
pi.displays = displays.clone();
|
pi.displays = displays.clone();
|
||||||
|
@ -577,7 +577,10 @@ pub async fn start_ipc<T: InvokeUiCM>(cm: ConnectionManager<T>) {
|
|||||||
|
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
target_os = "windows",
|
target_os = "windows",
|
||||||
all(target_os = "linux", feature = "unix-file-copy-paste"),
|
all(
|
||||||
|
any(target_os = "linux", target_os = "macos"),
|
||||||
|
feature = "unix-file-copy-paste"
|
||||||
|
),
|
||||||
))]
|
))]
|
||||||
ContextSend::enable(Config::get_option("enable-file-transfer").is_empty());
|
ContextSend::enable(Config::get_option("enable-file-transfer").is_empty());
|
||||||
|
|
||||||
|
@ -1030,8 +1030,12 @@ async fn check_connect_status_(reconnect: bool, rx: mpsc::UnboundedReceiver<ipc:
|
|||||||
*OPTIONS.lock().unwrap() = v;
|
*OPTIONS.lock().unwrap() = v;
|
||||||
*OPTION_SYNCED.lock().unwrap() = true;
|
*OPTION_SYNCED.lock().unwrap() = true;
|
||||||
|
|
||||||
#[cfg(any(target_os="windows",
|
#[cfg(any(
|
||||||
all(target_os="linux", feature = "unix-file-copy-paste")
|
target_os="windows",
|
||||||
|
all(
|
||||||
|
any(target_os="linux", target_os = "macos"),
|
||||||
|
feature = "unix-file-copy-paste"
|
||||||
|
)
|
||||||
))]
|
))]
|
||||||
{
|
{
|
||||||
let b = OPTIONS.lock().unwrap().get("enable-file-transfer").map(|x| x.to_string()).unwrap_or_default();
|
let b = OPTIONS.lock().unwrap().get("enable-file-transfer").map(|x| x.to_string()).unwrap_or_default();
|
||||||
|
@ -1422,7 +1422,10 @@ pub async fn io_loop<T: InvokeUiSession>(handler: Session<T>, round: u32) {
|
|||||||
// It is ok to call this function multiple times.
|
// It is ok to call this function multiple times.
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
target_os = "windows",
|
target_os = "windows",
|
||||||
all(target_os = "linux", feature = "unix-file-copy-paste")
|
all(
|
||||||
|
any(target_os = "linux", target_os = "macos"),
|
||||||
|
feature = "unix-file-copy-paste"
|
||||||
|
)
|
||||||
))]
|
))]
|
||||||
if !handler.is_file_transfer() && !handler.is_port_forward() {
|
if !handler.is_file_transfer() && !handler.is_port_forward() {
|
||||||
clipboard::ContextSend::enable(true);
|
clipboard::ContextSend::enable(true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user