Просмотр исходного кода

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

elilchen лет назад: 3
Родитель
Сommit
ad40d65070
10 измененных файлов с 35 добавлено и 8 удалено
  1. 7 0
      Cargo.lock
  2. 1 0
      Cargo.toml
  3. 3 0
      build.rs
  4. 7 0
      ui/Cargo.lock
  5. 2 1
      ui/Cargo.toml
  6. 2 1
      ui/build.rs
  7. 2 1
      ui/html/main.js
  8. 9 4
      ui/setup.nsi
  9. 1 0
      ui/src/adapter/view/desktop.rs
  10. 1 1
      ui/tauri.conf.json

+ 7 - 0
Cargo.lock

@@ -816,6 +816,7 @@ dependencies = [
816 816
  "serde_json",
817 817
  "sodiumoxide",
818 818
  "sqlx",
819
+ "static_vcruntime",
819 820
  "tokio-tungstenite",
820 821
  "tower-http",
821 822
  "tungstenite",
@@ -2092,6 +2093,12 @@ version = "1.1.0"
2092 2093
 source = "registry+https://github.com/rust-lang/crates.io-index"
2093 2094
 checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
2094 2095
 
2096
+[[package]]
2097
+name = "static_vcruntime"
2098
+version = "2.0.0"
2099
+source = "registry+https://github.com/rust-lang/crates.io-index"
2100
+checksum = "954e3e877803def9dc46075bf4060147c55cd70db97873077232eae0269dc89b"
2101
+
2095 2102
 [[package]]
2096 2103
 name = "stringprep"
2097 2104
 version = "0.1.2"

+ 1 - 0
Cargo.toml

@@ -54,6 +54,7 @@ ping = "0.4.0"
54 54
 
55 55
 [build-dependencies]
56 56
 hbb_common = { path = "libs/hbb_common" }
57
+static_vcruntime = "2.0"
57 58
 
58 59
 [workspace]
59 60
 members = ["libs/hbb_common"]

+ 3 - 0
build.rs

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

+ 7 - 0
ui/Cargo.lock

@@ -2324,6 +2324,7 @@ dependencies = [
2324 2324
  "once_cell",
2325 2325
  "serde",
2326 2326
  "serde_json",
2327
+ "static_vcruntime",
2327 2328
  "tauri",
2328 2329
  "tauri-build",
2329 2330
  "windows-service",
@@ -2625,6 +2626,12 @@ dependencies = [
2625 2626
  "loom",
2626 2627
 ]
2627 2628
 
2629
+[[package]]
2630
+name = "static_vcruntime"
2631
+version = "2.0.0"
2632
+source = "registry+https://github.com/rust-lang/crates.io-index"
2633
+checksum = "954e3e877803def9dc46075bf4060147c55cd70db97873077232eae0269dc89b"
2634
+
2628 2635
 [[package]]
2629 2636
 name = "string_cache"
2630 2637
 version = "0.8.4"

+ 2 - 1
ui/Cargo.toml

@@ -1,6 +1,6 @@
1 1
 [package]
2 2
 name = "rustdesk_server"
3
-version = "0.1.1"
3
+version = "0.1.2"
4 4
 description = "rustdesk server gui"
5 5
 authors = ["elilchen"]
6 6
 edition = "2021"
@@ -8,6 +8,7 @@ edition = "2021"
8 8
 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
9 9
 
10 10
 [build-dependencies]
11
+static_vcruntime = "2.0"
11 12
 tauri-build = { version = "1.2", features = [] }
12 13
 winres = "0.1"
13 14
 

+ 2 - 1
ui/build.rs

@@ -1,5 +1,5 @@
1 1
 fn main() {
2
-  tauri_build::build();
2
+    tauri_build::build();
3 3
     if cfg!(target_os = "windows") {
4 4
         let mut res = winres::WindowsResource::new();
5 5
         res.set_icon("icons\\icon.ico");
@@ -17,5 +17,6 @@ fn main() {
17 17
 "#,
18 18
         );
19 19
         res.compile().unwrap();
20
+        static_vcruntime::metabuild();
20 21
     }
21 22
 }

+ 2 - 1
ui/html/main.js

@@ -22,13 +22,14 @@ class View {
22 22
         event.listen('__update__', this.appAction.bind(this));
23 23
         event.emit('__action__', '__init__');
24 24
         while (true) {
25
+            let now = Date.now();
25 26
             try {
26 27
                 await this.update();
27 28
                 this.render();
28 29
             } catch (e) {
29 30
                 console.error(e);
30 31
             }
31
-            await new Promise(r => setTimeout(r, 100));
32
+            await new Promise(r => setTimeout(r, Math.max(0, 33 - (Date.now() - now))));
32 33
         }
33 34
     }
34 35
     async update() {

+ 9 - 4
ui/setup.nsi

@@ -67,7 +67,7 @@ Section "Install"
67 67
   nsExec::Exec 'sc stop hbbr'
68 68
   nsExec::Exec 'sc stop hbbs'
69 69
   nsExec::Exec 'taskkill /F /IM ${PRODUCT_NAME}.exe'
70
-  Sleep 500 ;
70
+  Sleep 500
71 71
 
72 72
   SetOutPath $INSTDIR
73 73
   File /r "setup\*.*"
@@ -77,12 +77,12 @@ Section "Install"
77 77
   CreateShortCut "$SMPROGRAMS\${APP_NAME}\${APP_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe"
78 78
   CreateShortCut "$SMPROGRAMS\${APP_NAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe"
79 79
   CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe"
80
-  CreateShortCut "$SMSTARTUP\${APP_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe"
81 80
 
82 81
   nsExec::Exec 'netsh advfirewall firewall add rule name="${APP_NAME}" dir=in action=allow program="$INSTDIR\hbbs.exe" enable=yes'
83 82
   nsExec::Exec 'netsh advfirewall firewall add rule name="${APP_NAME}" dir=out action=allow program="$INSTDIR\hbbs.exe" enable=yes'
84 83
   nsExec::Exec 'netsh advfirewall firewall add rule name="${APP_NAME}" dir=in action=allow program="$INSTDIR\hbbr.exe" enable=yes'
85 84
   nsExec::Exec 'netsh advfirewall firewall add rule name="${APP_NAME}" dir=out action=allow program="$INSTDIR\hbbr.exe" enable=yes'
85
+  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'
86 86
 SectionEnd
87 87
 
88 88
 Section "Uninstall"
@@ -90,7 +90,7 @@ Section "Uninstall"
90 90
   nsExec::Exec 'sc stop hbbr'
91 91
   nsExec::Exec 'sc stop hbbs'
92 92
   nsExec::Exec 'taskkill /F /IM ${PRODUCT_NAME}.exe'
93
-  Sleep 500 ;
93
+  Sleep 500
94 94
 
95 95
   RMDir /r "$SMPROGRAMS\${APP_NAME}"
96 96
   Delete "$SMSTARTUP\${APP_NAME}.lnk"
@@ -98,11 +98,16 @@ Section "Uninstall"
98 98
   nsExec::Exec 'sc delete hbbr'
99 99
   nsExec::Exec 'sc delete hbbs'
100 100
   nsExec::Exec 'netsh advfirewall firewall delete rule name="${APP_NAME}"'
101
+  RMDir /r "$INSTDIR\bin"
102
+  RMDir /r "$INSTDIR\logs"
103
+  RMDir /r "$INSTDIR\service"
104
+  Delete "$INSTDIR\${PRODUCT_NAME}.exe"
105
+  Delete "$INSTDIR\uninstall.exe"
101 106
 SectionEnd
102 107
 
103 108
 ####################################################################
104 109
 # Functions
105 110
 
106 111
 Function CreateStartupShortcut
107
-  CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe"
112
+  CreateShortCut "$SMSTARTUP\${APP_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe"
108 113
 FunctionEnd

+ 1 - 0
ui/src/adapter/view/desktop.rs

@@ -59,6 +59,7 @@ pub async fn run(sender: Sender<Event>, receiver: Receiver<Event>) {
59 59
             // }
60 60
             WindowEvent::CloseRequested { api, .. } => {
61 61
                 api.prevent_close();
62
+                event.window().minimize().unwrap();
62 63
                 event.window().hide().unwrap();
63 64
             }
64 65
             _ => {}

+ 1 - 1
ui/tauri.conf.json

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