Browse Source

add webclientv2

lejianwen 1 year ago
parent
commit
e09fa17013
93 changed files with 217848 additions and 0 deletions
  1. 1 0
      .gitignore
  2. 20 0
      http/controller/api/webClient.go
  3. 2 0
      http/controller/web/index.go
  4. 1 0
      http/router/api.go
  5. 1 0
      resources/web2/assets/AssetManifest.bin
  6. 1 0
      resources/web2/assets/AssetManifest.json
  7. 42 0
      resources/web2/assets/FontManifest.json
  8. 1 0
      resources/web2/assets/assets/actions.svg
  9. 1 0
      resources/web2/assets/assets/actions_mobile.svg
  10. BIN
      resources/web2/assets/assets/address_book.ttf
  11. 1 0
      resources/web2/assets/assets/android.svg
  12. 1 0
      resources/web2/assets/assets/arrow.svg
  13. 1 0
      resources/web2/assets/assets/auth-apple.svg
  14. 1 0
      resources/web2/assets/assets/auth-auth0.svg
  15. 1 0
      resources/web2/assets/assets/auth-azure.svg
  16. 1 0
      resources/web2/assets/assets/auth-default.svg
  17. 1 0
      resources/web2/assets/assets/auth-facebook.svg
  18. 1 0
      resources/web2/assets/assets/auth-github.svg
  19. 1 0
      resources/web2/assets/assets/auth-gitlab.svg
  20. 1 0
      resources/web2/assets/assets/auth-google.svg
  21. 1 0
      resources/web2/assets/assets/auth-okta.svg
  22. 1 0
      resources/web2/assets/assets/call_end.svg
  23. 1 0
      resources/web2/assets/assets/call_wait.svg
  24. 1 0
      resources/web2/assets/assets/chat.svg
  25. 1 0
      resources/web2/assets/assets/chat2.svg
  26. 1 0
      resources/web2/assets/assets/checkbox-outline.svg
  27. 1 0
      resources/web2/assets/assets/chevron_up_chevron_down.svg
  28. 1 0
      resources/web2/assets/assets/close.svg
  29. 1 0
      resources/web2/assets/assets/display.svg
  30. 1 0
      resources/web2/assets/assets/dots.svg
  31. 1 0
      resources/web2/assets/assets/file.svg
  32. 1 0
      resources/web2/assets/assets/file_transfer.svg
  33. 1 0
      resources/web2/assets/assets/folder.svg
  34. 1 0
      resources/web2/assets/assets/folder_new.svg
  35. 1 0
      resources/web2/assets/assets/fullscreen.svg
  36. 1 0
      resources/web2/assets/assets/fullscreen_exit.svg
  37. BIN
      resources/web2/assets/assets/gestures.ttf
  38. 1 0
      resources/web2/assets/assets/home.svg
  39. 1 0
      resources/web2/assets/assets/icon.svg
  40. 1 0
      resources/web2/assets/assets/insecure.svg
  41. 1 0
      resources/web2/assets/assets/insecure_relay.svg
  42. 1 0
      resources/web2/assets/assets/kb_layout_iso.svg
  43. 1 0
      resources/web2/assets/assets/kb_layout_not_iso.svg
  44. 1 0
      resources/web2/assets/assets/keyboard.svg
  45. 1 0
      resources/web2/assets/assets/linux.svg
  46. 1 0
      resources/web2/assets/assets/mac.svg
  47. 1 0
      resources/web2/assets/assets/message_24dp_5F6368.svg
  48. BIN
      resources/web2/assets/assets/peer_searchbar.ttf
  49. 1 0
      resources/web2/assets/assets/pinned.svg
  50. 1 0
      resources/web2/assets/assets/rec.svg
  51. 1 0
      resources/web2/assets/assets/record_screen.svg
  52. 1 0
      resources/web2/assets/assets/refresh.svg
  53. BIN
      resources/web2/assets/assets/scam.png
  54. 1 0
      resources/web2/assets/assets/screen.svg
  55. 1 0
      resources/web2/assets/assets/search.svg
  56. 1 0
      resources/web2/assets/assets/secure.svg
  57. 1 0
      resources/web2/assets/assets/secure_relay.svg
  58. BIN
      resources/web2/assets/assets/tabbar.ttf
  59. 1 0
      resources/web2/assets/assets/transfer.svg
  60. 1 0
      resources/web2/assets/assets/trash.svg
  61. 1 0
      resources/web2/assets/assets/unpinned.svg
  62. 1 0
      resources/web2/assets/assets/voice_call.svg
  63. 1 0
      resources/web2/assets/assets/voice_call_waiting.svg
  64. 1 0
      resources/web2/assets/assets/win.svg
  65. BIN
      resources/web2/assets/fonts/MaterialIcons-Regular.otf
  66. BIN
      resources/web2/assets/packages/dash_chat_2/assets/placeholder.png
  67. BIN
      resources/web2/assets/packages/dash_chat_2/assets/profile_placeholder.png
  68. BIN
      resources/web2/assets/packages/flex_color_picker/assets/opacity.png
  69. 230 0
      resources/web2/assets/packages/wakelock_plus/assets/no_sleep.js
  70. BIN
      resources/web2/assets/packages/window_manager/images/ic_chrome_close.png
  71. BIN
      resources/web2/assets/packages/window_manager/images/ic_chrome_maximize.png
  72. BIN
      resources/web2/assets/packages/window_manager/images/ic_chrome_minimize.png
  73. BIN
      resources/web2/assets/packages/window_manager/images/ic_chrome_unmaximize.png
  74. BIN
      resources/web2/assets/shaders/ink_sparkle.frag
  75. 1 0
      resources/web2/favicon.svg
  76. 16 0
      resources/web2/ffmpeg-core.js
  77. BIN
      resources/web2/ffmpeg-core.wasm
  78. 111 0
      resources/web2/ffmpeg.js
  79. 7201 0
      resources/web2/flutter_service_worker.js
  80. BIN
      resources/web2/icons/Icon-192.png
  81. BIN
      resources/web2/icons/libopus.wasm
  82. 341 0
      resources/web2/index.html
  83. 39881 0
      resources/web2/js/dist/index.js
  84. 82 0
      resources/web2/js/dist/ljw.js
  85. 102 0
      resources/web2/js/dist/vendor.js
  86. 5555 0
      resources/web2/libopus.js
  87. BIN
      resources/web2/libopus.wasm
  88. 2 0
      resources/web2/libs/firebase-analytics.js
  89. 2 0
      resources/web2/libs/firebase-app.js
  90. 8 0
      resources/web2/libs/stream/StreamSaver.min.js
  91. 8 0
      resources/web2/libs/stream/ponyfill.min.js
  92. 164153 0
      resources/web2/main.dart.js
  93. 35 0
      resources/web2/manifest.json

