Skip to content

Commit

Permalink
Merge pull request #21 from rustdesk/master
Browse files Browse the repository at this point in the history
sync
  • Loading branch information
eltorio authored Apr 21, 2024
2 parents cf79d80 + ad06248 commit f0371aa
Show file tree
Hide file tree
Showing 22 changed files with 173 additions and 160 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ jobs:
# - { target: aarch64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true }
# - { target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true }
# - { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true }
# - { target: i686-pc-windows-msvc , os: windows-2019 }
# - { target: i686-pc-windows-msvc , os: windows-2022 }
# - { target: i686-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true }
# - { target: i686-unknown-linux-musl , os: ubuntu-20.04, use-cross: true }
# - { target: x86_64-apple-darwin , os: macos-10.15 }
# - { target: x86_64-pc-windows-gnu , os: windows-2019 }
# - { target: x86_64-pc-windows-msvc , os: windows-2019 }
# - { target: x86_64-pc-windows-gnu , os: windows-2022 }
# - { target: x86_64-pc-windows-msvc , os: windows-2022 }
- { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04 }
# - { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true }
steps:
Expand Down
38 changes: 18 additions & 20 deletions .github/workflows/flutter-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
uses: ./.github/workflows/third-party-RustDeskTempTopMostWindow.yml
with:
upload-artifact: ${{ inputs.upload-artifact }}
target: windows-2019
target: windows-2022
configuration: Release
platform: x64
target_version: Windows10
Expand All @@ -56,10 +56,10 @@ jobs:
fail-fast: false
matrix:
job:
# - { target: i686-pc-windows-msvc , os: windows-2019 }
# - { target: x86_64-pc-windows-gnu , os: windows-2019 }
- { target: x86_64-pc-windows-msvc, os: windows-2019, arch: x86_64 }
# - { target: aarch64-pc-windows-msvc, os: windows-2019, arch: aarch64 }
# - { target: i686-pc-windows-msvc , os: windows-2022 }
# - { target: x86_64-pc-windows-gnu , os: windows-2022 }
- { target: x86_64-pc-windows-msvc, os: windows-2022, arch: x86_64 }
# - { target: aarch64-pc-windows-msvc, os: windows-2022, arch: aarch64 }
steps:
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v6
Expand Down Expand Up @@ -115,16 +115,11 @@ jobs:
- name: Build rustdesk
run: |
Invoke-WebRequest -Uri https://github.com/rustdesk-org/rdev/releases/download/usbmmidd_v2/usbmmidd_v2.zip -OutFile usbmmidd_v2.zip
$SHA256_SUM = '629b51e9944762bae73948171c65d09a79595cf4c771a82ebc003fbba5b24f51'
if ((Get-FileHash -Path .\usbmmidd_v2.zip -Algorithm SHA256).Hash -ne $SHA256_SUM) {
Write-Error "SHA256 sum mismatch, falling back to the non-virtual-display version"
python3 .\build.py --portable --hwcodec --flutter --vram --skip-portable-pack
} else {
Write-Host "SHA256 sum matched, using the virtual-display version"
Expand-Archive usbmmidd_v2.zip -DestinationPath .
python3 .\build.py --portable --hwcodec --flutter --vram --skip-portable-pack --virtual-display
mv -Force .\usbmmidd_v2 ./flutter/build/windows/x64/runner/Release/
}
Expand-Archive usbmmidd_v2.zip -DestinationPath .
python3 .\build.py --portable --hwcodec --flutter --vram --skip-portable-pack --virtual-display
Remove-Item -Path usbmmidd_v2\Win32 -Recurse
Remove-Item -Path usbmmidd_v2\deviceinstaller.exe
mv -Force .\usbmmidd_v2 ./flutter/build/windows/x64/runner/Release/
- name: find Runner.res
# Windows: find Runner.res (compiled from ./flutter/windows/runner/Runner.rc), copy to ./Runner.res
Expand Down Expand Up @@ -213,10 +208,10 @@ jobs:
fail-fast: false
matrix:
job:
# - { target: i686-pc-windows-msvc , os: windows-2019 }
# - { target: x86_64-pc-windows-gnu , os: windows-2019 }
- { target: i686-pc-windows-msvc, os: windows-2019, arch: x86 }
# - { target: aarch64-pc-windows-msvc, os: windows-2019 }
# - { target: i686-pc-windows-msvc , os: windows-2022 }
# - { target: x86_64-pc-windows-gnu , os: windows-2022 }
- { target: i686-pc-windows-msvc, os: windows-2022, arch: x86 }
# - { target: aarch64-pc-windows-msvc, os: windows-2022 }
steps:
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v6
Expand Down Expand Up @@ -262,11 +257,14 @@ jobs:
python3 res/inline-sciter.py
# Patch sciter x86
sed -i 's/branch = "dyn"/branch = "dyn_x86"/g' ./Cargo.toml
cargo build --features inline,vram,hwcodec --release --bins
cargo build --features inline,vram,hwcodec,virtual_display_driver --release --bins
mkdir -p ./Release
mv ./target/release/rustdesk.exe ./Release/rustdesk.exe
curl -LJ -o ./Release/sciter.dll https://github.com/c-smile/sciter-sdk/raw/master/bin.win/x32/sciter.dll
echo "output_folder=./Release" >> $GITHUB_OUTPUT
curl -LJ -o ./usbmmidd_v2.zip https://github.com/rustdesk-org/rdev/releases/download/usbmmidd_v2/usbmmidd_v2.zip
unzip usbmmidd_v2.zip
mv ./usbmmidd_v2 ./Release || true
- name: find Runner.res
# Windows: find Runner.res (compiled from ./flutter/windows/runner/Runner.rc), copy to ./Runner.res
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/history.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
fail-fast: false
matrix:
job:
- { target: x86_64-pc-windows-msvc, os: windows-2019, arch: x86_64, date: 2023-08-04, ref: 72c198a1e94cc1e0242fce88f92b3f3caedcd0c3 }
- { target: x86_64-pc-windows-msvc, os: windows-2022, arch: x86_64, date: 2023-08-04, ref: 72c198a1e94cc1e0242fce88f92b3f3caedcd0c3 }
steps:
- name: Checkout source code
uses: actions/checkout@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
description: 'Target'
required: true
type: string
default: 'windows-2019'
default: 'windows-2022'
configuration:
description: 'Configuration'
required: true
Expand Down
8 changes: 7 additions & 1 deletion flutter/lib/models/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,8 @@ class FfiModel with ChangeNotifier {
// Map clone is required here, otherwise "evt" may be changed by other threads through the reference.
// Because this function is asynchronous, there's an "await" in this function.
cachedPeerData.peerInfo = {...evt};
// Do not cache resolutions, because a new display connection have different resolutions.
cachedPeerData.peerInfo.remove('resolutions');

// Recent peer is updated by handle_peer_info(ui_session_interface.rs) --> handle_peer_info(client.rs) --> save_config(client.rs)
bind.mainLoadRecentPeers();
Expand Down Expand Up @@ -770,7 +772,9 @@ class FfiModel with ChangeNotifier {
}
Map<String, dynamic> features = json.decode(evt['features']);
_pi.features.privacyMode = features['privacy_mode'] == 1;
handleResolutions(peerId, evt["resolutions"]);
if (!isCache) {
handleResolutions(peerId, evt["resolutions"]);
}
parent.target?.elevationModel.onPeerInfo(_pi);
}
if (connType == ConnType.defaultConn) {
Expand Down Expand Up @@ -2317,6 +2321,8 @@ class FFI {
}
await ffiModel.handleCachedPeerData(data, id);
await sessionRefreshVideo(sessionId, ffiModel.pi);
await bind.sessionRequestNewDisplayInitMsgs(
sessionId: sessionId, display: ffiModel.pi.currentDisplay);
});
isToNewWindowNotified.value = true;
}
Expand Down
5 changes: 5 additions & 0 deletions flutter/lib/web/bridge.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1577,5 +1577,10 @@ class RustdeskImpl {
throw UnimplementedError();
}

