From f8092f924ab571069e174ccaf63ff3bd723fda2b Mon Sep 17 00:00:00 2001 From: solokot Date: Sat, 28 Oct 2023 06:29:50 +0300 Subject: [PATCH 1/7] Update ru.rs --- src/lang/ru.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lang/ru.rs b/src/lang/ru.rs index f43df683c..1ea714bf4 100644 --- a/src/lang/ru.rs +++ b/src/lang/ru.rs @@ -570,7 +570,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Big tiles", "Большие значки"), ("Small tiles", "Маленькие значки"), ("List", "Список"), - ("Virtual display", ""), - ("Plug out all", ""), + ("Virtual display", "Виртуальный дисплей"), + ("Plug out all", "Отключить все"), ].iter().cloned().collect(); } From dc96b473cd2c5e52bdb5f96d210f31d5be453b5b Mon Sep 17 00:00:00 2001 From: jxd1337 Date: Sat, 28 Oct 2023 10:50:39 +0200 Subject: [PATCH 2/7] lang.py PEP8 improvements --- res/lang.py | 102 ++++++++++++++++++++++++++-------------------------- 1 file changed, 52 insertions(+), 50 deletions(-) diff --git a/res/lang.py b/res/lang.py index 74492818a..2ed549fe1 100644 --- a/res/lang.py +++ b/res/lang.py @@ -5,20 +5,22 @@ import glob import sys import csv + def get_lang(lang): - out = {} - for ln in open('./src/lang/%s.rs'%lang, encoding='utf8'): - ln = ln.strip() - if ln.startswith('("'): - k, v = line_split(ln) - out[k] = v - return out + out = {} + for ln in open('./src/lang/%s.rs' % lang, encoding='utf8'): + ln = ln.strip() + if ln.startswith('("'): + k, v = line_split(ln) + out[k] = v + return out + def line_split(line): toks = line.split('", "') if len(toks) != 2: print(line) - assert(0) + assert (0) # Replace fixed position. # Because toks[1] may be v") or v"), k = toks[0][toks[0].find('"') + 1:] @@ -27,62 +29,62 @@ def line_split(line): def main(): - if len(sys.argv) == 1: - expand() - elif sys.argv[1] == '1': - to_csv() - else: - to_rs(sys.argv[1]) + if len(sys.argv) == 1: + expand() + elif sys.argv[1] == '1': + to_csv() + else: + to_rs(sys.argv[1]) def expand(): - for fn in glob.glob('./src/lang/*.rs'): - lang = os.path.basename(fn)[:-3] - if lang in ['en','template']: continue - print(lang) - dict = get_lang(lang) - fw = open("./src/lang/%s.rs"%lang, "wt", encoding='utf8') - for line in open('./src/lang/template.rs', encoding='utf8'): - line_strip = line.strip() - if line_strip.startswith('("'): - k, v = line_split(line_strip) - if k in dict: - # embraced with " to avoid empty v - line = line.replace('"%s"'%v, '"%s"'%dict[k]) - else: - line = line.replace(v, "") - fw.write(line) - else: - fw.write(line) - fw.close() + for fn in glob.glob('./src/lang/*.rs'): + lang = os.path.basename(fn)[:-3] + if lang in ['en', 'template']: continue + print(lang) + dict = get_lang(lang) + fw = open("./src/lang/%s.rs" % lang, "wt", encoding='utf8') + for line in open('./src/lang/template.rs', encoding='utf8'): + line_strip = line.strip() + if line_strip.startswith('("'): + k, v = line_split(line_strip) + if k in dict: + # embraced with " to avoid empty v + line = line.replace('"%s"' % v, '"%s"' % dict[k]) + else: + line = line.replace(v, "") + fw.write(line) + else: + fw.write(line) + fw.close() def to_csv(): - for fn in glob.glob('./src/lang/*.rs'): - lang = os.path.basename(fn)[:-3] - csvfile = open('./src/lang/%s.csv'%lang, "wt", encoding='utf8') - csvwriter = csv.writer(csvfile) - for line in open(fn, encoding='utf8'): - line_strip = line.strip() - if line_strip.startswith('("'): - k, v = line_split(line_strip) - csvwriter.writerow([k, v]) - csvfile.close() + for fn in glob.glob('./src/lang/*.rs'): + lang = os.path.basename(fn)[:-3] + csvfile = open('./src/lang/%s.csv' % lang, "wt", encoding='utf8') + csvwriter = csv.writer(csvfile) + for line in open(fn, encoding='utf8'): + line_strip = line.strip() + if line_strip.startswith('("'): + k, v = line_split(line_strip) + csvwriter.writerow([k, v]) + csvfile.close() def to_rs(lang): - csvfile = open('%s.csv'%lang, "rt", encoding='utf8') - fw = open("./src/lang/%s.rs"%lang, "wt", encoding='utf8') - fw.write('''lazy_static::lazy_static! { + csvfile = open('%s.csv' % lang, "rt", encoding='utf8') + fw = open("./src/lang/%s.rs" % lang, "wt", encoding='utf8') + fw.write('''lazy_static::lazy_static! { pub static ref T: std::collections::HashMap<&'static str, &'static str> = [ ''') - for row in csv.reader(csvfile): - fw.write(' ("%s", "%s"),\n'%(row[0].replace('"', '\"'), row[1].replace('"', '\"'))) - fw.write(''' ].iter().cloned().collect(); + for row in csv.reader(csvfile): + fw.write(' ("%s", "%s"),\n' % (row[0].replace('"', '\"'), row[1].replace('"', '\"'))) + fw.write(''' ].iter().cloned().collect(); } ''') - fw.close() + fw.close() main() From f61fd02ac7378172d4112f23c9c21dcfbdbd67e1 Mon Sep 17 00:00:00 2001 From: jxd1337 Date: Sat, 28 Oct 2023 10:57:50 +0200 Subject: [PATCH 3/7] build.py, generate.py improvements --- build.py | 11 ++++++++--- libs/portable/generate.py | 5 +++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/build.py b/build.py index 42dc8d6de..f65b3a4aa 100755 --- a/build.py +++ b/build.py @@ -24,18 +24,21 @@ else: flutter_build_dir_2 = f'flutter/{flutter_build_dir}' skip_cargo = False + def get_arch() -> str: custom_arch = os.environ.get("ARCH") if custom_arch is None: return "amd64" return custom_arch + def system2(cmd): err = os.system(cmd) if err != 0: print(f"Error occurred when executing: {cmd}. Exiting.") sys.exit(-1) + def get_version(): with open("Cargo.toml", encoding="utf-8") as fh: for line in fh: @@ -196,9 +199,9 @@ def download_extract_features(features, res_dir): for (feat, feat_info) in features.items(): includes = feat_info['include'] if 'include' in feat_info and feat_info['include'] else [] - includes = [ re.compile(p) for p in includes ] + includes = [re.compile(p) for p in includes] excludes = feat_info['exclude'] if 'exclude' in feat_info and feat_info['exclude'] else [] - excludes = [ re.compile(p) for p in excludes ] + excludes = [re.compile(p) for p in excludes] print(f'{feat} download begin') download_filename = feat_info['zip_url'].split('/')[-1] @@ -350,6 +353,7 @@ def build_flutter_deb(version, features): os.rename('rustdesk.deb', '../rustdesk-%s.deb' % version) os.chdir("..") + def build_deb_from_folder(version, binary_folder): os.chdir('flutter') system2('mkdir -p tmpdeb/usr/bin/') @@ -388,6 +392,7 @@ def build_deb_from_folder(version, binary_folder): os.rename('rustdesk.deb', '../rustdesk-%s.deb' % version) os.chdir("..") + def build_flutter_dmg(version, features): if not skip_cargo: # set minimum osx build target, now is 10.14, which is the same as the flutter xcode project @@ -577,7 +582,7 @@ def main(): else: print('Not signed') else: - # buid deb package + # build deb package system2( 'mv target/release/bundle/deb/rustdesk*.deb ./rustdesk.deb') system2('dpkg-deb -R rustdesk.deb tmpdeb') diff --git a/libs/portable/generate.py b/libs/portable/generate.py index 640f2ae6a..61d8c78f7 100644 --- a/libs/portable/generate.py +++ b/libs/portable/generate.py @@ -1,4 +1,3 @@ -from ast import parse import os import optparse from hashlib import md5 @@ -47,7 +46,7 @@ def write_metadata(md5_table: dict, output_folder: str, exe: str): f.write((len(path)).to_bytes(length=length_count, byteorder='big')) f.write(path) # data length & compressed data - f.write((data_length).to_bytes( + f.write(data_length.to_bytes( length=length_count, byteorder='big')) f.write(compressed_data) # md5 code @@ -65,6 +64,8 @@ def build_portable(output_folder: str): # Linux: python3 generate.py -f ../rustdesk-portable-packer/test -o . -e ./test/main.py # Windows: python3 .\generate.py -f ..\rustdesk\flutter\build\windows\runner\Debug\ -o . -e ..\rustdesk\flutter\build\windows\runner\Debug\rustdesk.exe + + if __name__ == '__main__': parser = optparse.OptionParser() parser.add_option("-f", "--folder", dest="folder", From 55412b94d2386f309ccc0cbe351891ba12bbb59f Mon Sep 17 00:00:00 2001 From: jxd1337 Date: Sat, 28 Oct 2023 10:59:33 +0200 Subject: [PATCH 4/7] assert without redundant () --- res/lang.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/lang.py b/res/lang.py index 2ed549fe1..4655d2cbe 100644 --- a/res/lang.py +++ b/res/lang.py @@ -20,7 +20,7 @@ def line_split(line): toks = line.split('", "') if len(toks) != 2: print(line) - assert (0) + assert 0 # Replace fixed position. # Because toks[1] may be v") or v"), k = toks[0][toks[0].find('"') + 1:] From f6ee61f29e17153c8a11e4aeda19e2cc30f21102 Mon Sep 17 00:00:00 2001 From: Mr-Update <37781396+Mr-Update@users.noreply.github.com> Date: Sat, 28 Oct 2023 20:19:17 +0200 Subject: [PATCH 5/7] Update de.rs --- src/lang/de.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lang/de.rs b/src/lang/de.rs index fde9d132c..3fcd2fada 100644 --- a/src/lang/de.rs +++ b/src/lang/de.rs @@ -570,7 +570,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Big tiles", "Große Kacheln"), ("Small tiles", "Kleine Kacheln"), ("List", "Liste"), - ("Virtual display", ""), - ("Plug out all", ""), + ("Virtual display", "Virtueller Bildschirm"), + ("Plug out all", "Alle ausschalten"), ].iter().cloned().collect(); } From f8d64528b5c20a21ce3d84925246e010ba8d40bd Mon Sep 17 00:00:00 2001 From: Andrzej Rudnik Date: Sat, 28 Oct 2023 20:19:50 +0200 Subject: [PATCH 6/7] Update pl.rs --- src/lang/pl.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/lang/pl.rs b/src/lang/pl.rs index 9c4101dfa..fbb04387d 100644 --- a/src/lang/pl.rs +++ b/src/lang/pl.rs @@ -274,7 +274,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Chat", "Czat"), ("Total", "Łącznie"), ("items", "elementów"), - ("Selected", "Zaznaczonych"), + ("Selected", "zaznaczonych"), ("Screen Capture", "Przechwytywanie ekranu"), ("Input Control", "Kontrola wejścia"), ("Audio Capture", "Przechwytywanie dźwięku"), @@ -564,13 +564,13 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("elevated_switch_display_msg", "Przełącz się na ekran główny, ponieważ wyświetlanie kilku ekranów nie jest obsługiwane przy podniesionych uprawnieniach."), ("Open in new window", "Otwórz w nowym oknie"), ("Show displays as individual windows", "Pokaż ekrany w osobnych oknach"), - ("Use all my displays for the remote session", ""), - ("selinux_tip", ""), - ("Change view", ""), - ("Big tiles", ""), - ("Small tiles", ""), - ("List", ""), - ("Virtual display", ""), - ("Plug out all", ""), + ("Use all my displays for the remote session", "Użyj wszystkich moich ekranów do zdalnej sesji"), + ("selinux_tip", "SELinux jest włączony na Twoim urządzeniu, co może przeszkodzić w uruchomieniu RustDesk po stronie kontrolowanej."), + ("Change view", "Zmień widok"), + ("Big tiles", "Duże kafelki"), + ("Small tiles", "Małe kafelki"), + ("List", "Lista"), + ("Virtual display", "Witualne ekrany"), + ("Plug out all", "Odłącz wszystko"), ].iter().cloned().collect(); } From a168fc37190d669403e1dd281fd763972ba53673 Mon Sep 17 00:00:00 2001 From: bovirus <1262554+bovirus@users.noreply.github.com> Date: Sun, 29 Oct 2023 08:57:49 +0100 Subject: [PATCH 7/7] Update Italian language --- src/lang/it.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lang/it.rs b/src/lang/it.rs index 87964f39a..b0a5218aa 100644 --- a/src/lang/it.rs +++ b/src/lang/it.rs @@ -570,7 +570,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Big tiles", "Icone grandi"), ("Small tiles", "Icone piccole"), ("List", "Elenco"), - ("Virtual display", ""), - ("Plug out all", ""), + ("Virtual display", "Scehrmo virtuale"), + ("Plug out all", "Scollega tutto"), ].iter().cloned().collect(); }