+ 1 - 0
.gitignore

@@ -7,6 +7,7 @@ go.sum
7 7
 resources/*
8 8
 !resources/public/upload/.gitignore
9 9
 !resources/web
10
+!resources/web2
10 11
 !resources/i18n
11 12
 release
12 13
 data

+ 20 - 0
http/controller/api/webClient.go

@@ -85,3 +85,23 @@ func (i *WebClient) SharedPeer(c *gin.Context) {
85 85
 		"peer":      pp,
86 86
 	})
87 87
 }
88
+
89
+// ServerConfigV2 服务配置
90
+// @Tags WEBCLIENT_V2
91
+// @Summary 服务配置
92
+// @Description 服务配置,给webclient提供api-server
93
+// @Accept  json
94
+// @Produce  json
95
+// @Success 200 {object} response.Response
96
+// @Failure 500 {object} response.Response
97
+// @Router /server-config [get]
98
+// @Security token
99
+func (i *WebClient) ServerConfigV2(c *gin.Context) {
100
+	response.Success(
101
+		c,
102
+		gin.H{
103
+			"id_server": global.Config.Rustdesk.IdServer,
104
+			"key":       global.Config.Rustdesk.Key,
105
+		},
106
+	)
107
+}

+ 2 - 0
http/controller/web/index.go

@@ -17,6 +17,8 @@ func (i *Index) ConfigJs(c *gin.Context) {
17 17
 
18 18
 	tmp := `
19 19
 localStorage.setItem('api-server', "` + apiServer + `")
20
+const ws2_prefix = 'wc-'
21
+localStorage.setItem(ws2_prefix+'api-server', "` + apiServer + `")
20 22
 `
21 23
 	c.String(200, tmp)
22 24
 }

+ 1 - 0
http/router/api.go

@@ -121,6 +121,7 @@ func WebClientRoutes(frg *gin.RouterGroup) {
121 121
 	}
122 122
 	{
123 123
 		frg.POST("/server-config", middleware.RustAuth(), w.ServerConfig)
124
+		frg.POST("/server-config-v2", middleware.RustAuth(), w.ServerConfigV2)
124 125
 	}
125 126
 
126 127
 }

File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/AssetManifest.bin


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/AssetManifest.json


+ 42 - 0
resources/web2/assets/FontManifest.json

@@ -0,0 +1,42 @@
1
+[
2
+  {
3
+    "family": "MaterialIcons",
4
+    "fonts": [
5
+      {
6
+        "asset": "fonts/MaterialIcons-Regular.otf"
7
+      }
8
+    ]
9
+  },
10
+  {
11
+    "family": "GestureIcons",
12
+    "fonts": [
13
+      {
14
+        "asset": "assets/gestures.ttf"
15
+      }
16
+    ]
17
+  },
18
+  {
19
+    "family": "Tabbar",
20
+    "fonts": [
21
+      {
22
+        "asset": "assets/tabbar.ttf"
23
+      }
24
+    ]
25
+  },
26
+  {
27
+    "family": "PeerSearchbar",
28
+    "fonts": [
29
+      {
30
+        "asset": "assets/peer_searchbar.ttf"
31
+      }
32
+    ]
33
+  },
34
+  {
35
+    "family": "AddressBook",
36
+    "fonts": [
37
+      {
38
+        "asset": "assets/address_book.ttf"
39
+      }
40
+    ]
41
+  }
42
+]

+ 1 - 0
resources/web2/assets/assets/actions.svg

@@ -0,0 +1 @@
1
+<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" style="isolation:isolate" viewBox="496.063 521.772 32 32"><path fill="none" d="M496.063 521.772h32v32h-32v-32Z"/><path d="m513.817 535.858.87-8.052c.136-1.26-.279-1.399-.927-.31l-6.856 11.532c-.216.363-.049.658.374.658h3.031l-.87 8.052c-.136 1.26.279 1.399.927.309l6.856-11.531c.216-.363.048-.658-.374-.658h-3.031Z"/></svg>

File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/actions_mobile.svg


BIN
resources/web2/assets/assets/address_book.ttf


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/android.svg


+ 1 - 0
resources/web2/assets/assets/arrow.svg

@@ -0,0 +1 @@
1
+<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" style="isolation:isolate" viewBox="305.118 110.478 32 32"><path fill="none" d="M305.118 110.478h32v32h-32v-32Z"/><path d="m322.26 126.052-5.963-5.962a1.48 1.48 0 1 1 2.093-2.093l7.63 7.63c.47.47.47 1.233 0 1.703l-7.63 7.629a1.48 1.48 0 0 1-2.093 0 1.482 1.482 0 0 1 0-2.093l5.963-5.962a.603.603 0 0 0 0-.852Z"/></svg>

File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/auth-apple.svg


+ 1 - 0
resources/web2/assets/assets/auth-auth0.svg

@@ -0,0 +1 @@
1
+<svg width="32" height="32"><path d="M29.307 9.932 26.161 0H5.796L2.692 9.932c-1.802 5.75.042 12.271 5.089 16.021L16.01 32l8.208-6.068c5.005-3.75 6.911-10.25 5.089-16.021l-8.214 6.104 3.12 9.938-8.208-6.13-8.208 6.104 3.141-9.911-8.25-6.063 10.177-.063 3.146-9.891 3.141 9.87z"/></svg>

File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/auth-azure.svg


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/auth-default.svg


+ 1 - 0
resources/web2/assets/assets/auth-facebook.svg

@@ -0,0 +1 @@
1
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><rect width="512" height="512" fill="#1877f2" rx="76.8"/><path fill="#fff" d="m355.6 330 11.4-74h-71v-48c0-20.2 9.9-40 41.7-40H370v-63s-29.3-5-57.3-5c-58.5 0-96.7 35.4-96.7 99.6V256h-65v74h65v182h80V330z"/></svg>

File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/auth-github.svg


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/auth-gitlab.svg


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/auth-google.svg


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/auth-okta.svg


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/call_end.svg


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/call_wait.svg


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/chat.svg


+ 1 - 0
resources/web2/assets/assets/chat2.svg

@@ -0,0 +1 @@
1
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="#fff"><path d="M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10a9.96 9.96 0 0 1-4.644-1.142l-4.29 1.117a.85.85 0 0 1-1.037-1.036l1.116-4.289A9.959 9.959 0 0 1 2 12C2 6.477 6.477 2 12 2Zm1.252 11H8.75l-.102.007a.75.75 0 0 0 0 1.486l.102.007h4.502l.101-.007a.75.75 0 0 0 0-1.486L13.252 13Zm1.998-3.5h-6.5l-.102.007a.75.75 0 0 0 0 1.486L8.75 11h6.5l.102-.007a.75.75 0 0 0 0-1.486L15.25 9.5Z"/></svg>

File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/checkbox-outline.svg


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/chevron_up_chevron_down.svg


+ 1 - 0
resources/web2/assets/assets/close.svg

@@ -0,0 +1 @@
1
+<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" style="isolation:isolate" viewBox="679.559 521.772 32 32"><path fill="none" d="M679.559 521.772h32v32h-32v-32Z"/><path d="m695.559 536.034-5.305-5.305a1.229 1.229 0 1 0-1.738 1.738l5.305 5.305-5.305 5.305a1.229 1.229 0 0 0 0 1.738 1.23 1.23 0 0 0 1.738 0l5.305-5.305 5.305 5.305a1.229 1.229 0 1 0 1.738-1.738l-5.305-5.305 5.305-5.305a1.229 1.229 0 1 0-1.738-1.738l-5.305 5.305Z"/></svg>

File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/display.svg


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/dots.svg


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/file.svg


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/file_transfer.svg


+ 1 - 0
resources/web2/assets/assets/folder.svg

@@ -0,0 +1 @@
1
+<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" style="isolation:isolate" viewBox="129.858 75.669 32 32"><path fill="none" d="M129.858 75.669h32v32h-32v-32Z"/><path d="M138.617 99.535H153.1a2.76 2.76 0 0 0 2.758-2.758V89.32a2.76 2.76 0 0 0-2.758-2.759h-5.397a.552.552 0 0 1-.552-.552v-.827a1.38 1.38 0 0 0-1.379-1.38h-5.776c-.761 0-1.816.437-2.355.976l-.808.808c-.538.538-.975 1.593-.975 2.354v8.837a2.76 2.76 0 0 0 2.759 2.758Z"/></svg>

File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/folder_new.svg


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/fullscreen.svg


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/fullscreen_exit.svg


BIN
resources/web2/assets/assets/gestures.ttf


+ 1 - 0
resources/web2/assets/assets/home.svg

@@ -0,0 +1 @@
1
+<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" style="isolation:isolate" viewBox="13.554 106.603 32 32"><path fill="none" d="M13.554 106.603h32v32h-32v-32Z"/><path d="M32.944 132.507h3.661a1 1 0 0 0 1-1v-7.837h2.335c.552 0 .683-.316.293-.707l-9.972-9.971a.999.999 0 0 0-1.414 0l-9.971 9.971c-.391.391-.259.707.293.707h2.334v7.837a1 1 0 0 0 1 1h3.661a1 1 0 0 0 1-1v-2.966a.5.5 0 0 1 .5-.5h3.78a.5.5 0 0 1 .5.5v2.966c0 .552.449 1 1 1Z"/></svg>

File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/icon.svg


+ 1 - 0
resources/web2/assets/assets/insecure.svg

@@ -0,0 +1 @@
1
+<svg viewBox="0 0 347.97 347.97"><path fill="none" stroke="red" stroke-width="14.827" d="M317.469 61.615c-59.442 0-104.976-16.082-143.489-51.539-38.504 35.457-84.04 51.539-143.479 51.539 0 92.337-20.177 224.612 143.479 278.324 163.661-53.717 143.489-185.992 143.489-278.324z"/><g fill="red"><path d="m238.802 115.023-111.573 114.68-8.6-8.367L230.2 106.656z"/><path d="m125.559 108.093 114.68 111.572-8.368 8.601-114.68-111.572z"/></g></svg>

File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/insecure_relay.svg


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/kb_layout_iso.svg


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/kb_layout_not_iso.svg


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/keyboard.svg


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/linux.svg


+ 1 - 0
resources/web2/assets/assets/mac.svg

@@ -0,0 +1 @@
1
+<svg viewBox="0 0 384 512"><path fill="#fff" d="M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z"/></svg>

+ 1 - 0
resources/web2/assets/assets/message_24dp_5F6368.svg

@@ -0,0 +1 @@
1
+<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="-4 -4 32 32" width="24px" fill="#5f6368"><path d="M0 0h24v24H0z" fill="none"/><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 12H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z"/></svg>

BIN
resources/web2/assets/assets/peer_searchbar.ttf


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/pinned.svg


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/rec.svg


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/record_screen.svg


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/refresh.svg


BIN
resources/web2/assets/assets/scam.png


+ 1 - 0
resources/web2/assets/assets/screen.svg

@@ -0,0 +1 @@
1
+<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" style="isolation:isolate" viewBox="321.118 40.669 32 32"><path fill="none" d="M321.118 40.669h32v32h-32v-32Z"/><path d="M344.588 47.817h-14.94a3.764 3.764 0 0 0-3.761 3.764v10.176a3.764 3.764 0 0 0 3.761 3.764h14.94a3.765 3.765 0 0 0 3.762-3.764V51.581a3.765 3.765 0 0 0-3.762-3.764Z"/></svg>

File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/search.svg


+ 1 - 0
resources/web2/assets/assets/secure.svg

@@ -0,0 +1 @@
1
+<svg viewBox="0 0 347.97 347.97"><path fill="#3F7D46" d="M317.31 54.367c-59.376 0-104.86-16.964-143.33-54.367-38.461 37.403-83.947 54.367-143.32 54.367 0 97.405-20.155 236.94 143.32 293.6 163.48-56.666 143.33-196.2 143.33-293.6zm-155.2 171.41-47.749-47.756 21.379-21.378 26.37 26.376 50.121-50.122 21.378 21.378-71.499 71.502z"/></svg>

File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/secure_relay.svg


BIN
resources/web2/assets/assets/tabbar.ttf


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/transfer.svg


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/trash.svg


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/unpinned.svg


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/voice_call.svg


File diff suppressed because it is too large
+ 1 - 0
resources/web2/assets/assets/voice_call_waiting.svg


+ 1 - 0
resources/web2/assets/assets/win.svg

@@ -0,0 +1 @@
1
+<svg viewBox="0 0 448 512"><path fill="#fff" d="m0 93.7 183.6-25.3v177.4H0V93.7zm0 324.6 183.6 25.3V268.4H0v149.9zm203.8 28L448 480V268.4H203.8v177.9zm0-380.6v180.1H448V32L203.8 65.7z"/></svg>

BIN
resources/web2/assets/fonts/MaterialIcons-Regular.otf


BIN
resources/web2/assets/packages/dash_chat_2/assets/placeholder.png


BIN
resources/web2/assets/packages/dash_chat_2/assets/profile_placeholder.png


BIN
resources/web2/assets/packages/flex_color_picker/assets/opacity.png


File diff suppressed because it is too large
+ 230 - 0
resources/web2/assets/packages/wakelock_plus/assets/no_sleep.js


BIN
resources/web2/assets/packages/window_manager/images/ic_chrome_close.png


BIN
resources/web2/assets/packages/window_manager/images/ic_chrome_maximize.png


BIN
resources/web2/assets/packages/window_manager/images/ic_chrome_minimize.png


BIN
resources/web2/assets/packages/window_manager/images/ic_chrome_unmaximize.png


BIN
resources/web2/assets/shaders/ink_sparkle.frag


File diff suppressed because it is too large
+ 1 - 0
resources/web2/favicon.svg


File diff suppressed because it is too large
+ 16 - 0
resources/web2/ffmpeg-core.js


BIN
resources/web2/ffmpeg-core.wasm


+ 111 - 0
resources/web2/ffmpeg.js

@@ -0,0 +1,111 @@
1
+
2
+const ERROR_IMPORT_FAILURE = 'Failed to import FFmpeg core';
3
+
4
+let ffmpeg;
5
+let arrayBufferPool = [];
6
+const load = async ({ coreURL, wasmURL }) => {
7
+  const first = !ffmpeg;
8
+  try {
9
+    // when web worker type is `classic`.
10
+    importScripts([coreURL]);
11
+  } catch {
12
+    // when web worker type is `module`.
13
+    const module = await import(/* @vite-ignore */ coreURL);
14
+    self.createFFmpegCore = module.default;
15
+
16
+    if (!self.createFFmpegCore) {
17
+      throw ERROR_IMPORT_FAILURE;
18
+    }
19
+  }
20
+
21
+  try {
22
+    ffmpeg = await self.createFFmpegCore({
23
+      // Fix `Overload resolution failed.` when using multi-threaded ffmpeg-core.
24
+      // Encoded wasmURL and workerURL in the URL as a hack to fix locateFile issue.
25
+      mainScriptUrlOrBlob: `${coreURL}#${btoa(JSON.stringify({ wasmURL }))}`,
26
+    });
27
+  } catch(e) {
28
+    console.error(e);
29
+    throw ERROR_IMPORT_FAILURE;
30
+  }
31
+
32
+  return first;
33
+};
34
+
35
+const decode = async ({ codec, data }) => {
36
+  return ffmpeg.processFrame(codec, data, (_) =>{});
37
+};
38
+
39
+const recycle = (array) => {
40
+  ffmpeg.recycleFrame(array);
41
+}
42
+
43
+const close = () => {
44
+  ffmpeg.close();
45
+  ffmpeg = null;
46
+  arrayBufferPool = [];
47
+}
48
+
49
+// message handler is synchronous
50
+self.onmessage = async ({ data: { id, type, data } }) => {
51
+  try {
52
+    if (type !== "LOAD" && !ffmpeg) {
53
+      self.postMessage({
54
+        id,
55
+        type: "ERROR",
56
+        data: "FFmpeg not loaded",
57
+      });
58
+    } else if (type === "LOAD") {
59
+      const ret = await load(data);
60
+      self.postMessage({ id, type, data: ret });
61
+    } else if (type === "DECODE") {
62
+      // accept moved buffer first
63
+      if (data.arrayBuffer) {
64
+        arrayBufferPool.push(data.arrayBuffer);
65
+        if (arrayBufferPool.length > 8) {
66
+          arrayBufferPool.shift();
67
+        }
68
+      }
69
+      const ret = await decode(data);
70
+      if (ret === 0) {
71
+        var buffer = null;
72
+        while(arrayBufferPool.length > 0) {
73
+          var pop = arrayBufferPool.pop();
74
+          if (pop.byteLength  === ffmpeg.frameBuffer.data.length) {
75
+            buffer = pop;
76
+            break;
77
+          }
78
+        }
79
+        if (!buffer) {
80
+          buffer = new ArrayBuffer(ffmpeg.frameBuffer.data.length);
81
+          console.log("worker create arrayBuffer");
82
+        }
83
+        let array = new Uint8Array(buffer);
84
+        array.set(ffmpeg.frameBuffer.data);
85
+        self.postMessage({ id, type, data: {data: {data: buffer, yuvFormat: ffmpeg.frameBuffer.yuvFormat}}}, [buffer]);
86
+        recycle(ffmpeg.frameBuffer.data);
87
+      } else {
88
+        self.postMessage({
89
+          id,
90
+          type: "ERROR",
91
+          data: {},
92
+        });
93
+      }
94
+    } else if (type === "CLOSE") {
95
+      close();
96
+      self.postMessage({ id, type, data: {} });
97
+    } else {
98
+      self.postMessage({
99
+        id,
100
+        type: "ERROR",
101
+        data: `Unknown command: ${type}`,
102
+      });
103
+    }
104
+  } catch (e) {
105
+    self.postMessage({
106
+      id,
107
+      type: "ERROR",
108
+      data: e.toString(),
109
+    });
110
+  }
111
+};

