issues #192 add MicrosoftEdgeWebview2Setup and fix the "VCRUNTIME140.dll Is Missing" error on windows server 2022

This commit is contained in:
elilchen 2023-02-16 13:39:08 +08:00
parent 7c3be2d9fb
commit ad40d65070
10 changed files with 35 additions and 8 deletions

7
Cargo.lock generated
View File

@ -816,6 +816,7 @@ dependencies = [
"serde_json",
"sodiumoxide",
"sqlx",
"static_vcruntime",
"tokio-tungstenite",
"tower-http",
"tungstenite",
@ -2092,6 +2093,12 @@ version = "1.1.0"
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"

View File

@ -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"]

View File

@ -1,3 +1,6 @@
fn main() {
hbb_common::gen_version();
if cfg!(target_os = "windows") {
static_vcruntime::metabuild();
}
}

7
ui/Cargo.lock generated
View File

@ -2324,6 +2324,7 @@ dependencies = [
"once_cell",
"serde",
"serde_json",
"static_vcruntime",
"tauri",
"tauri-build",
"windows-service",
@ -2625,6 +2626,12 @@ dependencies = [
"loom",
]
[[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"

View File

@ -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"

View File

@ -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();
}
}

View File

@ -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() {

View File

@ -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

View File

@ -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();
}
_ => {}

View File

@ -47,7 +47,7 @@
"icons/icon.icns",
"icons/icon.ico"
],
"identifier": "rustdesk_server",
"identifier": "rustdesk.server",
"longDescription": "",
"macOS": {
"entitlements": null,