peers and more trans
This commit is contained in:
parent
1e13484c26
commit
60783c875e
@ -3,7 +3,7 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"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"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -33,7 +33,7 @@ export async function decompress(compressedArray: Uint8Array) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function translate(locale: string, text: string): string {
|
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 en = LANGS.en as any;
|
||||||
let dict = (LANGS as any)[lang];
|
let dict = (LANGS as any)[lang];
|
||||||
if (!dict) dict = en;
|
if (!dict) dict = en;
|
||||||
|
@ -199,6 +199,12 @@ export const LANGS = {
|
|||||||
"Hostname": "主机名",
|
"Hostname": "主机名",
|
||||||
"Discovered": "已发现",
|
"Discovered": "已发现",
|
||||||
"install_daemon_tip": "为了开机启动,请安装系统服务。",
|
"install_daemon_tip": "为了开机启动,请安装系统服务。",
|
||||||
|
"Remote ID": "远程ID",
|
||||||
|
"Paste": "粘贴",
|
||||||
|
"Are you sure to close the connection?": "是否确认关闭连接?",
|
||||||
|
"Download new version": "下载新版本",
|
||||||
|
"Touch mode": "触屏模式",
|
||||||
|
"Reset canvas": "重置画布",
|
||||||
},
|
},
|
||||||
it: {
|
it: {
|
||||||
"Status": "Stato",
|
"Status": "Stato",
|
||||||
@ -393,6 +399,12 @@ export const LANGS = {
|
|||||||
"Invalid folder name": "Nome della cartella non valido",
|
"Invalid folder name": "Nome della cartella non valido",
|
||||||
"Hostname": "Nome host",
|
"Hostname": "Nome host",
|
||||||
"Discovered": "Scoperto",
|
"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: {
|
en: {
|
||||||
"desk_tip": "Your desktop can be accessed with this ID and password.",
|
"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",
|
"Invalid folder name": "Nom de dossier invalide",
|
||||||
"Hostname": "nom d'hôte",
|
"Hostname": "nom d'hôte",
|
||||||
"Discovered": "Découvert",
|
"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",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,10 +235,22 @@ window.getByName = (name, arg) => {
|
|||||||
return JSON.stringify(v);
|
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) {
|
function _getByName(name, arg) {
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case 'peers':
|
case 'peers':
|
||||||
return localStorage.getItem('peers') || '[]';
|
return getPeersForDart();
|
||||||
case 'remote_id':
|
case 'remote_id':
|
||||||
return localStorage.getItem('remote-id');
|
return localStorage.getItem('remote-id');
|
||||||
case 'remember':
|
case 'remember':
|
||||||
@ -257,6 +269,7 @@ function _getByName(name, arg) {
|
|||||||
case 'image_quality':
|
case 'image_quality':
|
||||||
return curConn.getImageQuality();
|
return curConn.getImageQuality();
|
||||||
case 'translate':
|
case 'translate':
|
||||||
|
const arg = JSON.parse(arg);
|
||||||
return translate(arg.locale, arg.text);
|
return translate(arg.locale, arg.text);
|
||||||
case 'peer_option':
|
case 'peer_option':
|
||||||
return curConn.getOption(arg);
|
return curConn.getOption(arg);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user