mirror of
https://github.com/lejianwen/rustdesk-api.git
synced 2025-11-29 08:33:21 +00:00
up web client can get pwd if exist
This commit is contained in:
@@ -12,6 +12,15 @@ func (i *Index) ConfigJs(c *gin.Context) {
|
||||
apiServer := global.Config.Rustdesk.ApiServer
|
||||
|
||||
tmp := `
|
||||
function stringToUint8Array(str){
|
||||
var arr = [];
|
||||
for (var i = 0, j = str.length; i < j; ++i) {
|
||||
arr.push(str.charCodeAt(i));
|
||||
}
|
||||
|
||||
var tmpUint8Array = new Uint8Array(arr);
|
||||
return tmpUint8Array
|
||||
}
|
||||
window._gwen = {}
|
||||
window._gwen.kv = {}
|
||||
function getQueryVariable() {
|
||||
@@ -53,13 +62,26 @@ const autoWriteServer = () => {
|
||||
}
|
||||
|
||||
if (res.data.peers) {
|
||||
oldPeers = JSON.parse(localStorage.getItem('peers')) || {}
|
||||
oldPeers = JSON.parse(localStorage.getItem('peers')) || {}
|
||||
let needUpdate = false
|
||||
Object.keys(res.data.peers).forEach(k => {
|
||||
if(!oldPeers[k]) {
|
||||
oldPeers[k] = res.data.peers[k]
|
||||
needUpdate = true
|
||||
}else{
|
||||
oldPeers[k].info = res.data.peers[k].info
|
||||
}
|
||||
if (oldPeers[k].info && oldPeers[k].info.hash&&!oldPeers[k].password ) {
|
||||
let p1 = window.atob(oldPeers[k].info.hash)
|
||||
const pwd = stringToUint8Array(p1)
|
||||
oldPeers[k].password = pwd.toString()
|
||||
oldPeers[k].remember = true
|
||||
}
|
||||
})
|
||||
localStorage.setItem('peers', JSON.stringify(oldPeers))
|
||||
if(needUpdate) {
|
||||
window.location.reload()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -15,6 +15,7 @@ type WebClientPeerInfoPayload struct {
|
||||
Username string `json:"username"`
|
||||
Hostname string `json:"hostname"`
|
||||
Platform string `json:"platform"`
|
||||
Hash string `json:"hash"`
|
||||
}
|
||||
|
||||
func (wcpp *WebClientPeerPayload) FromAddressBook(a *model.AddressBook) {
|
||||
@@ -25,5 +26,6 @@ func (wcpp *WebClientPeerPayload) FromAddressBook(a *model.AddressBook) {
|
||||
Username: a.Username,
|
||||
Hostname: a.Hostname,
|
||||
Platform: a.Platform,
|
||||
Hash: a.Hash,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user