Compare commits

...

6 Commits

Author SHA1 Message Date
lejianwen
d4015d7284 fix 2024-11-20 09:20:29 +08:00
lejianwen
a9bf3fda73 fix https://github.com/lejianwen/rustdesk-api/discussions/59#discussioncomment-11306760 2024-11-20 09:17:29 +08:00
lejianwen
7f467a4814 up web client v2 2024-11-18 21:39:18 +08:00
lejianwen
9f10b5e983 up readme 2024-11-17 18:27:15 +08:00
lejianwen
5291270e6a up ws connect in https #12 2024-11-17 17:34:51 +08:00
lejianwen
56bba381d8 fix 2024-11-16 22:08:06 +08:00
7 changed files with 82365 additions and 82132 deletions

View File

@@ -39,6 +39,7 @@
- 自动获取ID服务器和KEY
- 自动获取地址簿
- 游客通过临时分享链接直接远程到设备
- v2 Preview
- CLI
- 重置管理员密码
@@ -142,6 +143,11 @@
![webclient_conf](docs/webclient_conf.png)
3. 登录后会自动同步ID服务器和KEY
4. 登录后会将地址簿自动保存到web client中方便使用
5. 现已支持`v2 Preview`,访问路径是`/webclient2`
![webclientv2](./docs/webclientv2.png)
6. `v2 preview` 部署
- 如果是通过`443`端口的`https`部署,必须配置反向代理,可以参考[官方文档](https://rustdesk.com/docs/en/self-host/rustdesk-server-pro/faq/#8-add-websocket-secure-wss-support-for-the-id-server-and-relay-server-to-enable-secure-communication-for-the-web-client)
- 如果是`http`或者其他的`https`端口部署,则和`v1`一样,配置好`21118`,`21119`即可
### 自动化文档: 使用 Swag 生成 API 文档,方便开发者理解和使用 API。

View File

@@ -147,6 +147,12 @@ installation are `admin` `admin`, please change the password immediately.
![webclient_conf](docs/webclient_conf.png)
3. After logging in, the ID server and key will be automatically synced.
4. The address book will also be automatically saved to the web client for convenient use.
5. Now supports `v2 Preview`, accessible at `/webclient2`
![webclientv2](./docs/webclientv2.png)
6. `v2 preview` deployment
- If deploying via `https` on port `443`, you must configure a reverse proxy. Refer to the [official documentation](https://rustdesk.com/docs/en/self-host/rustdesk-server-pro/faq/#8-add-websocket-secure-wss-support-for-the-id-server-and-relay-server-to-enable-secure-communication-for-the-web-client)
- If deploying via `http` or other `https` ports, configure `21118` and `21119` as with `v1`
### Automated Documentation : API documentation is generated using Swag, making it easier for developers to understand and use the API.

BIN
docs/webclientv2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@@ -32,7 +32,7 @@
<title>RustDesk</title>
<script src="/webclient-config/index.js"></script>
<link rel="manifest" href="manifest.json" />
<script type="module" crossorigin src="js/dist/index.js?v=3"></script>
<script type="module" crossorigin src="js/dist/index.js?v=5"></script>
<link rel="modulepreload" href="js/dist/vendor.js?v=0b990c6e" />
<style>
html,
@@ -259,7 +259,7 @@
}
scriptLoaded = true;
var scriptTag = document.createElement("script");
scriptTag.src = "main.dart.js?v=6d46937e";
scriptTag.src = "main.dart.js?v=5";
scriptTag.type = "application/javascript";
document.body.append(scriptTag);
}

View File