File diff suppressed because it is too large
+ 7201 - 0
resources/web2/flutter_service_worker.js


BIN
resources/web2/icons/Icon-192.png


BIN
resources/web2/icons/libopus.wasm


+ 341 - 0
resources/web2/index.html

@@ -0,0 +1,341 @@
1
+<!DOCTYPE html>
2
+<html>
3
+  <head>
4
+    <!--
5
+    If you are serving your web app in a path other than the root, change the
6
+    href value below to reflect the base path you are serving from.
7
+
8
+    The path provided below has to start and end with a slash "/" in order for
9
+    it to work correctly.
10
+
11
+    For more details:
12
+    * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
13
+
14
+    This is a placeholder for base href that will be replaced by the value of
15
+    the `--base-href` argument provided to `flutter build`.
16
+  -->
17
+    <base href="/webclient2/" />
18
+
19
+    <meta charset="UTF-8" />
20
+    <meta content="IE=Edge" http-equiv="X-UA-Compatible" />
21
+    <meta name="description" content="Remote Desktop." />
22
+
23
+    <!-- iOS meta tags & icons -->
24
+    <meta name="apple-mobile-web-app-capable" content="yes" />
25
+    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
26
+    <meta name="apple-mobile-web-app-title" content="RustDesk" />
27
+    <link rel="apple-touch-icon" href="icons/Icon-192.png?v=1a7ad736" />
28
+
29
+    <!-- Favicon -->
30
+    <link rel="icon" type="image/svg+xml" href="favicon.svg?v=8fcccd9a" />
31
+
32
+    <title>RustDesk</title>
33
+    <script src="/webclient-config/index.js"></script>
34
+    <link rel="manifest" href="manifest.json" />
35
+    <script type="module" crossorigin src="js/dist/index.js?v=3"></script>
36
+    <link rel="modulepreload" href="js/dist/vendor.js?v=0b990c6e" />
37
+    <style>
38
+      html,
39
+      body,
40
+      #root {
41
+        height: 100%;
42
+        margin: 0;
43
+        padding: 0;
44
+      }
45
+      #root {
46
+        background-repeat: no-repeat;
47
+        background-size: 100% auto;
48
+      }
49
+
50
+      .loading-title {
51
+        font-size: 1.1rem;
52
+      }
53
+
54
+      .loading-sub-title {
55
+        margin-top: 20px;
56
+        font-size: 1rem;
57
+        color: #888;
58
+      }
59
+
60
+      .page-loading-warp {
61
+        display: flex;
62
+        align-items: center;
63
+        justify-content: center;
64
+        padding: 26px;
65
+      }
66
+      .ant-spin {
67
+        position: absolute;
68
+        display: none;
69
+        -webkit-box-sizing: border-box;
70
+        box-sizing: border-box;
71
+        margin: 0;
72
+        padding: 0;
73
+        color: rgba(0, 0, 0, 0.65);
74
+        color: #1890ff;
75
+        font-size: 14px;
76
+        font-variant: tabular-nums;
77
+        line-height: 1.5;
78
+        text-align: center;
79
+        list-style: none;
80
+        opacity: 0;
81
+        -webkit-transition: -webkit-transform 0.3s
82
+          cubic-bezier(0.78, 0.14, 0.15, 0.86);
83
+        transition: -webkit-transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86);
84
+        transition: transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86);
85
+        transition: transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86),
86
+          -webkit-transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86);
87
+        -webkit-font-feature-settings: "tnum";
88
+        font-feature-settings: "tnum";
89
+      }
90
+
91
+      .ant-spin-spinning {
92
+        position: static;
93
+        display: inline-block;
94
+        opacity: 1;
95
+      }
96
+
97
+      .ant-spin-dot {
98
+        position: relative;
99
+        display: inline-block;
100
+        width: 20px;
101
+        height: 20px;
102
+        font-size: 20px;
103
+      }
104
+
105
+      .ant-spin-dot-item {
106
+        position: absolute;
107
+        display: block;
108
+        width: 9px;
109
+        height: 9px;
110
+        background-color: #1890ff;
111
+        border-radius: 100%;
112
+        -webkit-transform: scale(0.75);
113
+        -ms-transform: scale(0.75);
114
+        transform: scale(0.75);
115
+        -webkit-transform-origin: 50% 50%;
116
+        -ms-transform-origin: 50% 50%;
117
+        transform-origin: 50% 50%;
118
+        opacity: 0.3;
119
+        -webkit-animation: antspinmove 1s infinite linear alternate;
120
+        animation: antSpinMove 1s infinite linear alternate;
121
+      }
122
+
123
+      .ant-spin-dot-item:nth-child(1) {
124
+        top: 0;
125
+        left: 0;
126
+      }
127
+
128
+      .ant-spin-dot-item:nth-child(2) {
129
+        top: 0;
130
+        right: 0;
131
+        -webkit-animation-delay: 0.4s;
132
+        animation-delay: 0.4s;
133
+      }
134
+
135
+      .ant-spin-dot-item:nth-child(3) {
136
+        right: 0;
137
+        bottom: 0;
138
+        -webkit-animation-delay: 0.8s;
139
+        animation-delay: 0.8s;
140
+      }
141
+
142
+      .ant-spin-dot-item:nth-child(4) {
143
+        bottom: 0;
144
+        left: 0;
145
+        -webkit-animation-delay: 1.2s;
146
+        animation-delay: 1.2s;
147
+      }
148
+
149
+      .ant-spin-dot-spin {
150
+        -webkit-transform: rotate(45deg);
151
+        -ms-transform: rotate(45deg);
152
+        transform: rotate(45deg);
153
+        -webkit-animation: antrotate 1.2s infinite linear;
154
+        animation: antRotate 1.2s infinite linear;
155
+      }
156
+
157
+      .ant-spin-lg .ant-spin-dot {
158
+        width: 32px;
159
+        height: 32px;
160
+        font-size: 32px;
161
+      }
162
+
163
+      .ant-spin-lg .ant-spin-dot i {
164
+        width: 14px;
165
+        height: 14px;
166
+      }
167
+
168
+      @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
169
+        .ant-spin-blur {
170
+          background: #fff;
171
+          opacity: 0.5;
172
+        }
173
+      }
174
+
175
+      @-webkit-keyframes antSpinMove {
176
+        to {
177
+          opacity: 1;
178
+        }
179
+      }
180
+
181
+      @keyframes antSpinMove {
182
+        to {
183
+          opacity: 1;
184
+        }
185
+      }
186
+
187
+      @-webkit-keyframes antRotate {
188
+        to {
189
+          -webkit-transform: rotate(405deg);
190
+          transform: rotate(405deg);
191
+        }
192
+      }
193
+
194
+      @keyframes antRotate {
195
+        to {
196
+          -webkit-transform: rotate(405deg);
197
+          transform: rotate(405deg);
198
+        }
199
+      }
200
+    </style>
201
+  </head>
202
+
203
+  <body>
204
+    <div id="root">
205
+      <div
206
+        id="div-background"
207
+        style="
208
+          display: flex;
209
+          flex-direction: column;
210
+          align-items: center;
211
+          justify-content: center;
212
+          height: 100%;
213
+          min-height: 420px;
214
+        "
215
+      >
216
+        <img src="./favicon.svg?v=8fcccd9a" alt="logo" width="256" />
217
+        <div class="page-loading-warp">
218
+          <div class="ant-spin ant-spin-lg ant-spin-spinning">
219
+            <span class="ant-spin-dot ant-spin-dot-spin">
220
+              <i class="ant-spin-dot-item"></i>
221
+              <i class="ant-spin-dot-item"></i>
222
+              <i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i>
223
+            </span>
224
+          </div>
225
+        </div>
226
+        <div
227
+          style="display: flex; align-items: center; justify-content: center"
228
+        >
229
+          <img src="./favicon.svg?v=8fcccd9a" width="32" style="margin-right: 8px" />
230
+          <span id="span-text">RustDesk Web Client V2 Preview</span>
231
+        </div>
232
+      </div>
233
+    </div>
234
+    <!-- This script installs service_worker.js to provide PWA functionality to
235
+       application. For more information, see:
236
+       https://developers.google.com/web/fundamentals/primers/service-workers -->
237
+    <script>
238
+      const systemTheme = window.matchMedia("(prefers-color-scheme: dark)")
239
+        .matches
240
+        ? "dark"
241
+        : "light";
242
+      const myTheme = localStorage.getItem("wc-option:local:theme");
243
+      const them = myTheme || systemTheme;
244
+
245
+      const divBackground = document.querySelector("#div-background");
246
+      if (divBackground) {
247
+        divBackground.style.backgroundColor = them === "dark" ? "#000" : "#fff";
248
+      }
249
+      const spanConsole = document.querySelector("#span-text");
250
+      if (spanConsole) {
251
+        spanConsole.style.color = them === "dark" ? "#fff" : "#000";
252
+      }
253
+
254
+      const serviceWorkerVersion = "3267265270";
255
+      var scriptLoaded = false;
256
+      function loadMainDartJs() {
257
+        if (scriptLoaded) {
258
+          return;
259
+        }
260
+        scriptLoaded = true;
261
+        var scriptTag = document.createElement("script");
262
+        scriptTag.src = "main.dart.js?v=6d46937e";
263
+        scriptTag.type = "application/javascript";
264
+        document.body.append(scriptTag);
265
+      }
266
+
267
+      if ("serviceWorker" in navigator) {
268
+        // Service workers are supported. Use them.
269
+        window.addEventListener("load", function () {
270
+          // Wait for registration to finish before dropping the <script> tag.
271
+          // Otherwise, the browser will load the script multiple times,
272
+          // potentially different versions.
273
+          var serviceWorkerUrl =
274
+            "flutter_service_worker.js?v=" + serviceWorkerVersion;
275
+          navigator.serviceWorker.register(serviceWorkerUrl).then((reg) => {
276
+            function waitForActivation(serviceWorker) {
277
+              serviceWorker.addEventListener("statechange", () => {
278
+                if (serviceWorker.state == "activated") {
279
+                  console.log("Installed new service worker.");
280
+                  loadMainDartJs();
281
+                }
282
+              });
283
+            }
284
+            if (!reg.active && (reg.installing || reg.waiting)) {
285
+              // No active web worker and we have installed or are installing
286
+              // one for the first time. Simply wait for it to activate.
287
+              waitForActivation(reg.installing || reg.waiting);
288
+            } else if (!reg.active.scriptURL.endsWith(serviceWorkerVersion)) {
289
+              // When the app updates the serviceWorkerVersion changes, so we
290
+              // need to ask the service worker to update.
291
+              console.log("New service worker available.");
292
+              reg.update();
293
+              waitForActivation(reg.installing);
294
+            } else {
295
+              // Existing service worker is still good.
296
+              console.log("Loading app from service worker.");
297
+              loadMainDartJs();
298
+            }
299
+          });
300
+
301
+          // If service worker doesn't succeed in a reasonable amount of time,
302
+          // fallback to plaint <script> tag.
303
+          setTimeout(() => {
304
+            if (!scriptLoaded) {
305
+              console.warn(
306
+                "Failed to load app from service worker. Falling back to plain <script> tag."
307
+              );
308
+              loadMainDartJs();
309
+            }
310
+          }, 4000);
311
+        });
312
+      } else {
313
+        // Service workers not supported. Just drop the <script> tag.
314
+        loadMainDartJs();
315
+      }
316
+    </script>
317
+    <script src="libs/stream/ponyfill.min.js"></script>
318
+    <script src="libs/stream/StreamSaver.min.js"></script>
319
+    <script src="libs/firebase-app.js?8.10.1"></script>
320
+    <script src="libs/firebase-analytics.js?8.10.1"></script>
321
+
322
+    <script>
323
+      // Your web app's Firebase configuration
324
+      // For Firebase JS SDK v7.20.0 and later, measurementId is optional
325
+      const firebaseConfig = {
326
+        apiKey: "AIzaSyCgehIZk1aFP0E7wZtYRRqrfvNiNAF39-A",
327
+        authDomain: "rustdesk.firebaseapp.com",
328
+        databaseURL: "https://rustdesk.firebaseio.com",
329
+        projectId: "rustdesk",
330
+        storageBucket: "rustdesk.appspot.com",
331
+        messagingSenderId: "768133699366",
332
+        appId: "1:768133699366:web:d50faf0792cb208d7993e7",
333
+        measurementId: "G-9PEH85N6ZQ",
334
+      };
335
+
336
+      // Initialize Firebase
337
+      firebase.initializeApp(firebaseConfig);
338
+      firebase.analytics();
339
+    </script>
340
+  </body>
341
+</html>

