peers and more trans

This commit is contained in:
rustdesk 2022-01-31 02:01:17 +08:00
parent 1e13484c26
commit 60783c875e
4 changed files with 34 additions and 3 deletions

View File

@ -3,7 +3,7 @@
"version": "1.0.0",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"build": "./gen_js_from_hbb.py > src/gen_js_from_hbb.ts && ./ts_proto.py && tsc && vite build",
"preview": "vite preview"
},
"devDependencies": {

View File

@ -33,7 +33,7 @@ export async function decompress(compressedArray: Uint8Array) {
}
export function translate(locale: string, text: string): string {
const lang = locale.substr(locale.length - 2).toLowerCase();
const lang = locale.substring(locale.length - 2).toLowerCase();
let en = LANGS.en as any;
let dict = (LANGS as any)[lang];
if (!dict) dict = en;

View File

@ -199,6 +199,12 @@ export const LANGS = {
"Hostname": "主机名",
"Discovered": "已发现",
"install_daemon_tip": "为了开机启动,请安装系统服务。",
"Remote ID": "远程ID",
"Paste": "粘贴",
"Are you sure to close the connection?": "是否确认关闭连接?",
"Download new version": "下载新版本",
"Touch mode": "触屏模式",
"Reset canvas": "重置画布",
},
it: {
"Status": "Stato",
@ -393,6 +399,12 @@ export const LANGS = {
"Invalid folder name": "Nome della cartella non valido",
"Hostname": "Nome host",
"Discovered": "Scoperto",
"Remote ID": "ID remoto",
"Paste": "Impasto",
"Are you sure to close the connection?": "Sei sicuro di chiudere la connessione?",
"Download new version": "Scarica nuova versione",
"Touch mode": "Modalità tocco",
"Reset canvas": "Ripristina tela",
},
en: {
"desk_tip": "Your desktop can be accessed with this ID and password.",
@ -605,6 +617,12 @@ export const LANGS = {
"Invalid folder name": "Nom de dossier invalide",
"Hostname": "nom d'hôte",
"Discovered": "Découvert",
"Remote ID": "ID à distance",
"Paste": "Pâte",
"Are you sure to close the connection?": "Êtes-vous sûr de fermer la connexion?",
"Download new version": "Télécharger la nouvelle version",
"Touch mode": "Mode tactile",
"Reset canvas": "Réinitialiser le canevas",
},
}

View File

@ -235,10 +235,22 @@ window.getByName = (name, arg) => {
return JSON.stringify(v);
}
function getPeersForDart() {
const peers = [];
for (const [key, value] of Object.entries(getPeers())) {
if (!key) continue;
const tm = value['tm'];
const info = values['info'];
if (!tm || !info) continue;
peers.push([tm, id, info]);
}
return peers.sort().reverse().map(x => x.slice(1));
}
function _getByName(name, arg) {
switch (name) {
case 'peers':
return localStorage.getItem('peers') || '[]';
return getPeersForDart();
case 'remote_id':
return localStorage.getItem('remote-id');
case 'remember':
@ -257,6 +269,7 @@ function _getByName(name, arg) {
case 'image_quality':
return curConn.getImageQuality();
case 'translate':
const arg = JSON.parse(arg);
return translate(arg.locale, arg.text);
case 'peer_option':
return curConn.getOption(arg);