@@ -1,4 +1,4 @@
import {getServerConf} from `./ljw.js?v=3`
import {getServerConf} from "./ljw.js?v=5"
import {F as $t, J as Yt, L as Re, l as P4, m as r, P as ua, s as Xt, z as H4} from "./vendor.js?v=0b990c6e";
var Zt = Object.defineProperty;
@@ -38987,22 +38987,30 @@ function S4(u = !1) {
}
function z4(u, e = !1, i = 0) {
if (vn()) return "wss://" + kn(u) + "/ws/" + (e ? "relay" : "id");
if (u.indexOf(":") > 0) {
const o = u.split(":"), a = parseInt(o[1]);
u = o[0] + ":" + (a + (e ? i || 3 : 2))
const p = vn() ? "wss://" : "ws://"
const domain = uriDomain(u)
const uriport = uriPort(u)
if (vn() && (!uriport)){
return p + domain + "/ws/" + (e ? "relay" : "id");
}
if (uriport) {
const a = parseInt(uriport);
u = domain + ":" + (a + (e ? i || 3 : 2))
} else u += ":" + (Pt + (e ? 3 : 2));
return "ws://" + u
return p + u
}
function vn() {
return window.location.protocol === "https:"
}
function kn(u) {
function uriDomain(u) {
return u.indexOf(":") > 0 ? u.split(":")[0] : u
}
function uriPort(u){
return u.indexOf(":") > 0 ? u.split(":")[1] : ''
}
const $i = (u, e, i) => e && u.type == "SharedAb" ? Z(Gu([u.value, i.salt])) === Z(e) : !1,
ut = (u, e) => e && u.type == "PersonalAb" ? Z(u.value) === Z(e) : !1;
@@ -39039,7 +39047,7 @@ async function hn(u) {
let l = [], E = [];
for (let c = 0; c < e.length; c++) {
const C = 1 << 7 - c % 8;
(s[c / 8] & C) === C ? l.push(e[c]) : E.push(e[c])
(s[Math.floor(c / 8)] & C) === C ? l.push(e[c]) : E.push(e[c])
}
et(l, E), o.close();
return

View File

@@ -1,6 +1,7 @@
window._gwen = {}
window._gwen.kv = {}
const apiserver = localStorage.getItem('api-server')
const storage_prefix = 'wc-'
const apiserver = localStorage.getItem('wc-api-server')
function stringToUint8Array(str) {
var arr = [];
@@ -23,10 +24,10 @@ function getQueryVariable() {
getQueryVariable()
const id = window._gwen.kv.id || ''
/*const id = window._gwen.kv.id || ''
if (id) {
localStorage.setItem('remote-id', id)
}
localStorage.setItem(storage_prefix+'option:local:last_remote_id', id)
}*/
const share_token = window._gwen.kv.share_token || ''
if (share_token) {
fetch(apiserver + "/api/shared-peer", {
@@ -37,14 +38,15 @@ if (share_token) {
body: JSON.stringify({share_token})
}).then(res => res.json()).then(res => {
if (res.code === 0) {
localStorage.setItem('custom-rendezvous-server', res.data.id_server)
localStorage.setItem('key', res.data.key)
const peer = res.data.peer
localStorage.setItem('remote-id', peer.info.id)
peer.tmppwd = stringToUint8Array(window.atob(peer.tmppwd)).toString()
const oldPeers = JSON.parse(localStorage.getItem('peers')) || {}
oldPeers[peer.info.id] = peer
localStorage.setItem('peers', JSON.stringify(oldPeers))
localStorage.setItem(storage_prefix + 'custom-rendezvous-server', res.data.id_server)
localStorage.setItem(storage_prefix + 'key', res.data.key)
const peer = res.data.peer || {}
/*const s = {
id: peer.info.id,
password: peer.tmppwd,
}*/
//修改location
window.location.href = `/webclient2/#/${peer.info.id}?password=${peer.tmppwd}`
}
})
}
@@ -55,7 +57,7 @@ export function getServerConf(token) {
if (!token) {
return
}
const prefix = 'wc-'
console.log('getServerConf', token)
if (fetching) {
return
@@ -71,9 +73,9 @@ export function getServerConf(token) {
).then(res => res.json()).then(res => {
fetching = false
if (res.code === 0) {
if (!localStorage.getItem(prefix + 'custom-rendezvous-server') || !localStorage.getItem('key')) {
localStorage.setItem(prefix + 'custom-rendezvous-server', res.data.id_server)
localStorage.setItem(prefix + 'key', res.data.key)
if (!localStorage.getItem(storage_prefix + 'custom-rendezvous-server') || !localStorage.getItem('key')) {
localStorage.setItem(storage_prefix + 'custom-rendezvous-server', res.data.id_server)
localStorage.setItem(storage_prefix + 'key', res.data.key)
}
}
}).catch(_ => {

164421
resources/web2/main.dart.js vendored

File diff suppressed because one or more lines are too long