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
|
apiServer := global.Config.Rustdesk.ApiServer
|
||||||
|
|
||||||
tmp := `
|
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 = {}
|
||||||
window._gwen.kv = {}
|
window._gwen.kv = {}
|
||||||
function getQueryVariable() {
|
function getQueryVariable() {
|
||||||
@@ -53,13 +62,26 @@ const autoWriteServer = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (res.data.peers) {
|
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 => {
|
Object.keys(res.data.peers).forEach(k => {
|
||||||
if(!oldPeers[k]) {
|
if(!oldPeers[k]) {
|
||||||
oldPeers[k] = res.data.peers[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))
|
localStorage.setItem('peers', JSON.stringify(oldPeers))
|
||||||
|
if(needUpdate) {
|
||||||
|
window.location.reload()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ type WebClientPeerInfoPayload struct {
|
|||||||
Username string `json:"username"`
|
Username string `json:"username"`
|
||||||
Hostname string `json:"hostname"`
|
Hostname string `json:"hostname"`
|
||||||
Platform string `json:"platform"`
|
Platform string `json:"platform"`
|
||||||
|
Hash string `json:"hash"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wcpp *WebClientPeerPayload) FromAddressBook(a *model.AddressBook) {
|
func (wcpp *WebClientPeerPayload) FromAddressBook(a *model.AddressBook) {
|
||||||
@@ -25,5 +26,6 @@ func (wcpp *WebClientPeerPayload) FromAddressBook(a *model.AddressBook) {
|
|||||||
Username: a.Username,
|
Username: a.Username,
|
||||||
Hostname: a.Hostname,
|
Hostname: a.Hostname,
|
||||||
Platform: a.Platform,
|
Platform: a.Platform,
|
||||||
|
Hash: a.Hash,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user