File diff suppressed because it is too large
+ 39881 - 0
resources/web2/js/dist/index.js


+ 82 - 0
resources/web2/js/dist/ljw.js

@@ -0,0 +1,82 @@
1
+window._gwen = {}
2
+window._gwen.kv = {}
3
+const apiserver = localStorage.getItem('api-server')
4
+
5
+function stringToUint8Array(str) {
6
+    var arr = [];
7
+    for (var i = 0, j = str.length; i < j; ++i) {
8
+        arr.push(str.charCodeAt(i));
9
+    }
10
+
11
+    var tmpUint8Array = new Uint8Array(arr);
12
+    return tmpUint8Array
13
+}
14
+
15
+function getQueryVariable() {
16
+    const query = window.location.hash.substring(3);
17
+    const vars = query.split("&");
18
+    for (var i = 0; i < vars.length; i++) {
19
+        var pair = vars[i].split("=");
20
+        window._gwen.kv[pair[0]] = pair[1]
21
+    }
22
+}
23
+
24
+getQueryVariable()
25
+
26
+const id = window._gwen.kv.id || ''
27
+if (id) {
28
+    localStorage.setItem('remote-id', id)
29
+}
30
+const share_token = window._gwen.kv.share_token || ''
31
+if (share_token) {
32
+    fetch(apiserver + "/api/shared-peer", {
33
+        method: 'POST',
34
+        headers: {
35
+            'Content-Type': 'application/json',
36
+        },
37
+        body: JSON.stringify({share_token})
38
+    }).then(res => res.json()).then(res => {
39
+        if (res.code === 0) {
40
+            localStorage.setItem('custom-rendezvous-server', res.data.id_server)
41
+            localStorage.setItem('key', res.data.key)
42
+            const peer = res.data.peer
43
+            localStorage.setItem('remote-id', peer.info.id)
44
+            peer.tmppwd = stringToUint8Array(window.atob(peer.tmppwd)).toString()
45
+            const oldPeers = JSON.parse(localStorage.getItem('peers')) || {}
46
+            oldPeers[peer.info.id] = peer
47
+            localStorage.setItem('peers', JSON.stringify(oldPeers))
48
+        }
49
+    })
50
+}
51
+
52
+let fetching = false
53
+
54
+export function getServerConf(token) {
55
+    if (!token) {
56
+        return
57
+    }
58
+    const prefix = 'wc-'
59
+    console.log('getServerConf', token)
60
+    if (fetching) {
61
+        return
62
+    }
63
+    fetching = true
64
+    fetch(apiserver + "/api/server-config-v2", {
65
+            method: 'POST',
66
+            headers: {
67
+                'Content-Type': 'application/json',
68
+                'Authorization': 'Bearer ' + token
69
+            }
70
+        }
71
+    ).then(res => res.json()).then(res => {
72
+        fetching = false
73
+        if (res.code === 0) {
74
+            if (!localStorage.getItem(prefix + 'custom-rendezvous-server') || !localStorage.getItem('key')) {
75
+                localStorage.setItem(prefix + 'custom-rendezvous-server', res.data.id_server)
76
+                localStorage.setItem(prefix + 'key', res.data.key)
77
+            }
78
+        }
79
+    }).catch(_ => {
80
+        fetching = false
81
+    })
82
+}

