From 1df5234eeadcc60c14cc3ca49b004c66f8c7ad2a Mon Sep 17 00:00:00 2001 From: "kerl.d.w" Date: Sun, 26 Sep 2021 09:51:40 +0800 Subject: [PATCH 01/34] Add some optimization options for Chinese developer in README-ZH.md. --- README-ZH.md | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/README-ZH.md b/README-ZH.md index d5d7804a3..5f7119bef 100644 --- a/README-ZH.md +++ b/README-ZH.md @@ -106,14 +106,54 @@ cd rustdesk docker build -t "rustdesk-builder" . ``` +针对国内网络访问问题,可以做以下几点优化: +1. Dockerfile中修改系统的源到国内镜像 + ``` + 在Dockerfile的RUN apt update之前插入两行: + + RUN sed -i "s/deb.debian.org/mirrors.163.com/g" /etc/apt/sources.list + RUN sed -i "s/security.debian.org/mirrors.163.com/g" /etc/apt/sources.list + ``` +2. 修改容器系统中的cargo源,在`RUN ./rustup.sh -y`后插入下面代码: + ``` + RUN echo '[source.crates-io]' > ~/.cargo/config \ + && echo 'registry = "https://github.com/rust-lang/crates.io-index"' >> ~/.cargo/config \ + && echo '# 替换成你偏好的镜像源' >> ~/.cargo/config \ + && echo "replace-with = 'sjtu'" >> ~/.cargo/config \ + && echo '# 上海交通大学' >> ~/.cargo/config \ + && echo '[source.sjtu]' >> ~/.cargo/config \ + && echo 'registry = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index"' >> ~/.cargo/config \ + && echo '' >> ~/.cargo/config + ``` + +2. Dockerfile中加入代理的env + ``` + 在User root后插入两行 + + ENV http_proxy=http://host:port + ENV https_proxy=http://host:port + ``` + +3. docker build命令后面加上proxy参数 + ``` + docker build -t "rustdesk-builder" . --build-arg http_proxy=http://host:port --build-arg https_proxy=http://host:port + ``` + 然后,每次需要构建应用程序时,运行以下命令: ```sh docker run --rm -it -v $PWD:/home/user/rustdesk -v rustdesk-git-cache:/home/user/.cargo/git -v rustdesk-registry-cache:/home/user/.cargo/registry -e PUID="$(id -u)" -e PGID="$(id -g)" rustdesk-builder ``` +运行若遇到无权限问题,出现以下提示: +``` +usermod: user user is currently used by process 1 +groupmod: Permission denied. +groupmod: cannot lock /etc/group; try again later. +``` +可以尝试把`-e PUID="$(id -u)" -e PGID="$(id -g)"`参数去掉。(出现这一问题的原因是容器中的entrypoint脚本中判定uid和gid与给定的环境变量不一致时会修改user的uid和gid重新运行,但是重新运行时取不到环境变量中的uid和gid了,会再次进入uid与gid与给定值不一致的逻辑分支) -请注意,第一次构建可能需要比较长的时间,因为需要缓存依赖项,后续构建会更快。此外,如果您需要为构建命令指定不同的参数, +请注意,第一次构建可能需要比较长的时间,因为需要缓存依赖项(国内网络经常出现拉取失败,可多尝试几次),后续构建会更快。此外,如果您需要为构建命令指定不同的参数, 您可以在命令末尾的 `` 位置执行此操作。例如,如果你想构建一个优化的发布版本,你可以在命令后跟 `---release`。 将在target下产生可执行程序,请通过以下方式运行调试版本: ```sh From 2d5758e880958975cb77464a9863052d81fdab06 Mon Sep 17 00:00:00 2001 From: RustDesk <71636191+rustdesk@users.noreply.github.com> Date: Thu, 30 Sep 2021 12:01:45 +0800 Subject: [PATCH 02/34] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3cb516f83..e84e14b04 100644 --- a/README.md +++ b/README.md @@ -148,4 +148,5 @@ RustDesk does not support Wayland. Check [this](https://docs.fedoraproject.org/e ![image](https://user-images.githubusercontent.com/71636191/113112857-3fbd5d80-923c-11eb-9836-768325faf906.png) -![image](https://user-images.githubusercontent.com/71636191/113112990-65e2fd80-923c-11eb-840e-349b4d6e340d.png) +![image](https://user-images.githubusercontent.com/71636191/135385039-38fdbd72-379a-422d-b97f-33df71fb1cec.png) + From aaba4c144c6d6af775ce5fc4af6fcc005d11d991 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Thu, 30 Sep 2021 12:07:18 +0800 Subject: [PATCH 03/34] fix README --- README-DE.md | 4 ++-- README-ES.md | 4 ++-- README-FR.md | 4 ++-- README-PL.md | 4 ++-- README-ZH.md | 4 ++-- README.md | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README-DE.md b/README-DE.md index 1d932a7fc..f29291a06 100644 --- a/README-DE.md +++ b/README-DE.md @@ -13,7 +13,7 @@ Rede mit uns: [Discord](https://discord.gg/nDceKgxnkV) | [Reddit](https://www.re [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/I2I04VU09) -Das hier ist ein Programm was man nutzen kann, um einen Computer fernzusteuern, es wurde in Rust geschrieben. Es funktioniert ohne Konfiguration oder ähnliches, man kann es einfach direkt nutzen. Es ist eine gute Alternative zu Programmen wie TeamViewer und AnyDesk! Du hast volle Kontrolle über deine Daten und brauchst dir daher auch keine Sorgen um die Sicherheit dieser Daten zu machen. Du kannst unseren rendezvous/relay Server nutzen, [einen eigenen Server eröffnen](https://rustdesk.com/blog/id-relay-set/) oder [einen neuen eigenen Server programmieren](https://github.com/rustdesk/rustdesk-server-demo). +Das hier ist ein Programm was man nutzen kann, um einen Computer fernzusteuern, es wurde in Rust geschrieben. Es funktioniert ohne Konfiguration oder ähnliches, man kann es einfach direkt nutzen. Du hast volle Kontrolle über deine Daten und brauchst dir daher auch keine Sorgen um die Sicherheit dieser Daten zu machen. Du kannst unseren rendezvous/relay Server nutzen, [einen eigenen Server eröffnen](https://rustdesk.com/blog/id-relay-set/) oder [einen neuen eigenen Server programmieren](https://github.com/rustdesk/rustdesk-server-demo). RustDesk heißt jegliche Mitarbeit willkommen. Schau dir [`CONTRIBUTING.md`](CONTRIBUTING.md) an, wenn du Hilfe brauchst für den Start. @@ -148,4 +148,4 @@ RustDesk unterstützt "Wayland" nicht. Siehe [hier](https://docs.fedoraproject.o ![image](https://user-images.githubusercontent.com/71636191/113112857-3fbd5d80-923c-11eb-9836-768325faf906.png) -![image](https://user-images.githubusercontent.com/71636191/113112990-65e2fd80-923c-11eb-840e-349b4d6e340d.png) +![image](https://user-images.githubusercontent.com/71636191/135385039-38fdbd72-379a-422d-b97f-33df71fb1cec.png) diff --git a/README-ES.md b/README-ES.md index 2566b6e71..283675608 100644 --- a/README-ES.md +++ b/README-ES.md @@ -13,7 +13,7 @@ Chat with us: [Discord](https://discord.gg/nDceKgxnkV) | [Reddit](https://www.re [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/I2I04VU09) -Otro software de escritorio remoto, escrito en Rust. Funciona de forma inmediata, sin necesidad de configuración. Gran alternativa a TeamViewer o AnyDesk. Tienes el control total de sus datos, sin preocupaciones sobre la seguridad. Puedes utilizar nuestro servidor de rendezvous/relay, [set up your own](https://rustdesk.com/blog/id-relay-set/), o [escribir tu propio servidor rendezvous/relay](https://github.com/rustdesk/rustdesk-server-demo). +Otro software de escritorio remoto, escrito en Rust. Funciona de forma inmediata, sin necesidad de configuración. Tienes el control total de sus datos, sin preocupaciones sobre la seguridad. Puedes utilizar nuestro servidor de rendezvous/relay, [set up your own](https://rustdesk.com/blog/id-relay-set/), o [escribir tu propio servidor rendezvous/relay](https://github.com/rustdesk/rustdesk-server-demo). RustDesk agradece la contribución de todo el mundo. Ve [`CONTRIBUTING.md`](CONTRIBUTING.md) para ayuda inicial. @@ -145,4 +145,4 @@ RustDesk no soporta Wayland. Comprueba [aquí](https://docs.fedoraproject.org/en ![image](https://user-images.githubusercontent.com/71636191/113112857-3fbd5d80-923c-11eb-9836-768325faf906.png) -![image](https://user-images.githubusercontent.com/71636191/113112990-65e2fd80-923c-11eb-840e-349b4d6e340d.png) +![image](https://user-images.githubusercontent.com/71636191/135385039-38fdbd72-379a-422d-b97f-33df71fb1cec.png) diff --git a/README-FR.md b/README-FR.md index 736143965..df275d4b1 100644 --- a/README-FR.md +++ b/README-FR.md @@ -13,7 +13,7 @@ Chattez avec nous : [Discord](https://discord.gg/nDceKgxnkV) | [Reddit](https:// [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/I2I04VU09) -Encore un autre logiciel de bureau à distance, écrit en Rust. Fonctionne directement, aucune configuration n'est nécessaire. Une excellente alternative à TeamViewer et AnyDesk ! Vous avez le contrôle total de vos données, sans aucun souci de sécurité. Vous pouvez utiliser notre serveur de rendez-vous/relais, [configurer le vôtre](https://rustdesk.com/blog/id-relay-set/), ou [écrire votre propre serveur de rendez-vous/relais](https://github.com/rustdesk/rustdesk-server-demo). +Encore un autre logiciel de bureau à distance, écrit en Rust. Fonctionne directement, aucune configuration n'est nécessaire. Vous avez le contrôle total de vos données, sans aucun souci de sécurité. Vous pouvez utiliser notre serveur de rendez-vous/relais, [configurer le vôtre](https://rustdesk.com/blog/id-relay-set/), ou [écrire votre propre serveur de rendez-vous/relais](https://github.com/rustdesk/rustdesk-server-demo). RustDesk accueille les contributions de tout le monde. Voir [`CONTRIBUTING.md`](CONTRIBUTING.md) pour plus d'informations. @@ -145,4 +145,4 @@ RustDesk ne supporte pas Wayland. Lisez [cela](https://docs.fedoraproject.org/en ![image](https://user-images.githubusercontent.com/71636191/113112857-3fbd5d80-923c-11eb-9836-768325faf906.png) -![image](https://user-images.githubusercontent.com/71636191/113112990-65e2fd80-923c-11eb-840e-349b4d6e340d.png) +![image](https://user-images.githubusercontent.com/71636191/135385039-38fdbd72-379a-422d-b97f-33df71fb1cec.png) diff --git a/README-PL.md b/README-PL.md index cb71dafdd..3c33e13f2 100644 --- a/README-PL.md +++ b/README-PL.md @@ -13,7 +13,7 @@ Porozmawiaj z nami na: [Discord](https://discord.gg/nDceKgxnkV) | [Reddit](https [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/I2I04VU09) -Kolejny program do zdalnego pulpitu, napisany w Rust. Działa od samego początku, nie wymaga konfiguracji. Świetna alternatywa dla TeamViewera i AnyDesk! Masz pełną kontrolę nad swoimi danymi, bez obaw o bezpieczeństwo. Możesz skorzystać z naszego darmowego serwera publicznego , [skonfigurować własny](https://rustdesk.com/blog/id-relay-set/), lub [napisać własny serwer rendezvous/relay server](https://github.com/rustdesk/rustdesk-server-demo). +Kolejny program do zdalnego pulpitu, napisany w Rust. Działa od samego początku, nie wymaga konfiguracji. Masz pełną kontrolę nad swoimi danymi, bez obaw o bezpieczeństwo. Możesz skorzystać z naszego darmowego serwera publicznego , [skonfigurować własny](https://rustdesk.com/blog/id-relay-set/), lub [napisać własny serwer rendezvous/relay server](https://github.com/rustdesk/rustdesk-server-demo). RustDesk zaprasza do współpracy każdego. Zobacz [`CONTRIBUTING.md`](CONTRIBUTING.md) pomoc w uruchomieniu programu. @@ -149,4 +149,4 @@ RustDesk nie obsługuje Waylanda. Sprawdź [this](https://docs.fedoraproject.org ![image](https://user-images.githubusercontent.com/71636191/113112857-3fbd5d80-923c-11eb-9836-768325faf906.png) -![image](https://user-images.githubusercontent.com/71636191/113112990-65e2fd80-923c-11eb-840e-349b4d6e340d.png) +![image](https://user-images.githubusercontent.com/71636191/135385039-38fdbd72-379a-422d-b97f-33df71fb1cec.png) diff --git a/README-ZH.md b/README-ZH.md index 5f7119bef..d0b95e1dd 100644 --- a/README-ZH.md +++ b/README-ZH.md @@ -12,7 +12,7 @@ Chat with us: [知乎](https://www.zhihu.com/people/rustdesk) | [Discord](https: [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/I2I04VU09) -远程桌面软件,开箱即用,无需任何配置,替代TeamViewer和AnyDesk。您完全掌控数据,不用担心安全问题。您可以使用我们的注册/中继服务器, +远程桌面软件,开箱即用,无需任何配置。您完全掌控数据,不用担心安全问题。您可以使用我们的注册/中继服务器, 或者[自己设置](https://rustdesk.com/blog/id-relay-set/), 亦或者[开发您的版本](https://github.com/rustdesk/rustdesk-server-demo)。 @@ -191,4 +191,4 @@ RustDesk暂时不支持Wayland,不过正在积极开发中. ![image](https://user-images.githubusercontent.com/71636191/113112857-3fbd5d80-923c-11eb-9836-768325faf906.png) -![image](https://user-images.githubusercontent.com/71636191/113112990-65e2fd80-923c-11eb-840e-349b4d6e340d.png) +![image](https://user-images.githubusercontent.com/71636191/135385039-38fdbd72-379a-422d-b97f-33df71fb1cec.png) diff --git a/README.md b/README.md index e84e14b04..242a2a023 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Chat with us: [Discord](https://discord.gg/nDceKgxnkV) | [Reddit](https://www.re [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/I2I04VU09) -Yet another remote desktop software, written in Rust. Works out of the box, no configuration required. Great alternative to TeamViewer and AnyDesk! You have full control of your data, with no concerns about security. You can use our rendezvous/relay server, [set up your own](https://rustdesk.com/blog/id-relay-set/), or [write your own rendezvous/relay server](https://github.com/rustdesk/rustdesk-server-demo). +Yet another remote desktop software, written in Rust. Works out of the box, no configuration required. You have full control of your data, with no concerns about security. You can use our rendezvous/relay server, [set up your own](https://rustdesk.com/blog/id-relay-set/), or [write your own rendezvous/relay server](https://github.com/rustdesk/rustdesk-server-demo). RustDesk welcomes contribution from everyone. See [`CONTRIBUTING.md`](CONTRIBUTING.md) for help getting started. From 66cdbbacd0d9977c9d7a2b96b6e6ca3fe8ff4216 Mon Sep 17 00:00:00 2001 From: Arash Hatami Date: Fri, 1 Oct 2021 12:10:53 +0330 Subject: [PATCH 04/34] Update README.md - Remove extra space after `git clone` command - Add `VCPKG_ROOT` env before `cargo run` command --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 242a2a023..88c8a85c4 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-c ### Install vcpkg ```sh -git clone https://github.com/microsoft/vcpkg +git clone https://github.com/microsoft/vcpkg cd vcpkg git checkout 134505003bb46e20fbace51ccfb69243fbbc5f82 cd .. @@ -94,7 +94,7 @@ cd rustdesk mkdir -p target/debug wget https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.lnx/x64/libsciter-gtk.so mv libsciter-gtk.so target/debug -cargo run +VCPKG_ROOT=$HOME/vcpkg cargo run ``` ## How to build with Docker From 18b1646cd4871e3aa36627ad9aad29555f09627a Mon Sep 17 00:00:00 2001 From: Arash Hatami Date: Fri, 1 Oct 2021 12:28:08 +0330 Subject: [PATCH 05/34] Fix Markdown syntax in all MD files --- CONTRIBUTING.md | 7 +-- README-DE.md | 35 ++++++++++----- README-ES.md | 62 ++++++++++++++----------- README-FR.md | 32 ++++++++----- README-PL.md | 39 +++++++++------- README-ZH.md | 117 ++++++++++++++++++++++++++++-------------------- README.md | 37 +++++++++------ SECURITY.md | 10 ++--- 8 files changed, 204 insertions(+), 135 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7f9b34394..b7265a257 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,7 +3,6 @@ RustDesk welcomes contribution from everyone. Here are the guidelines if you are thinking of helping us: - ## Contributions Contributions to RustDesk or its dependencies should be made in the form of GitHub @@ -23,7 +22,7 @@ efforts from contributors on the same issue. master you may be asked to rebase your changes. - Commits should be as small as possible, while ensuring that each commit is - correct independently (i.e., each commit should compile and pass tests). + correct independently (i.e., each commit should compile and pass tests). - Commits should be accompanied by a Developer Certificate of Origin (http://developercertificate.org) sign-off, which indicates that you (and @@ -40,10 +39,8 @@ For specific git instructions, see [GitHub workflow 101](https://github.com/serv ## Conduct -We follow the [Rust Code of Conduct](https://www.rust-lang.org/policies/code-of-conduct). - +We follow the [Rust Code of Conduct](https://www.rust-lang.org/policies/code-of-conduct). ## Communication RustDesk contributors frequent the [Discord](https://discord.gg/nDceKgxnkV). - diff --git a/README-DE.md b/README-DE.md index f29291a06..95d908023 100644 --- a/README-DE.md +++ b/README-DE.md @@ -20,52 +20,58 @@ RustDesk heißt jegliche Mitarbeit willkommen. Schau dir [`CONTRIBUTING.md`](CON [**PROGRAMM DOWNLOAD**](https://github.com/rustdesk/rustdesk/releases) ## Kostenlose öffentliche Server + Hier sind die Server die du kostenlos nutzen kannst, es kann sein das sich diese Liste immer mal wieder ändert. Falls du nicht in der Nähe einer dieser Server bist, kann es sein, dass deine Verbindung langsam sein wird. -| Standort | Serverart | Spezifikationen | Kommentare | -| --------- | ------------- | ------------------ | ---------------------------------------- | -| Seoul | AWS lightsail | 1 VCPU / 0.5GB RAM | | -| Singapore | Vultr | 1 VCPU / 1GB RAM | | -| Dallas | Vultr | 1 VCPU / 1GB RAM | | +| Standort | Serverart | Spezifikationen | Kommentare | +| --------- | ------------- | ------------------ | ---------- | +| Seoul | AWS lightsail | 1 VCPU / 0.5GB RAM | | +| Singapore | Vultr | 1 VCPU / 1GB RAM | | +| Dallas | Vultr | 1 VCPU / 1GB RAM | | ## Abhängigkeiten Die Desktop Versionen nutzen [Sciter](https://sciter.com/) für die Oberfläche, bitte lade die dynamische Sciter Bibliothek selbst herunter. -[Windows](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.win/x64/sciter.dll) | +[Windows](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.win/x64/sciter.dll) | [Linux](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.lnx/x64/libsciter-gtk.so) | [MacOS](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.osx/libsciter.dylib) ## Die groben Schritte zum Kompilieren -* Bereite deine Rust Entwicklungsumgebung und C++ Entwicklungsumgebung vor -* Installiere [vcpkg](https://github.com/microsoft/vcpkg) und füge die `VCPKG_ROOT` Systemumgebungsvariable hinzu +- Bereite deine Rust Entwicklungsumgebung und C++ Entwicklungsumgebung vor - - Windows: `vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static` - - Linux/MacOS: `vcpkg install libvpx libyuv opus` +- Installiere [vcpkg](https://github.com/microsoft/vcpkg) und füge die `VCPKG_ROOT` Systemumgebungsvariable hinzu -* Nutze `cargo run` + - Windows: `vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static` + - Linux/MacOS: `vcpkg install libvpx libyuv opus` + +- Nutze `cargo run` ## Kompilieren auf Linux ### Ubuntu 18 (Debian 10) + ```sh sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake ``` ### Fedora 28 (CentOS 8) + ```sh sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb-devel libxdo-devel libXfixes-devel pulseaudio-libs-devel cmake alsa-lib-devel ``` ### Arch (Manjaro) + ```sh sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio ``` ### vcpkg installieren + ```sh -git clone https://github.com/microsoft/vcpkg +git clone https://github.com/microsoft/vcpkg cd vcpkg git checkout 134505003bb46e20fbace51ccfb69243fbbc5f82 cd .. @@ -75,6 +81,7 @@ vcpkg/vcpkg install libvpx libyuv opus ``` ### libvpx reparieren (Für Fedora) + ```sh cd vcpkg/buildtrees/libvpx/src cd * @@ -87,6 +94,7 @@ cd ``` ### Kompilieren + ```sh curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source $HOME/.cargo/env @@ -109,6 +117,7 @@ docker build -t "rustdesk-builder" . ``` Jedes Mal, wenn du das Programm Kompilieren musst, nutze diesen Befehl: + ```sh docker run --rm -it -v $PWD:/home/user/rustdesk -v rustdesk-git-cache:/home/user/.cargo/git -v rustdesk-registry-cache:/home/user/.cargo/registry -e PUID="$(id -u)" -e PGID="$(id -g)" rustdesk-builder ``` @@ -128,6 +137,7 @@ target/release/rustdesk Bitte gehe sicher, dass du diese Befehle vom Stammverzeichnis vom RustDesk Repository nutzt, sonst kann es passieren, dass das Programm die Ressourcen nicht finden kann. Bitte bedenke auch, dass Unterbefehle von Cargo, wie z.B. `install` oder `run` aktuell noch nicht unterstützt werden, da sie das Programm innerhalb des Containers starten oder installieren würden, anstatt auf deinem eigentlichen System. ### Ändere Wayland zu X11 (Xorg) + RustDesk unterstützt "Wayland" nicht. Siehe [hier](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/) um Xorg als Standard GNOME Session zu nutzen. ## Dateistruktur @@ -142,6 +152,7 @@ RustDesk unterstützt "Wayland" nicht. Siehe [hier](https://docs.fedoraproject.o - **[src/platform](https://github.com/rustdesk/rustdesk/tree/master/src/platform)**: Plattformspezifischer Code ## Screenshots + ![image](https://user-images.githubusercontent.com/71636191/113112362-ae4deb80-923b-11eb-957d-ff88daad4f06.png) ![image](https://user-images.githubusercontent.com/71636191/113112619-f705a480-923b-11eb-911d-97e984ef52b6.png) diff --git a/README-ES.md b/README-ES.md index 283675608..79d880287 100644 --- a/README-ES.md +++ b/README-ES.md @@ -13,77 +13,86 @@ Chat with us: [Discord](https://discord.gg/nDceKgxnkV) | [Reddit](https://www.re [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/I2I04VU09) -Otro software de escritorio remoto, escrito en Rust. Funciona de forma inmediata, sin necesidad de configuración. Tienes el control total de sus datos, sin preocupaciones sobre la seguridad. Puedes utilizar nuestro servidor de rendezvous/relay, [set up your own](https://rustdesk.com/blog/id-relay-set/), o [escribir tu propio servidor rendezvous/relay](https://github.com/rustdesk/rustdesk-server-demo). +Otro software de escritorio remoto, escrito en Rust. Funciona de forma inmediata, sin necesidad de configuración. Tienes el control total de sus datos, sin preocupaciones sobre la seguridad. Puedes utilizar nuestro servidor de rendezvous/relay, [set up your own](https://rustdesk.com/blog/id-relay-set/), o [escribir tu propio servidor rendezvous/relay](https://github.com/rustdesk/rustdesk-server-demo). -RustDesk agradece la contribución de todo el mundo. Ve [`CONTRIBUTING.md`](CONTRIBUTING.md) para ayuda inicial. +RustDesk agradece la contribución de todo el mundo. Ve [`CONTRIBUTING.md`](CONTRIBUTING.md) para ayuda inicial. [**DESCARGA DE BINARIOS**](https://github.com/rustdesk/rustdesk/releases) ## Servidores gratis de uso público + A continuación se muestran los servidores que está utilizando de forma gratuita, puede cambiar en algún momento. Si no estás cerca de uno de ellos, tu red puede ser lenta. + - Seoul, AWS lightsail, 1 VCPU/0.5G RAM - Singapore, Vultr, 1 VCPU/1G RAM - Dallas, Vultr, 1 VCPU/1G RAM ## Dependencies -La versión Desktop usa [sciter](https://sciter.com/) para GUI, por favor bajate la librería sciter tu mismo.. +La versión Desktop usa [sciter](https://sciter.com/) para GUI, por favor bajate la librería sciter tu mismo.. -[Windows](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.win/x64/sciter.dll) | +[Windows](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.win/x64/sciter.dll) | [Linux](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.lnx/x64/libsciter-gtk.so) | [macOS](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.osx/libsciter.dylib) ## Pasos para compilar desde el inicio -* Prepara el entono de desarrollode Rust y el entorno de compilación de C++ y Rust. -* Instala [vcpkg](https://github.com/microsoft/vcpkg), y configura la variable de entono `VCPKG_ROOT` correctamente. +- Prepara el entono de desarrollode Rust y el entorno de compilación de C++ y Rust. - - Windows: vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static - - Linux/Osx: vcpkg install libvpx libyuv opus - -* run `cargo run` +- Instala [vcpkg](https://github.com/microsoft/vcpkg), y configura la variable de entono `VCPKG_ROOT` correctamente. + + - Windows: vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static + - Linux/Osx: vcpkg install libvpx libyuv opus + +- run `cargo run` ## Como compilar en linux ### Ubuntu 18 (Debian 10) + ```sh sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake ``` ### Fedora 28 (CentOS 8) + ```sh sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb-devel libxdo-devel libXfixes-devel pulseaudio-libs-devel cmake alsa-lib-devel ``` ### Arch (Manjaro) + ```sh sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio ``` ### Install vcpkg + ```sh -git clone https://github.com/microsoft/vcpkg -cd vcpkg +git clone https://github.com/microsoft/vcpkg +cd vcpkg git checkout 134505003bb46e20fbace51ccfb69243fbbc5f82 -cd .. +cd .. vcpkg/bootstrap-vcpkg.sh export VCPKG_ROOT=$HOME/vcpkg vcpkg/vcpkg install libvpx libyuv opus ``` - -### Soluciona libvpx (For Fedora) -```sh -cd vcpkg/buildtrees/libvpx/src -cd * -./configure -sed -i 's/CFLAGS+=-I/CFLAGS+=-fPIC -I/g' Makefile -sed -i 's/CXXFLAGS+=-I/CXXFLAGS+=-fPIC -I/g' Makefile -make -cp libvpx.a $HOME/vcpkg/installed/x64-linux/lib/ -cd -``` + +### Soluciona libvpx (For Fedora) + +```sh +cd vcpkg/buildtrees/libvpx/src +cd * +./configure +sed -i 's/CFLAGS+=-I/CFLAGS+=-fPIC -I/g' Makefile +sed -i 's/CXXFLAGS+=-I/CXXFLAGS+=-fPIC -I/g' Makefile +make +cp libvpx.a $HOME/vcpkg/installed/x64-linux/lib/ +cd +``` ### Compila + ```sh curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source $HOME/.cargo/env @@ -104,6 +113,7 @@ git clone https://github.com/rustdesk/rustdesk cd rustdesk docker build -t "rustdesk-builder" . ``` + Entonces, cada vez que necesites compilar una modificación, ejecuta el siguiente comando: ```sh @@ -125,6 +135,7 @@ target/release/rustdesk Por favor, asegurate de que estás ejecutando estos comandos desde la raíz del repositorio de RustDesk, de lo contrario la aplicación puede ser incapaz de encontrar los recursos necesarios. También hay que tener en cuenta que otros subcomandos de carga como `install` o `run` no estan actualmente soportados via este metodo y podrían requerir ser instalados dentro del contenedor y no en el host. ### Cambia Wayland a X11 (Xorg) + RustDesk no soporta Wayland. Comprueba [aquí](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/) para configurar Xorg en la sesión por defecto de GNOME. ## Estructura de archivos @@ -139,6 +150,7 @@ RustDesk no soporta Wayland. Comprueba [aquí](https://docs.fedoraproject.org/en - **[src/platform](https://github.com/rustdesk/rustdesk/tree/master/src/platform)**: código específico de cada plataforma ## Captura de pantalla + ![image](https://user-images.githubusercontent.com/71636191/113112362-ae4deb80-923b-11eb-957d-ff88daad4f06.png) ![image](https://user-images.githubusercontent.com/71636191/113112619-f705a480-923b-11eb-911d-97e984ef52b6.png) diff --git a/README-FR.md b/README-FR.md index df275d4b1..453309504 100644 --- a/README-FR.md +++ b/README-FR.md @@ -13,14 +13,16 @@ Chattez avec nous : [Discord](https://discord.gg/nDceKgxnkV) | [Reddit](https:// [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/I2I04VU09) -Encore un autre logiciel de bureau à distance, écrit en Rust. Fonctionne directement, aucune configuration n'est nécessaire. Vous avez le contrôle total de vos données, sans aucun souci de sécurité. Vous pouvez utiliser notre serveur de rendez-vous/relais, [configurer le vôtre](https://rustdesk.com/blog/id-relay-set/), ou [écrire votre propre serveur de rendez-vous/relais](https://github.com/rustdesk/rustdesk-server-demo). +Encore un autre logiciel de bureau à distance, écrit en Rust. Fonctionne directement, aucune configuration n'est nécessaire. Vous avez le contrôle total de vos données, sans aucun souci de sécurité. Vous pouvez utiliser notre serveur de rendez-vous/relais, [configurer le vôtre](https://rustdesk.com/blog/id-relay-set/), ou [écrire votre propre serveur de rendez-vous/relais](https://github.com/rustdesk/rustdesk-server-demo). -RustDesk accueille les contributions de tout le monde. Voir [`CONTRIBUTING.md`](CONTRIBUTING.md) pour plus d'informations. +RustDesk accueille les contributions de tout le monde. Voir [`CONTRIBUTING.md`](CONTRIBUTING.md) pour plus d'informations. [**TÉLÉCHARGEMENT BINAIRE**](https://github.com/rustdesk/rustdesk/releases) ## Serveurs publics libres + Ci-dessous se trouvent les serveurs que vous utilisez gratuitement, cela peut changer au fil du temps. Si vous n'êtes pas proche de l'un d'entre eux, votre réseau peut être lent. + - Séoul, AWS lightsail, 1 VCPU/0.5G RAM - Singapour, Vultr, 1 VCPU/1G RAM - Dallas, Vultr, 1 VCPU/1G RAM @@ -29,40 +31,45 @@ Ci-dessous se trouvent les serveurs que vous utilisez gratuitement, cela peut ch Les versions de bureau utilisent [sciter](https://sciter.com/) pour l'interface graphique, veuillez télécharger la bibliothèque dynamique sciter vous-même. -[Windows](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.win/x64/sciter.dll) | +[Windows](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.win/x64/sciter.dll) | [Linux](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.lnx/x64/libsciter-gtk.so) [macOS](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.osx/libsciter.dylib) ## Étapes brutes de la compilation/build -* Préparez votre environnement de développement Rust et votre environnement de compilation C++. -* Installez [vcpkg](https://github.com/microsoft/vcpkg), et définissez correctement la variable d'environnement `VCPKG_ROOT`. +- Préparez votre environnement de développement Rust et votre environnement de compilation C++. - - Windows : vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static - - Linux/Osx : vcpkg install libvpx libyuv opus - -* Exécuter `cargo run` +- Installez [vcpkg](https://github.com/microsoft/vcpkg), et définissez correctement la variable d'environnement `VCPKG_ROOT`. + + - Windows : vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static + - Linux/Osx : vcpkg install libvpx libyuv opus + +- Exécuter `cargo run` ## Comment compiler/build sous Linux ### Ubuntu 18 (Debian 10) + ```sh sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake ``` ### Fedora 28 (CentOS 8) + ```sh sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb-devel libxdo-devel libXfixes-devel pulseaudio-libs-devel cmake alsa-lib-devel ``` ### Arch (Manjaro) + ```sh sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio ``` ### Installer vcpkg + ```sh -git clone https://github.com/microsoft/vcpkg +git clone https://github.com/microsoft/vcpkg cd vcpkg git checkout 134505003bb46e20fbace51ccfb69243fbbc5f82 cd .. @@ -72,6 +79,7 @@ vcpkg/vcpkg install libvpx libyuv opus ``` ### Corriger libvpx (Pour Fedora) + ```sh cd vcpkg/buildtrees/libvpx/src cd * @@ -84,6 +92,7 @@ cd ``` ### Construire + ```sh curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source $HOME/.cargo/env @@ -116,6 +125,7 @@ Notez que le premier build peut prendre plus de temps avant que les dépendances ```sh target/debug/rustdesk ``` + Ou, si vous exécutez un exécutable provenant d'une release : ```sh @@ -125,6 +135,7 @@ target/release/rustdesk Veuillez vous assurer que vous exécutez ces commandes à partir de la racine du référentiel RustDesk, sinon l'application ne pourra pas trouver les ressources requises. Notez également que les autres sous-commandes de cargo telles que `install` ou `run` ne sont pas actuellement supportées par cette méthode car elles installeraient ou exécuteraient le programme à l'intérieur du conteneur au lieu de l'hôte. ### Changer Wayland en X11 (Xorg) + RustDesk ne supporte pas Wayland. Lisez [cela](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/) pour configurer Xorg comme la session GNOME par défaut. ## Structure du projet @@ -139,6 +150,7 @@ RustDesk ne supporte pas Wayland. Lisez [cela](https://docs.fedoraproject.org/en - **[src/platform](https://github.com/rustdesk/rustdesk/tree/master/src/platform)** : code spécifique à la plateforme ## Images + ![image](https://user-images.githubusercontent.com/71636191/113112362-ae4deb80-923b-11eb-957d-ff88daad4f06.png) ![image](https://user-images.githubusercontent.com/71636191/113112619-f705a480-923b-11eb-911d-97e984ef52b6.png) diff --git a/README-PL.md b/README-PL.md index 3c33e13f2..793a1f2fb 100644 --- a/README-PL.md +++ b/README-PL.md @@ -13,58 +13,64 @@ Porozmawiaj z nami na: [Discord](https://discord.gg/nDceKgxnkV) | [Reddit](https [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/I2I04VU09) -Kolejny program do zdalnego pulpitu, napisany w Rust. Działa od samego początku, nie wymaga konfiguracji. Masz pełną kontrolę nad swoimi danymi, bez obaw o bezpieczeństwo. Możesz skorzystać z naszego darmowego serwera publicznego , [skonfigurować własny](https://rustdesk.com/blog/id-relay-set/), lub [napisać własny serwer rendezvous/relay server](https://github.com/rustdesk/rustdesk-server-demo). +Kolejny program do zdalnego pulpitu, napisany w Rust. Działa od samego początku, nie wymaga konfiguracji. Masz pełną kontrolę nad swoimi danymi, bez obaw o bezpieczeństwo. Możesz skorzystać z naszego darmowego serwera publicznego , [skonfigurować własny](https://rustdesk.com/blog/id-relay-set/), lub [napisać własny serwer rendezvous/relay server](https://github.com/rustdesk/rustdesk-server-demo). -RustDesk zaprasza do współpracy każdego. Zobacz [`CONTRIBUTING.md`](CONTRIBUTING.md) pomoc w uruchomieniu programu. +RustDesk zaprasza do współpracy każdego. Zobacz [`CONTRIBUTING.md`](CONTRIBUTING.md) pomoc w uruchomieniu programu. [**POBIERZ KOMPILACJE**](https://github.com/rustdesk/rustdesk/releases) ## Darmowe Serwery Publiczne + Poniżej znajdują się serwery, z których można korzystać za darmo, może się to zmienić z upływem czasu. Jeśli nie znajdujesz się w pobliżu jednego z nich, Twoja prędkość połączenia może być niska. -| Lokalizacja | Dostawca | Specyfikacja | +| Lokalizacja | Dostawca | Specyfikacja | | --------- | ------------- | ------------------ | -| Seul | AWS lightsail | 1 VCPU / 0.5GB RAM | -| Singapur | Vultr | 1 VCPU / 1GB RAM | -| Dallas | Vultr | 1 VCPU / 1GB RAM | | +| Seul | AWS lightsail | 1 VCPU / 0.5GB RAM | +| Singapur | Vultr | 1 VCPU / 1GB RAM | +| Dallas | Vultr | 1 VCPU / 1GB RAM | | ## Zależności Wersje desktopowe używają [sciter](https://sciter.com/) dla GUI, proszę pobrać bibliotekę dynamiczną sciter samodzielnie. -[Windows](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.win/x64/sciter.dll) | +[Windows](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.win/x64/sciter.dll) | [Linux](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.lnx/x64/libsciter-gtk.so) | [MacOS](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.osx/libsciter.dylib) ## Podstawowe kroki do kompilacji. -* Przygotuj środowisko programistyczne Rust i środowisko programowania C++ -* Zainstaluj [vcpkg](https://github.com/microsoft/vcpkg), i ustaw `VCPKG_ROOT` env zmienną prawidłowo +- Przygotuj środowisko programistyczne Rust i środowisko programowania C++ - - Windows: vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static - - Linux/MacOS: vcpkg install libvpx libyuv opus - -* uruchom `cargo run` +- Zainstaluj [vcpkg](https://github.com/microsoft/vcpkg), i ustaw `VCPKG_ROOT` env zmienną prawidłowo + + - Windows: vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static + - Linux/MacOS: vcpkg install libvpx libyuv opus + +- uruchom `cargo run` ## Jak Kompilować na Linuxie ### Ubuntu 18 (Debian 10) + ```sh sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake ``` ### Fedora 28 (CentOS 8) + ```sh sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb-devel libxdo-devel libXfixes-devel pulseaudio-libs-devel cmake alsa-lib-devel ``` ### Arch (Manjaro) + ```sh sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio ``` ### Zainstaluj vcpkg + ```sh -git clone https://github.com/microsoft/vcpkg +git clone https://github.com/microsoft/vcpkg cd vcpkg git checkout 134505003bb46e20fbace51ccfb69243fbbc5f82 cd .. @@ -74,6 +80,7 @@ vcpkg/vcpkg install libvpx libyuv opus ``` ### Fix libvpx (For Fedora) + ```sh cd vcpkg/buildtrees/libvpx/src cd * @@ -86,6 +93,7 @@ cd ``` ### Kompilacja + ```sh curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source $HOME/.cargo/env @@ -115,7 +123,6 @@ docker run --rm -it -v $PWD:/home/user/rustdesk -v rustdesk-git-cache:/home/user Zauważ, że pierwsza kompilacja może potrwać dłużej zanim zależności zostaną zbuforowane, kolejne będą szybsze. Dodatkowo, jeśli potrzebujesz określić inne argumenty dla polecenia budowania, możesz to zrobić na końcu komendy w miejscu ``. Na przykład, jeśli chciałbyś zbudować zoptymalizowaną wersję wydania, uruchomiłbyś powyższą komendę a następnie `---release`. Powstały plik wykonywalny będzie dostępny w folderze docelowym w twoim systemie, i może być uruchomiony z: - ```sh target/debug/rustdesk ``` @@ -129,6 +136,7 @@ target/release/rustdesk Upewnij się, że uruchamiasz te polecenia z katalogu głównego repozytorium RustDesk, w przeciwnym razie aplikacja może nie być w stanie znaleźć wymaganych zasobów. Należy również pamiętać, że inne podpolecenia ładowania, takie jak `install` lub `run` nie są obecnie obsługiwane za pomocą tej metody, ponieważ instalowałyby lub uruchamiały program wewnątrz kontenera zamiast na hoście. ### Zmień Wayland na X11 (Xorg) + RustDesk nie obsługuje Waylanda. Sprawdź [this](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/) by skonfigurować Xorg jako domyślną sesję GNOME. ## Struktura plików @@ -143,6 +151,7 @@ RustDesk nie obsługuje Waylanda. Sprawdź [this](https://docs.fedoraproject.org - **[src/platform](https://github.com/rustdesk/rustdesk/tree/master/src/platform)**: specyficzny dla danej platformy kod ## Migawki(Snapshoty) + ![image](https://user-images.githubusercontent.com/71636191/113112362-ae4deb80-923b-11eb-957d-ff88daad4f06.png) ![image](https://user-images.githubusercontent.com/71636191/113112619-f705a480-923b-11eb-911d-97e984ef52b6.png) diff --git a/README-ZH.md b/README-ZH.md index d0b95e1dd..9382683b2 100644 --- a/README-ZH.md +++ b/README-ZH.md @@ -16,12 +16,14 @@ Chat with us: [知乎](https://www.zhihu.com/people/rustdesk) | [Discord](https: 或者[自己设置](https://rustdesk.com/blog/id-relay-set/), 亦或者[开发您的版本](https://github.com/rustdesk/rustdesk-server-demo)。 -欢迎大家贡献代码, 请看 [`CONTRIBUTING.md`](CONTRIBUTING.md). +欢迎大家贡献代码, 请看 [`CONTRIBUTING.md`](CONTRIBUTING.md). [**可执行程序下载**](https://github.com/rustdesk/rustdesk/releases) ## 免费公共服务器 + 以下是您免费使用的服务器,它可能会随着时间的推移而变化。如果您不靠近其中之一,您的网络可能会很慢。 + - 首尔, AWS lightsail, 1 VCPU/0.5G RAM - 新加坡, Vultr, 1 VCPU/1G RAM - 达拉斯, Vultr, 1 VCPU/1G RAM @@ -30,40 +32,45 @@ Chat with us: [知乎](https://www.zhihu.com/people/rustdesk) | [Discord](https: 桌面版本界面使用[sciter](https://sciter.com/), 请自行下载。 -[Windows](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.win/x64/sciter.dll) | +[Windows](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.win/x64/sciter.dll) | [Linux](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.lnx/x64/libsciter-gtk.so) | [macOS](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.osx/libsciter.dylib) ## 基本构建步骤 -* 请准备好Rust开发环境和C++编译环境 -* 安装[vcpkg](https://github.com/microsoft/vcpkg), 正确设置`VCPKG_ROOT`环境变量 +- 请准备好 Rust 开发环境和 C++编译环境 - - Windows: vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static - - Linux/Osx: vcpkg install libvpx libyuv opus - -* 运行 `cargo run` +- 安装[vcpkg](https://github.com/microsoft/vcpkg), 正确设置`VCPKG_ROOT`环境变量 -## 在Linux上编译 + - Windows: vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static + - Linux/Osx: vcpkg install libvpx libyuv opus + +- 运行 `cargo run` + +## 在 Linux 上编译 ### Ubuntu 18 (Debian 10) + ```sh sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake ``` ### Fedora 28 (CentOS 8) + ```sh sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb-devel libxdo-devel libXfixes-devel pulseaudio-libs-devel cmake alsa-lib-devel ``` ### Arch (Manjaro) + ```sh sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio ``` -### 安装vcpkg +### 安装 vcpkg + ```sh -git clone https://github.com/microsoft/vcpkg +git clone https://github.com/microsoft/vcpkg cd vcpkg git checkout 134505003bb46e20fbace51ccfb69243fbbc5f82 cd .. @@ -72,7 +79,8 @@ export VCPKG_ROOT=$HOME/vcpkg vcpkg/vcpkg install libvpx libyuv opus ``` -### 修复libvpx (仅仅针对Fedora) +### 修复 libvpx (仅仅针对 Fedora) + ```sh cd vcpkg/buildtrees/libvpx/src cd * @@ -85,6 +93,7 @@ cd ``` ### 构建 + ```sh curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source $HOME/.cargo/env @@ -96,7 +105,7 @@ mv libsciter-gtk.so target/debug cargo run ``` -## 使用Docker编译 +## 使用 Docker 编译 首先克隆存储库并构建 docker 容器: @@ -107,37 +116,42 @@ docker build -t "rustdesk-builder" . ``` 针对国内网络访问问题,可以做以下几点优化: -1. Dockerfile中修改系统的源到国内镜像 - ``` - 在Dockerfile的RUN apt update之前插入两行: - RUN sed -i "s/deb.debian.org/mirrors.163.com/g" /etc/apt/sources.list - RUN sed -i "s/security.debian.org/mirrors.163.com/g" /etc/apt/sources.list - ``` -2. 修改容器系统中的cargo源,在`RUN ./rustup.sh -y`后插入下面代码: - ``` - RUN echo '[source.crates-io]' > ~/.cargo/config \ - && echo 'registry = "https://github.com/rust-lang/crates.io-index"' >> ~/.cargo/config \ - && echo '# 替换成你偏好的镜像源' >> ~/.cargo/config \ - && echo "replace-with = 'sjtu'" >> ~/.cargo/config \ - && echo '# 上海交通大学' >> ~/.cargo/config \ - && echo '[source.sjtu]' >> ~/.cargo/config \ - && echo 'registry = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index"' >> ~/.cargo/config \ - && echo '' >> ~/.cargo/config - ``` +1. Dockerfile 中修改系统的源到国内镜像 -2. Dockerfile中加入代理的env - ``` - 在User root后插入两行 - - ENV http_proxy=http://host:port - ENV https_proxy=http://host:port - ``` + ``` + 在Dockerfile的RUN apt update之前插入两行: -3. docker build命令后面加上proxy参数 - ``` - docker build -t "rustdesk-builder" . --build-arg http_proxy=http://host:port --build-arg https_proxy=http://host:port - ``` + RUN sed -i "s/deb.debian.org/mirrors.163.com/g" /etc/apt/sources.list + RUN sed -i "s/security.debian.org/mirrors.163.com/g" /etc/apt/sources.list + ``` + +2. 修改容器系统中的 cargo 源,在`RUN ./rustup.sh -y`后插入下面代码: + + ``` + RUN echo '[source.crates-io]' > ~/.cargo/config \ + && echo 'registry = "https://github.com/rust-lang/crates.io-index"' >> ~/.cargo/config \ + && echo '# 替换成你偏好的镜像源' >> ~/.cargo/config \ + && echo "replace-with = 'sjtu'" >> ~/.cargo/config \ + && echo '# 上海交通大学' >> ~/.cargo/config \ + && echo '[source.sjtu]' >> ~/.cargo/config \ + && echo 'registry = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index"' >> ~/.cargo/config \ + && echo '' >> ~/.cargo/config + ``` + +3. Dockerfile 中加入代理的 env + + ``` + 在User root后插入两行 + + ENV http_proxy=http://host:port + ENV https_proxy=http://host:port + ``` + +4. docker build 命令后面加上 proxy 参数 + ``` + docker build -t "rustdesk-builder" . --build-arg http_proxy=http://host:port --build-arg https_proxy=http://host:port + ``` 然后,每次需要构建应用程序时,运行以下命令: @@ -146,16 +160,19 @@ docker run --rm -it -v $PWD:/home/user/rustdesk -v rustdesk-git-cache:/home/user ``` 运行若遇到无权限问题,出现以下提示: + ``` usermod: user user is currently used by process 1 groupmod: Permission denied. groupmod: cannot lock /etc/group; try again later. ``` -可以尝试把`-e PUID="$(id -u)" -e PGID="$(id -g)"`参数去掉。(出现这一问题的原因是容器中的entrypoint脚本中判定uid和gid与给定的环境变量不一致时会修改user的uid和gid重新运行,但是重新运行时取不到环境变量中的uid和gid了,会再次进入uid与gid与给定值不一致的逻辑分支) + +可以尝试把`-e PUID="$(id -u)" -e PGID="$(id -g)"`参数去掉。(出现这一问题的原因是容器中的 entrypoint 脚本中判定 uid 和 gid 与给定的环境变量不一致时会修改 user 的 uid 和 gid 重新运行,但是重新运行时取不到环境变量中的 uid 和 gid 了,会再次进入 uid 与 gid 与给定值不一致的逻辑分支) 请注意,第一次构建可能需要比较长的时间,因为需要缓存依赖项(国内网络经常出现拉取失败,可多尝试几次),后续构建会更快。此外,如果您需要为构建命令指定不同的参数, 您可以在命令末尾的 `` 位置执行此操作。例如,如果你想构建一个优化的发布版本,你可以在命令后跟 `---release`。 -将在target下产生可执行程序,请通过以下方式运行调试版本: +将在 target 下产生可执行程序,请通过以下方式运行调试版本: + ```sh target/debug/rustdesk ``` @@ -169,22 +186,24 @@ target/release/rustdesk 请确保您从 RustDesk 存储库的根目录运行这些命令,否则应用程序可能无法找到所需的资源。另请注意,此方法当前不支持其他`Cargo`子命令, 例如 `install` 或 `run`,因为运行在容器里,而不是宿主机上。 -### 把Wayland修改成X11 (Xorg) -RustDesk暂时不支持Wayland,不过正在积极开发中. -请查看[this](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/)配置X11. +### 把 Wayland 修改成 X11 (Xorg) + +RustDesk 暂时不支持 Wayland,不过正在积极开发中. +请查看[this](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/)配置 X11. ## 文件结构 -- **[libs/hbb_common](https://github.com/rustdesk/rustdesk/tree/master/libs/hbb_common)**: 视频编解码, 配置, tcp/udp封装, protobuf, 文件传输相关文件系统操作函数, 以及一些其他实用函数 +- **[libs/hbb_common](https://github.com/rustdesk/rustdesk/tree/master/libs/hbb_common)**: 视频编解码, 配置, tcp/udp 封装, protobuf, 文件传输相关文件系统操作函数, 以及一些其他实用函数 - **[libs/scrap](https://github.com/rustdesk/rustdesk/tree/master/libs/scrap)**: 截屏 - **[libs/enigo](https://github.com/rustdesk/rustdesk/tree/master/libs/enigo)**: 平台相关的鼠标键盘输入 - **[src/ui](https://github.com/rustdesk/rustdesk/tree/master/src/ui)**: GUI -- **[src/server](https://github.com/rustdesk/rustdesk/tree/master/src/server)**: 被控端服务,audio/clipboard/input/video服务, 已经连接实现 +- **[src/server](https://github.com/rustdesk/rustdesk/tree/master/src/server)**: 被控端服务,audio/clipboard/input/video 服务, 已经连接实现 - **[src/client.rs](https://github.com/rustdesk/rustdesk/tree/master/src/client.rs)**: 控制端 -- **[src/rendezvous_mediator.rs](https://github.com/rustdesk/rustdesk/tree/master/src/rendezvous_mediator.rs)**: 与[rustdesk-server](https://github.com/rustdesk/rustdesk-server)保持UDP通讯, 等待远程连接(通过打洞直连或者中继) +- **[src/rendezvous_mediator.rs](https://github.com/rustdesk/rustdesk/tree/master/src/rendezvous_mediator.rs)**: 与[rustdesk-server](https://github.com/rustdesk/rustdesk-server)保持 UDP 通讯, 等待远程连接(通过打洞直连或者中继) - **[src/platform](https://github.com/rustdesk/rustdesk/tree/master/src/platform)**: 平台服务相关代码 ## 截图 + ![image](https://user-images.githubusercontent.com/71636191/113112362-ae4deb80-923b-11eb-957d-ff88daad4f06.png) ![image](https://user-images.githubusercontent.com/71636191/113112619-f705a480-923b-11eb-911d-97e984ef52b6.png) diff --git a/README.md b/README.md index 88c8a85c4..f6b13cd6c 100644 --- a/README.md +++ b/README.md @@ -13,56 +13,62 @@ Chat with us: [Discord](https://discord.gg/nDceKgxnkV) | [Reddit](https://www.re [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/I2I04VU09) -Yet another remote desktop software, written in Rust. Works out of the box, no configuration required. You have full control of your data, with no concerns about security. You can use our rendezvous/relay server, [set up your own](https://rustdesk.com/blog/id-relay-set/), or [write your own rendezvous/relay server](https://github.com/rustdesk/rustdesk-server-demo). +Yet another remote desktop software, written in Rust. Works out of the box, no configuration required. You have full control of your data, with no concerns about security. You can use our rendezvous/relay server, [set up your own](https://rustdesk.com/blog/id-relay-set/), or [write your own rendezvous/relay server](https://github.com/rustdesk/rustdesk-server-demo). -RustDesk welcomes contribution from everyone. See [`CONTRIBUTING.md`](CONTRIBUTING.md) for help getting started. +RustDesk welcomes contribution from everyone. See [`CONTRIBUTING.md`](CONTRIBUTING.md) for help getting started. [**BINARY DOWNLOAD**](https://github.com/rustdesk/rustdesk/releases) ## Free Public Servers + Below are the servers you are using for free, it may change along the time. If you are not close to one of these, your network may be slow. -| Location | Vendor | Specification | +| Location | Vendor | Specification | | --------- | ------------- | ------------------ | -| Seoul | AWS lightsail | 1 VCPU / 0.5GB RAM | -| Singapore | Vultr | 1 VCPU / 1GB RAM | -| Dallas | Vultr | 1 VCPU / 1GB RAM | | +| Seoul | AWS lightsail | 1 VCPU / 0.5GB RAM | +| Singapore | Vultr | 1 VCPU / 1GB RAM | +| Dallas | Vultr | 1 VCPU / 1GB RAM | | ## Dependencies Desktop versions use [sciter](https://sciter.com/) for GUI, please download sciter dynamic library yourself. -[Windows](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.win/x64/sciter.dll) | +[Windows](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.win/x64/sciter.dll) | [Linux](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.lnx/x64/libsciter-gtk.so) | [MacOS](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.osx/libsciter.dylib) ## Raw steps to build -* Prepare your Rust development env and C++ build env -* Install [vcpkg](https://github.com/microsoft/vcpkg), and set `VCPKG_ROOT` env variable correctly +- Prepare your Rust development env and C++ build env - - Windows: vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static - - Linux/MacOS: vcpkg install libvpx libyuv opus - -* run `cargo run` +- Install [vcpkg](https://github.com/microsoft/vcpkg), and set `VCPKG_ROOT` env variable correctly + + - Windows: vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static + - Linux/MacOS: vcpkg install libvpx libyuv opus + +- run `cargo run` ## How to build on Linux ### Ubuntu 18 (Debian 10) + ```sh sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake ``` ### Fedora 28 (CentOS 8) + ```sh sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb-devel libxdo-devel libXfixes-devel pulseaudio-libs-devel cmake alsa-lib-devel ``` ### Arch (Manjaro) + ```sh sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio ``` ### Install vcpkg + ```sh git clone https://github.com/microsoft/vcpkg cd vcpkg @@ -74,6 +80,7 @@ vcpkg/vcpkg install libvpx libyuv opus ``` ### Fix libvpx (For Fedora) + ```sh cd vcpkg/buildtrees/libvpx/src cd * @@ -86,6 +93,7 @@ cd ``` ### Build + ```sh curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source $HOME/.cargo/env @@ -128,6 +136,7 @@ target/release/rustdesk Please ensure that you are running these commands from the root of the RustDesk repository, otherwise the application may be unable to find the required resources. Also note that other cargo subcommands such as `install` or `run` are not currently supported via this method as they would install or run the program inside the container instead of the host. ### Change Wayland to X11 (Xorg) + RustDesk does not support Wayland. Check [this](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/) to configuring Xorg as the default GNOME session. ## File Structure @@ -142,6 +151,7 @@ RustDesk does not support Wayland. Check [this](https://docs.fedoraproject.org/e - **[src/platform](https://github.com/rustdesk/rustdesk/tree/master/src/platform)**: platform specific code ## Snapshot + ![image](https://user-images.githubusercontent.com/71636191/113112362-ae4deb80-923b-11eb-957d-ff88daad4f06.png) ![image](https://user-images.githubusercontent.com/71636191/113112619-f705a480-923b-11eb-911d-97e984ef52b6.png) @@ -149,4 +159,3 @@ RustDesk does not support Wayland. Check [this](https://docs.fedoraproject.org/e ![image](https://user-images.githubusercontent.com/71636191/113112857-3fbd5d80-923c-11eb-9836-768325faf906.png) ![image](https://user-images.githubusercontent.com/71636191/135385039-38fdbd72-379a-422d-b97f-33df71fb1cec.png) - diff --git a/SECURITY.md b/SECURITY.md index 57c501eda..f1114f913 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -2,11 +2,11 @@ ## Supported Versions -| Version | Supported | -| ------- | ------------------ | -| 1.1.x | :white_check_mark: | -| 1.x | :white_check_mark: | -| Below 1.0 | :x: | +| Version | Supported | +| --------- | ------------------ | +| 1.1.x | :white_check_mark: | +| 1.x | :white_check_mark: | +| Below 1.0 | :x: | ## Reporting a Vulnerability From 2894a5ab7b8d7bea480a48cb22b94120d55264a0 Mon Sep 17 00:00:00 2001 From: Arash Hatami Date: Fri, 1 Oct 2021 22:48:04 +0330 Subject: [PATCH 06/34] Format rust files --- libs/hbb_common/src/config.rs | 5 ++++- src/platform/linux.rs | 26 +++++++++++++++++--------- src/platform/windows.rs | 20 ++++++++++++++++---- src/server/video_service.rs | 1 - src/ui.rs | 2 +- 5 files changed, 38 insertions(+), 16 deletions(-) diff --git a/libs/hbb_common/src/config.rs b/libs/hbb_common/src/config.rs index 819f4f8d7..bf4dfb7da 100644 --- a/libs/hbb_common/src/config.rs +++ b/libs/hbb_common/src/config.rs @@ -153,7 +153,10 @@ fn patch(path: PathBuf) -> PathBuf { { if _tmp == "/root" { if let Ok(output) = std::process::Command::new("whoami").output() { - let user = String::from_utf8_lossy(&output.stdout).to_string().trim().to_owned(); + let user = String::from_utf8_lossy(&output.stdout) + .to_string() + .trim() + .to_owned(); if user != "root" { return format!("/home/{}", user).into(); } diff --git a/src/platform/linux.rs b/src/platform/linux.rs index 9b68c3656..7368d3c04 100644 --- a/src/platform/linux.rs +++ b/src/platform/linux.rs @@ -417,7 +417,7 @@ pub fn fix_login_wayland() { "sed", "-i", "s/#WaylandEnable=false/WaylandEnable=false/g", - &file + &file, ]) .output() { @@ -435,20 +435,22 @@ pub fn fix_login_wayland() { pub fn current_is_wayland() -> bool { let dtype = get_display_server(); - return "wayland" == dtype && unsafe{UNMODIFIED}; + return "wayland" == dtype && unsafe { UNMODIFIED }; } pub fn modify_default_login() -> String { let dsession = std::env::var("DESKTOP_SESSION").unwrap(); let user_name = std::env::var("USERNAME").unwrap(); - if let Ok(Some(x)) = run_cmds("ls /usr/share/* | grep ${DESKTOP_SESSION}-xorg.desktop".to_owned()) { + if let Ok(Some(x)) = + run_cmds("ls /usr/share/* | grep ${DESKTOP_SESSION}-xorg.desktop".to_owned()) + { if x.trim_end().to_string() != "" { match std::process::Command::new("pkexec") .args(vec![ "sed", "-i", &format!("s/={0}$/={0}-xorg/g", &dsession), - &format!("/var/lib/AccountsService/users/{}", &user_name) + &format!("/var/lib/AccountsService/users/{}", &user_name), ]) .output() { @@ -458,7 +460,9 @@ pub fn modify_default_login() -> String { log::error!("modify_default_login failed: {}", x); return "Fix failed! Please re-login with X server manually".to_owned(); } else { - unsafe {UNMODIFIED = false;} + unsafe { + UNMODIFIED = false; + } return "".to_owned(); } } @@ -467,14 +471,16 @@ pub fn modify_default_login() -> String { return "Fix failed! Please re-login with X server manually".to_owned(); } } - } else if let Ok(Some(z)) = run_cmds("ls /usr/share/* | grep ${DESKTOP_SESSION:0:-8}.desktop".to_owned()) { + } else if let Ok(Some(z)) = + run_cmds("ls /usr/share/* | grep ${DESKTOP_SESSION:0:-8}.desktop".to_owned()) + { if z.trim_end().to_string() != "" { match std::process::Command::new("pkexec") .args(vec![ "sed", "-i", - &format!("s/={}$/={}/g", &dsession, &dsession[..dsession.len()-8]), - &format!("/var/lib/AccountsService/users/{}", &user_name) + &format!("s/={}$/={}/g", &dsession, &dsession[..dsession.len() - 8]), + &format!("/var/lib/AccountsService/users/{}", &user_name), ]) .output() { @@ -484,7 +490,9 @@ pub fn modify_default_login() -> String { log::error!("modify_default_login failed: {}", x); return "Fix failed! Please re-login with X server manually".to_owned(); } else { - unsafe {UNMODIFIED = false;} + unsafe { + UNMODIFIED = false; + } return "".to_owned(); } } diff --git a/src/platform/windows.rs b/src/platform/windows.rs index 5a18a2a5f..4fc134914 100644 --- a/src/platform/windows.rs +++ b/src/platform/windows.rs @@ -145,7 +145,13 @@ pub fn get_cursor_data(hcursor: u64) -> ResultType { if do_outline { let mut outline = Vec::new(); outline.resize(((width + 2) * (height + 2) * 4) as _, 0); - drawOutline(outline.as_mut_ptr(), cbits.as_ptr(), width, height, outline.len() as _); + drawOutline( + outline.as_mut_ptr(), + cbits.as_ptr(), + width, + height, + outline.len() as _, + ); cbits = outline; width += 2; height += 2; @@ -357,7 +363,7 @@ fn fix_cursor_mask( let mut alpha = 255; if mask_idx < bm_size { if (mbits[mask_idx] << (x & 0x7)) & 0x80 == 0 { - alpha = 0; + alpha = 0; } } let a = cbits[pix_idx + 2]; @@ -393,8 +399,14 @@ extern "C" { fn LaunchProcessWin(cmd: *const u16, session_id: DWORD, as_user: BOOL) -> HANDLE; fn selectInputDesktop() -> BOOL; fn inputDesktopSelected() -> BOOL; - fn handleMask(out: *mut u8, mask: *const u8, width: i32, height: i32, bmWidthBytes: i32, bmHeight: i32) - -> i32; + fn handleMask( + out: *mut u8, + mask: *const u8, + width: i32, + height: i32, + bmWidthBytes: i32, + bmHeight: i32, + ) -> i32; fn drawOutline(out: *mut u8, in_: *const u8, width: i32, height: i32, out_size: i32); fn get_di_bits(out: *mut u8, dc: HDC, hbmColor: HBITMAP, width: i32, height: i32) -> i32; fn blank_screen(v: BOOL); diff --git a/src/server/video_service.rs b/src/server/video_service.rs index 953d5efd8..fe3797930 100644 --- a/src/server/video_service.rs +++ b/src/server/video_service.rs @@ -99,7 +99,6 @@ fn run(sp: GenericService) -> ResultType<()> { *SWITCH.lock().unwrap() = false; sp.send(msg_out); } - let mut crc = (0, 0); let start = time::Instant::now(); let mut last_sent = time::Instant::now(); diff --git a/src/ui.rs b/src/ui.rs index ca6fbd950..15c2bc9ee 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -477,7 +477,7 @@ impl UI { #[cfg(target_os = "linux")] return crate::platform::linux::fix_login_wayland(); } - + fn current_is_wayland(&mut self) -> bool { #[cfg(target_os = "linux")] return crate::platform::linux::current_is_wayland(); From 678a3d2d282068cf9d343fec9b09df27121a7540 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Sat, 2 Oct 2021 08:48:41 +0800 Subject: [PATCH 07/34] README format bug --- README-DE.md | 2 +- README-ES.md | 2 +- README-FR.md | 2 +- README-PL.md | 2 +- README-ZH.md | 2 +- README.md | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README-DE.md b/README-DE.md index 95d908023..d24234b85 100644 --- a/README-DE.md +++ b/README-DE.md @@ -136,7 +136,7 @@ target/release/rustdesk Bitte gehe sicher, dass du diese Befehle vom Stammverzeichnis vom RustDesk Repository nutzt, sonst kann es passieren, dass das Programm die Ressourcen nicht finden kann. Bitte bedenke auch, dass Unterbefehle von Cargo, wie z.B. `install` oder `run` aktuell noch nicht unterstützt werden, da sie das Programm innerhalb des Containers starten oder installieren würden, anstatt auf deinem eigentlichen System. -### Ändere Wayland zu X11 (Xorg) +## Ändere Wayland zu X11 (Xorg) RustDesk unterstützt "Wayland" nicht. Siehe [hier](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/) um Xorg als Standard GNOME Session zu nutzen. diff --git a/README-ES.md b/README-ES.md index 79d880287..7e7c07bb3 100644 --- a/README-ES.md +++ b/README-ES.md @@ -134,7 +134,7 @@ target/release/rustdesk Por favor, asegurate de que estás ejecutando estos comandos desde la raíz del repositorio de RustDesk, de lo contrario la aplicación puede ser incapaz de encontrar los recursos necesarios. También hay que tener en cuenta que otros subcomandos de carga como `install` o `run` no estan actualmente soportados via este metodo y podrían requerir ser instalados dentro del contenedor y no en el host. -### Cambia Wayland a X11 (Xorg) +## Cambia Wayland a X11 (Xorg) RustDesk no soporta Wayland. Comprueba [aquí](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/) para configurar Xorg en la sesión por defecto de GNOME. diff --git a/README-FR.md b/README-FR.md index 453309504..33e21783e 100644 --- a/README-FR.md +++ b/README-FR.md @@ -134,7 +134,7 @@ target/release/rustdesk Veuillez vous assurer que vous exécutez ces commandes à partir de la racine du référentiel RustDesk, sinon l'application ne pourra pas trouver les ressources requises. Notez également que les autres sous-commandes de cargo telles que `install` ou `run` ne sont pas actuellement supportées par cette méthode car elles installeraient ou exécuteraient le programme à l'intérieur du conteneur au lieu de l'hôte. -### Changer Wayland en X11 (Xorg) +## Changer Wayland en X11 (Xorg) RustDesk ne supporte pas Wayland. Lisez [cela](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/) pour configurer Xorg comme la session GNOME par défaut. diff --git a/README-PL.md b/README-PL.md index 793a1f2fb..38d786dcf 100644 --- a/README-PL.md +++ b/README-PL.md @@ -135,7 +135,7 @@ target/release/rustdesk Upewnij się, że uruchamiasz te polecenia z katalogu głównego repozytorium RustDesk, w przeciwnym razie aplikacja może nie być w stanie znaleźć wymaganych zasobów. Należy również pamiętać, że inne podpolecenia ładowania, takie jak `install` lub `run` nie są obecnie obsługiwane za pomocą tej metody, ponieważ instalowałyby lub uruchamiały program wewnątrz kontenera zamiast na hoście. -### Zmień Wayland na X11 (Xorg) +## Zmień Wayland na X11 (Xorg) RustDesk nie obsługuje Waylanda. Sprawdź [this](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/) by skonfigurować Xorg jako domyślną sesję GNOME. diff --git a/README-ZH.md b/README-ZH.md index 9382683b2..fe7405a08 100644 --- a/README-ZH.md +++ b/README-ZH.md @@ -186,7 +186,7 @@ target/release/rustdesk 请确保您从 RustDesk 存储库的根目录运行这些命令,否则应用程序可能无法找到所需的资源。另请注意,此方法当前不支持其他`Cargo`子命令, 例如 `install` 或 `run`,因为运行在容器里,而不是宿主机上。 -### 把 Wayland 修改成 X11 (Xorg) +## 把 Wayland 修改成 X11 (Xorg) RustDesk 暂时不支持 Wayland,不过正在积极开发中. 请查看[this](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/)配置 X11. diff --git a/README.md b/README.md index f6b13cd6c..60ecb829a 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ target/release/rustdesk Please ensure that you are running these commands from the root of the RustDesk repository, otherwise the application may be unable to find the required resources. Also note that other cargo subcommands such as `install` or `run` are not currently supported via this method as they would install or run the program inside the container instead of the host. -### Change Wayland to X11 (Xorg) +## Change Wayland to X11 (Xorg) RustDesk does not support Wayland. Check [this](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/) to configuring Xorg as the default GNOME session. From c0459b8f94fb05db33b9cbabd45bf7d16e376c9d Mon Sep 17 00:00:00 2001 From: rustdesk Date: Sat, 2 Oct 2021 08:51:56 +0800 Subject: [PATCH 08/34] move change wayland to linux section --- README-DE.md | 8 ++++---- README-ES.md | 8 ++++---- README-FR.md | 8 ++++---- README-PL.md | 8 ++++---- README-ZH.md | 10 +++++----- README.md | 8 ++++---- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/README-DE.md b/README-DE.md index d24234b85..8ab4cc9cf 100644 --- a/README-DE.md +++ b/README-DE.md @@ -106,6 +106,10 @@ mv libsciter-gtk.so target/debug cargo run ``` +### Ändere Wayland zu X11 (Xorg) + +RustDesk unterstützt "Wayland" nicht. Siehe [hier](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/) um Xorg als Standard GNOME Session zu nutzen. + ## Auf Docker Kompilieren Beginne damit das Repository zu klonen und den Docker Container zu bauen: @@ -136,10 +140,6 @@ target/release/rustdesk Bitte gehe sicher, dass du diese Befehle vom Stammverzeichnis vom RustDesk Repository nutzt, sonst kann es passieren, dass das Programm die Ressourcen nicht finden kann. Bitte bedenke auch, dass Unterbefehle von Cargo, wie z.B. `install` oder `run` aktuell noch nicht unterstützt werden, da sie das Programm innerhalb des Containers starten oder installieren würden, anstatt auf deinem eigentlichen System. -## Ändere Wayland zu X11 (Xorg) - -RustDesk unterstützt "Wayland" nicht. Siehe [hier](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/) um Xorg als Standard GNOME Session zu nutzen. - ## Dateistruktur - **[libs/hbb_common](https://github.com/rustdesk/rustdesk/tree/master/libs/hbb_common)**: Video Codec, Konfiguration, TCP/UDP Wrapper, Protokoll Puffer, fs Funktionen für Dateitransfer, und ein paar andere nützliche Funktionen diff --git a/README-ES.md b/README-ES.md index 7e7c07bb3..087be2ee6 100644 --- a/README-ES.md +++ b/README-ES.md @@ -104,6 +104,10 @@ mv libsciter-gtk.so target/debug cargo run ``` +### Cambia Wayland a X11 (Xorg) + +RustDesk no soporta Wayland. Comprueba [aquí](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/) para configurar Xorg en la sesión por defecto de GNOME. + ## Como compilar con Docker Empieza clonando el repositorio y compilando el contenedor de docker: @@ -134,10 +138,6 @@ target/release/rustdesk Por favor, asegurate de que estás ejecutando estos comandos desde la raíz del repositorio de RustDesk, de lo contrario la aplicación puede ser incapaz de encontrar los recursos necesarios. También hay que tener en cuenta que otros subcomandos de carga como `install` o `run` no estan actualmente soportados via este metodo y podrían requerir ser instalados dentro del contenedor y no en el host. -## Cambia Wayland a X11 (Xorg) - -RustDesk no soporta Wayland. Comprueba [aquí](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/) para configurar Xorg en la sesión por defecto de GNOME. - ## Estructura de archivos - **[libs/hbb_common](https://github.com/rustdesk/rustdesk/tree/master/libs/hbb_common)**: video codec, configuración, tcp/udp wrapper, protobuf, fs funciones para transferencia de ficheros, y alguna función de utilidad. diff --git a/README-FR.md b/README-FR.md index 33e21783e..611c66961 100644 --- a/README-FR.md +++ b/README-FR.md @@ -104,6 +104,10 @@ mv libsciter-gtk.so target/debug Exécution du cargo ``` +### Changer Wayland en X11 (Xorg) + +RustDesk ne supporte pas Wayland. Lisez [cela](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/) pour configurer Xorg comme la session GNOME par défaut. + ## Comment construire avec Docker Commencez par cloner le dépôt et construire le conteneur Docker : @@ -134,10 +138,6 @@ target/release/rustdesk Veuillez vous assurer que vous exécutez ces commandes à partir de la racine du référentiel RustDesk, sinon l'application ne pourra pas trouver les ressources requises. Notez également que les autres sous-commandes de cargo telles que `install` ou `run` ne sont pas actuellement supportées par cette méthode car elles installeraient ou exécuteraient le programme à l'intérieur du conteneur au lieu de l'hôte. -## Changer Wayland en X11 (Xorg) - -RustDesk ne supporte pas Wayland. Lisez [cela](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/) pour configurer Xorg comme la session GNOME par défaut. - ## Structure du projet - **[libs/hbb_common](https://github.com/rustdesk/rustdesk/tree/master/libs/hbb_common)** : codec vidéo, config, wrapper tcp/udp, protobuf, fonctions fs pour le transfert de fichiers, et quelques autres fonctions utilitaires. diff --git a/README-PL.md b/README-PL.md index 38d786dcf..5291d50c7 100644 --- a/README-PL.md +++ b/README-PL.md @@ -105,6 +105,10 @@ mv libsciter-gtk.so target/debug cargo run ``` +### Zmień Wayland na X11 (Xorg) + +RustDesk nie obsługuje Waylanda. Sprawdź [this](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/) by skonfigurować Xorg jako domyślną sesję GNOME. + ## Jak kompilować za pomocą Dockera Rozpocznij od sklonowania repozytorium i stworzenia kontenera docker: @@ -135,10 +139,6 @@ target/release/rustdesk Upewnij się, że uruchamiasz te polecenia z katalogu głównego repozytorium RustDesk, w przeciwnym razie aplikacja może nie być w stanie znaleźć wymaganych zasobów. Należy również pamiętać, że inne podpolecenia ładowania, takie jak `install` lub `run` nie są obecnie obsługiwane za pomocą tej metody, ponieważ instalowałyby lub uruchamiały program wewnątrz kontenera zamiast na hoście. -## Zmień Wayland na X11 (Xorg) - -RustDesk nie obsługuje Waylanda. Sprawdź [this](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/) by skonfigurować Xorg jako domyślną sesję GNOME. - ## Struktura plików - **[libs/hbb_common](https://github.com/rustdesk/rustdesk/tree/master/libs/hbb_common)**: kodek wideo, config, wrapper tcp/udp, protobuf, funkcje fs do transferu plików i kilka innych funkcji użytkowych diff --git a/README-ZH.md b/README-ZH.md index fe7405a08..1ffdb5159 100644 --- a/README-ZH.md +++ b/README-ZH.md @@ -105,6 +105,11 @@ mv libsciter-gtk.so target/debug cargo run ``` +### 把 Wayland 修改成 X11 (Xorg) + +RustDesk 暂时不支持 Wayland,不过正在积极开发中. +请查看[this](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/)配置 X11. + ## 使用 Docker 编译 首先克隆存储库并构建 docker 容器: @@ -186,11 +191,6 @@ target/release/rustdesk 请确保您从 RustDesk 存储库的根目录运行这些命令,否则应用程序可能无法找到所需的资源。另请注意,此方法当前不支持其他`Cargo`子命令, 例如 `install` 或 `run`,因为运行在容器里,而不是宿主机上。 -## 把 Wayland 修改成 X11 (Xorg) - -RustDesk 暂时不支持 Wayland,不过正在积极开发中. -请查看[this](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/)配置 X11. - ## 文件结构 - **[libs/hbb_common](https://github.com/rustdesk/rustdesk/tree/master/libs/hbb_common)**: 视频编解码, 配置, tcp/udp 封装, protobuf, 文件传输相关文件系统操作函数, 以及一些其他实用函数 diff --git a/README.md b/README.md index 60ecb829a..f9cd7e6d8 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,10 @@ mv libsciter-gtk.so target/debug VCPKG_ROOT=$HOME/vcpkg cargo run ``` +### Change Wayland to X11 (Xorg) + +RustDesk does not support Wayland. Check [this](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/) to configuring Xorg as the default GNOME session. + ## How to build with Docker Begin by cloning the repository and building the docker container: @@ -135,10 +139,6 @@ target/release/rustdesk Please ensure that you are running these commands from the root of the RustDesk repository, otherwise the application may be unable to find the required resources. Also note that other cargo subcommands such as `install` or `run` are not currently supported via this method as they would install or run the program inside the container instead of the host. -## Change Wayland to X11 (Xorg) - -RustDesk does not support Wayland. Check [this](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/) to configuring Xorg as the default GNOME session. - ## File Structure - **[libs/hbb_common](https://github.com/rustdesk/rustdesk/tree/master/libs/hbb_common)**: video codec, config, tcp/udp wrapper, protobuf, fs functions for file transfer, and some other utility functions From c0db2e6da4456fe05e5e23cee75cdd622ba286f6 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Fri, 8 Oct 2021 00:16:10 +0800 Subject: [PATCH 09/34] refactor and fix --- src/ui.rs | 13 +++++++++++++ src/ui/index.tis | 27 ++++++++++----------------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/ui.rs b/src/ui.rs index ca6fbd950..b7cacf197 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -333,9 +333,21 @@ impl UI { } } } + + *self.2.lock().unwrap() = m.clone(); ipc::set_options(m).ok(); } + fn set_option(&self, key: String, value: String) { + let mut options = self.2.lock().unwrap(); + if value.is_empty() { + options.remove(&key); + } else { + options.insert(key, value); + } + ipc::set_options(options.clone()).ok(); + } + fn install_path(&mut self) -> String { #[cfg(windows)] return crate::platform::windows::get_install_info().1; @@ -587,6 +599,7 @@ impl sciter::EventHandler for UI { fn test_if_valid_server(String); fn get_sound_inputs(); fn set_options(Value); + fn set_option(String, String); fn get_software_update_url(); fn get_new_version(); fn get_version(); diff --git a/src/ui/index.tis b/src/ui/index.tis index ea48bacdc..55fcf6f7c 100644 --- a/src/ui/index.tis +++ b/src/ui/index.tis @@ -40,9 +40,7 @@ class ConnectStatus: Reactor.Component { } event click $(.connect-status .link) () { - var options = handler.get_options(); - options["stop-service"] = ""; - handler.set_options(options); + handler.set_option("stop-service", ""); } } @@ -138,7 +136,6 @@ function createNewConnect(id, type) { var myIdMenu; var audioInputMenu; -var configOptions = {}; class AudioInputs: Reactor.Component { function this() { audioInputMenu = this; @@ -167,7 +164,7 @@ class AudioInputs: Reactor.Component { } function get_value() { - return configOptions["audio-input"] || this.get_default(); + return handler.get_option("audio-input") || this.get_default(); } function toggleMenuState() { @@ -182,8 +179,7 @@ class AudioInputs: Reactor.Component { var v = me.id; if (v == this.get_value()) return; if (v == this.get_default()) v = ""; - configOptions["audio-input"] = v; - handler.set_options(configOptions); + handler.set_option("audio-input", v); this.toggleMenuState(); } } @@ -223,7 +219,6 @@ class MyIdMenu: Reactor.Component { event click $(svg#menu) (_, me) { audioInputMenu.update({ show: true }); - configOptions = handler.get_options(); this.toggleMenuState(); var menu = $(menu#config-options); me.popup(menu); @@ -232,7 +227,7 @@ class MyIdMenu: Reactor.Component { function toggleMenuState() { for (var el in $$(menu#config-options>li)) { if (el.id && el.id.indexOf("enable-") == 0) { - var enabled = configOptions[el.id] != "N"; + var enabled = handler.get_option(el.id) != "N"; el.attributes.toggleClass("selected", enabled); el.attributes.toggleClass("line-through", !enabled); } @@ -241,11 +236,10 @@ class MyIdMenu: Reactor.Component { event click $(menu#config-options>li) (_, me) { if (me.id && me.id.indexOf("enable-") == 0) { - configOptions[me.id] = configOptions[me.id] == "N" ? "" : "N"; - handler.set_options(configOptions); + handler.set_option(me.id, handler.get_option(me.id) == "N" ? "" : "N"); } if (me.id == "whitelist") { - var old_value = (configOptions["whitelist"] || "").split(",").join("\n"); + var old_value = handler.get_option("whitelist").split(",").join("\n"); handler.msgbox("custom-whitelist", "IP Whitelisting", "
\ \
\ @@ -253,7 +247,7 @@ class MyIdMenu: Reactor.Component { if (!res) return; var value = (res.text || "").trim(); if (value) { - var values = value.split(/[\s,;]+/g); + var values = value.split(/[\s,;\n]+/g); for (var ip in values) { if (!ip.match(/^\d+\.\d+\.\d+\.\d+$/)) { return "Invalid ip: " + ip; @@ -262,11 +256,11 @@ class MyIdMenu: Reactor.Component { value = values.join("\n"); } if (value == old_value) return; - configOptions["whitelist"] = value.replace("\n", ","); stdout.println("whitelist updated"); - handler.set_options(configOptions); + handler.set_option("whitelist", value.replace("\n", ",")); }, 300); } else if (me.id == "custom-server") { + var configOptions = handler.get_options(); var old_relay = configOptions["relay-server"] || ""; var old_id = configOptions["custom-rendezvous-server"] || ""; handler.msgbox("custom-server", "ID/Relay Server", "
\ @@ -293,8 +287,7 @@ class MyIdMenu: Reactor.Component { } else if (me.id == "forum") { handler.open_url("https:://forum.rustdesk.com"); } else if (me.id == "stop-service") { - configOptions["stop-service"] = service_stopped ? "" : "Y"; - handler.set_options(configOptions); + handler.set_option("stop-service", service_stopped ? "" : "Y"); } else if (me.id == "about") { var name = handler.get_app_name(); handler.msgbox("custom-nocancel-nook-hasclose", "About " + name, "
\ From 686e49517100d33225604b575f4b6ee3803a5da3 Mon Sep 17 00:00:00 2001 From: Tom Parker-Shemilt Date: Mon, 11 Oct 2021 21:36:45 +0100 Subject: [PATCH 10/34] Initial CI setup --- .github/workflows/ci.yml | 169 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..3561c5ba0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,169 @@ +name: CI + +# env: +# MIN_SUPPORTED_RUST_VERSION: "1.46.0" +# CICD_INTERMEDIATES_DIR: "_cicd-intermediates" + +on: + workflow_dispatch: + pull_request: + push: + branches: + - master + tags: + - '*' + +jobs: + # ensure_cargo_fmt: + # name: Ensure 'cargo fmt' has been run + # runs-on: ubuntu-20.04 + # steps: + # - uses: actions-rs/toolchain@v1 + # with: + # toolchain: stable + # default: true + # profile: minimal + # components: rustfmt + # - uses: actions/checkout@v2 + # - run: cargo fmt -- --check + + # min_version: + # name: Minimum supported rust version + # runs-on: ubuntu-20.04 + # steps: + # - name: Checkout source code + # uses: actions/checkout@v2 + + # - name: Install rust toolchain (v${{ env.MIN_SUPPORTED_RUST_VERSION }}) + # uses: actions-rs/toolchain@v1 + # with: + # toolchain: ${{ env.MIN_SUPPORTED_RUST_VERSION }} + # default: true + # profile: minimal # minimal component installation (ie, no documentation) + # components: clippy + # - name: Run clippy (on minimum supported rust version to prevent warnings we can't fix) + # uses: actions-rs/cargo@v1 + # with: + # command: clippy + # args: --locked --all-targets --all-features -- --allow clippy::unknown_clippy_lints + # - name: Run tests + # uses: actions-rs/cargo@v1 + # with: + # command: test + # args: --locked + + build: + name: ${{ matrix.job.target }} (${{ matrix.job.os }}) + runs-on: ${{ matrix.job.os }} + strategy: + fail-fast: false + matrix: + job: + # - { target: aarch64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } + # - { target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true } + # - { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true } + # - { target: i686-pc-windows-msvc , os: windows-2019 } + # - { target: i686-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } + # - { target: i686-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } + # - { target: x86_64-apple-darwin , os: macos-10.15 } + # - { target: x86_64-pc-windows-gnu , os: windows-2019 } + # - { target: x86_64-pc-windows-msvc , os: windows-2019 } + - { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04 } + # - { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } + steps: + - name: Checkout source code + uses: actions/checkout@v2 + + - name: Install prerequisites + shell: bash + run: | + case ${{ matrix.job.target }} in + x86_64-unknown-linux-gnu) sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake ;; + # arm-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;; + # aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;; + esac + + - name: Restore from cache and install vcpkg + uses: lukka/run-vcpkg@v7 + with: + setupOnly: true + - run: | + $VCPKG_ROOT/vcpkg install libvpx libyuv opus + shell: bash + + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: ${{ matrix.job.target }} + override: true + profile: minimal # minimal component installation (ie, no documentation) + + - name: Show version information (Rust, cargo, GCC) + shell: bash + run: | + gcc --version || true + rustup -V + rustup toolchain list + rustup default + cargo -V + rustc -V + + - name: Build + uses: actions-rs/cargo@v1 + with: + use-cross: ${{ matrix.job.use-cross }} + command: build + args: --locked --release --target=${{ matrix.job.target }} + + # - name: Strip debug information from executable + # id: strip + # shell: bash + # run: | + # # Figure out suffix of binary + # EXE_suffix="" + # case ${{ matrix.job.target }} in + # *-pc-windows-*) EXE_suffix=".exe" ;; + # esac; + + # # Figure out what strip tool to use if any + # STRIP="strip" + # case ${{ matrix.job.target }} in + # arm-unknown-linux-*) STRIP="arm-linux-gnueabihf-strip" ;; + # aarch64-unknown-linux-gnu) STRIP="aarch64-linux-gnu-strip" ;; + # *-pc-windows-msvc) STRIP="" ;; + # esac; + + # # Setup paths + # BIN_DIR="${{ env.CICD_INTERMEDIATES_DIR }}/stripped-release-bin/" + # mkdir -p "${BIN_DIR}" + # BIN_NAME="${{ env.PROJECT_NAME }}${EXE_suffix}" + # BIN_PATH="${BIN_DIR}/${BIN_NAME}" + + # # Copy the release build binary to the result location + # cp "target/${{ matrix.job.target }}/release/${BIN_NAME}" "${BIN_DIR}" + + # # Also strip if possible + # if [ -n "${STRIP}" ]; then + # "${STRIP}" "${BIN_PATH}" + # fi + + # # Let subsequent steps know where to find the (stripped) bin + # echo ::set-output name=BIN_PATH::${BIN_PATH} + # echo ::set-output name=BIN_NAME::${BIN_NAME} + + - name: Set testing options + id: test-options + shell: bash + run: | + # test only library unit tests and binary for arm-type targets + unset CARGO_TEST_OPTIONS + unset CARGO_TEST_OPTIONS ; case ${{ matrix.job.target }} in arm-* | aarch64-*) CARGO_TEST_OPTIONS="--lib --bin ${PROJECT_NAME}" ;; esac; + echo ::set-output name=CARGO_TEST_OPTIONS::${CARGO_TEST_OPTIONS} + + - name: Run tests + uses: actions-rs/cargo@v1 + with: + use-cross: ${{ matrix.job.use-cross }} + command: test + args: --locked --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}} \ No newline at end of file From 0ef424636065dca64983d48c0d1b325b78833654 Mon Sep 17 00:00:00 2001 From: Tom Parker-Shemilt Date: Mon, 11 Oct 2021 21:40:06 +0100 Subject: [PATCH 11/34] Set vcpkg commit id --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3561c5ba0..1d21d7818 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,7 +87,10 @@ jobs: uses: lukka/run-vcpkg@v7 with: setupOnly: true - - run: | + vcpkgGitCommitId: '1d4128f08e30cec31b94500840c7eca8ebc579cb' + + - name: Install vcpkg dependencies + run: | $VCPKG_ROOT/vcpkg install libvpx libyuv opus shell: bash From 7a7cca7e450d38435cd4467cd13152db5b8daca5 Mon Sep 17 00:00:00 2001 From: Tom Parker-Shemilt Date: Mon, 11 Oct 2021 21:48:56 +0100 Subject: [PATCH 12/34] Add rust cache --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d21d7818..cfa7333e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -112,6 +112,8 @@ jobs: cargo -V rustc -V + - uses: Swatinem/rust-cache@v1 + - name: Build uses: actions-rs/cargo@v1 with: From d25e17317da6b724c95160add78db0dc139fed55 Mon Sep 17 00:00:00 2001 From: Tom Parker-Shemilt Date: Mon, 11 Oct 2021 22:09:13 +0100 Subject: [PATCH 13/34] Skip tests for the moment --- .github/workflows/ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cfa7333e5..b945df652 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -166,9 +166,9 @@ jobs: unset CARGO_TEST_OPTIONS ; case ${{ matrix.job.target }} in arm-* | aarch64-*) CARGO_TEST_OPTIONS="--lib --bin ${PROJECT_NAME}" ;; esac; echo ::set-output name=CARGO_TEST_OPTIONS::${CARGO_TEST_OPTIONS} - - name: Run tests - uses: actions-rs/cargo@v1 - with: - use-cross: ${{ matrix.job.use-cross }} - command: test - args: --locked --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}} \ No newline at end of file + # - name: Run tests + # uses: actions-rs/cargo@v1 + # with: + # use-cross: ${{ matrix.job.use-cross }} + # command: test + # args: --locked --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}} \ No newline at end of file From 55d21ab151b9d892fe21d431c28ea39243ec678c Mon Sep 17 00:00:00 2001 From: Tom Parker-Shemilt Date: Mon, 11 Oct 2021 22:35:31 +0100 Subject: [PATCH 14/34] Just build the tests --- .github/workflows/ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b945df652..d9cfdbc9b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -166,6 +166,13 @@ jobs: unset CARGO_TEST_OPTIONS ; case ${{ matrix.job.target }} in arm-* | aarch64-*) CARGO_TEST_OPTIONS="--lib --bin ${PROJECT_NAME}" ;; esac; echo ::set-output name=CARGO_TEST_OPTIONS::${CARGO_TEST_OPTIONS} + - name: Build tests + uses: actions-rs/cargo@v1 + with: + use-cross: ${{ matrix.job.use-cross }} + command: build + args: --locked --tests --target=${{ matrix.job.target }} + # - name: Run tests # uses: actions-rs/cargo@v1 # with: From eea85b9b5add642d9c3ecec043bd4c4f0dc8208a Mon Sep 17 00:00:00 2001 From: Starccy <452276725@qq.com> Date: Sun, 17 Oct 2021 21:27:10 +0800 Subject: [PATCH 15/34] send & receive multiple files --- src/ui/file_transfer.css | 10 ++++++++++ src/ui/file_transfer.tis | 32 ++++++++++++++++++++++++++++---- src/ui/grid.tis | 5 +++++ 3 files changed, 43 insertions(+), 4 deletions(-) diff --git a/src/ui/file_transfer.css b/src/ui/file_transfer.css index 8acde0623..d1e1a4072 100644 --- a/src/ui/file_transfer.css +++ b/src/ui/file_transfer.css @@ -30,6 +30,7 @@ table > thead { } table > tbody { + behavior: select-multiple; overflow-y: scroll-indicator; size: *; background: white; @@ -85,6 +86,15 @@ table.has_current tr:current /* current row */ background-color: color(accent); } +table.has_current tbody tr:checked +{ + background-color: color(accent); +} + +table.has_current tbody tr:checked td { + color: highlighttext; +} + table td { padding: 4px; diff --git a/src/ui/file_transfer.tis b/src/ui/file_transfer.tis index da980d3cd..700efbdd2 100644 --- a/src/ui/file_transfer.tis +++ b/src/ui/file_transfer.tis @@ -25,6 +25,12 @@ var svg_computer = ; +const TYPE_DIR = 1; +const TYPE_DIR_LINK = 2; +const TYPE_DIR_DRIVE = 3; +const TYPE_FILE = 4; +const TYPE_FILE_LINK = 5; + function getSize(type, size) { if (!size) { if (type <= 3) return ""; @@ -374,7 +380,7 @@ class FolderView : Reactor.Component { path = this.joinPath(entry.name); } var tm = entry.time ? new Date(entry.time.toFloat() * 1000.).toLocaleString() : 0; - return + return {entry.name} {tm || ""} @@ -463,10 +469,28 @@ class FolderView : Reactor.Component { return [this.joinPath(name), type]; } + function getCurrentRows() { + var rows = this.table.getCurrentRows(); + if (!rows || rows.length== 0) return; + + var records = new Array(); + + for (var i = 0; i < rows.length; ++i) { + var name = rows[i][1].text; + if (!name || name == "..") continue; + + var type = rows[i][0].attributes["type"]; + records.push([this.joinPath(name), type]); + } + return records; + } + event click $(.send) () { - var cur = this.getCurrentRow(); - if (!cur) return; - file_transfer.job_table.send(cur[0], this.is_remote); + var rows = this.getCurrentRows(); + if (!rows || rows.length == 0) return; + for (var i = 0; i < rows.length; ++i) { + file_transfer.job_table.send(rows[i][0], this.is_remote); + } } event change $(.select-dir) (_, el) { diff --git a/src/ui/grid.tis b/src/ui/grid.tis index cb5932678..f33b4ef35 100644 --- a/src/ui/grid.tis +++ b/src/ui/grid.tis @@ -24,6 +24,11 @@ class Grid: Behavior { { return this.$(tbody>tr:current); } + + function getCurrentRows() + { + return this.$$(tbody>tr:checked); + } function getCurrentColumn() { From fb126164ef6b4f1f30a4b46f17abdc253c55eb2c Mon Sep 17 00:00:00 2001 From: Starccy <452276725@qq.com> Date: Sun, 17 Oct 2021 21:50:34 +0800 Subject: [PATCH 16/34] use multiple jobs to delete --- src/ui/common.tis | 4 ++++ src/ui/file_transfer.tis | 41 +++++++++++++++++++++++++--------------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/src/ui/common.tis b/src/ui/common.tis index 316def2d4..6af29ab02 100644 --- a/src/ui/common.tis +++ b/src/ui/common.tis @@ -257,6 +257,10 @@ handler.msgbox = function(type, title, text, callback=null, height=180, width=50 self.timer(150ms, function() { msgbox(type, title, text, callback, height, width, retry); }); } +handler.block_msgbox = function(type, title, text, callback=null, height=180, width=500, retry=0) { + msgbox(type, title, text, callback, height, width, retry); +} + var reconnectTimeout = 1; handler.msgbox_retry = function(type, title, text, hasRetry, callback=null, height=180, width=500) { handler.msgbox(type, title, text, callback, height, width, hasRetry ? reconnectTimeout : 0); diff --git a/src/ui/file_transfer.tis b/src/ui/file_transfer.tis index 700efbdd2..74eaf2b69 100644 --- a/src/ui/file_transfer.tis +++ b/src/ui/file_transfer.tis @@ -407,20 +407,31 @@ class FolderView : Reactor.Component { } event click $(.trash) () { - var row = this.getCurrentRow(); - if (!row) return; - var path = row[0]; - var type = row[1]; - var new_history = []; - for (var i = 0; i < this.history.length; ++i) { - var h = this.history[i]; - if ((h + this.sep()).indexOf(path + this.sep()) == -1) new_history.push(h); + var rows = this.getCurrentRows(); + if (!rows || rows.length == 0) return; + + var delete_dirs = new Array(); + + for (var i = 0; i < rows.length; ++i) { + var row = rows[i]; + + var path = row[0]; + var type = row[1]; + + var new_history = []; + for (var j = 0; j < this.history.length; ++j) { + var h = this.history[j]; + if ((h + this.sep()).indexOf(path + this.sep()) == -1) new_history.push(h); + } + this.history = new_history; + if (type == 1) { + delete_dirs.push(path); + } else { + confirmDelete(path, this.is_remote); + } } - this.history = new_history; - if (type == 1) { - file_transfer.job_table.addDelDir(path, this.is_remote); - } else { - confirmDelete(path, this.is_remote); + for (var i = 0; i < delete_dirs.length; ++i) { + file_transfer.job_table.addDelDir(delete_dirs[i], this.is_remote); } } @@ -594,7 +605,7 @@ var deleting_single_file_jobs = {}; var create_dir_jobs = {} function confirmDelete(path, is_remote) { - handler.msgbox("custom-skip", "Confirm Delete", "
\ + handler.block_msgbox("custom-skip", "Confirm Delete", "
\
Are you sure you want to delete this file?
\ " + path + "
\
", function(res=null) { @@ -614,7 +625,7 @@ handler.confirmDeleteFiles = function(id, i, name) { if (i >= n) return; var file_path = job.path; if (name) file_path += handler.get_path_sep(job.is_remote) + name; - handler.msgbox("custom-skip", "Confirm Delete", "
\ + handler.block_msgbox("custom-skip", "Confirm Delete", "
\
Deleting #" + (i + 1) + " of " + n + " files.
\
Are you sure you want to delete this file?
\ " + name + "
\ From 8be912a8cf6fe138db724e3f3332bdad4f2d5dbe Mon Sep 17 00:00:00 2001 From: dannkunt <32395839+dannkunt@users.noreply.github.com> Date: Wed, 20 Oct 2021 08:35:52 +0300 Subject: [PATCH 17/34] Add user privelege To fix this --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b8c320b44..94d713f6f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ RUN git clone https://github.com/microsoft/vcpkg && cd vcpkg && git checkout 134 RUN /vcpkg/bootstrap-vcpkg.sh -disableMetrics RUN /vcpkg/vcpkg --disable-metrics install libvpx libyuv opus -RUN groupadd -r user && useradd -r -g user user --home /home/user && mkdir -p /home/user && chown user /home/user +RUN groupadd -r user && useradd -r -g user user --home /home/user && mkdir -p /home/user && chown user /home/user && echo "user ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/user WORKDIR /home/user RUN wget https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.lnx/x64/libsciter-gtk.so USER user From 0db250f02a3e3649f33e5da1f3d4111eb8c33e68 Mon Sep 17 00:00:00 2001 From: dannkunt <32395839+dannkunt@users.noreply.github.com> Date: Wed, 20 Oct 2021 08:38:36 +0300 Subject: [PATCH 18/34] Delete this code This code is unnessesary and bug casing with previous fix --- entrypoint | 8 -------- 1 file changed, 8 deletions(-) diff --git a/entrypoint b/entrypoint index 75b9efd18..514de9b9d 100755 --- a/entrypoint +++ b/entrypoint @@ -1,13 +1,5 @@ #!/bin/sh -if [ "$(id -u)" != "${PUID:-1000}" ] || [ "$(id -g)" != "${PGID:-1000}" ]; then - usermod -o -u "${PUID:-1000}" user - groupmod -o -g "${PGID:-1000}" user - chown -R user /home/user - sudo -u user /entrypoint $@ - exit 0 -fi - cd $HOME/rustdesk . $HOME/.cargo/env From 1ddd5203e58ac2f8ee0dd5e58b10bf8d3eb39be0 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Wed, 20 Oct 2021 17:03:48 +0800 Subject: [PATCH 19/34] fix overflow --- src/common.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/common.rs b/src/common.rs index f67751236..e5a7e4f99 100644 --- a/src/common.rs +++ b/src/common.rs @@ -1,6 +1,6 @@ pub use arboard::Clipboard as ClipboardContext; use hbb_common::{ - allow_err, + allow_err, bail, compress::{compress as compress_func, decompress}, config::{Config, COMPRESS_LEVEL, RENDEZVOUS_TIMEOUT}, log, @@ -240,6 +240,10 @@ async fn test_nat_type_() -> ResultType { let rendezvous_server = get_rendezvous_server(100).await; let server1 = rendezvous_server; let mut server2 = server1; + if server1.port() == 0 { // offline + // avoid overflow crash + bail!("Offline"); + } server2.set_port(server1.port() - 1); let mut msg_out = RendezvousMessage::new(); let serial = Config::get_serial(); From 8f222737592d8438562cee4f6d8df75825a3df49 Mon Sep 17 00:00:00 2001 From: RustDesk <71636191+rustdesk@users.noreply.github.com> Date: Thu, 21 Oct 2021 10:00:53 +0800 Subject: [PATCH 20/34] Update ci.yml --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d9cfdbc9b..cd8282187 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,7 +78,7 @@ jobs: shell: bash run: | case ${{ matrix.job.target }} in - x86_64-unknown-linux-gnu) sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake ;; + x86_64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake ;; # arm-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;; # aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;; esac @@ -178,4 +178,4 @@ jobs: # with: # use-cross: ${{ matrix.job.use-cross }} # command: test - # args: --locked --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}} \ No newline at end of file + # args: --locked --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}} From 1bf80e3dd6f1fb39ac2e1599beffdd3b8ed4b214 Mon Sep 17 00:00:00 2001 From: cc-morning <90960002+cc-morning@users.noreply.github.com> Date: Fri, 22 Oct 2021 16:02:01 +0800 Subject: [PATCH 21/34] Optimize clipboard change listener --- Cargo.lock | 43 +++++++++++++++++++++++++++++++++ Cargo.toml | 1 + src/server/clipboard_service.rs | 22 ++++++++++++++++- src/server/service.rs | 34 ++++++++++++++++++++++++++ 4 files changed, 99 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index c3e139e8e..359e344bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -352,6 +352,20 @@ dependencies = [ "vec_map", ] +[[package]] +name = "clipboard-master" +version = "3.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cd1cb2f0df685eb4a61c656faeb6ef391ad776943d3723afb12bdcbceff824d" +dependencies = [ + "objc", + "objc-foundation", + "objc_id", + "winapi 0.3.9", + "windows-win", + "x11-clipboard", +] + [[package]] name = "clipboard-win" version = "4.2.1" @@ -2860,6 +2874,7 @@ dependencies = [ "cc", "cfg-if 1.0.0", "clap", + "clipboard-master", "cocoa", "core-foundation 0.9.1", "core-graphics", @@ -3771,6 +3786,15 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "windows-win" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d4243ec23afe4e9b4e668b3c0a0e973f1b8265f6a46223cfcbc16fd267480c0" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "winreg" version = "0.6.2" @@ -3814,6 +3838,15 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" +[[package]] +name = "x11-clipboard" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b397ace6e980510de59a4fe3d4c758dffab231d6d747ce9fa1aba6b6035d5f32" +dependencies = [ + "xcb", +] + [[package]] name = "x11rb" version = "0.8.1" @@ -3826,6 +3859,16 @@ dependencies = [ "winapi-wsapoll", ] +[[package]] +name = "xcb" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62056f63138b39116f82a540c983cc11f1c90cd70b3d492a70c25eaa50bd22a6" +dependencies = [ + "libc", + "log", +] + [[package]] name = "yansi" version = "0.5.0" diff --git a/Cargo.toml b/Cargo.toml index 75504a06f..b4b8ad48c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,6 +51,7 @@ mac_address = "1.1" sciter-rs = { git = "https://github.com/open-trade/rust-sciter", branch = "dyn" } ctrlc = "3.2" arboard = "2.0" +clipboard-master = "3" [target.'cfg(target_os = "windows")'.dependencies] #systray = { git = "https://github.com/open-trade/systray-rs" } diff --git a/src/server/clipboard_service.rs b/src/server/clipboard_service.rs index 25597d11c..3e94d2824 100644 --- a/src/server/clipboard_service.rs +++ b/src/server/clipboard_service.rs @@ -1,3 +1,7 @@ +use std::sync::mpsc::Sender; + +use clipboard_master::{CallbackResult, ClipboardHandler, Master}; + use super::*; pub use crate::common::{ check_clipboard, ClipboardContext, CLIPBOARD_INTERVAL as INTERVAL, CLIPBOARD_NAME as NAME, @@ -27,12 +31,28 @@ impl super::service::Reset for State { } } +struct ClipHandle { + tx: Sender, +} + +impl ClipboardHandler for ClipHandle { + fn on_clipboard_change(&mut self) -> CallbackResult { + let _ = self.tx.send(true); + CallbackResult::Next + } +} + pub fn new() -> GenericService { let sp = GenericService::new(NAME, true); - sp.repeat::(INTERVAL, run); + sp.listen::(notify, run); sp } +fn notify(tx: Sender) -> ResultType<()> { + Master::new(ClipHandle { tx }).run()?; + Ok(()) +} + fn run(sp: GenericService, state: &mut State) -> ResultType<()> { if let Some(ctx) = state.ctx.as_mut() { if let Some(msg) = check_clipboard(ctx, None) { diff --git a/src/server/service.rs b/src/server/service.rs index b60f5a8d4..3e8c840a2 100644 --- a/src/server/service.rs +++ b/src/server/service.rs @@ -1,5 +1,6 @@ use super::*; use std::{ + sync::{self, mpsc::Sender}, thread::{self, JoinHandle}, time, }; @@ -153,6 +154,39 @@ impl> ServiceTmpl { } } + pub fn listen(&self, notify: N, callback: F) + where + N: 'static + FnMut(Sender) -> ResultType<()> + Send, + F: 'static + FnMut(Self, &mut S) -> ResultType<()> + Send, + S: 'static + Default + Reset, + { + let mut notify = notify; + let mut callback = callback; + let sp = self.clone(); + let (tx, rx) = sync::mpsc::channel(); + thread::spawn(move || { + let _ = notify(tx); + }); + + let thread = thread::spawn(move || { + let mut state = S::default(); + while let Ok(changed) = rx.recv() { + if changed && sp.active() { + if sp.has_subscribes() { + if let Err(err) = callback(sp.clone(), &mut state) { + log::error!("Error of {} service: {}", sp.name(), err); + #[cfg(windows)] + crate::platform::windows::try_change_desktop(); + } + } else { + state.reset(); + } + } + } + }); + self.0.write().unwrap().handle = Some(thread); + } + pub fn repeat(&self, interval_ms: u64, callback: F) where F: 'static + FnMut(Self, &mut S) -> ResultType<()> + Send, From 972ec8d79d02ed68938b0a5825ae7f6fccd42bc5 Mon Sep 17 00:00:00 2001 From: cc-morning <90960002+cc-morning@users.noreply.github.com> Date: Sun, 24 Oct 2021 23:47:02 +0800 Subject: [PATCH 22/34] Fix missing clipboard content --- src/server/clipboard_service.rs | 82 +++++++++++++++++++-------------- src/server/service.rs | 34 -------------- 2 files changed, 48 insertions(+), 68 deletions(-) diff --git a/src/server/clipboard_service.rs b/src/server/clipboard_service.rs index 3e94d2824..a0711c8d9 100644 --- a/src/server/clipboard_service.rs +++ b/src/server/clipboard_service.rs @@ -1,12 +1,11 @@ -use std::sync::mpsc::Sender; - -use clipboard_master::{CallbackResult, ClipboardHandler, Master}; - use super::*; pub use crate::common::{ check_clipboard, ClipboardContext, CLIPBOARD_INTERVAL as INTERVAL, CLIPBOARD_NAME as NAME, CONTENT, }; +use clipboard_master::{CallbackResult, ClipboardHandler, Master}; +use hbb_common::ResultType; +use std::{sync, sync::mpsc::Sender, thread}; struct State { ctx: Option, @@ -31,41 +30,56 @@ impl super::service::Reset for State { } } -struct ClipHandle { - tx: Sender, -} - -impl ClipboardHandler for ClipHandle { - fn on_clipboard_change(&mut self) -> CallbackResult { - let _ = self.tx.send(true); - CallbackResult::Next - } -} - pub fn new() -> GenericService { let sp = GenericService::new(NAME, true); - sp.listen::(notify, run); + sp.run::<_>(listen::run); sp } -fn notify(tx: Sender) -> ResultType<()> { - Master::new(ClipHandle { tx }).run()?; - Ok(()) -} +mod listen { + use super::*; -fn run(sp: GenericService, state: &mut State) -> ResultType<()> { - if let Some(ctx) = state.ctx.as_mut() { - if let Some(msg) = check_clipboard(ctx, None) { - sp.send(msg); - } - sp.snapshot(|sps| { - let txt = crate::CONTENT.lock().unwrap().clone(); - if !txt.is_empty() { - let msg_out = crate::create_clipboard_msg(txt); - sps.send_shared(Arc::new(msg_out)); - } - Ok(()) - })?; + struct ClipHandle { + tx: Sender<()>, + } + + impl ClipboardHandler for ClipHandle { + fn on_clipboard_change(&mut self) -> CallbackResult { + let _ = self.tx.send(()); + CallbackResult::Next + } + } + + fn notify(tx: Sender<()>) -> ResultType<()> { + Master::new(ClipHandle { tx }).run()?; + Ok(()) + } + + pub fn run(sp: GenericService) -> ResultType<()> { + let mut state = State::default(); + let (tx, rx) = sync::mpsc::channel::<()>(); + thread::spawn(|| { + let _ = notify(tx); + }); + + while sp.ok() { + sp.snapshot(|sps| { + let txt = crate::CONTENT.lock().unwrap().clone(); + if !txt.is_empty() { + let msg_out = crate::create_clipboard_msg(txt); + sps.send_shared(Arc::new(msg_out)); + } + Ok(()) + })?; + + if let Ok(()) = rx.recv() { + if let Some(ctx) = state.ctx.as_mut() { + if let Some(msg) = check_clipboard(ctx, None) { + sp.send(msg); + } + } + } + } + Ok(()) } - Ok(()) } diff --git a/src/server/service.rs b/src/server/service.rs index 3e8c840a2..b60f5a8d4 100644 --- a/src/server/service.rs +++ b/src/server/service.rs @@ -1,6 +1,5 @@ use super::*; use std::{ - sync::{self, mpsc::Sender}, thread::{self, JoinHandle}, time, }; @@ -154,39 +153,6 @@ impl> ServiceTmpl { } } - pub fn listen(&self, notify: N, callback: F) - where - N: 'static + FnMut(Sender) -> ResultType<()> + Send, - F: 'static + FnMut(Self, &mut S) -> ResultType<()> + Send, - S: 'static + Default + Reset, - { - let mut notify = notify; - let mut callback = callback; - let sp = self.clone(); - let (tx, rx) = sync::mpsc::channel(); - thread::spawn(move || { - let _ = notify(tx); - }); - - let thread = thread::spawn(move || { - let mut state = S::default(); - while let Ok(changed) = rx.recv() { - if changed && sp.active() { - if sp.has_subscribes() { - if let Err(err) = callback(sp.clone(), &mut state) { - log::error!("Error of {} service: {}", sp.name(), err); - #[cfg(windows)] - crate::platform::windows::try_change_desktop(); - } - } else { - state.reset(); - } - } - } - }); - self.0.write().unwrap().handle = Some(thread); - } - pub fn repeat(&self, interval_ms: u64, callback: F) where F: 'static + FnMut(Self, &mut S) -> ResultType<()> + Send, From 5164f7691949d68befb058f38485663c2e3353d9 Mon Sep 17 00:00:00 2001 From: cc-morning <90960002+cc-morning@users.noreply.github.com> Date: Mon, 25 Oct 2021 16:25:23 +0800 Subject: [PATCH 23/34] Fix lost clipboard content again --- src/server/clipboard_service.rs | 81 +++++++++++++++++---------------- 1 file changed, 42 insertions(+), 39 deletions(-) diff --git a/src/server/clipboard_service.rs b/src/server/clipboard_service.rs index a0711c8d9..f972771c3 100644 --- a/src/server/clipboard_service.rs +++ b/src/server/clipboard_service.rs @@ -4,34 +4,25 @@ pub use crate::common::{ CONTENT, }; use clipboard_master::{CallbackResult, ClipboardHandler, Master}; -use hbb_common::ResultType; -use std::{sync, sync::mpsc::Sender, thread}; - -struct State { - ctx: Option, -} - -impl Default for State { - fn default() -> Self { - let ctx = match ClipboardContext::new() { - Ok(ctx) => Some(ctx), - Err(err) => { - log::error!("Failed to start {}: {}", NAME, err); - None - } - }; - Self { ctx } - } -} - -impl super::service::Reset for State { - fn reset(&mut self) { - *CONTENT.lock().unwrap() = Default::default(); - } -} +use hbb_common::{anyhow, ResultType}; +use std::{ + sync, + sync::mpsc::{Receiver, Sender}, + thread, + time::Duration, +}; pub fn new() -> GenericService { let sp = GenericService::new(NAME, true); + + thread::spawn(|| { + let (tx, rx) = sync::mpsc::channel(); + unsafe { + listen::RECEIVER = Some(rx); + } + let _ = listen::notify(tx); + }); + sp.run::<_>(listen::run); sp } @@ -39,6 +30,10 @@ pub fn new() -> GenericService { mod listen { use super::*; + pub(super) static mut RECEIVER: Option> = None; + static mut CTX: Option = None; + static WAIT: Duration = Duration::from_millis(1000); + struct ClipHandle { tx: Sender<()>, } @@ -50,19 +45,33 @@ mod listen { } } - fn notify(tx: Sender<()>) -> ResultType<()> { + pub fn notify(tx: Sender<()>) -> ResultType<()> { Master::new(ClipHandle { tx }).run()?; Ok(()) } pub fn run(sp: GenericService) -> ResultType<()> { - let mut state = State::default(); - let (tx, rx) = sync::mpsc::channel::<()>(); - thread::spawn(|| { - let _ = notify(tx); - }); + if unsafe { CTX.as_ref() }.is_none() { + match ClipboardContext::new() { + Ok(ctx) => unsafe { + CTX = Some(ctx); + }, + Err(err) => { + log::error!("Failed to start {}: {}", NAME, err); + return Err(anyhow::Error::from(err)); + } + }; + } while sp.ok() { + if let Ok(_) = unsafe { RECEIVER.as_ref() }.unwrap().recv_timeout(WAIT) { + if let Some(mut ctx) = unsafe { CTX.as_mut() } { + if let Some(msg) = check_clipboard(&mut ctx, None) { + sp.send(msg); + } + } + } + sp.snapshot(|sps| { let txt = crate::CONTENT.lock().unwrap().clone(); if !txt.is_empty() { @@ -71,15 +80,9 @@ mod listen { } Ok(()) })?; - - if let Ok(()) = rx.recv() { - if let Some(ctx) = state.ctx.as_mut() { - if let Some(msg) = check_clipboard(ctx, None) { - sp.send(msg); - } - } - } } + + *CONTENT.lock().unwrap() = Default::default(); Ok(()) } } From 318e3cbd7d61acc4a5bd34c7173d9e5b6abf3ac9 Mon Sep 17 00:00:00 2001 From: cc-morning <90960002+cc-morning@users.noreply.github.com> Date: Tue, 26 Oct 2021 16:59:31 +0800 Subject: [PATCH 24/34] Code Format --- src/server/clipboard_service.rs | 67 +++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 28 deletions(-) diff --git a/src/server/clipboard_service.rs b/src/server/clipboard_service.rs index f972771c3..cc470ec7e 100644 --- a/src/server/clipboard_service.rs +++ b/src/server/clipboard_service.rs @@ -8,19 +8,22 @@ use hbb_common::{anyhow, ResultType}; use std::{ sync, sync::mpsc::{Receiver, Sender}, - thread, + thread::{self}, time::Duration, }; pub fn new() -> GenericService { let sp = GenericService::new(NAME, true); + // Listening service needs to run for a long time, + // otherwise it will cause part of the content to + // be missed during the closure of the clipboard + // (during the closure, the content copied by the + // remote machine will be missed, and the clipboard + // will not be synchronized immediately when it is + // opened again), and CONTENT will not be updated thread::spawn(|| { - let (tx, rx) = sync::mpsc::channel(); - unsafe { - listen::RECEIVER = Some(rx); - } - let _ = listen::notify(tx); + let _ = listen::notify(); }); sp.run::<_>(listen::run); @@ -30,44 +33,52 @@ pub fn new() -> GenericService { mod listen { use super::*; - pub(super) static mut RECEIVER: Option> = None; + static mut CHANNEL: Option<(Sender<()>, Receiver<()>)> = None; static mut CTX: Option = None; - static WAIT: Duration = Duration::from_millis(1000); + static WAIT: Duration = Duration::from_millis(1500); - struct ClipHandle { - tx: Sender<()>, - } + struct ClipHandle; impl ClipboardHandler for ClipHandle { fn on_clipboard_change(&mut self) -> CallbackResult { - let _ = self.tx.send(()); + if let Some((tx, _rx)) = unsafe { CHANNEL.as_ref() } { + let _ = tx.send(()); + } CallbackResult::Next } } - pub fn notify(tx: Sender<()>) -> ResultType<()> { - Master::new(ClipHandle { tx }).run()?; + pub fn notify() -> ResultType<()> { + Master::new(ClipHandle).run()?; Ok(()) } pub fn run(sp: GenericService) -> ResultType<()> { - if unsafe { CTX.as_ref() }.is_none() { - match ClipboardContext::new() { - Ok(ctx) => unsafe { - CTX = Some(ctx); - }, - Err(err) => { - log::error!("Failed to start {}: {}", NAME, err); - return Err(anyhow::Error::from(err)); - } - }; + unsafe { + if CHANNEL.is_none() { + CHANNEL = Some(sync::mpsc::channel()); + } + + if CTX.is_none() { + match ClipboardContext::new() { + Ok(ctx) => { + CTX = Some(ctx); + } + Err(err) => { + log::error!("Failed to start {}: {}", NAME, err); + return Err(anyhow::Error::from(err)); + } + }; + } } while sp.ok() { - if let Ok(_) = unsafe { RECEIVER.as_ref() }.unwrap().recv_timeout(WAIT) { - if let Some(mut ctx) = unsafe { CTX.as_mut() } { - if let Some(msg) = check_clipboard(&mut ctx, None) { - sp.send(msg); + if let Some((_tx, rx)) = unsafe { CHANNEL.as_ref() } { + if let Ok(_) = rx.recv_timeout(WAIT) { + if let Some(mut ctx) = unsafe { CTX.as_mut() } { + if let Some(msg) = check_clipboard(&mut ctx, None) { + sp.send(msg); + } } } } From 0cf2db92391ce90115a8b68b44e5d581e0963016 Mon Sep 17 00:00:00 2001 From: cc-morning <90960002+cc-morning@users.noreply.github.com> Date: Wed, 27 Oct 2021 20:02:17 +0800 Subject: [PATCH 25/34] Clipboard listener lifecycle follows service --- src/server/clipboard_service.rs | 105 +++++++++++++++++--------------- 1 file changed, 56 insertions(+), 49 deletions(-) diff --git a/src/server/clipboard_service.rs b/src/server/clipboard_service.rs index cc470ec7e..811aebb7b 100644 --- a/src/server/clipboard_service.rs +++ b/src/server/clipboard_service.rs @@ -6,26 +6,16 @@ pub use crate::common::{ use clipboard_master::{CallbackResult, ClipboardHandler, Master}; use hbb_common::{anyhow, ResultType}; use std::{ - sync, - sync::mpsc::{Receiver, Sender}, - thread::{self}, + io, sync, + sync::{ + atomic::{AtomicBool, Ordering}, + mpsc::SyncSender, + }, time::Duration, }; pub fn new() -> GenericService { let sp = GenericService::new(NAME, true); - - // Listening service needs to run for a long time, - // otherwise it will cause part of the content to - // be missed during the closure of the clipboard - // (during the closure, the content copied by the - // remote machine will be missed, and the clipboard - // will not be synchronized immediately when it is - // opened again), and CONTENT will not be updated - thread::spawn(|| { - let _ = listen::notify(); - }); - sp.run::<_>(listen::run); sp } @@ -33,53 +23,56 @@ pub fn new() -> GenericService { mod listen { use super::*; - static mut CHANNEL: Option<(Sender<()>, Receiver<()>)> = None; - static mut CTX: Option = None; + static RUNNING: AtomicBool = AtomicBool::new(true); static WAIT: Duration = Duration::from_millis(1500); - struct ClipHandle; + struct ClipHandle { + tx: SyncSender<()>, + } impl ClipboardHandler for ClipHandle { fn on_clipboard_change(&mut self) -> CallbackResult { - if let Some((tx, _rx)) = unsafe { CHANNEL.as_ref() } { - let _ = tx.send(()); + if !RUNNING.load(Ordering::SeqCst) { + return CallbackResult::Stop; } + + let _ = self.tx.send(()); CallbackResult::Next } - } - pub fn notify() -> ResultType<()> { - Master::new(ClipHandle).run()?; - Ok(()) - } - - pub fn run(sp: GenericService) -> ResultType<()> { - unsafe { - if CHANNEL.is_none() { - CHANNEL = Some(sync::mpsc::channel()); - } - - if CTX.is_none() { - match ClipboardContext::new() { - Ok(ctx) => { - CTX = Some(ctx); - } - Err(err) => { - log::error!("Failed to start {}: {}", NAME, err); - return Err(anyhow::Error::from(err)); - } - }; + fn on_clipboard_error(&mut self, error: io::Error) -> CallbackResult { + if !RUNNING.load(Ordering::SeqCst) { + CallbackResult::Stop + } else { + CallbackResult::StopWithError(error) } } + } + + #[tokio::main] + pub async fn run(sp: GenericService) -> ResultType<()> { + let mut ctx = match ClipboardContext::new() { + Ok(ctx) => ctx, + Err(err) => { + log::error!("Failed to start {}: {}", NAME, err); + return Err(anyhow::Error::from(err)); + } + }; + + if !RUNNING.load(Ordering::SeqCst) { + RUNNING.store(true, Ordering::SeqCst); + } + + let (tx, rx) = sync::mpsc::sync_channel(12); + let listener = tokio::spawn(async { + log::info!("Clipboard listener running!"); + let _ = Master::new(ClipHandle { tx }).run(); + }); while sp.ok() { - if let Some((_tx, rx)) = unsafe { CHANNEL.as_ref() } { - if let Ok(_) = rx.recv_timeout(WAIT) { - if let Some(mut ctx) = unsafe { CTX.as_mut() } { - if let Some(msg) = check_clipboard(&mut ctx, None) { - sp.send(msg); - } - } + if let Ok(_) = rx.recv_timeout(WAIT) { + if let Some(msg) = check_clipboard(&mut ctx, None) { + sp.send(msg); } } @@ -93,7 +86,21 @@ mod listen { })?; } + { + RUNNING.store(false, Ordering::SeqCst); + trigger(&mut ctx); + let _ = listener.await; + log::info!("Clipboard listener stopped!"); + } + *CONTENT.lock().unwrap() = Default::default(); Ok(()) } + + fn trigger(ctx: &mut ClipboardContext) { + let _ = match ctx.get_text() { + Ok(text) => ctx.set_text(text), + Err(_) => ctx.set_text(Default::default()), + }; + } } From 231231e51f5310c719a8c41e6abdf3d697a5d5a1 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Sat, 30 Oct 2021 14:03:33 +0800 Subject: [PATCH 26/34] refactor --- src/server/clipboard_service.rs | 10 ++++------ src/ui/file_transfer.tis | 6 ------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/server/clipboard_service.rs b/src/server/clipboard_service.rs index 811aebb7b..be496c859 100644 --- a/src/server/clipboard_service.rs +++ b/src/server/clipboard_service.rs @@ -86,12 +86,10 @@ mod listen { })?; } - { - RUNNING.store(false, Ordering::SeqCst); - trigger(&mut ctx); - let _ = listener.await; - log::info!("Clipboard listener stopped!"); - } + RUNNING.store(false, Ordering::SeqCst); + trigger(&mut ctx); + let _ = listener.await; + log::info!("Clipboard listener stopped!"); *CONTENT.lock().unwrap() = Default::default(); Ok(()) diff --git a/src/ui/file_transfer.tis b/src/ui/file_transfer.tis index 74eaf2b69..9c67d79ba 100644 --- a/src/ui/file_transfer.tis +++ b/src/ui/file_transfer.tis @@ -25,12 +25,6 @@ var svg_computer = ; -const TYPE_DIR = 1; -const TYPE_DIR_LINK = 2; -const TYPE_DIR_DRIVE = 3; -const TYPE_FILE = 4; -const TYPE_FILE_LINK = 5; - function getSize(type, size) { if (!size) { if (type <= 3) return ""; From e6bd5b06989964fb8f6dda425d727575a54f7f36 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Sun, 7 Nov 2021 10:18:10 +0800 Subject: [PATCH 27/34] pb in version --- libs/hbb_common/protos/rendezvous.proto | 3 +++ src/rendezvous_mediator.rs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/libs/hbb_common/protos/rendezvous.proto b/libs/hbb_common/protos/rendezvous.proto index bd058ac4d..1a1671ce1 100644 --- a/libs/hbb_common/protos/rendezvous.proto +++ b/libs/hbb_common/protos/rendezvous.proto @@ -48,6 +48,7 @@ message PunchHoleSent { string id = 2; string relay_server = 3; NatType nat_type = 4; + string version = 5; } message RegisterPk { @@ -110,6 +111,7 @@ message RelayResponse { bytes pk = 5; } string refuse_reason = 6; + string version = 7; } message SoftwareUpdate { string url = 1; } @@ -128,6 +130,7 @@ message LocalAddr { bytes local_addr = 2; string relay_server = 3; string id = 4; + string version = 5; } message RendezvousMessage { diff --git a/src/rendezvous_mediator.rs b/src/rendezvous_mediator.rs index 13f0f605c..9e1554c6c 100644 --- a/src/rendezvous_mediator.rs +++ b/src/rendezvous_mediator.rs @@ -285,6 +285,7 @@ impl RendezvousMediator { let mut msg_out = Message::new(); let mut rr = RelayResponse { socket_addr, + version: crate::VERSION.to_owned(), ..Default::default() }; if initiate { @@ -321,6 +322,7 @@ impl RendezvousMediator { socket_addr: AddrMangle::encode(peer_addr), local_addr: AddrMangle::encode(local_addr), relay_server, + version: crate::VERSION.to_owned(), ..Default::default() }); let bytes = msg_out.write_to_bytes()?; @@ -359,6 +361,7 @@ impl RendezvousMediator { id: Config::get_id(), relay_server, nat_type: nat_type.into(), + version: crate::VERSION.to_owned(), ..Default::default() }); let bytes = msg_out.write_to_bytes()?; From 96208e9fef16e7d29749b65923c53114e2dd3c9a Mon Sep 17 00:00:00 2001 From: Arash Hatami Date: Sun, 14 Nov 2021 18:36:03 +0330 Subject: [PATCH 28/34] git ignore .vscode --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index cdf54e40b..a620ac0bd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /target +.vscode .idea .DS_Store src/ui/inline.rs From 7f13edd14a36e76cfec0e05e1ec85b7840f972fe Mon Sep 17 00:00:00 2001 From: Arash Hatami Date: Sun, 14 Nov 2021 18:52:05 +0330 Subject: [PATCH 29/34] Fix misspelled words --- libs/hbb_common/protos/rendezvous.proto | 4 ++-- libs/hbb_common/src/fs.rs | 10 +++++----- libs/hbb_common/src/tcp.rs | 2 +- libs/hbb_common/src/udp.rs | 2 +- src/client.rs | 2 +- src/ipc.rs | 4 ++-- src/rendezvous_mediator.rs | 8 ++++---- src/ui.rs | 2 +- src/ui/remote.rs | 15 ++++++++------- src/windows.cc | 2 +- 10 files changed, 26 insertions(+), 25 deletions(-) diff --git a/libs/hbb_common/protos/rendezvous.proto b/libs/hbb_common/protos/rendezvous.proto index bd058ac4d..e38dbb84c 100644 --- a/libs/hbb_common/protos/rendezvous.proto +++ b/libs/hbb_common/protos/rendezvous.proto @@ -75,8 +75,8 @@ message PunchHoleResponse { enum Failure { ID_NOT_EXIST = 1; OFFLINE = 2; - LICENCE_MISMATCH = 3; - LICENCE_OVERUSE = 4; + LICENSE_MISMATCH = 3; + LICENSE_OVERUSE = 4; } Failure failure = 3; string relay_server = 4; diff --git a/libs/hbb_common/src/fs.rs b/libs/hbb_common/src/fs.rs index 2a3a6c9f4..99e594751 100644 --- a/libs/hbb_common/src/fs.rs +++ b/libs/hbb_common/src/fs.rs @@ -193,7 +193,7 @@ pub struct TransferJob { file: Option, total_size: u64, finished_size: u64, - transfered: u64, + transferred: u64, } #[inline] @@ -268,8 +268,8 @@ impl TransferJob { } #[inline] - pub fn transfered(&self) -> u64 { - self.transfered + pub fn transferred(&self) -> u64 { + self.transferred } #[inline] @@ -332,7 +332,7 @@ impl TransferJob { self.file.as_mut().unwrap().write_all(&block.data).await?; self.finished_size += block.data.len() as u64; } - self.transfered += block.data.len() as u64; + self.transferred += block.data.len() as u64; Ok(()) } @@ -398,7 +398,7 @@ impl TransferJob { compressed = true; } } - self.transfered += buf.len() as u64; + self.transferred += buf.len() as u64; } Ok(Some(FileTransferBlock { id: self.id, diff --git a/libs/hbb_common/src/tcp.rs b/libs/hbb_common/src/tcp.rs index a83ae36ab..0789c87f0 100644 --- a/libs/hbb_common/src/tcp.rs +++ b/libs/hbb_common/src/tcp.rs @@ -34,7 +34,7 @@ fn new_socket(addr: std::net::SocketAddr, reuse: bool) -> Result Result { if reuse { // windows has no reuse_port, but it's reuse_address // almost equals to unix's reuse_port + reuse_address, - // though may introduce nondeterministic bahavior + // though may introduce nondeterministic behavior #[cfg(unix)] socket.set_reuse_port(true)?; socket.set_reuse_address(true)?; diff --git a/src/client.rs b/src/client.rs index 0416e8582..4484a8f0a 100644 --- a/src/client.rs +++ b/src/client.rs @@ -141,7 +141,7 @@ impl Client { punch_hole_response::Failure::OFFLINE => { bail!("Remote desktop is offline"); } - punch_hole_response::Failure::LICENCE_MISMATCH => { + punch_hole_response::Failure::LICENSE_MISMATCH => { bail!("Key mismatch"); } _ => { diff --git a/src/ipc.rs b/src/ipc.rs index b4e11e40a..0474e457f 100644 --- a/src/ipc.rs +++ b/src/ipc.rs @@ -147,7 +147,7 @@ pub async fn new_listener(postfix: &str) -> ResultType { } Err(err) => { log::error!( - "Faild to start ipc{} server at path {}: {}", + "Failed to start ipc{} server at path {}: {}", postfix, path, err @@ -374,7 +374,7 @@ pub fn set_password(v: String) -> ResultType<()> { pub fn get_id() -> String { if let Ok(Some(v)) = get_config("id") { - // update salt also, so that nexttime reinstallation not causing first-time auto-login failure + // update salt also, so that next time reinstallation not causing first-time auto-login failure if let Ok(Some(v2)) = get_config("salt") { Config::set_salt(&v2); } diff --git a/src/rendezvous_mediator.rs b/src/rendezvous_mediator.rs index 13f0f605c..a89fca945 100644 --- a/src/rendezvous_mediator.rs +++ b/src/rendezvous_mediator.rs @@ -34,7 +34,7 @@ pub struct RendezvousMediator { host: String, host_prefix: String, rendezvous_servers: Vec, - last_id_pk_registery: String, + last_id_pk_registry: String, } impl RendezvousMediator { @@ -90,7 +90,7 @@ impl RendezvousMediator { host: host.clone(), host_prefix, rendezvous_servers, - last_id_pk_registery: "".to_owned(), + last_id_pk_registry: "".to_owned(), }; allow_err!(rz.dns_check()); let mut socket = FramedSocket::new(Config::get_any_listen_addr()).await?; @@ -377,7 +377,7 @@ impl RendezvousMediator { pk.clone() }; let id = Config::get_id(); - self.last_id_pk_registery = id.clone(); + self.last_id_pk_registry = id.clone(); msg_out.set_register_pk(RegisterPk { id, uuid, @@ -389,7 +389,7 @@ impl RendezvousMediator { } async fn handle_uuid_mismatch(&mut self, socket: &mut FramedSocket) -> ResultType<()> { - if self.last_id_pk_registery != Config::get_id() { + if self.last_id_pk_registry != Config::get_id() { return Ok(()); } { diff --git a/src/ui.rs b/src/ui.rs index 15c2bc9ee..dc229067f 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -621,7 +621,7 @@ pub fn check_zombie(childs: Childs) { } } -// notice: avoiding create ipc connecton repeatly, +// notice: avoiding create ipc connection repeatedly, // because windows named pipe has serious memory leak issue. #[tokio::main(flavor = "current_thread")] async fn check_connect_status_( diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 8cd4b09d8..8c82ce4d5 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -694,8 +694,8 @@ impl Handler { let mut key_event = KeyEvent::new(); if down_or_up == 2 { /* windows send both keyup/keydown and keychar, so here we avoid keychar - for <= 0xFF, best practise should only avoid those not on keyboard, but - for now, we have no way to test, so avoid <= 0xFF totaly + for <= 0xFF, best practice should only avoid those not on keyboard, but + for now, we have no way to test, so avoid <= 0xFF totally */ if code <= 0xFF { return None; @@ -891,7 +891,8 @@ impl Handler { let mut name = name; #[cfg(target_os = "linux")] - if code == 65383 { // VK_MENU + if code == 65383 { + // VK_MENU name = "Apps".to_owned(); } @@ -1435,16 +1436,16 @@ impl Remote { if elapsed <= 0 { return; } - let transfered = job.transfered(); - let last_transfered = { + let transferred = job.transferred(); + let last_transferred = { if let Some(v) = last_update_jobs_status.1.get(&job.id()) { v.to_owned() } else { 0 } }; - last_update_jobs_status.1.insert(job.id(), transfered); - let speed = (transfered - last_transfered) as f64 / (elapsed as f64 / 1000.); + last_update_jobs_status.1.insert(job.id(), transferred); + let speed = (transferred - last_transferred) as f64 / (elapsed as f64 / 1000.); let file_num = job.file_num() - 1; handler.call( "jobProgress", diff --git a/src/windows.cc b/src/windows.cc index e9a7294cd..162c8a0a7 100644 --- a/src/windows.cc +++ b/src/windows.cc @@ -89,7 +89,7 @@ extern "C" CreateEnvironmentBlock(&lpEnvironment, // Environment block hToken, // New token - TRUE); // Inheritence + TRUE); // Inheritance } if (lpEnvironment) { From 2758f6b7d583cc3f334f039796e3fc8e7718a59f Mon Sep 17 00:00:00 2001 From: Arash Hatami Date: Sun, 14 Nov 2021 19:01:34 +0330 Subject: [PATCH 30/34] Fix misspelled words --- src/platform/windows.rs | 6 +++--- src/server/connection.rs | 14 +++++++------- src/server/service.rs | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/platform/windows.rs b/src/platform/windows.rs index 4fc134914..074b3ccd1 100644 --- a/src/platform/windows.rs +++ b/src/platform/windows.rs @@ -546,7 +546,7 @@ async fn launch_server(session_id: DWORD, close_first: bool) -> ResultType> = Arc::new(Mutex::new(Instant::now())); + static ref SUPPRESS: Arc> = Arc::new(Mutex::new(Instant::now())); } pub fn desktop_changed() -> bool { @@ -617,7 +617,7 @@ pub fn try_change_desktop() -> bool { if inputDesktopSelected() == FALSE { let res = selectInputDesktop() == TRUE; if !res { - let mut s = SUPRESS.lock().unwrap(); + let mut s = SUPPRESS.lock().unwrap(); if s.elapsed() > std::time::Duration::from_secs(3) { log::error!("Failed to switch desktop: {}", get_error()); *s = Instant::now(); diff --git a/src/server/connection.rs b/src/server/connection.rs index 0ed2338d5..e8eae4fe1 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -120,13 +120,13 @@ impl Connection { return; } if !conn.keyboard { - conn.send_permisssion(Permission::Keyboard, false).await; + conn.send_permission(Permission::Keyboard, false).await; } if !conn.clipboard { - conn.send_permisssion(Permission::Clipboard, false).await; + conn.send_permission(Permission::Clipboard, false).await; } if !conn.audio { - conn.send_permisssion(Permission::Audio, false).await; + conn.send_permission(Permission::Audio, false).await; } let mut test_delay_timer = time::interval_at(Instant::now() + TEST_DELAY_TIMEOUT, TEST_DELAY_TIMEOUT); @@ -164,7 +164,7 @@ impl Connection { log::info!("Change permission {} -> {}", name, enabled); if &name == "keyboard" { conn.keyboard = enabled; - conn.send_permisssion(Permission::Keyboard, enabled).await; + conn.send_permission(Permission::Keyboard, enabled).await; if let Some(s) = conn.server.upgrade() { s.write().unwrap().subscribe( NAME_CURSOR, @@ -172,7 +172,7 @@ impl Connection { } } else if &name == "clipboard" { conn.clipboard = enabled; - conn.send_permisssion(Permission::Clipboard, enabled).await; + conn.send_permission(Permission::Clipboard, enabled).await; if let Some(s) = conn.server.upgrade() { s.write().unwrap().subscribe( super::clipboard_service::NAME, @@ -180,7 +180,7 @@ impl Connection { } } else if &name == "audio" { conn.audio = enabled; - conn.send_permisssion(Permission::Audio, enabled).await; + conn.send_permission(Permission::Audio, enabled).await; if let Some(s) = conn.server.upgrade() { s.write().unwrap().subscribe( super::audio_service::NAME, @@ -331,7 +331,7 @@ impl Connection { } } - async fn send_permisssion(&mut self, permission: Permission, enabled: bool) { + async fn send_permission(&mut self, permission: Permission, enabled: bool) { let mut misc = Misc::new(); misc.set_permission_info(PermissionInfo { permission: permission.into(), diff --git a/src/server/service.rs b/src/server/service.rs index b60f5a8d4..150cccb75 100644 --- a/src/server/service.rs +++ b/src/server/service.rs @@ -34,7 +34,7 @@ pub trait Reset { pub struct ServiceTmpl>(Arc>>); pub struct ServiceSwap>(ServiceTmpl); pub type GenericService = ServiceTmpl; -pub const HIBERATE_TIMEOUT: u64 = 30; +pub const HIBERNATE_TIMEOUT: u64 = 30; pub const MAX_ERROR_TIMEOUT: u64 = 1_000; impl> ServiceInner { @@ -191,7 +191,7 @@ impl> ServiceTmpl { let sp = self.clone(); let mut callback = callback; let thread = thread::spawn(move || { - let mut error_timeout = HIBERATE_TIMEOUT; + let mut error_timeout = HIBERNATE_TIMEOUT; while sp.active() { if sp.has_subscribes() { log::debug!("Enter {} service inner loop", sp.name()); @@ -199,7 +199,7 @@ impl> ServiceTmpl { if let Err(err) = callback(sp.clone()) { log::error!("Error of {} service: {}", sp.name(), err); if tm.elapsed() > time::Duration::from_millis(MAX_ERROR_TIMEOUT) { - error_timeout = HIBERATE_TIMEOUT; + error_timeout = HIBERNATE_TIMEOUT; } else { error_timeout *= 2; } @@ -213,7 +213,7 @@ impl> ServiceTmpl { log::debug!("Exit {} service inner loop", sp.name()); } } - thread::sleep(time::Duration::from_millis(HIBERATE_TIMEOUT)); + thread::sleep(time::Duration::from_millis(HIBERNATE_TIMEOUT)); } }); self.0.write().unwrap().handle = Some(thread); From 7964afeb84d839f28bce4a49973ea883f325f080 Mon Sep 17 00:00:00 2001 From: cxl Date: Sun, 21 Nov 2021 22:45:12 +0800 Subject: [PATCH 31/34] resolution changed, no need to reconnect Signed-off-by: cxl --- src/server/video_service.rs | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/server/video_service.rs b/src/server/video_service.rs index fe3797930..1d698b9df 100644 --- a/src/server/video_service.rs +++ b/src/server/video_service.rs @@ -43,6 +43,36 @@ pub fn new() -> GenericService { sp } +fn check_display_changed( + last_n: usize, + last_current: usize, + last_width: usize, + last_hegiht: usize, +) -> bool { + let displays = match Display::all() { + Ok(d) => d, + _ => return false, + }; + + let n = displays.len(); + if n != last_n { + return true; + }; + + for (i, d) in displays.iter().enumerate() { + if d.is_primary() { + if i != last_current { + return true; + }; + if d.width() != last_width || d.height() != last_hegiht { + return true; + }; + } + } + + return false; +} + fn run(sp: GenericService) -> ResultType<()> { let fps = 30; let spf = time::Duration::from_secs_f32(1. / (fps as f32)); @@ -161,6 +191,12 @@ fn run(sp: GenericService) -> ResultType<()> { continue; } Err(err) => { + if check_display_changed(ndisplay, current, width, height) { + log::info!("Displays changed"); + *SWITCH.lock().unwrap() = true; + bail!("SWITCH"); + } + return Err(err.into()); } } From 5a1ab371718be5b3f193fce6a1a13a1adcece421 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Mon, 22 Nov 2021 01:38:58 +0800 Subject: [PATCH 32/34] FI --- README-FI.md | 161 +++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 2 +- 2 files changed, 162 insertions(+), 1 deletion(-) create mode 100644 README-FI.md diff --git a/README-FI.md b/README-FI.md new file mode 100644 index 000000000..380ad4f4f --- /dev/null +++ b/README-FI.md @@ -0,0 +1,161 @@ +

+ RustDesk - Etätyöpöytäsi
+ Palvelimet • + Rakenna • + Docker • + Rakenne • + Tilannevedos
+ [中文] | [Español] | [Français] | [Deutsch] | [Polski] | [日本語] | [Русский] | [Português] | [a href="README-FI.md">suomi]
+ Tarvitsemme apua tämän README-tiedoston kääntämiseksi äidinkielellesi +

+ +Juttele meidän kanssa: [Discord](https://discord.gg/nDceKgxnkV) | [Reddit](https://www.reddit.com/r/rustdesk) + +[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/I2I04VU09) + +Vielä yksi etätyöpöytäohjelmisto, ohjelmoitu Rust-kielellä. Toimii suoraan pakkauksesta, ei tarvitse asetuksia. Hallitset täysin tietojasi, ei tarvitse murehtia turvallisuutta. Voit käyttää meidän rendezvous/relay-palvelinta, [aseta omasi](https://rustdesk.com/blog/id-relay-set/), tai [kirjoita oma rendezvous/relay-palvelin](https://github.com/rustdesk/rustdesk-server-demo). + +RustDesk toivottaa avustukset tervetulleiksi kaikilta. Katso lisätietoja [`CONTRIBUTING.md`](CONTRIBUTING.md) avun saamiseksi. + +[**BINAARILATAUS**](https://github.com/rustdesk/rustdesk/releases) + +## Vapaita julkisia palvelimia + +Alla on palvelimia, joita voit käyttää ilmaiseksi, ne saattavat muuttua ajan mittaan. Jos et ole lähellä yhtä näistä, verkkosi voi olla hidas. +| Sijainti | Myyjä | Määrittely | +| --------- | ------------- | ------------------ | +| Seoul | AWS lightsail | 1 VCPU / 0.5GB RAM | +| Singapore | Vultr | 1 VCPU / 1GB RAM | +| Dallas | Vultr | 1 VCPU / 1GB RAM | | + +## Riippuvuudet + +Desktop-versiot käyttävät [sciter](https://sciter.com/) graafisena käyttöliittymänä, lataa sciter-dynaaminen kirjasto itsellesi. + +[Windows](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.win/x64/sciter.dll) | +[Linux](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.lnx/x64/libsciter-gtk.so) | +[MacOS](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.osx/libsciter.dylib) + +## Rakentamisaskeleet harppoen + +- Valmistele Rust-kehitysympäristö ja C++-rakentamisympäristö + +- Asenna [vcpkg](https://github.com/microsoft/vcpkg), ja aseta `VCPKG_ROOT`-ympäristömuuttuja oikein + + - Windows: vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static + - Linux/MacOS: vcpkg install libvpx libyuv opus + +- aja `cargo run` + +## Kuinka rakentaa Linuxissa + +### Ubuntu 18 (Debian 10) + +```sh +sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake +``` + +### Fedora 28 (CentOS 8) + +```sh +sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb-devel libxdo-devel libXfixes-devel pulseaudio-libs-devel cmake alsa-lib-devel +``` + +### Arch (Manjaro) + +```sh +sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio +``` + +### Asenna vcpkg + +```sh +git clone https://github.com/microsoft/vcpkg +cd vcpkg +git checkout 134505003bb46e20fbace51ccfb69243fbbc5f82 +cd .. +vcpkg/bootstrap-vcpkg.sh +export VCPKG_ROOT=$HOME/vcpkg +vcpkg/vcpkg install libvpx libyuv opus +``` + +### Korjaa libvpx (Fedora-linux-versiota varten) + +```sh +cd vcpkg/buildtrees/libvpx/src +cd * +./configure +sed -i 's/CFLAGS+=-I/CFLAGS+=-fPIC -I/g' Makefile +sed -i 's/CXXFLAGS+=-I/CXXFLAGS+=-fPIC -I/g' Makefile +make +cp libvpx.a $HOME/vcpkg/installed/x64-linux/lib/ +cd +``` + +### Rakenna + +```sh +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +source $HOME/.cargo/env +git clone https://github.com/rustdesk/rustdesk +cd rustdesk +mkdir -p target/debug +wget https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.lnx/x64/libsciter-gtk.so +mv libsciter-gtk.so target/debug +VCPKG_ROOT=$HOME/vcpkg cargo run +``` + +### Vaihda Wayland-ympäristö X11 (Xorg)-ympäristöön + +RustDesk ei tue Waylandia. Tarkista [tämä](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/) asettamaan Xorg oletus GNOME-istuntona. + +## Kuinka rakennetaan Dockerin kanssa + +Aloita kloonaamalla tietovarasto ja rakentamalla docker-säiliö: + +```sh +git clone https://github.com/rustdesk/rustdesk +cd rustdesk +docker build -t "rustdesk-builder" . +``` + +Sitten, joka kerta kun sinun on rakennettava sovellus, aja seuraava komento: + +```sh +docker run --rm -it -v $PWD:/home/user/rustdesk -v rustdesk-git-cache:/home/user/.cargo/git -v rustdesk-registry-cache:/home/user/.cargo/registry -e PUID="$(id -u)" -e PGID="$(id -g)" rustdesk-builder +``` + +Huomaa, että ensimmäinen rakentaminen saattaa kestää pitempään ennen kuin riippuvuudet on siirretty välimuistiin, seuraavat rakentamiset ovat nopeampia. Lisäksi, jos sinun on määritettävä eri argumentteja rakentamiskomennolle, saatat tehdä sen niin, että komennon lopussa `-kohdassa. Esimerkiksi, jos haluat rakentaa optimoidun julkaisuversion, sinun on ajettava komento yllä siten, että sitä seuraa argumentti `---release`. Suoritettava tiedosto on saatavilla järjestelmäsi kohdehakemistossa, ja se voidaan suorittaa seuraavan kera: + +```sh +target/debug/rustdesk +``` + +Tai, jos olet suorittamassa jakeluversion suoritettavaa tiedostoa: + +```sh +target/release/rustdesk +``` + +Varmista, että suoritat näitä komentoja RustDesktop-tietovaraston juurihakemistossa, muutoin sovellus ei ehkä löydä vaadittuja resursseja. Huomaa myös, että muita cargo-alikomentoja kuten `install` tai `run` ei nykyisin tueta tässä menetelmässä, koska ne asentavat tai suorittavat ohjelman säiliön sisällä eikä isäntäohjelman sisällä. + +## Tiedostorakenne + +- **[libs/hbb_common](https://github.com/rustdesk/rustdesk/tree/master/libs/hbb_common)**: video codec, config, tcp/udp wrapper, protobuf, fs-funktiot tiedostosiirtoon, ja jotkut muut apuohjelmafunktiot +- **[libs/scrap](https://github.com/rustdesk/rustdesk/tree/master/libs/scrap)**: näyttökaappaukset +- **[libs/enigo](https://github.com/rustdesk/rustdesk/tree/master/libs/enigo)**: platform specific keyboard/mouse control +- **[src/ui](https://github.com/rustdesk/rustdesk/tree/master/src/ui)**: Graafinen käyttöliittymä +- **[src/server](https://github.com/rustdesk/rustdesk/tree/master/src/server)**: audio/clipboard/input/video services, and network connections +- **[src/client.rs](https://github.com/rustdesk/rustdesk/tree/master/src/client.rs)**: start a peer connection +- **[src/rendezvous_mediator.rs](https://github.com/rustdesk/rustdesk/tree/master/src/rendezvous_mediator.rs)**: Communicate with [rustdesk-server](https://github.com/rustdesk/rustdesk-server), wait for remote direct (TCP hole punching) or relayed connection +- **[src/platform](https://github.com/rustdesk/rustdesk/tree/master/src/platform)**: platform specific code + +## Tilannekuvat + +![image](https://user-images.githubusercontent.com/71636191/113112362-ae4deb80-923b-11eb-957d-ff88daad4f06.png) + +![image](https://user-images.githubusercontent.com/71636191/113112619-f705a480-923b-11eb-911d-97e984ef52b6.png) + +![image](https://user-images.githubusercontent.com/71636191/113112857-3fbd5d80-923c-11eb-9836-768325faf906.png) + +![image](https://user-images.githubusercontent.com/71636191/135385039-38fdbd72-379a-422d-b97f-33df71fb1cec.png) diff --git a/README.md b/README.md index f9cd7e6d8..a30576e34 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ DockerStructureSnapshot
- [中文] | [Español] | [Français] | [Deutsch] | [Polski] | [日本語] | [Русский] | [Português]
+ [中文] | [Español] | [Français] | [Deutsch] | [Polski] | [a href="README-FI.md">suomi] | [日本語] | [Русский] | [Português]
We need your help to translate this README to your native language

From 6afb6aaff2e09772162a9a293b27f4a5b4560007 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Mon, 22 Nov 2021 01:40:45 +0800 Subject: [PATCH 33/34] Fix on FI --- README-FI.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README-FI.md b/README-FI.md index 380ad4f4f..1c470fe66 100644 --- a/README-FI.md +++ b/README-FI.md @@ -5,7 +5,7 @@ DockerRakenneTilannevedos
- [中文] | [Español] | [Français] | [Deutsch] | [Polski] | [日本語] | [Русский] | [Português] | [a href="README-FI.md">suomi]
+ [中文] | [Español] | [Français] | [Deutsch] | [Polski] | [日本語] | [Русский] | [Português] | [suomi]
Tarvitsemme apua tämän README-tiedoston kääntämiseksi äidinkielellesi

diff --git a/README.md b/README.md index a30576e34..f20b0a582 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ DockerStructureSnapshot
- [中文] | [Español] | [Français] | [Deutsch] | [Polski] | [a href="README-FI.md">suomi] | [日本語] | [Русский] | [Português]
+ [中文] | [Español] | [Français] | [Deutsch] | [Polski] | [suomi] | [日本語] | [Русский] | [Português]
We need your help to translate this README to your native language

From b79f086df5180cec2ce53c5d2cbae5611874561c Mon Sep 17 00:00:00 2001 From: rustdesk Date: Mon, 22 Nov 2021 01:42:53 +0800 Subject: [PATCH 34/34] suomi -> Suomi --- README-FI.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README-FI.md b/README-FI.md index 1c470fe66..2c03425f8 100644 --- a/README-FI.md +++ b/README-FI.md @@ -5,7 +5,7 @@ DockerRakenneTilannevedos
- [中文] | [Español] | [Français] | [Deutsch] | [Polski] | [日本語] | [Русский] | [Português] | [suomi]
+ [中文] | [Español] | [Français] | [Deutsch] | [Polski] | [日本語] | [Русский] | [Português] | [Suomi]
Tarvitsemme apua tämän README-tiedoston kääntämiseksi äidinkielellesi

diff --git a/README.md b/README.md index f20b0a582..a9803c05f 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ DockerStructureSnapshot
- [中文] | [Español] | [Français] | [Deutsch] | [Polski] | [suomi] | [日本語] | [Русский] | [Português]
+ [中文] | [Español] | [Français] | [Deutsch] | [Polski] | [Suomi] | [日本語] | [Русский] | [Português]
We need your help to translate this README to your native language