Future<void> sessionRequestNewDisplayInitMsgs(
{required UuidValue sessionId, required int display, dynamic hint}) {
throw UnimplementedError();
}

void dispose() {}
}
19 changes: 18 additions & 1 deletion libs/hbb_common/protos/message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,11 @@ message Resolution {
int32 height = 2;
}

message DisplayResolution {
int32 display = 1;
Resolution resolution = 2;
}

message SupportedResolutions { repeated Resolution resolutions = 1; }

message SwitchDisplay {
Expand Down Expand Up @@ -596,7 +601,8 @@ message OptionMessage {
BoolOption disable_keyboard = 12;
// Position 13 is used for Resolution. Remove later.
// Resolution custom_resolution = 13;
BoolOption support_windows_specific_session = 14;
// BoolOption support_windows_specific_session = 14;
// starting from 15 please, do not use removed fields
}

message TestDelay {
Expand Down Expand Up @@ -716,6 +722,13 @@ message WindowsSessions {
uint32 current_sid = 2;
}

// Query messages from peer.
message MessageQuery {
// The SwitchDisplay message of the target display.
// If the target display is not found, the message will be ignored.
int32 switch_display = 1;
}

message Misc {
oneof union {
ChatMessage chat_message = 4;
Expand All @@ -736,6 +749,8 @@ message Misc {
bool portable_service_running = 20;
SwitchSidesRequest switch_sides_request = 21;
SwitchBack switch_back = 22;
// Deprecated since 1.2.4, use `change_display_resolution` (36) instead.
// But we must keep it for compatibility when peer version < 1.2.4.
Resolution change_resolution = 24;
PluginRequest plugin_request = 25;
PluginFailure plugin_failure = 26;
Expand All @@ -748,6 +763,8 @@ message Misc {
TogglePrivacyMode toggle_privacy_mode = 33;
SupportedEncoding supported_encoding = 34;
uint32 selected_sid = 35;
DisplayResolution change_display_resolution = 36;
MessageQuery message_query = 37;
}
}

Expand Down
36 changes: 16 additions & 20 deletions res/msi/CustomActions/CustomActions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,9 +607,7 @@ UINT __stdcall RemoveAmyuniIdd(
DWORD fileAttributes = 0;
HINSTANCE hi = 0;

USHORT processMachine = 0;
USHORT nativeMachine = 0;
BOOL isWow64Res = FALSE;
SYSTEM_INFO si;
LPCWSTR exe = NULL;

hr = WcaInitialize(hInstall, "RemoveAmyuniIdd");
Expand All @@ -630,24 +628,22 @@ UINT __stdcall RemoveAmyuniIdd(
goto LExit;
}

isWow64Res = IsWow64Process2(GetCurrentProcess(), &processMachine, &nativeMachine);
if (isWow64Res == TRUE) {
if (nativeMachine == IMAGE_FILE_MACHINE_AMD64) {
exe = L"deviceinstaller64.exe";
} else {
exe = L"deviceinstaller.exe";
}
WcaLog(LOGMSG_STANDARD, "Remove amyuni idd %ls in %ls", exe, workDir);
hi = ShellExecuteW(NULL, L"open", exe, L"remove usbmmidd", workDir, SW_HIDE);
// https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shellexecutew
if ((int)hi <= 32) {
WcaLog(LOGMSG_STANDARD, "Failed to remove amyuni idd : %d, last error: %d", (int)hi, GetLastError());
}
else {
WcaLog(LOGMSG_STANDARD, "Amyuni idd is removed");
}
GetNativeSystemInfo(&si);
if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) {
exe = L"deviceinstaller64.exe";
} else {
WcaLog(LOGMSG_STANDARD, "Failed to call IsWow64Process2(): %d", GetLastError());
// No need to check if is other architecture.
// Because the driver is only for x86 and x64. It will not work at on other architectures.
exe = L"deviceinstaller.exe";
}
WcaLog(LOGMSG_STANDARD, "Remove amyuni idd %ls in %ls", exe, workDir);
hi = ShellExecuteW(NULL, L"open", exe, L"remove usbmmidd", workDir, SW_HIDE);
// https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shellexecutew
if ((int)hi <= 32) {
WcaLog(LOGMSG_STANDARD, "Failed to remove amyuni idd : %d, last error: %d", (int)hi, GetLastError());
}
else {
WcaLog(LOGMSG_STANDARD, "Amyuni idd is removed");
}

LExit:
Expand Down
4 changes: 2 additions & 2 deletions res/msi/CustomActions/CustomActions.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{6b3647e0-b4a3-46ae-8757-a22ee51c1dac}</ProjectGuid>
<RootNamespace>CustomActions</RootNamespace>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
Expand Down Expand Up @@ -81,4 +81,4 @@
<Error Condition="!Exists('..\packages\WixToolset.DUtil.4.0.5\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\WixToolset.DUtil.4.0.5\build\WixToolset.DUtil.props'))" />
<Error Condition="!Exists('..\packages\WixToolset.WcaUtil.4.0.5\build\WixToolset.WcaUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\WixToolset.WcaUtil.4.0.5\build\WixToolset.WcaUtil.props'))" />
</Target>
</Project>
</Project>
2 changes: 1 addition & 1 deletion res/msi/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# RustDesk msi project

Use Visual Studio 2019 to compile this project.
Use Visual Studio 2022 to compile this project.

This project is mainly derived from <https://github.com/MediaPortal/MediaPortal-2.git> .

Expand Down
25 changes: 2 additions & 23 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1564,22 +1564,13 @@ impl LoginConfigHandler {
///
/// * `ignore_default` - If `true`, ignore the default value of the option.
fn get_option_message(&self, ignore_default: bool) -> Option<OptionMessage> {
if self.conn_type.eq(&ConnType::PORT_FORWARD) || self.conn_type.eq(&ConnType::RDP) {
if self.conn_type.eq(&ConnType::PORT_FORWARD) || self.conn_type.eq(&ConnType::RDP) || self.conn_type.eq(&ConnType::FILE_TRANSFER) {
return None;
}
let mut n = 0;
let mut msg = OptionMessage::new();
// Version 1.2.5 can remove this, and OptionMessage is not needed for file transfer
msg.support_windows_specific_session = BoolOption::Yes.into();
n += 1;

if self.conn_type.eq(&ConnType::FILE_TRANSFER) {
return Some(msg);
}
let q = self.image_quality.clone();
if let Some(q) = self.get_image_quality_enum(&q, ignore_default) {
msg.image_quality = q.into();
n += 1;
} else if q == "custom" {
let config = self.load_config();
let allow_more = !crate::using_public_server() || self.direct == Some(true);
Expand All @@ -1602,32 +1593,25 @@ impl LoginConfigHandler {
msg.custom_fps = custom_fps;
*self.custom_fps.lock().unwrap() = Some(custom_fps as _);
}
n += 1;
}
let view_only = self.get_toggle_option("view-only");
if view_only {
msg.disable_keyboard = BoolOption::Yes.into();
n += 1;
}
if view_only || self.get_toggle_option("show-remote-cursor") {
msg.show_remote_cursor = BoolOption::Yes.into();
n += 1;
}
if !view_only && self.get_toggle_option("lock-after-session-end") {
msg.lock_after_session_end = BoolOption::Yes.into();
n += 1;
}
if self.get_toggle_option("disable-audio") {
msg.disable_audio = BoolOption::Yes.into();
n += 1;
}
if !view_only && self.get_toggle_option("enable-file-transfer") {
msg.enable_file_transfer = BoolOption::Yes.into();
n += 1;
}
if view_only || self.get_toggle_option("disable-clipboard") {
msg.disable_clipboard = BoolOption::Yes.into();
n += 1;
}
msg.supported_decoding =
hbb_common::protobuf::MessageField::some(Decoder::supported_decodings(
Expand All @@ -1636,12 +1620,7 @@ impl LoginConfigHandler {
self.adapter_luid,
&self.mark_unsupported,
));
n += 1;
if n > 0 {
Some(msg)
} else {
None
}
Some(msg)
}

pub fn get_option_message_after_login(&self) -> Option<OptionMessage> {
Expand Down
6 changes: 6 additions & 0 deletions src/flutter_ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2104,6 +2104,12 @@ pub fn main_check_hwcodec() {
check_hwcodec()
}

pub fn session_request_new_display_init_msgs(session_id: SessionID, display: usize) {
if let Some(session) = sessions::get_session_by_session_id(&session_id) {
session.request_init_msgs(display);
}
}

#[cfg(target_os = "android")]
pub mod server_side {
use hbb_common::{config, log};
Expand Down
2 changes: 1 addition & 1 deletion src/lang/cs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Everyone", "Každý"),
("ab_web_console_tip", "Více na webové konzoli"),
("allow-only-conn-window-open-tip", "Povolit připojení pouze v případě, že je otevřené okno RustDesk"),
("no_need_privacy_mode_no_physical_displays_tip", ""),
("no_need_privacy_mode_no_physical_displays_tip", "Žádné fyzické displeje, není třeba používat režim soukromí."),
].iter().cloned().collect();
}
2 changes: 1 addition & 1 deletion src/lang/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Everyone", "Jeder"),
("ab_web_console_tip", "Mehr über Webkonsole"),
("allow-only-conn-window-open-tip", "Verbindung nur zulassen, wenn das RustDesk-Fenster geöffnet ist"),
("no_need_privacy_mode_no_physical_displays_tip", ""),
("no_need_privacy_mode_no_physical_displays_tip", "Keine physischen Bildschirme; keine Notwendigkeit, den Datenschutzmodus zu verwenden."),
].iter().cloned().collect();
}
2 changes: 1 addition & 1 deletion src/lang/it.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Everyone", "Everyone"),
("ab_web_console_tip", "Altre info sulla console web"),
("allow-only-conn-window-open-tip", "Consenti la connessione solo se la finestra RustDesk è aperta"),
("no_need_privacy_mode_no_physical_displays_tip", ""),
("no_need_privacy_mode_no_physical_displays_tip", "Nessun display fisico, nessuna necessità di usare la modalità privacy."),
].iter().cloned().collect();
}
2 changes: 1 addition & 1 deletion src/lang/lv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Everyone", "Visi"),
("ab_web_console_tip", "Vairāk par tīmekļa konsoli"),
("allow-only-conn-window-open-tip", "Atļaut savienojumu tikai tad, ja ir atvērts RustDesk logs"),
("no_need_privacy_mode_no_physical_displays_tip", ""),
("no_need_privacy_mode_no_physical_displays_tip", "Nav fizisku displeju, nav jāizmanto privātuma režīms."),
].iter().cloned().collect();
}
Loading

0 comments on commit f0371aa

Please sign in to comment.