File diff suppressed because it is too large
+ 102 - 0
resources/web2/js/dist/vendor.js


File diff suppressed because it is too large
+ 5555 - 0
resources/web2/libopus.js


BIN
resources/web2/libopus.wasm


File diff suppressed because it is too large
+ 2 - 0
resources/web2/libs/firebase-analytics.js


File diff suppressed because it is too large
+ 2 - 0
resources/web2/libs/firebase-app.js


File diff suppressed because it is too large
+ 8 - 0
resources/web2/libs/stream/StreamSaver.min.js


File diff suppressed because it is too large
+ 8 - 0
resources/web2/libs/stream/ponyfill.min.js


File diff suppressed because it is too large
+ 164153 - 0
resources/web2/main.dart.js


+ 35 - 0
resources/web2/manifest.json

@@ -0,0 +1,35 @@
1
+{
2
+    "name": "rustdesk",
3
+    "short_name": "rustdesk",
4
+    "start_url": ".",
5
+    "display": "standalone",
6
+    "background_color": "#0175C2",
7
+    "theme_color": "#0175C2",
8
+    "description": "Remote Desktop.",
9
+    "orientation": "portrait-primary",
10
+    "prefer_related_applications": false,
11
+    "icons": [
12
+        {
13
+            "src": "icons/Icon-192.png",
14
+            "sizes": "192x192",
15
+            "type": "image/png"
16
+        },
17
+        {
18
+            "src": "icons/Icon-512.png",
19
+            "sizes": "512x512",
20
+            "type": "image/png"
21
+        },
22
+        {
23
+            "src": "icons/Icon-maskable-192.png",
24
+            "sizes": "192x192",
25
+            "type": "image/png",
26
+            "purpose": "maskable"
27
+        },
28
+        {
29
+            "src": "icons/Icon-maskable-512.png",
30
+            "sizes": "512x512",
31
+            "type": "image/png",
32
+            "purpose": "maskable"
33
+        }
34
+    ]
35
+}