diff options
-rw-r--r-- | Cargo.lock | 7 | ||||
-rw-r--r-- | Cargo.toml | 1 | ||||
-rw-r--r-- | build.rs | 3 | ||||
-rw-r--r-- | ui/Cargo.lock | 7 | ||||
-rw-r--r-- | ui/Cargo.toml | 3 | ||||
-rw-r--r-- | ui/build.rs | 3 | ||||
-rw-r--r-- | ui/html/main.js | 3 | ||||
-rw-r--r-- | ui/setup.nsi | 13 | ||||
-rw-r--r-- | ui/src/adapter/view/desktop.rs | 1 | ||||
-rw-r--r-- | ui/tauri.conf.json | 2 |
10 files changed, 35 insertions, 8 deletions
@@ -816,6 +816,7 @@ dependencies = [ "serde_json", "sodiumoxide", "sqlx", + "static_vcruntime", "tokio-tungstenite", "tower-http", "tungstenite", @@ -2093,6 +2094,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] +name = "static_vcruntime" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "954e3e877803def9dc46075bf4060147c55cd70db97873077232eae0269dc89b" + +[[package]] name = "stringprep" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -54,6 +54,7 @@ ping = "0.4.0" [build-dependencies] hbb_common = { path = "libs/hbb_common" } +static_vcruntime = "2.0" [workspace] members = ["libs/hbb_common"] @@ -1,3 +1,6 @@ fn main() { hbb_common::gen_version(); + if cfg!(target_os = "windows") { + static_vcruntime::metabuild(); + } } diff --git a/ui/Cargo.lock b/ui/Cargo.lock index 7c45be6..6fe161c 100644 --- a/ui/Cargo.lock +++ b/ui/Cargo.lock @@ -2324,6 +2324,7 @@ dependencies = [ "once_cell", "serde", "serde_json", + "static_vcruntime", "tauri", "tauri-build", "windows-service", @@ -2626,6 +2627,12 @@ dependencies = [ ] [[package]] +name = "static_vcruntime" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "954e3e877803def9dc46075bf4060147c55cd70db97873077232eae0269dc89b" + +[[package]] name = "string_cache" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/ui/Cargo.toml b/ui/Cargo.toml index 9cd47ac..9e2f902 100644 --- a/ui/Cargo.toml +++ b/ui/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustdesk_server" -version = "0.1.1" +version = "0.1.2" description = "rustdesk server gui" authors = ["elilchen"] edition = "2021" @@ -8,6 +8,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [build-dependencies] +static_vcruntime = "2.0" tauri-build = { version = "1.2", features = [] } winres = "0.1" diff --git a/ui/build.rs b/ui/build.rs index 811b4a2..250c43b 100644 --- a/ui/build.rs +++ b/ui/build.rs @@ -1,5 +1,5 @@ fn main() { - tauri_build::build(); + tauri_build::build(); if cfg!(target_os = "windows") { let mut res = winres::WindowsResource::new(); res.set_icon("icons\\icon.ico"); @@ -17,5 +17,6 @@ fn main() { "#, ); res.compile().unwrap(); + static_vcruntime::metabuild(); } } diff --git a/ui/html/main.js b/ui/html/main.js index 5f3b5a5..0c25c5f 100644 --- a/ui/html/main.js +++ b/ui/html/main.js @@ -22,13 +22,14 @@ class View { event.listen('__update__', this.appAction.bind(this)); event.emit('__action__', '__init__'); while (true) { + let now = Date.now(); try { await this.update(); this.render(); } catch (e) { console.error(e); } - await new Promise(r => setTimeout(r, 100)); + await new Promise(r => setTimeout(r, Math.max(0, 33 - (Date.now() - now)))); } } async update() { diff --git a/ui/setup.nsi b/ui/setup.nsi index 8bdfdf2..f9625d7 100644 --- a/ui/setup.nsi +++ b/ui/setup.nsi @@ -67,7 +67,7 @@ Section "Install" nsExec::Exec 'sc stop hbbr' nsExec::Exec 'sc stop hbbs' nsExec::Exec 'taskkill /F /IM ${PRODUCT_NAME}.exe' - Sleep 500 ; + Sleep 500 SetOutPath $INSTDIR File /r "setup\*.*" @@ -77,12 +77,12 @@ Section "Install" CreateShortCut "$SMPROGRAMS\${APP_NAME}\${APP_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe" CreateShortCut "$SMPROGRAMS\${APP_NAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe" - CreateShortCut "$SMSTARTUP\${APP_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe" nsExec::Exec 'netsh advfirewall firewall add rule name="${APP_NAME}" dir=in action=allow program="$INSTDIR\hbbs.exe" enable=yes' nsExec::Exec 'netsh advfirewall firewall add rule name="${APP_NAME}" dir=out action=allow program="$INSTDIR\hbbs.exe" enable=yes' nsExec::Exec 'netsh advfirewall firewall add rule name="${APP_NAME}" dir=in action=allow program="$INSTDIR\hbbr.exe" enable=yes' nsExec::Exec 'netsh advfirewall firewall add rule name="${APP_NAME}" dir=out action=allow program="$INSTDIR\hbbr.exe" enable=yes' + ExecWait 'powershell.exe -NoProfile -windowstyle hidden try { [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 } catch {}; Invoke-WebRequest -Uri "https://go.microsoft.com/fwlink/p/?LinkId=2124703" -OutFile "$$env:TEMP\MicrosoftEdgeWebview2Setup.exe" ; Start-Process -FilePath "$$env:TEMP\MicrosoftEdgeWebview2Setup.exe" -ArgumentList ($\'/silent$\', $\'/install$\') -Wait' SectionEnd Section "Uninstall" @@ -90,7 +90,7 @@ Section "Uninstall" nsExec::Exec 'sc stop hbbr' nsExec::Exec 'sc stop hbbs' nsExec::Exec 'taskkill /F /IM ${PRODUCT_NAME}.exe' - Sleep 500 ; + Sleep 500 RMDir /r "$SMPROGRAMS\${APP_NAME}" Delete "$SMSTARTUP\${APP_NAME}.lnk" @@ -98,11 +98,16 @@ Section "Uninstall" nsExec::Exec 'sc delete hbbr' nsExec::Exec 'sc delete hbbs' nsExec::Exec 'netsh advfirewall firewall delete rule name="${APP_NAME}"' + RMDir /r "$INSTDIR\bin" + RMDir /r "$INSTDIR\logs" + RMDir /r "$INSTDIR\service" + Delete "$INSTDIR\${PRODUCT_NAME}.exe" + Delete "$INSTDIR\uninstall.exe" SectionEnd #################################################################### # Functions Function CreateStartupShortcut - CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe" + CreateShortCut "$SMSTARTUP\${APP_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe" FunctionEnd
\ No newline at end of file diff --git a/ui/src/adapter/view/desktop.rs b/ui/src/adapter/view/desktop.rs index 328d587..ddfc01b 100644 --- a/ui/src/adapter/view/desktop.rs +++ b/ui/src/adapter/view/desktop.rs @@ -59,6 +59,7 @@ pub async fn run(sender: Sender<Event>, receiver: Receiver<Event>) { // } WindowEvent::CloseRequested { api, .. } => { api.prevent_close(); + event.window().minimize().unwrap(); event.window().hide().unwrap(); } _ => {} diff --git a/ui/tauri.conf.json b/ui/tauri.conf.json index 0afeda1..e25fca5 100644 --- a/ui/tauri.conf.json +++ b/ui/tauri.conf.json @@ -47,7 +47,7 @@ "icons/icon.icns", "icons/icon.ico" ], - "identifier": "rustdesk_server", + "identifier": "rustdesk.server", "longDescription": "", "macOS": { "entitlements": null, |