Compare commits
57
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1ca09766c | ||
|
|
0aaf3a02bf | ||
|
|
eba0a6e552 | ||
|
|
3cb027a372 | ||
|
|
5217f32a12 | ||
|
|
c8cb6fb509 | ||
|
|
df9df7e914 | ||
|
|
acda5a73e2 | ||
|
|
04360797ad | ||
|
|
bb8083cb2f | ||
|
|
350966b331 | ||
|
|
d0a1af8c51 | ||
|
|
894f532835 | ||
|
|
eb23902450 | ||
|
|
59f2953c94 | ||
|
|
a5e986401c | ||
|
|
182356ee8b | ||
|
|
f96a44a019 | ||
|
|
1297da6d18 | ||
|
|
8814503e06 | ||
|
|
c8a4e0680c | ||
|
|
ed6a1acce8 | ||
|
|
4d37f00af9 | ||
|
|
21c488b6ce | ||
|
|
01e1323e51 | ||
|
|
106f700be4 | ||
|
|
f7b0af78cb | ||
|
|
25d2742273 | ||
|
|
eb6c32bd57 | ||
|
|
398364fa18 | ||
|
|
828d1101af | ||
|
|
3ec041644d | ||
|
|
d97351ad73 | ||
|
|
2b6fedfc8e | ||
|
|
f010d33ca6 | ||
|
|
bd92623972 | ||
|
|
4e93a41ecc | ||
|
|
ce54e33c71 | ||
|
|
2016f48dd7 | ||
|
|
b44b71cfab | ||
|
|
eef1096395 | ||
|
|
8b61033178 | ||
|
|
c29bef18bb | ||
|
|
c6258f4166 | ||
|
|
989beee17f | ||
|
|
4b1821d1ff | ||
|
|
3202d1764c | ||
|
|
c7f212df2c | ||
|
|
7f5a401947 | ||
|
|
bbffc1de5a | ||
|
|
4b92080e3e | ||
|
|
0cbeb04730 | ||
|
|
1042a26deb | ||
|
|
53996e3c40 | ||
|
|
e400bb7554 | ||
|
|
392188596c | ||
|
|
c0750fb50c |
Generated
+16
-15
@@ -3737,7 +3737,7 @@ dependencies = [
|
||||
"url",
|
||||
"users",
|
||||
"uuid",
|
||||
"webpki-roots 1.0.9",
|
||||
"webpki-roots 1.0.11",
|
||||
"webrtc",
|
||||
"whoami",
|
||||
"x11 2.21.0",
|
||||
@@ -3888,8 +3888,8 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
||||
|
||||
[[package]]
|
||||
name = "hwcodec"
|
||||
version = "0.7.1"
|
||||
source = "git+https://github.com/rustdesk-org/hwcodec#778df1f99597722473b29443bac22ae6c23946fe"
|
||||
version = "0.8.0"
|
||||
source = "git+https://github.com/rustdesk-org/hwcodec#ec38ebaf2454269d4c5668a57e3813c6e5541be7"
|
||||
dependencies = [
|
||||
"bindgen 0.59.2",
|
||||
"cc",
|
||||
@@ -3935,7 +3935,7 @@ dependencies = [
|
||||
"tokio",
|
||||
"tokio-rustls",
|
||||
"tower-service",
|
||||
"webpki-roots 1.0.9",
|
||||
"webpki-roots 1.0.11",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6930,7 +6930,7 @@ dependencies = [
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
"webpki-roots 1.0.9",
|
||||
"webpki-roots 1.0.11",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7041,7 +7041,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "rust-pulsectl"
|
||||
version = "0.2.12"
|
||||
source = "git+https://github.com/rustdesk-org/pulsectl#aa34dde499aa912a3abc5289cc0b547bd07dd6e2"
|
||||
source = "git+https://github.com/rustdesk-org/pulsectl#d2ec086b5770dce934a66956364d09df8cc9484c"
|
||||
dependencies = [
|
||||
"libpulse-binding",
|
||||
]
|
||||
@@ -7296,11 +7296,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustls-pki-types"
|
||||
version = "1.11.0"
|
||||
version = "1.15.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "917ce264624a4b4db1c364dcc35bfca9ded014d0a958cd47ad3e960e988ea51c"
|
||||
checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96"
|
||||
dependencies = [
|
||||
"web-time",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7332,9 +7333,9 @@ checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f"
|
||||
|
||||
[[package]]
|
||||
name = "rustls-webpki"
|
||||
version = "0.103.3"
|
||||
version = "0.103.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e4a72fe2bcf7a6ac6fd7d0b9e5cb68aeb7d4c0a0271730218b3e92d43b4eb435"
|
||||
checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281"
|
||||
dependencies = [
|
||||
"ring",
|
||||
"rustls-pki-types",
|
||||
@@ -9539,9 +9540,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "webpki-root-certs"
|
||||
version = "1.0.3"
|
||||
version = "1.0.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05d651ec480de84b762e7be71e6efa7461699c19d9e2c272c8d93455f567786e"
|
||||
checksum = "58ec80e73fd8baf57bf0d9615554c75348bda990d6d5bbeab964dd068319fecb"
|
||||
dependencies = [
|
||||
"rustls-pki-types",
|
||||
]
|
||||
@@ -9552,14 +9553,14 @@ version = "0.26.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9"
|
||||
dependencies = [
|
||||
"webpki-roots 1.0.9",
|
||||
"webpki-roots 1.0.11",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webpki-roots"
|
||||
version = "1.0.9"
|
||||
version = "1.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7dcd9d09a39985f5344844e66b0c530a33843579125f23e21e9f0f220850f22a"
|
||||
checksum = "f5f280bbb2b287bc8e7de7e3852945a0ff50d1bbcb5ed42b6c7a568c546df171"
|
||||
dependencies = [
|
||||
"rustls-pki-types",
|
||||
]
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<a href="#how-to-build-with-docker">Docker</a> •
|
||||
<a href="#file-structure">Structure</a> •
|
||||
<a href="#screenshots">Screenshots</a><br>
|
||||
[<a href="docs/README-UA.md">Українська</a>] | [<a href="docs/README-CS.md">česky</a>] | [<a href="docs/README-ZH.md">中文</a>] | [<a href="docs/README-HU.md">Magyar</a>] | [<a href="docs/README-ES.md">Español</a>] | [<a href="docs/README-FA.md">فارسی</a>] | [<a href="docs/README-FR.md">Français</a>] | [<a href="docs/README-DE.md">Deutsch</a>] | [<a href="docs/README-PL.md">Polski</a>] | [<a href="docs/README-ID.md">Indonesian</a>] | [<a href="docs/README-FI.md">Suomi</a>] | [<a href="docs/README-ML.md">മലയാളം</a>] | [<a href="docs/README-JP.md">日本語</a>] | [<a href="docs/README-NL.md">Nederlands</a>] | [<a href="docs/README-IT.md">Italiano</a>] | [<a href="docs/README-RU.md">Русский</a>] | [<a href="docs/README-PTBR.md">Português (Brasil)</a>] | [<a href="docs/README-EO.md">Esperanto</a>] | [<a href="docs/README-KR.md">한국어</a>] | [<a href="docs/README-AR.md">العربي</a>] | [<a href="docs/README-VN.md">Tiếng Việt</a>] | [<a href="docs/README-DA.md">Dansk</a>] | [<a href="docs/README-GR.md">Ελληνικά</a>] | [<a href="docs/README-TR.md">Türkçe</a>] | [<a href="docs/README-NO.md">Norsk</a>] | [<a href="docs/README-RO.md">Română</a>]<br>
|
||||
[<a href="docs/README-UA.md">Українська</a>] | [<a href="docs/README-CS.md">česky</a>] | [<a href="docs/README-ZH.md">中文</a>] | [<a href="docs/README-HU.md">Magyar</a>] | [<a href="docs/README-ES.md">Español</a>] | [<a href="docs/README-FA.md">فارسی</a>] | [<a href="docs/README-FR.md">Français</a>] | [<a href="docs/README-DE.md">Deutsch</a>] | [<a href="docs/README-PL.md">Polski</a>] | [<a href="docs/README-ID.md">Indonesian</a>] | [<a href="docs/README-FI.md">Suomi</a>] | [<a href="docs/README-ML.md">മലയാളം</a>] | [<a href="docs/README-JP.md">日本語</a>] | [<a href="docs/README-NL.md">Nederlands</a>] | [<a href="docs/README-IT.md">Italiano</a>] | [<a href="docs/README-RU.md">Русский</a>] | [<a href="docs/README-PTPT.md">Português (Portugal)</a>] | [<a href="docs/README-PTBR.md">Português (Brasil)</a>] | [<a href="docs/README-EO.md">Esperanto</a>] | [<a href="docs/README-KR.md">한국어</a>] | [<a href="docs/README-AR.md">العربي</a>] | [<a href="docs/README-VN.md">Tiếng Việt</a>] | [<a href="docs/README-DA.md">Dansk</a>] | [<a href="docs/README-GR.md">Ελληνικά</a>] | [<a href="docs/README-TR.md">Türkçe</a>] | [<a href="docs/README-NO.md">Norsk</a>] | [<a href="docs/README-RO.md">Română</a>]<br>
|
||||
<b>We need your help to translate this README, <a href="https://github.com/rustdesk/rustdesk/tree/master/src/lang">RustDesk UI</a> and <a href="https://github.com/rustdesk/doc.rustdesk.com">RustDesk Doc</a> to your native language</b>
|
||||
</p>
|
||||
|
||||
|
||||
@@ -2,7 +2,12 @@
|
||||
fn build_windows() {
|
||||
let file = "src/platform/windows.cc";
|
||||
let file2 = "src/platform/windows_delete_test_cert.cc";
|
||||
cc::Build::new().file(file).file(file2).compile("windows");
|
||||
let mut build = cc::Build::new();
|
||||
if !cfg!(feature = "flutter") {
|
||||
build.cpp(true).std("c++17").define("RUSTDESK_SCITER", None);
|
||||
println!("cargo:rerun-if-changed=flutter/windows/runner/service_control.h");
|
||||
}
|
||||
build.file(file).file(file2).compile("windows");
|
||||
println!("cargo:rustc-link-lib=WtsApi32");
|
||||
println!("cargo:rerun-if-changed={}", file);
|
||||
println!("cargo:rerun-if-changed={}", file2);
|
||||
|
||||
+8
-1
@@ -9,6 +9,10 @@
|
||||
<b>Kami membutuhkan bantuanmu untuk menterjemahkan file README dan <a href="https://github.com/rustdesk/rustdesk/tree/master/src/lang">RustDesk UI</a> ke Bahasa Indonesia</b>
|
||||
</p>
|
||||
|
||||
> [!Caution]
|
||||
> **Peringatan Penyalahgunaan:** <br>
|
||||
> Pengembang RustDesk tidak membenarkan atau mendukung penggunaan perangkat lunak ini yang tidak etis atau melanggar hukum. Penyalahgunaan, seperti akses tanpa izin, pengambilalihan kendali, atau pelanggaran privasi, sangat dilarang berdasarkan pedoman kami. Para pengembang tidak bertanggung jawab atas penyalahgunaan aplikasi ini.
|
||||
|
||||
Mari mengobrol bersama kami: [Discord](https://discord.gg/nDceKgxnkV) | [Twitter](https://twitter.com/rustdesk) | [Reddit](https://www.reddit.com/r/rustdesk) | [YouTube](https://www.youtube.com/@rustdesk)
|
||||
|
||||
[](https://rustdesk.com/pricing.html)
|
||||
@@ -30,6 +34,9 @@ RustDesk mengajak semua orang untuk ikut berkontribusi. Lihat [`docs/CONTRIBUTIN
|
||||
[<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png"
|
||||
alt="Get it on F-Droid"
|
||||
height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb)
|
||||
[<img src="https://flathub.org/api/badge?svg&locale=en"
|
||||
alt="Get it on Flathub"
|
||||
height="80">](https://flathub.org/apps/com.rustdesk.RustDesk)
|
||||
|
||||
## Dependensi
|
||||
|
||||
@@ -154,7 +161,7 @@ Harap pastikan bahwa kamu menjalankan perintah ini dari repositori root RustDesk
|
||||
- **[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)**: Komunikasi dengan [rustdesk-server](https://github.com/rustdesk/rustdesk-server), menunggu untuk remote direct (TCP hole punching) atau relayed connection
|
||||
- **[src/platform](https://github.com/rustdesk/rustdesk/tree/master/src/platform)**: kode khusus platform
|
||||
|
||||
- **[flutter](https://github.com/rustdesk/rustdesk/tree/master/flutter)**: kode Flutter untuk platform desktop dan perangkat seluler
|
||||
## Snapshots
|
||||
|
||||

|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
<p align="center">
|
||||
<img src="../res/logo-header.svg" alt="RustDesk - O seu ambiente de trabalho remoto"><br>
|
||||
<a href="#compilar">Compilar</a> •
|
||||
<a href="#como-compilar-com-o-docker">Docker</a> •
|
||||
<a href="#estrutura-de-ficheiros">Estrutura</a> •
|
||||
<a href="#capturas-de-ecrã">Capturas de Ecrã</a><br>
|
||||
[<a href="../README.md">Inglês</a>] | [<a href="README-UA.md">Ucraniano</a>] | [<a href="README-CS.md">Checo</a>] | [<a href="README-ZH.md">Chinês</a>] | [<a href="README-HU.md">Húngaro</a>] | [<a href="README-ES.md">Espanhol</a>] | [<a href="README-FA.md">Persa</a>] | [<a href="README-FR.md">Francês</a>] | [<a href="README-DE.md">Alemão</a>] | [<a href="README-PL.md">Polaco</a>] | [<a href="README-ID.md">Indonésio</a>] | [<a href="README-FI.md">Finlandês</a>] | [<a href="README-ML.md">Malaiala</a>] | [<a href="README-JP.md">Japonês</a>] | [<a href="README-NL.md">Holandês</a>] | [<a href="README-IT.md">Italiano</a>] | [<a href="README-RU.md">Russo</a>] | [<a href="README-EO.md">Esperanto</a>] | [<a href="README-KR.md">Coreano</a>] | [<a href="README-AR.md">Árabe</a>] | [<a href="README-VN.md">Vietnamita</a>] | [<a href="README-DA.md">Dinamarquês</a>] | [<a href="README-GR.md">Grego</a>] | [<a href="README-TR.md">Turco</a>] | [<a href="README-NO.md">Norueguês</a>] | [<a href="README-RO.md">Romeno</a>]<br>
|
||||
<b>Precisamos da sua ajuda para traduzir este README, a <a href="https://github.com/rustdesk/rustdesk/tree/master/src/lang">Interface do RustDesk</a> e a <a href="https://github.com/rustdesk/doc.rustdesk.com">Documentação do RustDesk</a> para o seu idioma nativo</b>
|
||||
</p>
|
||||
|
||||
> [!Caution]
|
||||
> **Aviso de Isenção de Responsabilidade por Uso Indevido:** <br>
|
||||
> Os programadores do RustDesk não toleram ou apoiam qualquer uso antiético ou ilegal deste software. O uso indevido, como acesso não autorizado, controlo ou invasão de privacidade, é estritamente contrário às nossas diretrizes. Os autores não se responsabilizam por qualquer uso indevido da aplicação.
|
||||
|
||||
|
||||
Converse connosco: [Discord](https://discord.gg/nDceKgxnkV) | [Twitter](https://twitter.com/rustdesk) | [Reddit](https://www.reddit.com/r/rustdesk) | [YouTube](https://www.youtube.com/@rustdesk)
|
||||
|
||||
[](https://rustdesk.com/pricing.html)
|
||||
|
||||
Mais uma solução de ambiente de trabalho remoto, escrita em Rust. Funciona imediatamente, sem necessidade de configuração. Tem controlo total dos seus dados, sem preocupações com a segurança. Pode usar o nosso servidor de ligação/retransmissão (rendezvous/relay), [configurar o seu próprio](https://rustdesk.com/server) ou [escrever o seu próprio servidor de ligação/retransmissão](https://github.com/rustdesk/rustdesk-server-demo).
|
||||
|
||||

|
||||
|
||||
O RustDesk agradece as contribuições de todos. Veja [CONTRIBUTING.md](CONTRIBUTING.md) para obter ajuda para começar.
|
||||
|
||||
[**Perguntas Frequentes (FAQ)**](https://github.com/rustdesk/rustdesk/wiki/FAQ)
|
||||
|
||||
[**DOWNLOAD DOS BINÁRIOS**](https://github.com/rustdesk/rustdesk/releases)
|
||||
|
||||
[**VERSÕES NIGHTLY (EM DESENVOLVIMENTO)**](https://github.com/rustdesk/rustdesk/releases/tag/nightly)
|
||||
|
||||
[<img src="https://f-droid.org/badge/get-it-on.png"
|
||||
alt="Transfira no F-Droid"
|
||||
height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb)
|
||||
[<img src="https://flathub.org/api/badge?svg&locale=en"
|
||||
alt="Transfira no Flathub"
|
||||
height="80">](https://flathub.org/apps/com.rustdesk.RustDesk)
|
||||
|
||||
## Dependências
|
||||
|
||||
As versões para ambiente de trabalho usam Flutter ou Sciter (descontinuado) para a interface gráfica (GUI). Este tutorial é apenas para o Sciter, por ser mais fácil e acessível para começar. Consulte o nosso [CI](https://github.com/rustdesk/rustdesk/blob/master/.github/workflows/flutter-build.yml) para instruções de compilação da versão Flutter.
|
||||
|
||||
Por favor transfira a biblioteca dinâmica do Sciter por conta própria.
|
||||
|
||||
[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)
|
||||
|
||||
## Passos básicos para compilar
|
||||
|
||||
- Prepare o seu ambiente de desenvolvimento Rust e o ambiente de compilação C++
|
||||
|
||||
- Instale o [vcpkg](https://github.com/microsoft/vcpkg) e configure a variável de ambiente `VCPKG_ROOT` corretamente
|
||||
|
||||
- Windows: `vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static aom:x64-windows-static`
|
||||
- Linux/macOS: `vcpkg install libvpx libyuv opus aom`
|
||||
|
||||
- Execute `cargo run`
|
||||
|
||||
## [Compilar](https://rustdesk.com/docs/en/dev/build/)
|
||||
|
||||
## Como Compilar no Linux
|
||||
|
||||
### Ubuntu 18 (Debian 10)
|
||||
|
||||
```sh
|
||||
sudo apt install -y zip 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 make libclang-dev ninja-build libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
|
||||
```
|
||||
|
||||
### openSUSE Tumbleweed
|
||||
|
||||
```sh
|
||||
sudo zypper install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb-devel libXfixes-devel cmake alsa-lib-devel gstreamer-devel gstreamer-plugins-base-devel xdotool-devel
|
||||
```
|
||||
|
||||
### 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 gstreamer1-devel gstreamer1-plugins-base-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 pipewire
|
||||
```
|
||||
|
||||
### Instalar o vcpkg
|
||||
|
||||
```sh
|
||||
git clone https://github.com/microsoft/vcpkg
|
||||
cd vcpkg
|
||||
git checkout 2023.04.15
|
||||
cd ..
|
||||
vcpkg/bootstrap-vcpkg.sh
|
||||
export VCPKG_ROOT=$HOME/vcpkg
|
||||
vcpkg/vcpkg install libvpx libyuv opus aom
|
||||
```
|
||||
|
||||
### Corrigir o libvpx (Para 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
|
||||
```
|
||||
|
||||
### Compilar
|
||||
|
||||
```sh
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||
source $HOME/.cargo/env
|
||||
git clone --recurse-submodules 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
|
||||
```
|
||||
|
||||
## Como compilar com o Docker
|
||||
|
||||
Comece por clonar o repositório e construir o contentor Docker:
|
||||
|
||||
```sh
|
||||
git clone https://github.com/rustdesk/rustdesk
|
||||
cd rustdesk
|
||||
git submodule update --init --recursive
|
||||
docker build -t "rustdesk-builder" .
|
||||
```
|
||||
|
||||
Depois, cada vez que precisar de compilar a aplicação, execute o seguinte comando:
|
||||
|
||||
```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
|
||||
```
|
||||
|
||||
Note que a primeira compilação pode demorar mais até que as dependências sejam armazenadas em cache, as compilações subsequentes serão mais rápidas. Além disso, se precisar especificar argumentos diferentes para o comando de compilação, poderá fazê-lo no final do comando na posição `<ARGUMENTOS-OPCIONAIS>`. Por exemplo, se quiser compilar uma versão de lançamento (release) otimizada, executaria o comando acima seguido de `--release`. O executável resultante estará disponível na pasta `target` do seu sistema e pode ser executado com:
|
||||
|
||||
```sh
|
||||
target/debug/rustdesk
|
||||
```
|
||||
|
||||
Ou, se estiver a correr o executável de lançamento:
|
||||
|
||||
```sh
|
||||
target/release/rustdesk
|
||||
```
|
||||
|
||||
Certifique-se de que executa estes comandos a partir da raiz do repositório do RustDesk, caso contrário a aplicação poderá não encontrar os recursos necessários. Note também que outros subcomandos do cargo, como `install` ou `run`, não são suportados atualmente por este método, pois instalariam ou executariam o programa dentro do contentor em vez de o fazerem no host.
|
||||
|
||||
## Estrutura de Ficheiros
|
||||
|
||||
- **[libs/hbb_common](https://github.com/rustdesk/rustdesk/tree/master/libs/hbb_common)**: codec de vídeo, configuração, wrapper TCP/UDP e algumas outras funções utilitárias partilhadas com o servidor
|
||||
- **[libs/base](https://github.com/rustdesk/rustdesk/tree/master/libs/base)**: protobuf, funções fs para transferência de ficheiros, código relacionado com o teclado e com a plataforma utilizado exclusivamente por esta aplicação
|
||||
- **[libs/scrap](https://github.com/rustdesk/rustdesk/tree/master/libs/scrap)**: captura de ecrã
|
||||
- **[libs/enigo](https://github.com/rustdesk/rustdesk/tree/master/libs/enigo)**: controlo de teclado/rato específico da plataforma.
|
||||
- **[libs/clipboard](https://github.com/rustdesk/rustdesk/tree/master/libs/clipboard)**: implementação de copiar e colar ficheiros para Windows, Linux e macOS.
|
||||
- **[src/ui](https://github.com/rustdesk/rustdesk/tree/master/src/ui)**: interface Sciter obsoleta (descontinuada).
|
||||
- **[src/server](https://github.com/rustdesk/rustdesk/tree/master/src/server)**: serviços de áudio, área de transferência, entrada e vídeo, e ligações de rede
|
||||
- **[src/client.rs](https://github.com/rustdesk/rustdesk/tree/master/src/client.rs)**: inicia uma ligação entre pares
|
||||
- **[src/rendezvous_mediator.rs](https://github.com/rustdesk/rustdesk/tree/master/src/rendezvous_mediator.rs)**: Comunica com o [rustdesk-server](https://github.com/rustdesk/rustdesk-server), aguarda por uma ligação direta remota (TCP hole punching) ou uma ligação retransmitida
|
||||
- **[src/platform](https://github.com/rustdesk/rustdesk/tree/master/src/platform)**: código específico da plataforma
|
||||
- **[flutter](https://github.com/rustdesk/rustdesk/tree/master/flutter)**: código Flutter para ambiente de trabalho e dispositivos móveis
|
||||
|
||||
## Capturas de Ecrã
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
@@ -0,0 +1,41 @@
|
||||
package com.carriez.flutter_hbb
|
||||
|
||||
import android.os.ParcelFileDescriptor
|
||||
import org.json.JSONObject
|
||||
import java.io.IOException
|
||||
import java.util.UUID
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
internal class DocumentDescriptors {
|
||||
private val descriptors = ConcurrentHashMap<String, ParcelFileDescriptor>()
|
||||
|
||||
fun open(descriptor: ParcelFileDescriptor): JSONObject {
|
||||
val id = UUID.randomUUID().toString()
|
||||
try {
|
||||
// Only detach the duplicate: the original carries the provider's close/error channel.
|
||||
val duplicate = ParcelFileDescriptor.dup(descriptor.fileDescriptor)
|
||||
descriptors[id] = descriptor
|
||||
return JSONObject().put("fd", duplicate.detachFd()).put("descriptor", id)
|
||||
} catch (error: Exception) {
|
||||
descriptors.remove(id)
|
||||
try {
|
||||
descriptor.closeWithError(error.message ?: "Unable to open document")
|
||||
} catch (closeError: Exception) {
|
||||
error.addSuppressed(closeError)
|
||||
}
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
fun close(request: JSONObject): Boolean {
|
||||
val descriptor = descriptors.remove(request.getString("descriptor"))
|
||||
?: throw IOException("Document descriptor was already closed")
|
||||
val error = request.optString("error", "")
|
||||
if (error.isNotEmpty()) {
|
||||
descriptor.closeWithError(error)
|
||||
} else {
|
||||
descriptor.use { if (it.canDetectErrors()) it.checkError() }
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,261 @@
|
||||
package com.carriez.flutter_hbb
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.ParcelFileDescriptor
|
||||
import android.provider.DocumentsContract
|
||||
import android.provider.DocumentsContract.Document
|
||||
import android.util.Log
|
||||
import java.io.FileNotFoundException
|
||||
import java.io.IOException
|
||||
import java.util.UUID
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.concurrent.locks.ReentrantLock
|
||||
import kotlin.concurrent.withLock
|
||||
|
||||
internal class DocumentLogs(private val context: Context) {
|
||||
private val resolver = context.contentResolver
|
||||
private val prefs = context.getSharedPreferences(DOCUMENT_PREFS, Context.MODE_PRIVATE)
|
||||
private val appName = context.applicationInfo.loadLabel(context.packageManager).toString()
|
||||
private val appDirectoryId = "$PARENT_ID/$appName"
|
||||
private val directoryId = "$appDirectoryId/Logs"
|
||||
val directoryPath = directoryId.substringAfter(':')
|
||||
private var output: ParcelFileDescriptor.AutoCloseOutputStream? = null
|
||||
private var written = 0L
|
||||
private var openedDay = 0L
|
||||
private var failure: Exception? = null
|
||||
private val lock = ReentrantLock()
|
||||
|
||||
init {
|
||||
setEnabled(grant() != null)
|
||||
}
|
||||
|
||||
@androidx.annotation.Keep
|
||||
private external fun setEnabled(enabled: Boolean)
|
||||
|
||||
private fun grant(): Uri? = prefs.getString(LOG_GRANT, null)?.let(Uri::parse)
|
||||
|
||||
fun hasPermission(): Boolean {
|
||||
val uri = grant() ?: return false
|
||||
if (!isLogGrant(uri)) return false
|
||||
return resolver.persistedUriPermissions.any {
|
||||
it.uri == uri && it.isReadPermission && it.isWritePermission
|
||||
}
|
||||
}
|
||||
|
||||
private fun isLogGrant(uri: Uri): Boolean =
|
||||
uri.authority == AUTHORITY && DocumentsContract.isTreeUri(uri) &&
|
||||
DocumentsContract.getTreeDocumentId(uri) in listOf(PARENT_ID, appDirectoryId, directoryId)
|
||||
|
||||
private fun isDirectory(uri: Uri): Boolean = try {
|
||||
resolver.query(uri, arrayOf(Document.COLUMN_MIME_TYPE), null, null, null)?.use {
|
||||
it.moveToFirst() && it.getString(it.getColumnIndexOrThrow(
|
||||
Document.COLUMN_MIME_TYPE)) == Document.MIME_TYPE_DIR
|
||||
} ?: false
|
||||
} catch (_: FileNotFoundException) {
|
||||
false
|
||||
}
|
||||
|
||||
private fun containsDirectory(grant: Uri, parentId: String, id: String): Boolean {
|
||||
val children = DocumentsContract.buildChildDocumentsUriUsingTree(grant, parentId)
|
||||
val columns = arrayOf(Document.COLUMN_DOCUMENT_ID, Document.COLUMN_MIME_TYPE)
|
||||
return resolver.query(children, columns, null, null, null)?.use { cursor ->
|
||||
checkDocumentListing(cursor, "Unable to list ${parentId.substringAfter(':')}",
|
||||
"${parentId.substringAfter(':')} is still loading")
|
||||
while (cursor.moveToNext()) {
|
||||
if (cursor.getString(cursor.getColumnIndexOrThrow(Document.COLUMN_DOCUMENT_ID)) != id) continue
|
||||
check(cursor.getString(cursor.getColumnIndexOrThrow(Document.COLUMN_MIME_TYPE)) ==
|
||||
Document.MIME_TYPE_DIR) { "${id.substringAfter(':')} is not a directory" }
|
||||
return@use true
|
||||
}
|
||||
false
|
||||
} ?: throw IOException("Unable to list ${parentId.substringAfter(':')}")
|
||||
}
|
||||
|
||||
private fun ensureDirectory(grant: Uri): Uri {
|
||||
checkDocumentName(appName)
|
||||
val rootId = DocumentsContract.getTreeDocumentId(grant)
|
||||
var parent = DocumentsContract.buildDocumentUriUsingTree(grant, rootId)
|
||||
check(isDirectory(parent)) { "The authorized log folder is unavailable" }
|
||||
val children = when (rootId) {
|
||||
PARENT_ID -> listOf(appDirectoryId, directoryId)
|
||||
appDirectoryId -> listOf(directoryId)
|
||||
directoryId -> emptyList()
|
||||
else -> throw IOException("The selected folder does not contain $directoryPath")
|
||||
}
|
||||
for (id in children) {
|
||||
val child = DocumentsContract.buildDocumentUriUsingTree(grant, id)
|
||||
if (!containsDirectory(grant, DocumentsContract.getDocumentId(parent), id)) {
|
||||
closeOutput()
|
||||
val created = DocumentsContract.createDocument(
|
||||
resolver, parent, Document.MIME_TYPE_DIR, id.substringAfterLast('/'))
|
||||
?: throw IOException("Unable to create ${id.substringAfter(':')}")
|
||||
check(DocumentsContract.getDocumentId(created) == id) {
|
||||
"${id.substringAfter(':')} is not available as a directory"
|
||||
}
|
||||
}
|
||||
parent = child
|
||||
}
|
||||
return parent
|
||||
}
|
||||
|
||||
fun select(uri: Uri, flags: Int) = lock.withLock {
|
||||
require(isLogGrant(uri)) {
|
||||
"Please select Android → media."
|
||||
}
|
||||
val permissions = flags and GRANT_FLAGS
|
||||
require(permissions == GRANT_FLAGS) { "Read and write access is required for logs" }
|
||||
setEnabled(false)
|
||||
resolver.takePersistableUriPermission(uri, permissions)
|
||||
ensureDirectory(uri)
|
||||
closeOutput()
|
||||
check(prefs.edit().putString(LOG_GRANT, uri.toString()).commit()) {
|
||||
"Unable to remember the log directory"
|
||||
}
|
||||
check(ensureReady()) { "Log directory access was revoked" }
|
||||
}
|
||||
|
||||
fun ensureReady(): Boolean = lock.withLock {
|
||||
setEnabled(false)
|
||||
if (!hasPermission()) return false
|
||||
val uri = grant() ?: return false
|
||||
val root = DocumentsContract.buildDocumentUriUsingTree(uri, DocumentsContract.getTreeDocumentId(uri))
|
||||
if (!isDirectory(root)) return false
|
||||
ensureDirectory(uri)
|
||||
failure = null
|
||||
if (output == null) openNext(uri)
|
||||
setEnabled(true)
|
||||
return true
|
||||
}
|
||||
|
||||
fun write(message: String): Boolean {
|
||||
if (!lock.tryLock()) return false
|
||||
return try {
|
||||
writeLocked(message)
|
||||
} finally {
|
||||
lock.unlock()
|
||||
}
|
||||
}
|
||||
|
||||
private fun writeLocked(message: String): Boolean {
|
||||
val uri = grant() ?: return false
|
||||
failure?.let { throw IOException("File logging stopped: ${it.message}", it) }
|
||||
try {
|
||||
if (output == null && !hasPermission()) {
|
||||
throw IOException("Log directory access was revoked")
|
||||
}
|
||||
if (output == null || written >= MAX_LOG_BYTES || openedDay != currentDay()) {
|
||||
openNext(uri)
|
||||
}
|
||||
val bytes = message.toByteArray(Charsets.UTF_8)
|
||||
val stream = output ?: throw IOException("The log file is not open")
|
||||
stream.write(bytes)
|
||||
written += bytes.size
|
||||
return true
|
||||
} catch (error: Exception) {
|
||||
setEnabled(false)
|
||||
failure = error
|
||||
try {
|
||||
closeOutput()
|
||||
} catch (closeError: Exception) {
|
||||
error.addSuppressed(closeError)
|
||||
}
|
||||
Log.e("DocumentLogs", "File logging stopped", error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
private fun closeOutput() {
|
||||
val stream = output
|
||||
output = null
|
||||
stream?.close()
|
||||
}
|
||||
|
||||
private fun openNext(grant: Uri) {
|
||||
closeOutput()
|
||||
val name = "rustdesk-${System.currentTimeMillis()}-${UUID.randomUUID()}.txt"
|
||||
val document = DocumentsContract.createDocument(
|
||||
resolver, ensureDirectory(grant), "text/plain", name)
|
||||
?: throw IOException("Unable to create a log file")
|
||||
try {
|
||||
val descriptor = resolver.openFileDescriptor(document, "w")
|
||||
?: throw IOException("Unable to open the log file")
|
||||
output = ParcelFileDescriptor.AutoCloseOutputStream(descriptor)
|
||||
} catch (error: Exception) {
|
||||
try {
|
||||
if (!DocumentsContract.deleteDocument(resolver, document)) {
|
||||
throw IOException("Unable to remove the unopened log file")
|
||||
}
|
||||
} catch (cleanupError: Exception) {
|
||||
error.addSuppressed(cleanupError)
|
||||
}
|
||||
throw error
|
||||
}
|
||||
written = 0L
|
||||
openedDay = currentDay()
|
||||
val logs = files(grant).sortedBy { it.second }
|
||||
for ((uri, _) in logs.filter { it.first != document }
|
||||
.take((logs.size - MAX_LOG_FILES).coerceAtLeast(0))) {
|
||||
try {
|
||||
if (!DocumentsContract.deleteDocument(resolver, uri)) {
|
||||
throw IOException("Unable to remove an expired log file")
|
||||
}
|
||||
} catch (error: Exception) {
|
||||
Log.w("DocumentLogs", "Unable to remove an expired log file", error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun files(grant: Uri): List<Pair<Uri, String>> {
|
||||
val children = DocumentsContract.buildChildDocumentsUriUsingTree(grant, directoryId)
|
||||
val columns = arrayOf(Document.COLUMN_DOCUMENT_ID, Document.COLUMN_DISPLAY_NAME,
|
||||
Document.COLUMN_MIME_TYPE)
|
||||
return resolver.query(children, columns, null, null, null)?.use { cursor ->
|
||||
checkDocumentListing(cursor, "Unable to list logs", "The log directory is still loading")
|
||||
val entries = mutableListOf<Pair<Uri, String>>()
|
||||
while (cursor.moveToNext()) {
|
||||
if (cursor.getString(cursor.getColumnIndexOrThrow(Document.COLUMN_MIME_TYPE)) ==
|
||||
Document.MIME_TYPE_DIR) continue
|
||||
val name = cursor.getString(cursor.getColumnIndexOrThrow(Document.COLUMN_DISPLAY_NAME))
|
||||
if (!LOG_NAME.matches(name)) continue
|
||||
val id = cursor.getString(cursor.getColumnIndexOrThrow(Document.COLUMN_DOCUMENT_ID))
|
||||
entries.add(DocumentsContract.buildDocumentUriUsingTree(grant, id) to name)
|
||||
}
|
||||
entries
|
||||
} ?: throw IOException("Unable to list logs")
|
||||
}
|
||||
|
||||
fun exportTo(destination: Uri): Int {
|
||||
val uri = grant() ?: return 0
|
||||
check(hasPermission()) { "Log directory access was revoked" }
|
||||
val parent = DocumentsContract.buildDocumentUriUsingTree(
|
||||
destination, DocumentsContract.getTreeDocumentId(destination))
|
||||
val logs = files(uri)
|
||||
for ((source, name) in logs) {
|
||||
val target = DocumentsContract.createDocument(resolver, parent, "text/plain", name)
|
||||
?: throw IOException("Unable to create an exported log")
|
||||
val input = resolver.openInputStream(source)
|
||||
?: throw IOException("Unable to read log $name")
|
||||
input.use {
|
||||
val output = resolver.openOutputStream(target, "w")
|
||||
?: throw IOException("Unable to write log $name")
|
||||
output.use { destinationStream -> it.copyTo(destinationStream) }
|
||||
}
|
||||
}
|
||||
return logs.size
|
||||
}
|
||||
|
||||
private fun currentDay(): Long = System.currentTimeMillis() / TimeUnit.DAYS.toMillis(1)
|
||||
|
||||
companion object {
|
||||
const val AUTHORITY = "com.android.externalstorage.documents"
|
||||
const val PARENT_ID = "primary:Android/media"
|
||||
private const val LOG_GRANT = "log-folder"
|
||||
private const val GRANT_FLAGS = Intent.FLAG_GRANT_READ_URI_PERMISSION or
|
||||
Intent.FLAG_GRANT_WRITE_URI_PERMISSION
|
||||
private const val MAX_LOG_BYTES = 16L * 1024 * 1024
|
||||
private const val MAX_LOG_FILES = 90
|
||||
private val LOG_NAME = Regex("rustdesk-[0-9]+-[0-9a-f-]{36}\\.txt")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
package com.carriez.flutter_hbb
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.provider.DocumentsContract
|
||||
import io.flutter.plugin.common.MethodCall
|
||||
import io.flutter.plugin.common.MethodChannel
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
internal class DocumentPicker(private val activity: Activity) {
|
||||
private var pending: Pair<MethodChannel.Result, Boolean>? = null
|
||||
private var pendingLogFolder: MethodChannel.Result? = null
|
||||
private val storage = (activity.application as MainApplication).documentStorage
|
||||
|
||||
fun handle(call: MethodCall, result: MethodChannel.Result): Boolean {
|
||||
when (call.method) {
|
||||
"document_require_log_folder" ->
|
||||
requireLogFolder(result, call.argument<Boolean>("checkOnly") == true)
|
||||
"document_workspace" -> if (call.argument<Boolean>("share") == true) {
|
||||
run(result) { storage.shareWorkspace() }
|
||||
} else {
|
||||
result.success((activity.getExternalFilesDir(null) ?: activity.filesDir).path)
|
||||
}
|
||||
"document_folder" -> pick(result, call.argument<Boolean>("share") == true)
|
||||
else -> return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
private fun pick(result: MethodChannel.Result, share: Boolean) {
|
||||
if (pending != null || pendingLogFolder != null) {
|
||||
result.error("picker_in_progress", "Another document picker is already open", null)
|
||||
return
|
||||
}
|
||||
try {
|
||||
val intent = treePickerIntent("primary:Documents")
|
||||
pending = result to share
|
||||
activity.startActivityForResult(intent, REQUEST_DOCUMENT)
|
||||
} catch (error: Exception) {
|
||||
pending = null
|
||||
result.error("picker_unavailable", error.message, null)
|
||||
}
|
||||
}
|
||||
|
||||
fun onResult(requestCode: Int, resultCode: Int, data: Intent?): Boolean {
|
||||
if (requestCode == REQUEST_LOG_FOLDER) {
|
||||
val result = pendingLogFolder ?: return true
|
||||
pendingLogFolder = null
|
||||
if (resultCode != Activity.RESULT_OK || data?.data == null) {
|
||||
result.success(false)
|
||||
} else {
|
||||
run(result) {
|
||||
storage.logs.select(requireNotNull(data.data), data.flags)
|
||||
true
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
if (requestCode != REQUEST_DOCUMENT) return false
|
||||
val (result, share) = pending ?: return true
|
||||
pending = null
|
||||
if (resultCode != Activity.RESULT_OK || data == null) {
|
||||
result.success(null)
|
||||
return true
|
||||
}
|
||||
run(result) {
|
||||
storage.select(requireNotNull(data.data), data.flags, share).toString()
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
fun close() {
|
||||
pendingLogFolder?.error("picker_closed", "Log directory selection was interrupted", null)
|
||||
pendingLogFolder = null
|
||||
pending?.first?.error("picker_closed", "Document selection was interrupted", null)
|
||||
pending = null
|
||||
}
|
||||
|
||||
private fun run(result: MethodChannel.Result, action: () -> Any?) {
|
||||
thread {
|
||||
try {
|
||||
val value = action()
|
||||
activity.runOnUiThread { result.success(value) }
|
||||
} catch (error: Exception) {
|
||||
activity.runOnUiThread { result.error("document_failed", error.message, null) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun requireLogFolder(result: MethodChannel.Result, checkOnly: Boolean) {
|
||||
if (pending != null || pendingLogFolder != null) {
|
||||
result.error("picker_in_progress", "Another document picker is already open", null)
|
||||
return
|
||||
}
|
||||
pendingLogFolder = result
|
||||
thread {
|
||||
val ready = runCatching { storage.logs.ensureReady() }
|
||||
activity.runOnUiThread { completeLogFolderCheck(result, ready, checkOnly) }
|
||||
}
|
||||
}
|
||||
|
||||
private fun completeLogFolderCheck(
|
||||
result: MethodChannel.Result, ready: Result<Boolean>, checkOnly: Boolean
|
||||
) {
|
||||
if (pendingLogFolder !== result) return
|
||||
ready.fold(onSuccess = {
|
||||
if (it || checkOnly) {
|
||||
pendingLogFolder = null
|
||||
result.success(it)
|
||||
} else {
|
||||
pickLogFolder(result)
|
||||
}
|
||||
}, onFailure = {
|
||||
pendingLogFolder = null
|
||||
result.error("log_directory_failed", it.message, null)
|
||||
})
|
||||
}
|
||||
|
||||
private fun treePickerIntent(initialId: String): Intent =
|
||||
Intent(Intent.ACTION_OPEN_DOCUMENT_TREE).apply {
|
||||
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION or
|
||||
Intent.FLAG_GRANT_WRITE_URI_PERMISSION or Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
putExtra(DocumentsContract.EXTRA_INITIAL_URI,
|
||||
DocumentsContract.buildDocumentUri(DocumentLogs.AUTHORITY, initialId))
|
||||
}
|
||||
}
|
||||
|
||||
private fun pickLogFolder(result: MethodChannel.Result) {
|
||||
try {
|
||||
activity.startActivityForResult(treePickerIntent(DocumentLogs.PARENT_ID), REQUEST_LOG_FOLDER)
|
||||
} catch (error: Exception) {
|
||||
pendingLogFolder = null
|
||||
result.error("picker_unavailable", error.message, null)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val REQUEST_DOCUMENT = 4251
|
||||
private const val REQUEST_LOG_FOLDER = 4252
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.carriez.flutter_hbb
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.database.Cursor
|
||||
import android.net.Uri
|
||||
import android.provider.DocumentsContract
|
||||
import android.util.Base64
|
||||
import org.json.JSONObject
|
||||
import java.io.IOException
|
||||
|
||||
private const val TREE_ROOT = "/@rustdesk/tree/"
|
||||
internal const val DOCUMENT_PREFS = "document-storage"
|
||||
internal const val DEFAULT_LOCATION = "default-location"
|
||||
private const val URI_FLAGS = Base64.URL_SAFE or Base64.NO_WRAP or Base64.NO_PADDING
|
||||
private const val MIN_LOCATION_COMPONENTS = 2
|
||||
|
||||
internal fun documentRoot(uri: Uri): String =
|
||||
"$TREE_ROOT${Base64.encodeToString(uri.toString().toByteArray(Charsets.UTF_8), URI_FLAGS)}"
|
||||
|
||||
internal fun checkDocumentName(name: String): String {
|
||||
require(name.isNotEmpty() && name != "." && name != ".." &&
|
||||
!name.contains('/') && !name.contains('\\') && !name.contains('\u0000')) {
|
||||
"Invalid document name"
|
||||
}
|
||||
return name
|
||||
}
|
||||
|
||||
internal fun checkDocumentListing(cursor: Cursor, errorMessage: String, loadingMessage: String) {
|
||||
val extras = cursor.extras
|
||||
extras.getString(DocumentsContract.EXTRA_ERROR)?.let {
|
||||
throw IOException("$errorMessage: $it")
|
||||
}
|
||||
if (extras.getBoolean(DocumentsContract.EXTRA_LOADING)) {
|
||||
throw IOException(loadingMessage)
|
||||
}
|
||||
}
|
||||
|
||||
internal fun documentEntry(name: String, directory: Boolean, size: Long = 0): JSONObject =
|
||||
JSONObject().put("name", name).put("directory", directory)
|
||||
.put("size", size).put("modified", 0)
|
||||
|
||||
internal class DocumentStorage(private val context: Context) {
|
||||
private val prefs = context.getSharedPreferences(DOCUMENT_PREFS, Context.MODE_PRIVATE)
|
||||
private val descriptors = DocumentDescriptors()
|
||||
val logs = DocumentLogs(context)
|
||||
|
||||
fun home(): String? = prefs.getString(DEFAULT_LOCATION, null)
|
||||
|
||||
fun shareWorkspace(): String {
|
||||
check(prefs.edit().remove(DEFAULT_LOCATION).commit()) {
|
||||
"Unable to remember the shared folder"
|
||||
}
|
||||
return (context.getExternalFilesDir(null) ?: context.filesDir).path
|
||||
}
|
||||
|
||||
fun select(uri: Uri, flags: Int, share: Boolean): JSONObject {
|
||||
require(uri.scheme == "content") { "Invalid document selection" }
|
||||
val grants = flags and (Intent.FLAG_GRANT_READ_URI_PERMISSION or
|
||||
Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
|
||||
require(grants != 0) { "The selected location has no access grant" }
|
||||
context.contentResolver.takePersistableUriPermission(uri, grants)
|
||||
val root = documentRoot(uri)
|
||||
val backend = DocumentTree(context, uri, descriptors)
|
||||
val name = checkDocumentName(backend.rootName())
|
||||
val path = "$root/$name"
|
||||
if (share) {
|
||||
check(prefs.edit().putString(DEFAULT_LOCATION, path).commit()) {
|
||||
"Unable to remember the shared folder"
|
||||
}
|
||||
}
|
||||
return JSONObject().put("path", path).put("name", name)
|
||||
}
|
||||
|
||||
fun backend(path: String): DocumentTree {
|
||||
require(path.startsWith(TREE_ROOT)) { "Invalid document location" }
|
||||
val parts = path.removePrefix(TREE_ROOT).split('/')
|
||||
require(parts.size >= MIN_LOCATION_COMPONENTS) { "Invalid document location" }
|
||||
parts.forEach(::checkDocumentName)
|
||||
val uri = Uri.parse(String(Base64.decode(parts.first(), URI_FLAGS), Charsets.UTF_8))
|
||||
require(uri.scheme == "content") { "Invalid document URI" }
|
||||
val authorized =
|
||||
context.contentResolver.persistedUriPermissions.any { it.uri == uri && it.isReadPermission }
|
||||
check(authorized) {
|
||||
"Access to this location was revoked. Select it again on the Android device."
|
||||
}
|
||||
return DocumentTree(context, uri, descriptors)
|
||||
}
|
||||
|
||||
fun request(request: String): String = try {
|
||||
JSONObject().put("value", execute(JSONObject(request)) ?: JSONObject.NULL).toString()
|
||||
} catch (error: Exception) {
|
||||
JSONObject().put("error", error.message ?: error.javaClass.simpleName).toString()
|
||||
}
|
||||
|
||||
private fun execute(request: JSONObject): Any? {
|
||||
val operation = request.getString("op")
|
||||
if (operation == "home") return home()
|
||||
if (operation == "log_write") return logs.write(request.getString("message"))
|
||||
if (operation == "close") return descriptors.close(request)
|
||||
val path = request.getString("path")
|
||||
val backend = backend(path)
|
||||
return when (operation) {
|
||||
"allowed" -> true
|
||||
"list" -> backend.list(path)
|
||||
"stat" -> backend.stat(path)
|
||||
"open" -> backend.open(path)
|
||||
else -> mutate(request, backend)
|
||||
}
|
||||
}
|
||||
|
||||
private fun mutate(request: JSONObject, backend: DocumentTree): Any {
|
||||
val path = request.getString("path")
|
||||
return when (val operation = request.getString("op")) {
|
||||
"begin" -> backend.begin(path, request.getBoolean("overwrite"))
|
||||
"finish" -> backend.finish(request.getJSONObject("token")).let { true }
|
||||
"discard" -> backend.discard(request.getJSONObject("token")).let { true }
|
||||
"delete" -> backend.delete(path).let { true }
|
||||
"mkdir" -> backend.mkdir(path).let { true }
|
||||
"rename" -> backend.rename(path, checkDocumentName(request.getString("name"))).let { true }
|
||||
else -> throw IOException("Unsupported document operation: $operation")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
package com.carriez.flutter_hbb
|
||||
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import android.provider.DocumentsContract
|
||||
import android.provider.DocumentsContract.Document
|
||||
import android.webkit.MimeTypeMap
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import java.io.FileNotFoundException
|
||||
import java.io.IOException
|
||||
import java.util.UUID
|
||||
|
||||
internal class DocumentTree(
|
||||
context: Context,
|
||||
private val grant: Uri,
|
||||
private val descriptors: DocumentDescriptors
|
||||
) {
|
||||
private val root = documentRoot(grant)
|
||||
private val resolver = context.contentResolver
|
||||
private val rootUri: Uri get() = DocumentsContract.buildDocumentUriUsingTree(
|
||||
grant, DocumentsContract.getTreeDocumentId(grant))
|
||||
private val projection = arrayOf(Document.COLUMN_DOCUMENT_ID, Document.COLUMN_DISPLAY_NAME,
|
||||
Document.COLUMN_MIME_TYPE, Document.COLUMN_SIZE, Document.COLUMN_LAST_MODIFIED)
|
||||
|
||||
fun rootName(): String = metadata(rootUri)?.getString("name")
|
||||
?: throw FileNotFoundException("The selected document no longer exists")
|
||||
|
||||
private fun metadata(uri: Uri): JSONObject? = resolver.query(uri, projection, null, null, null)?.use {
|
||||
if (!it.moveToFirst()) return@use null
|
||||
val directory = it.getString(MIME_COLUMN) == Document.MIME_TYPE_DIR
|
||||
val size = if (it.isNull(SIZE_COLUMN)) -1 else it.getLong(SIZE_COLUMN)
|
||||
documentEntry(it.getString(NAME_COLUMN), directory, size)
|
||||
.put("modified", it.getLong(MODIFIED_COLUMN) / MILLIS_PER_SECOND).put("uri", uri.toString())
|
||||
} ?: throw IOException("Unable to query the selected document")
|
||||
|
||||
private fun children(uri: Uri): List<Pair<Uri, JSONObject>> {
|
||||
val query = DocumentsContract.buildChildDocumentsUriUsingTree(
|
||||
grant, DocumentsContract.getDocumentId(uri))
|
||||
return resolver.query(query, projection, null, null, null)?.use { cursor ->
|
||||
checkDocumentListing(cursor, "Unable to list the selected folder",
|
||||
"The selected folder is still loading. Try again.")
|
||||
val entries = mutableListOf<Pair<Uri, JSONObject>>()
|
||||
while (cursor.moveToNext()) {
|
||||
val child = DocumentsContract.buildDocumentUriUsingTree(grant, cursor.getString(ID_COLUMN))
|
||||
val name = checkDocumentName(cursor.getString(NAME_COLUMN))
|
||||
val entry = documentEntry(name, cursor.getString(MIME_COLUMN) == Document.MIME_TYPE_DIR,
|
||||
if (cursor.isNull(SIZE_COLUMN)) -1 else cursor.getLong(SIZE_COLUMN))
|
||||
.put("modified", cursor.getLong(MODIFIED_COLUMN) / MILLIS_PER_SECOND)
|
||||
.put("uri", child.toString())
|
||||
entries.add(child to entry)
|
||||
}
|
||||
entries
|
||||
} ?: throw IOException("Unable to list the selected folder")
|
||||
}
|
||||
|
||||
private fun relative(path: String): List<String> {
|
||||
val parts = path.removePrefix("$root/").split('/')
|
||||
require(path.startsWith("$root/") && parts.first() == rootName()) {
|
||||
"The selected document was moved or renamed. Select it again."
|
||||
}
|
||||
parts.forEach(::checkDocumentName)
|
||||
return parts.drop(1)
|
||||
}
|
||||
|
||||
private fun resolve(path: String, createParents: Boolean = false): Uri? {
|
||||
var current = rootUri
|
||||
for (name in relative(path)) {
|
||||
val matches = children(current).filter { it.second.getString("name") == name }
|
||||
check(matches.size <= 1) { "The provider returned multiple documents named $name" }
|
||||
val child = matches.singleOrNull()
|
||||
current = child?.first ?: if (createParents) {
|
||||
val created = DocumentsContract.createDocument(resolver, current, Document.MIME_TYPE_DIR, name)
|
||||
?: throw IOException("Unable to create folder $name")
|
||||
check(metadata(created)?.getString("name") == name) {
|
||||
"The provider cannot preserve folder name: $name"
|
||||
}
|
||||
created
|
||||
} else return null
|
||||
}
|
||||
return current
|
||||
}
|
||||
|
||||
fun uri(path: String): Uri = resolve(path)
|
||||
?: throw FileNotFoundException("Document does not exist: $path")
|
||||
|
||||
fun list(path: String): JSONArray = JSONArray(children(uri(path)).map { it.second })
|
||||
|
||||
fun stat(path: String): JSONObject? = resolve(path)?.let(::metadata)
|
||||
|
||||
fun open(path: String): JSONObject = descriptors.open(
|
||||
resolver.openFileDescriptor(uri(path), "r") ?: throw IOException("Unable to open document"))
|
||||
|
||||
fun begin(path: String, overwrite: Boolean): JSONObject {
|
||||
val original = resolve(path)
|
||||
check(original == null || overwrite) { "Document overwrite requires confirmation" }
|
||||
require(original == null || metadata(original)?.getBoolean("directory") == false) {
|
||||
"Cannot replace a folder with a file"
|
||||
}
|
||||
val parent = resolve(path.substringBeforeLast('/'), true)
|
||||
?: throw FileNotFoundException("Destination folder no longer exists")
|
||||
val name = checkDocumentName(path.substringAfterLast('/'))
|
||||
val temporary = DocumentsContract.createDocument(resolver, parent, mime(name),
|
||||
temporaryName(name, "download"))
|
||||
?: throw IOException("Unable to create the receiving file")
|
||||
try {
|
||||
val descriptor = resolver.openFileDescriptor(temporary, "rw")
|
||||
?: throw IOException("Unable to open the receiving file")
|
||||
return descriptors.open(descriptor).put("uri", temporary.toString())
|
||||
.put("path", path).put("original", original?.toString() ?: JSONObject.NULL)
|
||||
} catch (error: Exception) {
|
||||
try {
|
||||
check(DocumentsContract.deleteDocument(resolver, temporary)) {
|
||||
"Unable to remove the receiving file"
|
||||
}
|
||||
} catch (cleanup: Exception) {
|
||||
error.addSuppressed(cleanup)
|
||||
throw IOException("${error.message ?: error.javaClass.simpleName}; " +
|
||||
"temporary file cleanup failed: ${cleanup.message}", error)
|
||||
}
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
fun finish(token: JSONObject) {
|
||||
val path = token.getString("path")
|
||||
val name = checkDocumentName(path.substringAfterLast('/'))
|
||||
val original = resolve(path)
|
||||
val expected = if (token.isNull("original")) null else token.getString("original")
|
||||
check(original?.toString() == expected) {
|
||||
"The destination changed during the transfer; the received data was retained"
|
||||
}
|
||||
val backup = original?.let { renameChecked(it, temporaryName(name, "backup")) }
|
||||
try {
|
||||
renameChecked(Uri.parse(token.getString("uri")), name)
|
||||
} catch (error: Exception) {
|
||||
if (backup != null) {
|
||||
try { renameChecked(backup, name) } catch (restore: Exception) {
|
||||
error.addSuppressed(restore)
|
||||
throw IOException("Publishing failed and the original remains in $backup: ${restore.message}", error)
|
||||
}
|
||||
}
|
||||
throw error
|
||||
}
|
||||
if (backup != null && !DocumentsContract.deleteDocument(resolver, backup)) {
|
||||
throw IOException("File saved, but the previous copy could not be removed: $backup")
|
||||
}
|
||||
}
|
||||
|
||||
private fun renameChecked(uri: Uri, name: String): Uri {
|
||||
val renamed = DocumentsContract.renameDocument(resolver, uri, name)
|
||||
?: throw IOException("Unable to publish the received file; the partial file was retained")
|
||||
check(metadata(renamed)?.getString("name") == name) { "The provider changed the saved filename" }
|
||||
return renamed
|
||||
}
|
||||
|
||||
fun discard(token: JSONObject) {
|
||||
check(DocumentsContract.deleteDocument(resolver, Uri.parse(token.getString("uri")))) {
|
||||
"Unable to remove the canceled transfer"
|
||||
}
|
||||
}
|
||||
|
||||
fun delete(path: String) {
|
||||
require(relative(path).isNotEmpty()) { "Cannot delete a shared root" }
|
||||
check(DocumentsContract.deleteDocument(resolver, uri(path))) { "Unable to delete document" }
|
||||
}
|
||||
|
||||
fun mkdir(path: String) {
|
||||
val created = resolve(path, true) ?: throw IOException("Unable to create folder")
|
||||
check(metadata(created)?.getBoolean("directory") == true) { "The destination is not a folder" }
|
||||
}
|
||||
|
||||
fun rename(path: String, name: String) {
|
||||
require(relative(path).isNotEmpty()) { "Cannot rename a shared root" }
|
||||
if (resolve(path.substringBeforeLast('/') + "/" + name) != null) throw IOException(EXISTS_MESSAGE)
|
||||
renameChecked(uri(path), name)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val ID_COLUMN = 0
|
||||
private const val NAME_COLUMN = 1
|
||||
private const val MIME_COLUMN = 2
|
||||
private const val SIZE_COLUMN = 3
|
||||
private const val MODIFIED_COLUMN = 4
|
||||
private const val MILLIS_PER_SECOND = 1000L
|
||||
const val EXISTS_MESSAGE = "A file already exists at the destination. Rename the file or select another folder."
|
||||
fun temporaryName(name: String, purpose: String): String {
|
||||
// Providers can append the MIME extension when renaming; preserve it for temporary files.
|
||||
val extension = name.substringAfterLast('.', "").let { if (it.isEmpty()) "" else ".$it" }
|
||||
return ".rustdesk-${UUID.randomUUID()}.$purpose$extension"
|
||||
}
|
||||
|
||||
fun mime(name: String): String = MimeTypeMap.getSingleton()
|
||||
.getMimeTypeFromExtension(name.substringAfterLast('.', "").lowercase())
|
||||
?: "application/octet-stream"
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,15 @@ const val WHEEL_BUTTON_UP = 34
|
||||
const val WHEEL_DOWN = 523331
|
||||
const val WHEEL_UP = 963
|
||||
|
||||
// src/common.rs MOUSE_TYPE_WHEEL: the controller sends a wheel tick as a
|
||||
// MouseEvent with these type bits and the scroll delta in y (y < 0 = down).
|
||||
const val MOUSE_TYPE_WHEEL = 3
|
||||
|
||||
// Wheel-tick travel for MOUSE_TYPE_WHEEL events. Three quarters of the legacy
|
||||
// WHEEL_STEP; tuned on real devices during review (the full 120px felt too
|
||||
// far per tick).
|
||||
const val MOUSE_WHEEL_STEP = 90
|
||||
|
||||
const val TOUCH_SCALE_START = 1
|
||||
const val TOUCH_SCALE = 2
|
||||
const val TOUCH_SCALE_END = 3
|
||||
@@ -102,6 +111,12 @@ class InputService : AccessibilityService() {
|
||||
|
||||
private val volumeController: VolumeController by lazy { VolumeController(applicationContext.getSystemService(AUDIO_SERVICE) as AudioManager) }
|
||||
|
||||
/**
|
||||
* Handles a remote mouse event on the gesture path. [mask] is the
|
||||
* button/phase mask of the mouse protocol ([MOUSE_TYPE_WHEEL] ticks carry
|
||||
* the scroll delta in [_y] instead of a position), x/y the screen-space
|
||||
* position. Requires API 24 for the gesture APIs.
|
||||
*/
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
fun onMouseInput(mask: Int, _x: Int, _y: Int) {
|
||||
val x = max(0, _x)
|
||||
@@ -184,6 +199,38 @@ class InputService : AccessibilityService() {
|
||||
return
|
||||
}
|
||||
|
||||
// The controller sends a wheel tick as a MouseEvent with the type bits
|
||||
// MOUSE_TYPE_WHEEL (src/common.rs) and the scroll delta in _y
|
||||
// (y < 0 = wheel down); the WHEEL_DOWN/WHEEL_UP masks below are legacy
|
||||
// values that current controllers never send. Gated to API 24+ like
|
||||
// the rest of the gesture path - below that, legacy devices take the
|
||||
// Shizuku backend or a no-op, not this class.
|
||||
if (mask == MOUSE_TYPE_WHEEL && Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
// A horizontal tick (the controller sends y = 0 when the
|
||||
// horizontal delta dominates) or a delta truncated to zero is not
|
||||
// a vertical swipe.
|
||||
if (_y == 0) {
|
||||
return
|
||||
}
|
||||
if (mouseY < MOUSE_WHEEL_STEP) {
|
||||
return
|
||||
}
|
||||
val path = Path()
|
||||
path.moveTo(mouseX.toFloat(), mouseY.toFloat())
|
||||
val deltaY = if (_y < 0) -MOUSE_WHEEL_STEP else MOUSE_WHEEL_STEP
|
||||
path.lineTo(mouseX.toFloat(), (mouseY + deltaY).toFloat())
|
||||
val stroke = GestureDescription.StrokeDescription(
|
||||
path,
|
||||
0,
|
||||
WHEEL_DURATION
|
||||
)
|
||||
val builder = GestureDescription.Builder()
|
||||
builder.addStroke(stroke)
|
||||
wheelActionsQueue.offer(builder.build())
|
||||
consumeWheelActions()
|
||||
return
|
||||
}
|
||||
|
||||
if (mask == WHEEL_DOWN) {
|
||||
if (mouseY < WHEEL_STEP) {
|
||||
return
|
||||
|
||||
@@ -63,7 +63,8 @@ class MainActivity : FlutterActivity() {
|
||||
data class ExportFiles(
|
||||
val sources: List<File>,
|
||||
val rejected: Int,
|
||||
val result: MethodChannel.Result
|
||||
val result: MethodChannel.Result,
|
||||
val documentLogs: Boolean = false
|
||||
) : PendingPicker()
|
||||
}
|
||||
|
||||
@@ -73,6 +74,7 @@ class MainActivity : FlutterActivity() {
|
||||
)
|
||||
|
||||
private var pendingPicker: PendingPicker? = null
|
||||
private val documentPicker by lazy { DocumentPicker(this) }
|
||||
|
||||
private var isAudioStart = false
|
||||
private val audioRecordHandle = AudioRecordHandle(this, { false }, { isAudioStart })
|
||||
@@ -127,6 +129,7 @@ class MainActivity : FlutterActivity() {
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
if (documentPicker.onResult(requestCode, resultCode, data)) return
|
||||
if (requestCode == REQ_IMPORT_FILES) {
|
||||
val pending = pendingPicker as? PendingPicker.ImportFiles ?: return
|
||||
pendingPicker = null
|
||||
@@ -223,6 +226,14 @@ class MainActivity : FlutterActivity() {
|
||||
Log.e(logTag, "Failed to export selected files", e)
|
||||
failed += pending.sources.size - processed
|
||||
}
|
||||
if (pending.documentLogs) {
|
||||
try {
|
||||
exported += (application as MainApplication).documentStorage.logs.exportTo(treeUri)
|
||||
} catch (error: Exception) {
|
||||
Log.e(logTag, "Failed to export document logs", error)
|
||||
failed++
|
||||
}
|
||||
}
|
||||
runOnUiThread {
|
||||
pending.result.success(mapOf("exported" to exported, "failed" to failed))
|
||||
}
|
||||
@@ -243,6 +254,7 @@ class MainActivity : FlutterActivity() {
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
documentPicker.close()
|
||||
Log.e(logTag, "onDestroy")
|
||||
// The process can outlive the UI whenever something keeps it alive:
|
||||
// MainService, or the accessibility InputService on its own. Only the
|
||||
@@ -275,6 +287,7 @@ class MainActivity : FlutterActivity() {
|
||||
|
||||
private fun initFlutterChannel(flutterMethodChannel: MethodChannel) {
|
||||
flutterMethodChannel.setMethodCallHandler { call, result ->
|
||||
if (documentPicker.handle(call, result)) return@setMethodCallHandler
|
||||
// make sure result will be invoked, otherwise flutter will await forever
|
||||
when (call.method) {
|
||||
"init_service" -> {
|
||||
@@ -614,19 +627,22 @@ class MainActivity : FlutterActivity() {
|
||||
}
|
||||
EXPORT_FILES -> {
|
||||
val paths = (call.arguments as? Map<*, *>)?.get("paths") as? List<*>
|
||||
if (paths.isNullOrEmpty()) {
|
||||
val documentLogs = (call.arguments as? Map<*, *>)?.get("documentLogs") == true
|
||||
if (paths == null || (paths.isEmpty() && !documentLogs)) {
|
||||
result.error("invalid_source", "The selected files are outside app-scoped storage", null)
|
||||
} else {
|
||||
val sources = paths.mapNotNull {
|
||||
(it as? String)?.let(::canonicalExportSource)
|
||||
}
|
||||
val rejected = paths.size - sources.size
|
||||
if (sources.isEmpty()) {
|
||||
if (sources.isEmpty() && (!documentLogs ||
|
||||
!(application as MainApplication).documentStorage.logs.hasPermission())) {
|
||||
result.success(mapOf("exported" to 0, "failed" to rejected))
|
||||
} else if (pendingPicker != null) {
|
||||
result.error("picker_in_progress", "Another document picker is already open", null)
|
||||
} else {
|
||||
pendingPicker = PendingPicker.ExportFiles(sources, rejected, result)
|
||||
pendingPicker = PendingPicker.ExportFiles(
|
||||
sources, rejected, result, documentLogs = documentLogs)
|
||||
try {
|
||||
startActivityForResult(
|
||||
Intent(Intent.ACTION_OPEN_DOCUMENT_TREE).apply {
|
||||
|
||||
@@ -5,6 +5,11 @@ import android.util.Log
|
||||
import ffi.FFI
|
||||
|
||||
class MainApplication : Application() {
|
||||
internal val documentStorage by lazy { DocumentStorage(this) }
|
||||
|
||||
@androidx.annotation.Keep
|
||||
fun rustDocumentStorage(request: String): String = documentStorage.request(request)
|
||||
|
||||
companion object {
|
||||
private const val TAG = "MainApplication"
|
||||
}
|
||||
|
||||
@@ -346,7 +346,7 @@ prebuild)
|
||||
pushd flutter
|
||||
|
||||
flutter clean
|
||||
flutter packages pub get
|
||||
flutter packages pub get --enforce-lockfile
|
||||
|
||||
popd # flutter
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import UIKit
|
||||
import Flutter
|
||||
import AVFoundation
|
||||
|
||||
@main
|
||||
@objc class AppDelegate: FlutterAppDelegate {
|
||||
@@ -8,6 +9,12 @@ import Flutter
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||
) -> Bool {
|
||||
GeneratedPluginRegistrant.register(with: self)
|
||||
do {
|
||||
// Mix remote audio with other apps while still respecting silent mode.
|
||||
try AVAudioSession.sharedInstance().setCategory(.ambient)
|
||||
} catch {
|
||||
NSLog("Failed to configure audio mixing: %@", error.localizedDescription)
|
||||
}
|
||||
dummyMethodToEnforceBundling();
|
||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hbb/models/platform_model.dart';
|
||||
|
||||
String _resolveApiServer({required String api, required String custom}) {
|
||||
final key = 'resolve-api-server:${jsonEncode([api, custom])}';
|
||||
final response = jsonDecode(bind.mainGetCommonSync(key: key));
|
||||
if (response['error'] != null) {
|
||||
throw FormatException('Failed to resolve API server: ${response['error']}');
|
||||
}
|
||||
return response['url'] as String;
|
||||
}
|
||||
|
||||
bool shouldWarnApiServer(String? apiServer) {
|
||||
final uri = Uri.tryParse(apiServer?.trim() ?? '');
|
||||
if (uri == null || uri.host.isEmpty || uri.scheme != 'http') {
|
||||
return false;
|
||||
}
|
||||
return !const {'localhost', '127.0.0.1', '::1'}.contains(uri.host);
|
||||
}
|
||||
|
||||
class ApiServerWarning extends StatelessWidget {
|
||||
final TextEditingController controller;
|
||||
final TextEditingController idController;
|
||||
final String message;
|
||||
final String emptyMessage;
|
||||
final String Function({required String api, required String custom})
|
||||
resolveApiServer;
|
||||
|
||||
const ApiServerWarning({
|
||||
super.key,
|
||||
required this.controller,
|
||||
required this.idController,
|
||||
required this.message,
|
||||
required this.emptyMessage,
|
||||
this.resolveApiServer = _resolveApiServer,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListenableBuilder(
|
||||
listenable: Listenable.merge([controller, idController]),
|
||||
builder: (context, child) {
|
||||
final apiServer = controller.text;
|
||||
final idServer = idController.text;
|
||||
final String effectiveApiServer;
|
||||
try {
|
||||
effectiveApiServer =
|
||||
resolveApiServer(api: apiServer.trim(), custom: idServer.trim());
|
||||
} catch (error, stack) {
|
||||
FlutterError.reportError(FlutterErrorDetails(
|
||||
exception: error,
|
||||
stack: stack,
|
||||
context: ErrorDescription('while resolving the API server warning'),
|
||||
));
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
if (!shouldWarnApiServer(effectiveApiServer)) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: Text(
|
||||
controller.text.trim().isEmpty ? emptyMessage : message,
|
||||
style: TextStyle(color: Colors.orange.shade700),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2278,9 +2278,12 @@ void changeBot({Function()? callback}) async {
|
||||
|
||||
void change2fa({Function()? callback}) async {
|
||||
if (bind.mainHasValid2FaSync()) {
|
||||
await bind.mainSetOption(key: "2fa", value: "");
|
||||
await bind.mainClearTrustedDevices();
|
||||
callback?.call();
|
||||
try {
|
||||
await bind.mainSetOption(key: "2fa", value: "");
|
||||
callback?.call();
|
||||
} catch (error) {
|
||||
showToast(error.toString());
|
||||
}
|
||||
return;
|
||||
}
|
||||
var new2fa = (await bind.mainGenerate2Fa());
|
||||
@@ -2795,23 +2798,48 @@ void confrimDeleteTrustedDevicesDialog(
|
||||
CommonConfirmDialog(gFFI.dialogManager, '${translate('Confirm Delete')}?',
|
||||
() async {
|
||||
if (selectedDevices.isEmpty) return;
|
||||
if (selectedDevices.length == trustedDevices.length) {
|
||||
await bind.mainClearTrustedDevices();
|
||||
trustedDevices.clear();
|
||||
selectedDevices.clear();
|
||||
} else {
|
||||
final json = jsonEncode(selectedDevices.map((e) => e.toList()).toList());
|
||||
await bind.mainRemoveTrustedDevices(json: json);
|
||||
trustedDevices.removeWhere((element) {
|
||||
return selectedDevices.contains(element.hwid);
|
||||
});
|
||||
selectedDevices.clear();
|
||||
try {
|
||||
if (selectedDevices.length == trustedDevices.length) {
|
||||
await bind.mainClearTrustedDevices();
|
||||
trustedDevices.clear();
|
||||
selectedDevices.clear();
|
||||
} else {
|
||||
final json = jsonEncode(selectedDevices.map((e) => e.toList()).toList());
|
||||
await bind.mainRemoveTrustedDevices(json: json);
|
||||
trustedDevices.removeWhere((element) {
|
||||
return selectedDevices.contains(element.recordId);
|
||||
});
|
||||
selectedDevices.clear();
|
||||
}
|
||||
} catch (error) {
|
||||
showToast(error.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> renewTrustedDevice(
|
||||
TrustedDevice device,
|
||||
RxList<TrustedDevice> trustedDevices,
|
||||
RxList<Uint8List> selectedDevices) async {
|
||||
try {
|
||||
final json = jsonEncode([device.recordId.toList()]);
|
||||
await bind.mainRenewTrustedDevices(json: json);
|
||||
final result = await TrustedDevice.get();
|
||||
selectedDevices.clear();
|
||||
trustedDevices.assignAll(result);
|
||||
} catch (error) {
|
||||
showToast(error.toString());
|
||||
}
|
||||
}
|
||||
|
||||
void manageTrustedDeviceDialog() async {
|
||||
RxList<TrustedDevice> trustedDevices = (await TrustedDevice.get()).obs;
|
||||
late final RxList<TrustedDevice> trustedDevices;
|
||||
try {
|
||||
trustedDevices = (await TrustedDevice.get()).obs;
|
||||
} catch (error) {
|
||||
showToast(error.toString());
|
||||
return;
|
||||
}
|
||||
RxList<Uint8List> selectedDevices = RxList.empty();
|
||||
gFFI.dialogManager.show((setState, close, context) {
|
||||
return CustomAlertDialog(
|
||||
@@ -2837,25 +2865,67 @@ void manageTrustedDeviceDialog() async {
|
||||
});
|
||||
}
|
||||
|
||||
Widget trustedDeviceExpiration({
|
||||
required bool enabled,
|
||||
required VoidCallback onChanged,
|
||||
bool showLabel = true,
|
||||
}) {
|
||||
final period = bind.mainGetOptionSync(key: kOptionTrustedDeviceExpiration);
|
||||
const periods = ['1', '7', '30', '90', '0'];
|
||||
const dropdownHeight = 36.0;
|
||||
return Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: Wrap(
|
||||
spacing: 12,
|
||||
runSpacing: 8,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
if (showLabel) Text(translate('Trust duration (days)')),
|
||||
SizedBox(
|
||||
width: isDesktop || isWebDesktop ? 140 : 100,
|
||||
height: dropdownHeight,
|
||||
child: ComboBox(
|
||||
keys: periods,
|
||||
values: ['1', '7', '30', '90', translate('Never')],
|
||||
initialKey: periods.contains(period) ? period : '90',
|
||||
enabled: enabled && !isOptionFixed(kOptionTrustedDeviceExpiration),
|
||||
onChanged: (value) async {
|
||||
try {
|
||||
await bind.mainSetOption(
|
||||
key: kOptionTrustedDeviceExpiration, value: value);
|
||||
} catch (error) {
|
||||
showToast(error.toString());
|
||||
}
|
||||
onChanged();
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class TrustedDevice {
|
||||
late final Uint8List hwid;
|
||||
late final Uint8List recordId;
|
||||
late final int time;
|
||||
late final int expiresAt;
|
||||
late final String id;
|
||||
late final String name;
|
||||
late final String platform;
|
||||
|
||||
TrustedDevice.fromJson(Map<String, dynamic> json) {
|
||||
final hwidList = json['hwid'] as List<dynamic>;
|
||||
hwid = Uint8List.fromList(hwidList.cast<int>());
|
||||
final recordIdList = json['record_id'] as List<dynamic>;
|
||||
recordId = Uint8List.fromList(recordIdList.cast<int>());
|
||||
time = json['time'];
|
||||
expiresAt = json['expires_at'];
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
platform = json['platform'];
|
||||
}
|
||||
|
||||
String daysRemaining() {
|
||||
final expiry = time + 90 * 24 * 60 * 60 * 1000;
|
||||
final remaining = expiry - DateTime.now().millisecondsSinceEpoch;
|
||||
if (expiresAt == 0) return translate('Never');
|
||||
final remaining = expiresAt - DateTime.now().millisecondsSinceEpoch;
|
||||
if (remaining < 0) {
|
||||
return '0';
|
||||
}
|
||||
@@ -2864,18 +2934,11 @@ class TrustedDevice {
|
||||
|
||||
static Future<List<TrustedDevice>> get() async {
|
||||
final List<TrustedDevice> devices = List.empty(growable: true);
|
||||
try {
|
||||
final devicesJson = await bind.mainGetTrustedDevices();
|
||||
if (devicesJson.isNotEmpty) {
|
||||
final devicesList = json.decode(devicesJson);
|
||||
if (devicesList is List) {
|
||||
for (var device in devicesList) {
|
||||
devices.add(TrustedDevice.fromJson(device));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
final devicesJson = await bind.mainGetTrustedDevices();
|
||||
final result = json.decode(devicesJson) as Map<String, dynamic>;
|
||||
final devicesList = result['devices'] as List;
|
||||
for (final device in devicesList) {
|
||||
devices.add(TrustedDevice.fromJson(device));
|
||||
}
|
||||
devices.sort((a, b) => b.time.compareTo(a.time));
|
||||
return devices;
|
||||
@@ -2909,7 +2972,7 @@ Widget trustedDevicesTable(
|
||||
onChanged: (value) {
|
||||
if (value == true) {
|
||||
selectedDevices.clear();
|
||||
selectedDevices.addAll(devices.map((e) => e.hwid));
|
||||
selectedDevices.addAll(devices.map((e) => e.recordId));
|
||||
} else {
|
||||
selectedDevices.clear();
|
||||
}
|
||||
@@ -2923,21 +2986,30 @@ Widget trustedDevicesTable(
|
||||
rows: devices.map((device) {
|
||||
return DataRow(cells: [
|
||||
DataCell(Checkbox(
|
||||
value: selectedDevices.contains(device.hwid),
|
||||
value: selectedDevices.contains(device.recordId),
|
||||
onChanged: (value) {
|
||||
if (value == null) return;
|
||||
if (value) {
|
||||
selectedDevices.remove(device.hwid);
|
||||
selectedDevices.add(device.hwid);
|
||||
selectedDevices.remove(device.recordId);
|
||||
selectedDevices.add(device.recordId);
|
||||
} else {
|
||||
selectedDevices.remove(device.hwid);
|
||||
selectedDevices.remove(device.recordId);
|
||||
}
|
||||
},
|
||||
)),
|
||||
DataCell(Text(device.platform)),
|
||||
DataCell(Text(device.id)),
|
||||
DataCell(Text(device.name)),
|
||||
DataCell(Text(device.daysRemaining())),
|
||||
DataCell(Row(mainAxisSize: MainAxisSize.min, children: [
|
||||
Text(device.daysRemaining()),
|
||||
if (device.expiresAt != 0)
|
||||
IconButton(
|
||||
icon: Icon(Icons.refresh),
|
||||
tooltip: translate('Renew trust'),
|
||||
onPressed: () =>
|
||||
renewTrustedDevice(device, devices, selectedDevices),
|
||||
),
|
||||
])),
|
||||
]);
|
||||
}).toList(),
|
||||
)),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_hbb/common/widgets/dialog.dart';
|
||||
@@ -62,6 +63,8 @@ class _PeerCardState extends State<_PeerCard>
|
||||
final PeerTabModel peerTabModel = Provider.of(context);
|
||||
final peer = super.widget.peer;
|
||||
return GestureDetector(
|
||||
// Web card actions have their own semantics; preserve pointer double-clicks.
|
||||
excludeFromSemantics: isWebDesktop,
|
||||
onDoubleTap: peerTabModel.multiSelectionMode
|
||||
? null
|
||||
: () => widget.connect(context, peer.id),
|
||||
@@ -423,7 +426,7 @@ class _PeerCardState extends State<_PeerCard>
|
||||
final PeerTabModel peerTabModel = Provider.of(context);
|
||||
final selected = peerTabModel.isPeerSelected(peer.id);
|
||||
if (peerTabModel.multiSelectionMode) {
|
||||
return Padding(
|
||||
final checkbox = Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: selected
|
||||
? Icon(
|
||||
@@ -432,7 +435,16 @@ class _PeerCardState extends State<_PeerCard>
|
||||
)
|
||||
: Icon(Icons.check_box_outline_blank),
|
||||
);
|
||||
return isWebDesktop
|
||||
? Semantics(
|
||||
container: true,
|
||||
label: formatID(peer.id),
|
||||
checked: selected,
|
||||
onTap: () => peerTabModel.select(peer),
|
||||
child: checkbox)
|
||||
: checkbox;
|
||||
} else {
|
||||
if (isWebDesktop) return _actionMoreWeb(peer);
|
||||
return InkWell(
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(12), child: Icon(Icons.more_vert)),
|
||||
@@ -457,19 +469,27 @@ class _PeerCardState extends State<_PeerCard>
|
||||
color: MyTheme.accent,
|
||||
)
|
||||
: Icon(Icons.check_box_outline_blank);
|
||||
final checkbox = isWebDesktop
|
||||
? Semantics(
|
||||
container: true,
|
||||
label: formatID(peer.id),
|
||||
checked: selected,
|
||||
onTap: () => peerTabModel.select(peer),
|
||||
child: icon)
|
||||
: icon;
|
||||
bool last = peerTabModel.isShiftDown && peer.id == peerTabModel.lastId;
|
||||
double right = isTile ? 4 : 0;
|
||||
if (last) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: MyTheme.accent, width: 1)),
|
||||
child: icon,
|
||||
child: checkbox,
|
||||
).marginOnly(right: right);
|
||||
} else {
|
||||
return icon.marginOnly(right: right);
|
||||
return checkbox.marginOnly(right: right);
|
||||
}
|
||||
} else {
|
||||
return _actionMore(peer);
|
||||
return isWebDesktop ? _actionMoreWeb(peer) : _actionMore(peer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -482,6 +502,20 @@ class _PeerCardState extends State<_PeerCard>
|
||||
onPointerUp: (_) => _showPeerMenu(peer.id),
|
||||
child: build_more(context));
|
||||
|
||||
Widget _actionMoreWeb(Peer peer) => Semantics(
|
||||
container: true,
|
||||
button: true,
|
||||
label: translate('More'),
|
||||
child: Builder(
|
||||
builder: (context) => build_more(context, onTap: () {
|
||||
final box = context.findRenderObject() as RenderBox;
|
||||
final position =
|
||||
box.localToGlobal(box.size.center(Offset.zero));
|
||||
_menuPos = RelativeRect.fromLTRB(
|
||||
position.dx, position.dy, position.dx, position.dy);
|
||||
_showPeerMenu(peer.id);
|
||||
})));
|
||||
|
||||
bool _shouldBuildPasswordIcon(Peer peer) {
|
||||
if (gFFI.peerTabModel.currentTab != PeerTabIndex.ab.index) return false;
|
||||
if (gFFI.abModel.current.isPersonal()) return false;
|
||||
@@ -1474,11 +1508,12 @@ Widget getOnline(double rightPadding, bool online) {
|
||||
radius: 3, backgroundColor: online ? Colors.green : kColorWarn)));
|
||||
}
|
||||
|
||||
Widget build_more(BuildContext context, {bool invert = false}) {
|
||||
Widget build_more(BuildContext context,
|
||||
{bool invert = false, VoidCallback? onTap}) {
|
||||
final RxBool hover = false.obs;
|
||||
return InkWell(
|
||||
final button = InkWell(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
onTap: () {},
|
||||
onTap: onTap ?? () {},
|
||||
onHover: (value) => hover.value = value,
|
||||
child: Obx(() => CircleAvatar(
|
||||
radius: 14,
|
||||
@@ -1498,6 +1533,19 @@ Widget build_more(BuildContext context, {bool invert = false}) {
|
||||
.titleLarge
|
||||
?.color
|
||||
?.withOpacity(0.5)))));
|
||||
if (onTap == null) return button;
|
||||
// Serial taps preserve cancellation without waiting for the card's double tap.
|
||||
return RawGestureDetector(
|
||||
excludeFromSemantics: true,
|
||||
gestures: {
|
||||
SerialTapGestureRecognizer:
|
||||
GestureRecognizerFactoryWithHandlers<SerialTapGestureRecognizer>(
|
||||
() => SerialTapGestureRecognizer(
|
||||
allowedButtonsFilter: (buttons) =>
|
||||
buttons == kPrimaryButton),
|
||||
(recognizer) => recognizer.onSerialTapUp = (_) => onTap()),
|
||||
},
|
||||
child: button);
|
||||
}
|
||||
|
||||
class TagPainter extends CustomPainter {
|
||||
|
||||
@@ -21,6 +21,7 @@ import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:pull_down_button/pull_down_button.dart';
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
|
||||
import '../../common.dart';
|
||||
import '../../models/platform_model.dart';
|
||||
@@ -549,6 +550,28 @@ class _PeerTabPageState extends State<PeerTabPage>
|
||||
});
|
||||
}
|
||||
|
||||
Widget _openWebConsole() {
|
||||
return _hoverAction(
|
||||
context: context,
|
||||
toolTip: translate('ab_web_console_tip'),
|
||||
child: Icon(
|
||||
Icons.open_in_new,
|
||||
size: 18,
|
||||
),
|
||||
onTap: () async {
|
||||
final url = await bind.mainGetApiServer();
|
||||
if (await canLaunchUrlString(url)) {
|
||||
launchUrlString(url);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
bool _showWebConsole(PeerTabModel model) =>
|
||||
model.currentTab == PeerTabIndex.ab.index &&
|
||||
gFFI.userModel.isLogin &&
|
||||
!gFFI.abModel.legacyMode.value &&
|
||||
gFFI.abModel.current.canWrite();
|
||||
|
||||
List<Widget> _landscapeRightActions(BuildContext context) {
|
||||
final model = Provider.of<PeerTabModel>(context);
|
||||
return [
|
||||
@@ -566,6 +589,10 @@ class _PeerTabPageState extends State<PeerTabPage>
|
||||
offstage: model.currentTab == PeerTabIndex.recent.index,
|
||||
child: PeerSortDropdown(),
|
||||
),
|
||||
Offstage(
|
||||
offstage: !_showWebConsole(model),
|
||||
child: _openWebConsole(),
|
||||
),
|
||||
Offstage(
|
||||
offstage: model.currentTab != PeerTabIndex.ab.index,
|
||||
child: _toggleTags(),
|
||||
@@ -630,6 +657,7 @@ class _PeerTabPageState extends State<PeerTabPage>
|
||||
final List<Widget> dynamicActions = [
|
||||
if (model.currentTabCachedPeers.isNotEmpty) _createMultiSelection(),
|
||||
if (model.currentTab != PeerTabIndex.recent.index) PeerSortDropdown(),
|
||||
if (_showWebConsole(model)) _openWebConsole(),
|
||||
if (model.currentTab == PeerTabIndex.ab.index) _toggleTags()
|
||||
];
|
||||
final rightWidth = availableWidth -
|
||||
|
||||
@@ -184,6 +184,7 @@ const String kOptionAllowSyncClipboardBetweenSessions =
|
||||
const String kOptionEnableWebrtc = "enable-webrtc";
|
||||
const String kOptionRelayFallbackDelay = "relay-fallback-delay";
|
||||
const String kOptionEnableTrustedDevices = "enable-trusted-devices";
|
||||
const String kOptionTrustedDeviceExpiration = "trusted-device-expiration-days";
|
||||
const String kOptionShowVirtualMouse = "show-virtual-mouse";
|
||||
const String kOptionVirtualMouseScale = "virtual-mouse-scale";
|
||||
const String kOptionShowVirtualJoystick = "show-virtual-joystick";
|
||||
|
||||
@@ -1144,6 +1144,13 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
|
||||
message: translate("enable-trusted-devices-tip"),
|
||||
child: _OptionCheckBox(context, "Enable trusted devices",
|
||||
kOptionEnableTrustedDevices,
|
||||
optSetter: (key, value) async {
|
||||
try {
|
||||
await mainSetBoolOption(key, value);
|
||||
} catch (error) {
|
||||
showToast(error.toString());
|
||||
}
|
||||
},
|
||||
enabled: !locked, update: (v) {
|
||||
setState(() {});
|
||||
}),
|
||||
@@ -1161,7 +1168,21 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
|
||||
).marginOnly(left: 30);
|
||||
|
||||
return Column(
|
||||
children: [tfa, bot, trust],
|
||||
children: [
|
||||
tfa,
|
||||
bot,
|
||||
trust,
|
||||
if (mainGetBoolOptionSync(kOptionEnableTrustedDevices))
|
||||
trustedDeviceExpiration(
|
||||
enabled: !locked,
|
||||
onChanged: () {
|
||||
if (mounted) setState(() {});
|
||||
},
|
||||
).marginOnly(
|
||||
left: _kCheckBoxLeftMargin + 20 + _kContentHSubMargin,
|
||||
top: _kContentHMargin,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -497,7 +497,12 @@ class _FileManagerViewState extends State<FileManagerView> {
|
||||
},
|
||||
onExit: (evt) =>
|
||||
widget._mouseFocusScope.value = MouseFocusScope.none,
|
||||
child: _buildFileList(context, _fileListScrollController),
|
||||
child: Focus(
|
||||
canRequestFocus: false,
|
||||
skipTraversal: true,
|
||||
onKeyEvent: _onFileListKeyEvent,
|
||||
child: _buildFileList(context, _fileListScrollController),
|
||||
),
|
||||
))
|
||||
],
|
||||
),
|
||||
@@ -1135,6 +1140,7 @@ class _FileManagerViewState extends State<FileManagerView> {
|
||||
: "${entry.lastModified().toString().replaceAll(".000", "")} ";
|
||||
var secondaryPosition = RelativeRect.fromLTRB(0, 0, 0, 0);
|
||||
onTap() {
|
||||
_keyboardNode.requestFocus();
|
||||
final items = selectedItems;
|
||||
// handle double click
|
||||
if (_checkDoubleClick(entry)) {
|
||||
@@ -1363,6 +1369,102 @@ class _FileManagerViewState extends State<FileManagerView> {
|
||||
debugPrint("focused on ${searchResult.first.name}");
|
||||
}
|
||||
|
||||
KeyEventResult _onFileListKeyEvent(FocusNode node, KeyEvent event) {
|
||||
// A focused child such as a sort header keeps its default keys, e.g.
|
||||
// Enter to sort.
|
||||
if (!_keyboardNode.hasPrimaryFocus) return KeyEventResult.ignored;
|
||||
for (final binding in _fileListKeyBindings().entries) {
|
||||
if (binding.key.accepts(event, HardwareKeyboard.instance)) {
|
||||
binding.value();
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
}
|
||||
return KeyEventResult.ignored;
|
||||
}
|
||||
|
||||
Map<ShortcutActivator, VoidCallback> _fileListKeyBindings() {
|
||||
int all() => controller.directory.value.entries.length;
|
||||
return {
|
||||
const SingleActivator(LogicalKeyboardKey.arrowUp): () =>
|
||||
_moveSelectionByKey(-1, false),
|
||||
const SingleActivator(LogicalKeyboardKey.arrowDown): () =>
|
||||
_moveSelectionByKey(1, false),
|
||||
const SingleActivator(LogicalKeyboardKey.arrowUp, shift: true): () =>
|
||||
_moveSelectionByKey(-1, true),
|
||||
const SingleActivator(LogicalKeyboardKey.arrowDown, shift: true): () =>
|
||||
_moveSelectionByKey(1, true),
|
||||
// Unhandled, they would move keyboard focus to the other pane.
|
||||
const SingleActivator(LogicalKeyboardKey.arrowLeft): () {},
|
||||
const SingleActivator(LogicalKeyboardKey.arrowRight): () {},
|
||||
const SingleActivator(LogicalKeyboardKey.pageUp): () =>
|
||||
_moveSelectionByKey(_pageDelta(false), false),
|
||||
const SingleActivator(LogicalKeyboardKey.pageDown): () =>
|
||||
_moveSelectionByKey(_pageDelta(true), false),
|
||||
const SingleActivator(LogicalKeyboardKey.home): () =>
|
||||
_moveSelectionByKey(-all(), false),
|
||||
const SingleActivator(LogicalKeyboardKey.end): () =>
|
||||
_moveSelectionByKey(all(), false),
|
||||
const SingleActivator(LogicalKeyboardKey.pageUp, shift: true): () =>
|
||||
_moveSelectionByKey(_pageDelta(false), true),
|
||||
const SingleActivator(LogicalKeyboardKey.pageDown, shift: true): () =>
|
||||
_moveSelectionByKey(_pageDelta(true), true),
|
||||
const SingleActivator(LogicalKeyboardKey.home, shift: true): () =>
|
||||
_moveSelectionByKey(-all(), true),
|
||||
const SingleActivator(LogicalKeyboardKey.end, shift: true): () =>
|
||||
_moveSelectionByKey(all(), true),
|
||||
const SingleActivator(LogicalKeyboardKey.enter): _openSelectedDirectory,
|
||||
const SingleActivator(LogicalKeyboardKey.numpadEnter):
|
||||
_openSelectedDirectory,
|
||||
};
|
||||
}
|
||||
|
||||
void _openSelectedDirectory() {
|
||||
final items = selectedItems.items;
|
||||
if (items.length != 1 || items.first.isFile) return;
|
||||
controller.openDirectory(items.first.path);
|
||||
selectedItems.clear();
|
||||
}
|
||||
|
||||
List<Entry> _filteredEntries() {
|
||||
final entries = controller.directory.value.entries;
|
||||
return _searchText.isNotEmpty
|
||||
? entries.where((element) {
|
||||
return element.name.contains(_searchText.value);
|
||||
}).toList(growable: false)
|
||||
: entries;
|
||||
}
|
||||
|
||||
int _pageDelta(bool down) {
|
||||
final entries = _filteredEntries();
|
||||
final items = selectedItems.items;
|
||||
final index = items.isEmpty ? -1 : entries.indexOf(items.last);
|
||||
final position = _fileListScrollController.position;
|
||||
final first = (position.pixels / kDesktopFileTransferRowHeight).ceil();
|
||||
final last = ((position.pixels + position.viewportDimension) /
|
||||
kDesktopFileTransferRowHeight)
|
||||
.floor() -
|
||||
1;
|
||||
return pageDelta(
|
||||
index >= 0 ? index : (down ? -1 : entries.length), first, last, down);
|
||||
}
|
||||
|
||||
void _moveSelectionByKey(int delta, bool extend) {
|
||||
final filteredEntries = _filteredEntries();
|
||||
final selection =
|
||||
navigateSelection(filteredEntries, selectedItems.items, delta, extend);
|
||||
if (selection.isEmpty) return;
|
||||
selectedItems.items.assignAll(selection.where((e) => !e.isDrive));
|
||||
final position = _fileListScrollController.position;
|
||||
final top =
|
||||
filteredEntries.indexOf(selection.last) * kDesktopFileTransferRowHeight;
|
||||
final bottom = top + kDesktopFileTransferRowHeight;
|
||||
if (top < position.pixels) {
|
||||
_fileListScrollController.jumpTo(top);
|
||||
} else if (bottom > position.pixels + position.viewportDimension) {
|
||||
_fileListScrollController.jumpTo(bottom - position.viewportDimension);
|
||||
}
|
||||
}
|
||||
|
||||
void _onSelectedChanged(SelectedItems selectedItems, List<Entry> entries,
|
||||
Entry entry, bool isLocal) {
|
||||
final isCtrlDown = RawKeyboard.instance.keysPressed
|
||||
@@ -1717,6 +1819,36 @@ class _FileManagerViewState extends State<FileManagerView> {
|
||||
// }
|
||||
}
|
||||
|
||||
/// Selection after a navigation key moves it by [delta] rows. A shift range is
|
||||
/// returned ordered from its anchor to the moved end, so the first and last
|
||||
/// items of [selected] stand for those two ends on the next press without
|
||||
/// separate state.
|
||||
@visibleForTesting
|
||||
List<Entry> navigateSelection(
|
||||
List<Entry> entries, List<Entry> selected, int delta, bool extend) {
|
||||
if (entries.isEmpty) return [];
|
||||
final current = selected.isEmpty ? -1 : entries.indexOf(selected.last);
|
||||
// With nothing selected, moving down starts above the first row and moving
|
||||
// up below the last one, as the Sciter grid did.
|
||||
final lead = current >= 0 ? current : (delta > 0 ? -1 : entries.length);
|
||||
final next = (lead + delta).clamp(0, entries.length - 1);
|
||||
if (!extend || current < 0) return [entries[next]];
|
||||
final first = entries.indexOf(selected.first);
|
||||
final anchor = first < 0 ? current : first;
|
||||
final step = next < anchor ? -1 : 1;
|
||||
return [for (var i = anchor; i != next + step; i += step) entries[i]];
|
||||
}
|
||||
|
||||
/// Rows a PageUp/PageDown press moves from [lead] while rows [first]..[last]
|
||||
/// are fully visible: to that edge first, then a page further, as list views
|
||||
/// do.
|
||||
@visibleForTesting
|
||||
int pageDelta(int lead, int first, int last, bool down) {
|
||||
final page = max(1, last - first);
|
||||
if (down) return lead < last ? last - lead : page;
|
||||
return lead > first ? first - lead : -page;
|
||||
}
|
||||
|
||||
Widget buildWindowsThisPC(BuildContext context, [TextStyle? textStyle]) {
|
||||
final color = Theme.of(context).iconTheme.color?.withOpacity(0.7);
|
||||
return Row(children: [
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class ListSearchActionListener extends StatelessWidget {
|
||||
final FocusNode node;
|
||||
@@ -22,7 +23,7 @@ class ListSearchActionListener extends StatelessWidget {
|
||||
autofocus: true,
|
||||
onKeyEvent: (kv) {
|
||||
final ch = kv.character;
|
||||
if (ch == null) {
|
||||
if (ch == null || LogicalKeyboardKey.isControlCharacter(ch)) {
|
||||
return;
|
||||
}
|
||||
final action = buffer.input(ch);
|
||||
|
||||
@@ -577,6 +577,8 @@ _registerEventHandler() {
|
||||
|
||||
Widget keyListenerBuilder(BuildContext context, Widget? child) {
|
||||
return RawKeyboardListener(
|
||||
// Keep this keyboard-only wrapper from taking focus away from web inputs.
|
||||
includeSemantics: !isWeb,
|
||||
// `skipTraversal: isWeb` is to fix "Bad state: RenderBox was not laid out: minified:aeL#c19e4"
|
||||
focusNode: FocusNode(skipTraversal: isWeb),
|
||||
child: child ?? Container(),
|
||||
|
||||
@@ -10,6 +10,7 @@ import 'package:toggle_switch/toggle_switch.dart';
|
||||
import '../../common.dart';
|
||||
import '../../common/widgets/dialog.dart';
|
||||
import '../../consts.dart';
|
||||
import '../../utils/android_documents.dart';
|
||||
|
||||
class FileManagerPage extends StatefulWidget {
|
||||
FileManagerPage(
|
||||
@@ -142,6 +143,29 @@ class _FileManagerPageState extends State<FileManagerPage> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _changeLocalStorage({required bool workspace}) async {
|
||||
try {
|
||||
final path = workspace
|
||||
? await AndroidDocuments.workspace()
|
||||
: (await AndroidDocuments.selectFolder())?['path'] as String?;
|
||||
if (path == null || !mounted) return;
|
||||
final previousHome = model.localController.homePath;
|
||||
model.localController.homePath = path;
|
||||
try {
|
||||
if (await model.localController.openDirectory(path, isBack: true)) {
|
||||
model.localController.history.clear();
|
||||
} else {
|
||||
model.localController.homePath = previousHome;
|
||||
}
|
||||
} catch (_) {
|
||||
model.localController.homePath = previousHome;
|
||||
rethrow;
|
||||
}
|
||||
} catch (error) {
|
||||
showToast(error.toString());
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _exportFile(Entry entry) async {
|
||||
try {
|
||||
final exported = await _runAndroidDocumentPicker(() => gFFI
|
||||
@@ -206,9 +230,11 @@ class _FileManagerPageState extends State<FileManagerPage> {
|
||||
}
|
||||
|
||||
Future<void> _exportLogs() async {
|
||||
final home = currentFileController.homePath;
|
||||
if (home.isEmpty) {
|
||||
showToast(translate('Failed'));
|
||||
final String home;
|
||||
try {
|
||||
home = await AndroidDocuments.workspace();
|
||||
} catch (error) {
|
||||
showToast(error.toString());
|
||||
return;
|
||||
}
|
||||
final appDir = PathUtil.join(home, appName, false);
|
||||
@@ -216,22 +242,25 @@ class _FileManagerPageState extends State<FileManagerPage> {
|
||||
PathUtil.join(appDir, 'Logs', false),
|
||||
PathUtil.join(appDir, 'ScreenRecord', false),
|
||||
].where((p) => File(p).existsSync() || Directory(p).existsSync()).toList();
|
||||
if (paths.isEmpty) {
|
||||
showToast(translate('Failed'));
|
||||
return;
|
||||
}
|
||||
await _exportPaths(paths);
|
||||
await _exportPaths(paths, includeDocumentLogs: true);
|
||||
}
|
||||
|
||||
Future<void> _exportPaths(Iterable<String> paths) async {
|
||||
Future<void> _exportPaths(Iterable<String> paths,
|
||||
{bool includeDocumentLogs = false}) async {
|
||||
try {
|
||||
final result = await _runAndroidDocumentPicker(() =>
|
||||
gFFI.invokeMethodWithResult<Map<dynamic, dynamic>>(
|
||||
AndroidChannel.kExportFiles, {'paths': paths.toList()}));
|
||||
final result = await _runAndroidDocumentPicker(() => gFFI
|
||||
.invokeMethodWithResult<Map<dynamic, dynamic>>(
|
||||
AndroidChannel.kExportFiles, {
|
||||
'paths': paths.toList(),
|
||||
if (includeDocumentLogs) 'documentLogs': true,
|
||||
}));
|
||||
if (result == null) return;
|
||||
final exported = result['exported'] as int? ?? 0;
|
||||
final failed = result['failed'] as int? ?? 0;
|
||||
if (failed > 0) {
|
||||
if (includeDocumentLogs && exported > 0 && failed > 0) {
|
||||
showToast('${translate('Successful')}: $exported, '
|
||||
'${translate('Failed')}: $failed');
|
||||
} else if (failed > 0 || (includeDocumentLogs && exported == 0)) {
|
||||
showToast(translate('Failed'));
|
||||
} else if (exported > 0) {
|
||||
showToast(translate('Successful'));
|
||||
@@ -317,6 +346,31 @@ class _FileManagerPageState extends State<FileManagerPage> {
|
||||
icon: Icon(Icons.more_vert),
|
||||
itemBuilder: (context) {
|
||||
return [
|
||||
if (isAndroid && showLocal) ...[
|
||||
PopupMenuItem(
|
||||
value: 'workspace',
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.storage_outlined,
|
||||
color: Theme.of(context).iconTheme.color),
|
||||
SizedBox(width: 5),
|
||||
Text(translate('RustDesk storage')),
|
||||
],
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: 'choose_folder',
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.folder_open_outlined,
|
||||
color: Theme.of(context).iconTheme.color),
|
||||
SizedBox(width: 5),
|
||||
Text('${translate('Other folders')}…'),
|
||||
],
|
||||
),
|
||||
),
|
||||
const PopupMenuDivider(),
|
||||
],
|
||||
PopupMenuItem(
|
||||
child: Row(
|
||||
children: [
|
||||
@@ -328,7 +382,7 @@ class _FileManagerPageState extends State<FileManagerPage> {
|
||||
),
|
||||
value: "refresh",
|
||||
),
|
||||
if (isAndroid)
|
||||
if (isAndroid && !AndroidDocuments.isPath(currentDir.path))
|
||||
PopupMenuItem(
|
||||
enabled: showLocal && currentDir.path.isNotEmpty,
|
||||
value: "import",
|
||||
@@ -341,7 +395,7 @@ class _FileManagerPageState extends State<FileManagerPage> {
|
||||
],
|
||||
),
|
||||
),
|
||||
if (isAndroid)
|
||||
if (isAndroid && !AndroidDocuments.isPath(currentDir.path))
|
||||
PopupMenuItem(
|
||||
enabled: showLocal && currentDir.path.isNotEmpty,
|
||||
value: "import_folder",
|
||||
@@ -409,7 +463,9 @@ class _FileManagerPageState extends State<FileManagerPage> {
|
||||
];
|
||||
},
|
||||
onSelected: (v) {
|
||||
if (v == "refresh") {
|
||||
if (v == 'workspace' || v == 'choose_folder') {
|
||||
_changeLocalStorage(workspace: v == 'workspace');
|
||||
} else if (v == "refresh") {
|
||||
currentFileController.refresh();
|
||||
} else if (v == "import") {
|
||||
_importFiles();
|
||||
@@ -515,6 +571,7 @@ class _FileManagerPageState extends State<FileManagerPage> {
|
||||
},
|
||||
actions: [
|
||||
if (isAndroid &&
|
||||
!AndroidDocuments.isPath(currentDir.path) &&
|
||||
selectedItems?.isLocal == true &&
|
||||
selectedItems?.items.isNotEmpty == true) ...[
|
||||
if (selectedItems!.items.length == 1 &&
|
||||
@@ -900,7 +957,7 @@ class _FileManagerViewState extends State<FileManagerView> {
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(30, 5, 30, 0),
|
||||
child: Text(
|
||||
controller.directory.value.path,
|
||||
AndroidDocuments.displayPath(controller.directory.value.path),
|
||||
style: TextStyle(color: MyTheme.darkGray),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -13,6 +13,7 @@ import '../../common/widgets/dialog.dart';
|
||||
import '../../consts.dart';
|
||||
import '../../models/platform_model.dart';
|
||||
import '../../models/server_model.dart';
|
||||
import '../../utils/android_documents.dart';
|
||||
import 'home_page.dart';
|
||||
|
||||
class ServerPage extends StatefulWidget implements PageShape {
|
||||
@@ -573,6 +574,44 @@ class PermissionChecker extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _PermissionCheckerState extends State<PermissionChecker> {
|
||||
static const _folderOptionIndent = 16.0;
|
||||
|
||||
Future<void> _selectFolder() async {
|
||||
try {
|
||||
final workspace = await gFFI.dialogManager.show<bool>(
|
||||
(_, close, __) => CustomAlertDialog(
|
||||
title: Text(translate('Change Path')),
|
||||
content: Column(mainAxisSize: MainAxisSize.min, children: [
|
||||
ListTile(
|
||||
title: Text(translate('RustDesk storage')),
|
||||
onTap: () => close(true),
|
||||
),
|
||||
ListTile(
|
||||
title: Text('${translate('Other folders')}…'),
|
||||
onTap: () => close(false),
|
||||
),
|
||||
]),
|
||||
),
|
||||
backDismiss: true,
|
||||
clickMaskDismiss: true);
|
||||
if (workspace == null) return;
|
||||
if (workspace) {
|
||||
showToast(await AndroidDocuments.workspace(share: true));
|
||||
await bind.setLocalFlutterOption(
|
||||
k: 'android-file-transfer-folder-setup', v: 'Y');
|
||||
return;
|
||||
}
|
||||
final selected = await AndroidDocuments.selectFolder(share: true);
|
||||
if (selected != null) {
|
||||
await bind.setLocalFlutterOption(
|
||||
k: 'android-file-transfer-folder-setup', v: 'Y');
|
||||
showToast(AndroidDocuments.displayPath(selected['path'] as String));
|
||||
}
|
||||
} catch (error) {
|
||||
showToast(error.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final serverModel = Provider.of<ServerModel>(context);
|
||||
@@ -620,6 +659,19 @@ class _PermissionCheckerState extends State<PermissionChecker> {
|
||||
serverModel.toggleFile,
|
||||
enabled: !permissionChangeLocked,
|
||||
),
|
||||
if (isAndroid &&
|
||||
!bind.isDisableSettings() &&
|
||||
!bind.isOutgoingOnly() &&
|
||||
bind.mainGetBuildinOption(key: kOptionHideSecuritySetting) != 'Y')
|
||||
ListTile(
|
||||
dense: true,
|
||||
contentPadding:
|
||||
const EdgeInsetsDirectional.only(start: _folderOptionIndent),
|
||||
title: Text(translate('Change Path')),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
enabled: !permissionChangeLocked,
|
||||
onTap: _selectFolder,
|
||||
),
|
||||
hasAudioPermission
|
||||
? PermissionRow(translate("Audio Capture"), serverModel.audioOk,
|
||||
serverModel.toggleAudio,
|
||||
|
||||
@@ -359,12 +359,28 @@ class _SettingsState extends State<SettingsPage> with WidgetsBindingObserver {
|
||||
onToggle: isOptionFixed(kOptionEnableTrustedDevices)
|
||||
? null
|
||||
: (v) async {
|
||||
mainSetBoolOption(kOptionEnableTrustedDevices, v);
|
||||
setState(() {
|
||||
_enableTrustedDevices = v;
|
||||
});
|
||||
try {
|
||||
await mainSetBoolOption(kOptionEnableTrustedDevices, v);
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
_enableTrustedDevices = v;
|
||||
});
|
||||
} catch (error) {
|
||||
showToast(error.toString());
|
||||
}
|
||||
},
|
||||
),
|
||||
if (enable2fa && _enableTrustedDevices)
|
||||
SettingsTile(
|
||||
title: Text(translate('Trust duration (days)')),
|
||||
trailing: trustedDeviceExpiration(
|
||||
enabled: true,
|
||||
showLabel: false,
|
||||
onChanged: () {
|
||||
if (mounted) setState(() {});
|
||||
},
|
||||
),
|
||||
),
|
||||
if (enable2fa && _enableTrustedDevices)
|
||||
SettingsTile(
|
||||
title: Text(translate('Manage trusted devices')),
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../common.dart';
|
||||
import '../../consts.dart';
|
||||
import '../../models/model.dart';
|
||||
import '../../models/platform_model.dart';
|
||||
import '../../utils/android_documents.dart';
|
||||
|
||||
const _setupOption = 'android-file-transfer-folder-setup';
|
||||
const _folderChoicePadding = EdgeInsets.fromLTRB(12, 12, 12, 0);
|
||||
const _folderChoiceSpacing = 4.0;
|
||||
|
||||
enum _FolderChoice { workspace, other, skip }
|
||||
|
||||
Future<bool> showAndroidFileTransferSetup(FFI ffi) async {
|
||||
if (bind.getLocalFlutterOption(k: _setupOption) == 'Y' ||
|
||||
!_canConfigureSharedFolder(ffi)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
final choice = await ffi.dialogManager.show<_FolderChoice>(
|
||||
(_, close, __) => _setupDialog(close),
|
||||
backDismiss: true,
|
||||
forceGlobal: true,
|
||||
);
|
||||
if (choice == null) return false;
|
||||
switch (choice) {
|
||||
case _FolderChoice.workspace:
|
||||
await AndroidDocuments.workspace(share: true);
|
||||
break;
|
||||
case _FolderChoice.other:
|
||||
if (await AndroidDocuments.selectFolder(share: true) == null) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case _FolderChoice.skip:
|
||||
break;
|
||||
}
|
||||
await bind.setLocalFlutterOption(k: _setupOption, v: 'Y');
|
||||
return true;
|
||||
} catch (error) {
|
||||
showToast(error.toString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool _canConfigureSharedFolder(FFI ffi) =>
|
||||
!bind.isOutgoingOnly() &&
|
||||
!bind.isDisableSettings() &&
|
||||
bind.mainGetBuildinOption(key: kOptionHideSecuritySetting) != 'Y' &&
|
||||
(!ffi.serverModel.clients.any((client) => !client.disconnected) ||
|
||||
option2bool(
|
||||
kOptionEnablePermChangeInAcceptWindow,
|
||||
bind.mainGetBuildinOption(
|
||||
key: kOptionEnablePermChangeInAcceptWindow)));
|
||||
|
||||
CustomAlertDialog _setupDialog(void Function([dynamic]) close) {
|
||||
final choiceStyle = OutlinedButton.styleFrom(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
minimumSize: const Size(0, kMinInteractiveDimension),
|
||||
);
|
||||
return CustomAlertDialog(
|
||||
title: Text(translate('Transfer file')),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(translate('Choose which folder remote devices can access.')),
|
||||
Padding(
|
||||
padding: _folderChoicePadding,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
OutlinedButton(
|
||||
style: choiceStyle,
|
||||
onPressed: () => close(_FolderChoice.workspace),
|
||||
child: Text(translate('RustDesk storage')),
|
||||
),
|
||||
const SizedBox(height: _folderChoiceSpacing),
|
||||
OutlinedButton(
|
||||
style: choiceStyle,
|
||||
onPressed: () => close(_FolderChoice.other),
|
||||
child: Text('${translate('Other folders')}…'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => close(_FolderChoice.skip),
|
||||
child: Text(translate('Skip')),
|
||||
),
|
||||
],
|
||||
onCancel: close,
|
||||
);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hbb/common/widgets/api_server_warning.dart';
|
||||
import 'package:flutter_hbb/common/widgets/setting_widgets.dart';
|
||||
import 'package:flutter_hbb/common/widgets/toolbar.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -69,6 +70,8 @@ void showServerSettingsWithValue(
|
||||
ServerConfig serverConfig,
|
||||
OverlayDialogManager dialogManager,
|
||||
void Function(VoidCallback)? upSetState) async {
|
||||
const labelWidth = 120.0;
|
||||
const labelSpacing = 8.0;
|
||||
var isInProgress = false;
|
||||
final idCtrl = TextEditingController(text: serverConfig.idServer);
|
||||
final relayCtrl = TextEditingController(text: serverConfig.relayServer);
|
||||
@@ -112,10 +115,10 @@ void showServerSettingsWithValue(
|
||||
return Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 120,
|
||||
width: labelWidth,
|
||||
child: Text(label),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
SizedBox(width: labelSpacing),
|
||||
Expanded(
|
||||
child: serverSettingsTextFormField(
|
||||
label: label,
|
||||
@@ -175,6 +178,17 @@ void showServerSettingsWithValue(
|
||||
return null;
|
||||
},
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.only(
|
||||
start: isDesktop || isWeb ? labelWidth + labelSpacing : 0,
|
||||
),
|
||||
child: ApiServerWarning(
|
||||
controller: apiCtrl,
|
||||
idController: idCtrl,
|
||||
message: translate('api_server_connection_tip'),
|
||||
emptyMessage: translate('api_server_empty_tip'),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
buildField('Key', keyCtrl, ''),
|
||||
if (isInProgress)
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hbb/common.dart';
|
||||
import 'package:flutter_hbb/common/widgets/dialog.dart';
|
||||
import 'package:flutter_hbb/utils/download_paths.dart';
|
||||
import 'package:flutter_hbb/utils/event_loop.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
@@ -11,6 +12,7 @@ import 'package:flutter_hbb/web/dummy.dart'
|
||||
if (dart.library.html) 'package:flutter_hbb/web/web_unique.dart';
|
||||
|
||||
import '../consts.dart';
|
||||
import '../utils/android_documents.dart';
|
||||
import 'model.dart';
|
||||
import 'platform_model.dart';
|
||||
|
||||
@@ -383,6 +385,7 @@ class FileController {
|
||||
|
||||
bool _isPathAllowed(String candidate) {
|
||||
if (!isAndroid || !isLocal) return true;
|
||||
if (AndroidDocuments.isPath(candidate)) return true;
|
||||
if (homePath.isEmpty || candidate.isEmpty) return false;
|
||||
final home = PathUtil.posixContext.normalize(homePath);
|
||||
final target = PathUtil.posixContext.normalize(candidate);
|
||||
@@ -408,6 +411,15 @@ class FileController {
|
||||
return DirectoryData(directory.value, options.value);
|
||||
}
|
||||
|
||||
Future<void> _restoreWorkspaceHome(String savedDir) async {
|
||||
if (savedDir.isEmpty || AndroidDocuments.isPath(savedDir)) return;
|
||||
final workspace = await AndroidDocuments.workspace();
|
||||
if (PathUtil.posixContext.equals(workspace, savedDir) ||
|
||||
PathUtil.posixContext.isWithin(workspace, savedDir)) {
|
||||
homePath = workspace;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> onReady() async {
|
||||
if (isLocal) {
|
||||
options.value.home = await bind.mainGetHomeDir();
|
||||
@@ -424,6 +436,7 @@ class FileController {
|
||||
|
||||
var savedDir = (await bind.sessionGetPeerOption(
|
||||
sessionId: sessionId, name: isLocal ? "local_dir" : "remote_dir"));
|
||||
if (isAndroid && isLocal) await _restoreWorkspaceHome(savedDir);
|
||||
if (savedDir.isNotEmpty && !_isPathAllowed(savedDir)) {
|
||||
savedDir = options.value.home;
|
||||
await bind.sessionPeerOption(
|
||||
@@ -436,7 +449,13 @@ class FileController {
|
||||
options.value.home,
|
||||
};
|
||||
for (final dir in dirs) {
|
||||
if (isAndroid && isLocal) await _restoreWorkspaceHome(dir);
|
||||
if (await _openDirectoryPath(dir, isBack: true)) {
|
||||
final documentRoot = RegExp(r'^/@rustdesk/tree/[^/]+/[^/]+')
|
||||
.stringMatch(directory.value.path);
|
||||
if (isLocal && documentRoot != null) {
|
||||
homePath = documentRoot;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -528,6 +547,9 @@ class FileController {
|
||||
return true;
|
||||
}
|
||||
debugPrint("Failed to openDirectory $path: $e");
|
||||
if (isAndroid && isLocal && AndroidDocuments.isPath(path)) {
|
||||
showToast(e.toString());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -564,6 +586,9 @@ class FileController {
|
||||
}
|
||||
|
||||
Future<bool> _goToParentDirectory({bool isBack = false}) async {
|
||||
if (AndroidDocuments.isRoot(directory.value.path)) {
|
||||
return false;
|
||||
}
|
||||
final isWindows = options.value.isWindows;
|
||||
final dirPath = directory.value.path;
|
||||
var parent = PathUtil.dirname(dirPath, isWindows);
|
||||
@@ -627,6 +652,17 @@ class FileController {
|
||||
final transferJobIds = <int>[];
|
||||
for (var from in items.items) {
|
||||
final jobID = jobController.addTransferJob(from, isRemoteToLocal);
|
||||
// Keep this check before PathUtil.join: Rust does not receive the selected
|
||||
// root separately, and Web transfers bypass Rust validation.
|
||||
if (isRemoteToLocal &&
|
||||
!DownloadPaths.validName(from.name, windows: isWindows)) {
|
||||
jobController.jobError({
|
||||
'id': '$jobID',
|
||||
'file_num': '0',
|
||||
'err': 'Invalid file name: ${from.name}',
|
||||
});
|
||||
continue;
|
||||
}
|
||||
transferJobs.add((from, jobID));
|
||||
transferJobIds.add(jobID);
|
||||
}
|
||||
@@ -651,6 +687,15 @@ class FileController {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isRemoteToLocal) {
|
||||
for (final (entry, jobID) in transferJobs) {
|
||||
if (entry.isDirectory) {
|
||||
await _downloadEmptyDirectories(entry, jobID, otherSideData);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final List<Entry> entrys = items.items.toList();
|
||||
var isRemote = isLocal == true ? true : false;
|
||||
|
||||
@@ -683,6 +728,35 @@ class FileController {
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _downloadEmptyDirectories(
|
||||
Entry entry, int jobID, DirectoryData destination) async {
|
||||
try {
|
||||
final emptyDirs = await fileFetcher.readEmptyDirs(
|
||||
entry.path, false, destination.options.showHidden);
|
||||
final localRoot = PathUtil.join(destination.directory.path, entry.name,
|
||||
destination.options.isWindows);
|
||||
final paths = emptyDirs
|
||||
.map((dir) => DownloadPaths.mapDirectory(
|
||||
entry.path, dir.path, localRoot,
|
||||
remoteWindows: options.value.isWindows,
|
||||
localWindows: destination.options.isWindows))
|
||||
.toList();
|
||||
for (final path in paths) {
|
||||
await DownloadPaths.ensureNoLinks(destination.directory.path, path);
|
||||
}
|
||||
for (final path in paths) {
|
||||
await createDirWithRemote(path, false);
|
||||
}
|
||||
} on FormatException catch (err) {
|
||||
await bind.sessionCancelJob(sessionId: sessionId, actId: jobID);
|
||||
jobController.jobError({
|
||||
'id': '$jobID',
|
||||
'file_num': '0',
|
||||
'err': err.message,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
bool _removeCheckboxRemember = false;
|
||||
|
||||
Future<void> removeAction(SelectedItems items) async {
|
||||
@@ -692,7 +766,7 @@ class FileController {
|
||||
return;
|
||||
}
|
||||
final isWindows = options.value.isWindows;
|
||||
await Future.forEach(items.items, (Entry item) async {
|
||||
await Future.forEach(items.items.toList(), (Entry item) async {
|
||||
final jobID = JobController.jobID.next();
|
||||
var title = "";
|
||||
var content = "";
|
||||
@@ -1104,7 +1178,8 @@ class JobController {
|
||||
}
|
||||
|
||||
Future<bool> jobDone(Map<String, dynamic> evt) async {
|
||||
if (jobResultListener.isListening) {
|
||||
final waitingForResult = jobResultListener.isListening;
|
||||
if (waitingForResult) {
|
||||
jobResultListener.complete(evt);
|
||||
// return;
|
||||
}
|
||||
@@ -1120,6 +1195,11 @@ class JobController {
|
||||
return true;
|
||||
}
|
||||
final job = jobTable[jobIndex];
|
||||
if (job.type == JobType.transfer &&
|
||||
job.isRemoteToLocal &&
|
||||
job.state == JobState.error) {
|
||||
return true;
|
||||
}
|
||||
job.recvJobRes = true;
|
||||
if (job.type == JobType.deleteFile) {
|
||||
job.state = JobState.done;
|
||||
@@ -1150,7 +1230,8 @@ class JobController {
|
||||
if (job.type == JobType.deleteDir) {
|
||||
return job.state == JobState.done;
|
||||
} else {
|
||||
return true;
|
||||
// An awaiting file-deletion batch refreshes when removeAction finishes.
|
||||
return job.type != JobType.deleteFile || !waitingForResult;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1448,6 +1529,12 @@ class FileFetcher {
|
||||
if (!_removeRemoteReadTask(entry.key, task)) continue;
|
||||
task.completer.completeError(StateError(_kRemoteSessionChangedError));
|
||||
}
|
||||
for (final path in remoteEmptyDirsTasks.keys.toList()) {
|
||||
if (!AndroidDocuments.isPath(path)) continue;
|
||||
remoteEmptyDirsTasks
|
||||
.remove(path)
|
||||
?.completeError(StateError(_kRemoteSessionChangedError));
|
||||
}
|
||||
}
|
||||
|
||||
_RemoteReadTask _registerRemoteReadTask(String path, bool includeHidden) {
|
||||
@@ -1488,15 +1575,18 @@ class FileFetcher {
|
||||
final c = Completer<List<FileDirectory>>();
|
||||
tasks[path] = c;
|
||||
|
||||
Timer(Duration(seconds: 2), () {
|
||||
final timeout = AndroidDocuments.isPath(path)
|
||||
? _kRemoteReadDirTimeout
|
||||
: const Duration(seconds: 2);
|
||||
Timer(timeout, () {
|
||||
if (!identical(tasks[path], c)) return;
|
||||
tasks.remove(path);
|
||||
if (c.isCompleted) return;
|
||||
c.completeError("Failed to read empty dirs, timeout");
|
||||
});
|
||||
return c.future;
|
||||
}
|
||||
|
||||
Future<FileDirectory> registerReadRecursiveTask(int actID) {
|
||||
Future<FileDirectory> registerReadRecursiveTask(int actID, String path) {
|
||||
final tasks = readRecursiveTasks;
|
||||
if (tasks.containsKey(actID)) {
|
||||
throw "Failed to registerRemoveTask, already have same ReadRecursive job";
|
||||
@@ -1504,7 +1594,10 @@ class FileFetcher {
|
||||
final c = Completer<FileDirectory>();
|
||||
tasks[actID] = c;
|
||||
|
||||
Timer(Duration(seconds: 2), () {
|
||||
final timeout = AndroidDocuments.isPath(path)
|
||||
? _kRemoteReadDirTimeout
|
||||
: const Duration(seconds: 2);
|
||||
Timer(timeout, () {
|
||||
tasks.remove(actID);
|
||||
if (c.isCompleted) return;
|
||||
c.completeError("Failed to read dir, timeout");
|
||||
@@ -1586,8 +1679,13 @@ class FileFetcher {
|
||||
fdJsons.map((fdJson) => FileDirectory.fromJson(fdJson)).toList();
|
||||
return fds;
|
||||
} else {
|
||||
final generation = _remoteSessionGeneration;
|
||||
await bind.sessionReadRemoteEmptyDirsRecursiveSync(
|
||||
sessionId: sessionId, path: path, includeHidden: showHidden);
|
||||
if (AndroidDocuments.isPath(path) &&
|
||||
generation != _remoteSessionGeneration) {
|
||||
throw StateError(_kRemoteSessionChangedError);
|
||||
}
|
||||
return registerReadEmptyDirsTask(isLocal, path);
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -1601,6 +1699,11 @@ class FileFetcher {
|
||||
if (isLocal) {
|
||||
final res = await bind.sessionReadLocalDirSync(
|
||||
sessionId: sessionId, path: path, showHidden: showHidden);
|
||||
if (isAndroid && AndroidDocuments.isPath(path)) {
|
||||
final data = jsonDecode(res);
|
||||
if (data['error'] != null) throw StateError(data['error'] as String);
|
||||
return FileDirectory.fromJson(data);
|
||||
}
|
||||
final fd = FileDirectory.fromJson(jsonDecode(res));
|
||||
return fd;
|
||||
} else {
|
||||
@@ -1640,7 +1743,7 @@ class FileFetcher {
|
||||
path: path,
|
||||
isRemote: !isLocal,
|
||||
showHidden: showHidden);
|
||||
return registerReadRecursiveTask(actID);
|
||||
return registerReadRecursiveTask(actID, path);
|
||||
} catch (e) {
|
||||
return Future.error(e);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ import '../common/formatter/id_formatter.dart';
|
||||
import '../desktop/pages/server_page.dart' as desktop;
|
||||
import '../desktop/widgets/tabbar_widget.dart';
|
||||
import '../mobile/pages/server_page.dart';
|
||||
import '../mobile/widgets/android_file_transfer_setup.dart';
|
||||
import '../utils/android_documents.dart';
|
||||
import 'model.dart';
|
||||
|
||||
const kLoginDialogTag = "LOGIN";
|
||||
@@ -399,6 +401,14 @@ class ServerModel with ChangeNotifier {
|
||||
stopService();
|
||||
}
|
||||
} else {
|
||||
if (isAndroid) {
|
||||
try {
|
||||
await AndroidDocuments.requireLogFolder();
|
||||
await showAndroidFileTransferSetup(gFFI);
|
||||
} catch (_) {
|
||||
debugPrint('Folder setup failed; continuing service startup');
|
||||
}
|
||||
}
|
||||
await checkRequestNotificationPermission();
|
||||
if (bind.mainGetLocalOption(key: kOptionDisableFloatingWindow) != 'Y') {
|
||||
await checkFloatingWindowPermission();
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../common.dart';
|
||||
|
||||
class AndroidDocuments {
|
||||
static const root = '/@rustdesk/';
|
||||
|
||||
static bool isPath(String path) => path.startsWith(root);
|
||||
|
||||
static bool isRoot(String path) =>
|
||||
RegExp(r'^/@rustdesk/tree/[^/]+/[^/]+$').hasMatch(path);
|
||||
|
||||
static String displayPath(String path) {
|
||||
if (!isPath(path)) return path;
|
||||
return path.replaceFirst(RegExp(r'^/@rustdesk/tree/[^/]+/'), '');
|
||||
}
|
||||
|
||||
static Future<Map<String, dynamic>?> selectFolder({bool share = false}) async {
|
||||
gFFI.ffiModel.beginAndroidDocumentPicker();
|
||||
try {
|
||||
final result = await gFFI.invokeMethodWithResult<String>(
|
||||
'document_folder', {'share': share});
|
||||
return result == null ? null : jsonDecode(result) as Map<String, dynamic>;
|
||||
} finally {
|
||||
gFFI.ffiModel.endAndroidDocumentPicker();
|
||||
}
|
||||
}
|
||||
|
||||
static Future<String> workspace({bool share = false}) async {
|
||||
final path = await gFFI
|
||||
.invokeMethodWithResult<String>('document_workspace', {'share': share});
|
||||
if (path == null || path.isEmpty) {
|
||||
throw StateError('App workspace is unavailable');
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
static Future<bool> requireLogFolder() async {
|
||||
gFFI.ffiModel.beginAndroidDocumentPicker();
|
||||
try {
|
||||
final ready = await gFFI.invokeMethodWithResult<bool>(
|
||||
'document_require_log_folder', {'checkOnly': true});
|
||||
if (ready == null) {
|
||||
throw StateError('Log directory setup did not complete');
|
||||
}
|
||||
if (ready) return true;
|
||||
if (!await _confirmLogFolder()) return false;
|
||||
final selected = await gFFI
|
||||
.invokeMethodWithResult<bool>('document_require_log_folder');
|
||||
if (selected == null) {
|
||||
throw StateError('Log directory setup did not complete');
|
||||
}
|
||||
return selected;
|
||||
} catch (error) {
|
||||
debugPrint('Log directory setup failed');
|
||||
await gFFI.dialogManager.show<void>(
|
||||
(_, close, __) => CustomAlertDialog(
|
||||
title: Text(translate('Error')),
|
||||
content: Text(error is PlatformException
|
||||
? translate(error.message ?? 'Failed')
|
||||
: error.toString()),
|
||||
actions: [
|
||||
TextButton(onPressed: close, child: Text(translate('OK'))),
|
||||
],
|
||||
onSubmit: close,
|
||||
onCancel: close,
|
||||
),
|
||||
backDismiss: true,
|
||||
forceGlobal: true,
|
||||
);
|
||||
rethrow;
|
||||
} finally {
|
||||
gFFI.ffiModel.endAndroidDocumentPicker();
|
||||
}
|
||||
}
|
||||
|
||||
static Future<bool> _confirmLogFolder() async =>
|
||||
await gFFI.dialogManager.show<bool>(
|
||||
(_, close, __) => CustomAlertDialog(
|
||||
title: Text(translate('Permissions')),
|
||||
content: Text(
|
||||
'${translate('android-logs-folder-tip')}\n'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => close(true),
|
||||
child: Text(translate('Choose folder')),
|
||||
),
|
||||
],
|
||||
onCancel: () => close(false),
|
||||
),
|
||||
backDismiss: true,
|
||||
forceGlobal: true,
|
||||
) ==
|
||||
true;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
class DownloadPaths {
|
||||
static Future<void> ensureNoLinks(String root, String destination) async {
|
||||
if (!path.isWithin(root, destination)) {
|
||||
throw FormatException('Invalid download directory: $destination');
|
||||
}
|
||||
var current = root;
|
||||
for (final name in path.split(path.relative(destination, from: root))) {
|
||||
current = path.join(current, name);
|
||||
if (await FileSystemEntity.type(current, followLinks: false) ==
|
||||
FileSystemEntityType.link) {
|
||||
throw FormatException('Download directory contains a link: $current');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool validName(String name, {required bool windows}) {
|
||||
if (name.isEmpty || name == '.' || name == '..' || name.contains('\x00')) {
|
||||
return false;
|
||||
}
|
||||
if (name.contains('/')) return false;
|
||||
return !windows ||
|
||||
(!name.contains(RegExp(r'[<>:"\\|?*]')) &&
|
||||
!name.endsWith('.') &&
|
||||
!name.endsWith(' '));
|
||||
}
|
||||
|
||||
static String mapDirectory(
|
||||
String remoteRoot, String remotePath, String localRoot,
|
||||
{required bool remoteWindows, required bool localWindows}) {
|
||||
final remote = path.Context(
|
||||
style: remoteWindows ? path.Style.windows : path.Style.posix);
|
||||
final local = path.Context(
|
||||
style: localWindows ? path.Style.windows : path.Style.posix);
|
||||
if (remotePath.contains('\x00') ||
|
||||
remote.split(remotePath).contains('..') ||
|
||||
(!remote.equals(remoteRoot, remotePath) &&
|
||||
!remote.isWithin(remoteRoot, remotePath))) {
|
||||
throw FormatException('Invalid download directory: $remotePath');
|
||||
}
|
||||
final relative = remote.relative(remotePath, from: remoteRoot);
|
||||
if (relative == '.') return localRoot;
|
||||
final names = remote.split(relative);
|
||||
if (names.any((name) => !validName(name, windows: localWindows))) {
|
||||
throw FormatException('Invalid download directory: $remotePath');
|
||||
}
|
||||
return local.joinAll([localRoot, ...names]);
|
||||
}
|
||||
}
|
||||
@@ -1834,6 +1834,10 @@ class RustdeskImpl {
|
||||
throw UnimplementedError("mainRemoveTrustedDevices");
|
||||
}
|
||||
|
||||
Future<void> mainRenewTrustedDevices({required String json, dynamic hint}) {
|
||||
throw UnimplementedError("mainRenewTrustedDevices");
|
||||
}
|
||||
|
||||
Future<void> mainClearTrustedDevices({dynamic hint}) {
|
||||
throw UnimplementedError("mainClearTrustedDevices");
|
||||
}
|
||||
@@ -1928,6 +1932,11 @@ class RustdeskImpl {
|
||||
}
|
||||
|
||||
String mainGetCommonSync({required String key, dynamic hint}) {
|
||||
const prefix = 'resolve-api-server:';
|
||||
if (key.startsWith(prefix)) {
|
||||
return js.context
|
||||
.callMethod('getByName', ['api_server', key.substring(prefix.length)]);
|
||||
}
|
||||
throw UnimplementedError("mainGetCommonSync");
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_hbb/common.dart';
|
||||
import 'package:flutter_hbb/generated_bridge.dart';
|
||||
import 'package:flutter_hbb/mobile/widgets/android_file_transfer_setup.dart';
|
||||
import 'package:flutter_hbb/models/model.dart';
|
||||
import 'package:flutter_hbb/models/platform_model.dart';
|
||||
import 'package:flutter_hbb/models/server_model.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
class _Binding extends Fake implements RustdeskImpl {
|
||||
final options = <String, String>{};
|
||||
|
||||
@override
|
||||
String translate(
|
||||
{required String name, required String locale, dynamic hint}) =>
|
||||
name;
|
||||
|
||||
@override
|
||||
String getLocalFlutterOption({required String k, dynamic hint}) =>
|
||||
options[k] ?? '';
|
||||
|
||||
@override
|
||||
Future<void> setLocalFlutterOption(
|
||||
{required String k, required String v, dynamic hint}) async {
|
||||
options[k] = v;
|
||||
}
|
||||
|
||||
@override
|
||||
bool isDisableSettings({dynamic hint}) => false;
|
||||
|
||||
@override
|
||||
bool isOutgoingOnly({dynamic hint}) => false;
|
||||
|
||||
@override
|
||||
String mainGetBuildinOption({required String key, dynamic hint}) => '';
|
||||
}
|
||||
|
||||
class _Server extends Fake implements ServerModel {
|
||||
@override
|
||||
List<Client> get clients => [];
|
||||
}
|
||||
|
||||
class _Session extends Fake implements FFI {
|
||||
@override
|
||||
final dialogManager = OverlayDialogManager();
|
||||
|
||||
@override
|
||||
final serverModel = _Server();
|
||||
}
|
||||
|
||||
void main() {
|
||||
late _Session session;
|
||||
|
||||
setUp(() {
|
||||
platformFFI.setBindingForTesting(_Binding());
|
||||
session = _Session();
|
||||
});
|
||||
|
||||
Future<void> openApp(WidgetTester tester) => tester.pumpWidget(MaterialApp(
|
||||
navigatorKey: globalKey,
|
||||
home: const Scaffold(),
|
||||
));
|
||||
|
||||
testWidgets('skipping folder setup suppresses later prompts', (tester) async {
|
||||
await openApp(tester);
|
||||
final first = showAndroidFileTransferSetup(session);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Skip'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(await first, isTrue);
|
||||
expect(await showAndroidFileTransferSetup(_Session()), isTrue);
|
||||
expect(find.byType(CustomAlertDialog), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('canceling setup leaves it available at the next entry',
|
||||
(tester) async {
|
||||
await openApp(tester);
|
||||
final first = showAndroidFileTransferSetup(session);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
|
||||
await tester.pumpAndSettle();
|
||||
expect(await first, isFalse);
|
||||
|
||||
final retry = showAndroidFileTransferSetup(session);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(CustomAlertDialog), findsOneWidget);
|
||||
await tester.tap(find.text('Skip'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(await retry, isTrue);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter_hbb/common/widgets/api_server_warning.dart';
|
||||
|
||||
void main() {
|
||||
test('warns only for remote HTTP endpoints', () {
|
||||
final cases = <String?, bool>{
|
||||
null: false,
|
||||
'': false,
|
||||
'https://api.example.com': false,
|
||||
'http://api.example.com': true,
|
||||
'http://192.168.1.13:13000': true,
|
||||
'http://localhost:21114': false,
|
||||
'http://127.0.0.1:21114': false,
|
||||
'http://[::1]:21114': false,
|
||||
};
|
||||
for (final entry in cases.entries) {
|
||||
expect(shouldWarnApiServer(entry.key), entry.value, reason: entry.key);
|
||||
}
|
||||
});
|
||||
|
||||
testWidgets('warning follows API and ID changes using the resolved endpoint',
|
||||
(tester) async {
|
||||
final api = TextEditingController();
|
||||
final id = TextEditingController(text: 'id.example.com');
|
||||
addTearDown(api.dispose);
|
||||
addTearDown(id.dispose);
|
||||
await tester.pumpWidget(MaterialApp(
|
||||
home: ApiServerWarning(
|
||||
controller: api,
|
||||
idController: id,
|
||||
message: 'HTTP warning',
|
||||
emptyMessage: 'Default HTTP warning',
|
||||
resolveApiServer: ({required api, required custom}) =>
|
||||
api.isNotEmpty ? api : 'http://$custom',
|
||||
),
|
||||
));
|
||||
expect(find.text('Default HTTP warning'), findsOneWidget);
|
||||
|
||||
id.text = 'localhost';
|
||||
await tester.pump();
|
||||
expect(find.text('Default HTTP warning'), findsNothing);
|
||||
|
||||
api.text = 'http://api.example.com';
|
||||
await tester.pump();
|
||||
expect(find.text('HTTP warning'), findsOneWidget);
|
||||
|
||||
api.text = 'https://api.example.com';
|
||||
await tester.pump();
|
||||
expect(find.text('HTTP warning'), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('resolver failures are reported without breaking the server form',
|
||||
(tester) async {
|
||||
final api = TextEditingController();
|
||||
final id = TextEditingController();
|
||||
addTearDown(api.dispose);
|
||||
addTearDown(id.dispose);
|
||||
await tester.pumpWidget(MaterialApp(
|
||||
home: Scaffold(
|
||||
body: Column(children: [
|
||||
TextField(controller: api),
|
||||
Expanded(
|
||||
child: ApiServerWarning(
|
||||
controller: api,
|
||||
idController: id,
|
||||
message: 'HTTP warning',
|
||||
emptyMessage: 'Default HTTP warning',
|
||||
resolveApiServer: ({required api, required custom}) =>
|
||||
throw const FormatException('API preview failed'),
|
||||
)),
|
||||
]),
|
||||
),
|
||||
));
|
||||
expect(tester.takeException(), isA<FormatException>());
|
||||
expect(find.byType(ErrorWidget), findsNothing);
|
||||
expect(find.text('Default HTTP warning'), findsNothing);
|
||||
expect(find.byType(TextField), findsOneWidget);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter_hbb/generated_bridge.dart';
|
||||
import 'package:flutter_hbb/models/file_model.dart';
|
||||
import 'package:flutter_hbb/models/model.dart';
|
||||
import 'package:flutter_hbb/models/platform_model.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
final _sessionId = UuidValue('00000000-0000-4000-8000-000000000001');
|
||||
|
||||
class _Binding extends Fake implements RustdeskImpl {
|
||||
final sent = <String>[];
|
||||
final created = <String>[];
|
||||
int nextId = 0;
|
||||
|
||||
@override
|
||||
String mainGetCommonSync({required String key, dynamic hint}) =>
|
||||
'${++nextId}';
|
||||
|
||||
@override
|
||||
int versionToNumber({required String v, dynamic hint}) =>
|
||||
v == '1.3.3' ? 1 : 2;
|
||||
|
||||
@override
|
||||
Future<void> sessionSendFiles({
|
||||
required UuidValue sessionId,
|
||||
required int actId,
|
||||
required String path,
|
||||
required String to,
|
||||
required int fileNum,
|
||||
required bool includeHidden,
|
||||
required bool isRemote,
|
||||
required bool isDir,
|
||||
dynamic hint,
|
||||
}) async {
|
||||
expect(isRemote, isTrue);
|
||||
sent.add(to);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> sessionCreateDir({
|
||||
required UuidValue sessionId,
|
||||
required int actId,
|
||||
required String path,
|
||||
required bool isRemote,
|
||||
dynamic hint,
|
||||
}) async {
|
||||
expect(isRemote, isFalse);
|
||||
created.add(path);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> sessionCancelJob({
|
||||
required UuidValue sessionId,
|
||||
required int actId,
|
||||
dynamic hint,
|
||||
}) async {}
|
||||
}
|
||||
|
||||
class _Session extends Fake implements FFI {
|
||||
@override
|
||||
final String id = 'download-test';
|
||||
@override
|
||||
UuidValue get sessionId => _sessionId;
|
||||
@override
|
||||
late final ffiModel = FfiModel(WeakReference(this));
|
||||
}
|
||||
|
||||
class _Fetcher extends FileFetcher {
|
||||
_Fetcher() : super(() => _sessionId);
|
||||
List<String> emptyDirectories = [];
|
||||
|
||||
@override
|
||||
Future<List<FileDirectory>> readEmptyDirs(
|
||||
String path, bool isLocal, bool showHidden) async =>
|
||||
emptyDirectories.map((path) => FileDirectory()..path = path).toList();
|
||||
}
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
late _Binding binding;
|
||||
late _Session session;
|
||||
late _Fetcher fetcher;
|
||||
late FileController controller;
|
||||
late DirectoryData destination;
|
||||
|
||||
setUp(() {
|
||||
binding = _Binding();
|
||||
platformFFI.setBindingForTesting(binding);
|
||||
session = _Session();
|
||||
session.ffiModel.pi.version = '1.5.1';
|
||||
fetcher = _Fetcher();
|
||||
destination =
|
||||
DirectoryData(FileDirectory()..path = '/downloads', DirectoryOptions());
|
||||
controller = FileController(
|
||||
isLocal: false,
|
||||
getSessionID: () => _sessionId,
|
||||
rootState: WeakReference(session),
|
||||
jobController: JobController(() => _sessionId, () => null),
|
||||
fileFetcher: fetcher,
|
||||
getOtherSideDirectoryData: () => destination,
|
||||
);
|
||||
controller.directory.value.path = '/remote';
|
||||
});
|
||||
|
||||
tearDown(() => session.ffiModel.dispose());
|
||||
|
||||
Future<void> download(String name, {bool directory = false}) async {
|
||||
final entry = Entry()
|
||||
..name = name
|
||||
..path = '/remote/$name'
|
||||
..entryType = directory ? 0 : 4;
|
||||
final items = SelectedItems(isLocal: false)..add(entry);
|
||||
await controller.sendFiles(items, destination);
|
||||
}
|
||||
|
||||
test('downloads refuse peer listing names that escape the local folder',
|
||||
() async {
|
||||
await download('report.txt');
|
||||
expect(binding.sent, ['/downloads/report.txt']);
|
||||
binding.sent.clear();
|
||||
for (final windows in [false, true]) {
|
||||
destination.options.isWindows = windows;
|
||||
destination.directory.path = windows ? r'C:\downloads' : '/downloads';
|
||||
for (final name in [
|
||||
'../outside.txt',
|
||||
'/outside.txt',
|
||||
'.',
|
||||
'..',
|
||||
'',
|
||||
'bad\x00name',
|
||||
if (windows) ...[r'..\outside.txt', r'C:\outside.txt', r'\\host\share'],
|
||||
]) {
|
||||
await download(name);
|
||||
expect(binding.sent, isEmpty, reason: name);
|
||||
expect(controller.jobController.jobTable.last.state, JobState.error);
|
||||
}
|
||||
}
|
||||
await controller.jobController.jobDone({
|
||||
'id': '${controller.jobController.jobTable.last.id}',
|
||||
'file_num': '0',
|
||||
});
|
||||
expect(controller.jobController.jobTable.last.state, JobState.error);
|
||||
});
|
||||
|
||||
test('empty-directory downloads reject paths outside the selected folder',
|
||||
() async {
|
||||
for (final path in ['/remote/other/empty', '/remote/docs/../out']) {
|
||||
fetcher.emptyDirectories = ['/remote/docs/ok', path];
|
||||
await download('docs', directory: true);
|
||||
expect(binding.created, isEmpty, reason: path);
|
||||
expect(controller.jobController.jobTable.last.state, JobState.error);
|
||||
}
|
||||
fetcher.emptyDirectories = ['/remote/docs', '/remote/docs/sub/empty'];
|
||||
await download('docs', directory: true);
|
||||
expect(binding.created, ['/downloads/docs', '/downloads/docs/sub/empty']);
|
||||
});
|
||||
|
||||
test('empty-directory downloads refuse existing local links', () async {
|
||||
final temporary =
|
||||
await Directory.systemTemp.createTemp('rustdesk_download_');
|
||||
addTearDown(() => temporary.delete(recursive: true));
|
||||
final outside = await Directory('${temporary.path}/outside').create();
|
||||
final downloads = await Directory('${temporary.path}/downloads').create();
|
||||
await Link('${downloads.path}/docs').create(outside.path);
|
||||
destination.directory.path = downloads.path;
|
||||
destination.options.isWindows = Platform.isWindows;
|
||||
fetcher.emptyDirectories = ['/remote/docs/empty'];
|
||||
await download('docs', directory: true);
|
||||
expect(binding.created, isEmpty);
|
||||
expect(controller.jobController.jobTable.last.state, JobState.error);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_hbb/desktop/pages/file_manager_page.dart';
|
||||
import 'package:flutter_hbb/desktop/widgets/list_search_action_listener.dart';
|
||||
import 'package:flutter_hbb/models/file_model.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
List<Entry> _entries(int count) => [
|
||||
for (var i = 0; i < count; i++)
|
||||
Entry()
|
||||
..name = 'f$i'
|
||||
..path = '/f$i'
|
||||
];
|
||||
|
||||
List<String> _names(List<Entry> entries) =>
|
||||
entries.map((e) => e.name).toList()..sort();
|
||||
|
||||
void main() {
|
||||
test('navigation keys move the selection and stop at the ends', () {
|
||||
final entries = _entries(5);
|
||||
expect(_names(navigateSelection(entries, [], 1, false)), ['f0']);
|
||||
expect(_names(navigateSelection(entries, [], -1, false)), ['f4']);
|
||||
var selected = navigateSelection(entries, [entries[1]], 1, false);
|
||||
expect(_names(selected), ['f2']);
|
||||
selected = navigateSelection(entries, selected, -1, false);
|
||||
expect(_names(selected), ['f1']);
|
||||
expect(_names(navigateSelection(entries, selected, -3, false)), ['f0']);
|
||||
expect(_names(navigateSelection(entries, selected, 5, false)), ['f4']);
|
||||
});
|
||||
|
||||
test('shift extends and shrinks the range from the anchor', () {
|
||||
final entries = _entries(5);
|
||||
var selected = [entries[2]];
|
||||
selected = navigateSelection(entries, selected, 1, true);
|
||||
selected = navigateSelection(entries, selected, 1, true);
|
||||
expect(_names(selected), ['f2', 'f3', 'f4']);
|
||||
selected = navigateSelection(entries, selected, -1, true);
|
||||
selected = navigateSelection(entries, selected, -1, true);
|
||||
selected = navigateSelection(entries, selected, -1, true);
|
||||
expect(_names(selected), ['f1', 'f2']);
|
||||
selected = navigateSelection(entries, selected, 1, false);
|
||||
expect(_names(selected), ['f2']);
|
||||
});
|
||||
|
||||
test('page keys go to the visible edge before paging', () {
|
||||
// Rows 10..19 are fully visible.
|
||||
expect(pageDelta(12, 10, 19, true), 7);
|
||||
expect(pageDelta(19, 10, 19, true), 9);
|
||||
expect(pageDelta(12, 10, 19, false), -2);
|
||||
expect(pageDelta(10, 10, 19, false), -9);
|
||||
});
|
||||
|
||||
testWidgets('Enter does not reach type-to-search', (tester) async {
|
||||
final node = FocusNode();
|
||||
addTearDown(node.dispose);
|
||||
final searched = <String>[];
|
||||
await tester.pumpWidget(MaterialApp(
|
||||
home: ListSearchActionListener(
|
||||
node: node,
|
||||
buffer: TimeoutStringBuffer(),
|
||||
onNext: searched.add,
|
||||
onSearch: searched.add,
|
||||
child: const SizedBox(),
|
||||
),
|
||||
));
|
||||
node.requestFocus();
|
||||
await tester.pump();
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.enter, character: '\r');
|
||||
expect(searched, isEmpty);
|
||||
});
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter_hbb/generated_bridge.dart';
|
||||
import 'package:flutter_hbb/models/file_model.dart';
|
||||
import 'package:flutter_hbb/models/model.dart';
|
||||
import 'package:flutter_hbb/models/platform_model.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
@@ -47,7 +50,124 @@ class _SentRead {
|
||||
const _SentRead(this.path, this.includeHidden);
|
||||
}
|
||||
|
||||
class _FileBinding extends Fake implements RustdeskImpl {
|
||||
int _jobId = 0;
|
||||
final emptyDirsDispatch = Completer<void>();
|
||||
|
||||
@override
|
||||
Future<void> sessionReadRemoteEmptyDirsRecursiveSync(
|
||||
{required UuidValue sessionId,
|
||||
required String path,
|
||||
required bool includeHidden,
|
||||
dynamic hint}) =>
|
||||
emptyDirsDispatch.future;
|
||||
|
||||
@override
|
||||
String translate(
|
||||
{required String name, required String locale, dynamic hint}) =>
|
||||
name;
|
||||
|
||||
@override
|
||||
String mainGetCommonSync({required String key, dynamic hint}) =>
|
||||
'${++_jobId}';
|
||||
}
|
||||
|
||||
class _DeletingController extends FileController {
|
||||
final confirmations = <String>[];
|
||||
|
||||
_DeletingController()
|
||||
: super(
|
||||
isLocal: false,
|
||||
getSessionID: () => _sessionId,
|
||||
rootState: WeakReference(_FakeFFI()),
|
||||
jobController: JobController(() => _sessionId, () => null),
|
||||
fileFetcher: FileFetcher(() => _sessionId),
|
||||
getOtherSideDirectoryData: () =>
|
||||
DirectoryData(FileDirectory(), DirectoryOptions()),
|
||||
);
|
||||
|
||||
@override
|
||||
Future<bool?> showRemoveDialog(
|
||||
String title, String content, bool showCheckbox) async {
|
||||
confirmations.add(content);
|
||||
return true;
|
||||
}
|
||||
|
||||
@override
|
||||
void sendRemoveFile(String path, int fileNum, int actId) {
|
||||
scheduleMicrotask(() {
|
||||
selectedItems.reconcile(
|
||||
selectedItems.items.where((entry) => entry.path != path).toList());
|
||||
unawaited(
|
||||
jobController.jobDone({'id': '$actId', 'file_num': '$fileNum'}));
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> refresh() async => true;
|
||||
}
|
||||
|
||||
void main() {
|
||||
for (final scenario in ['completion', 'reconnect', 'dispatch reconnect']) {
|
||||
testWidgets('SAF retry after $scenario', (tester) async {
|
||||
const path = '/@rustdesk/tree/grant/root';
|
||||
final response = jsonEncode({
|
||||
'path': path,
|
||||
'empty_dirs': [jsonDecode(_directoryJson('$path/empty'))],
|
||||
});
|
||||
final binding = _FileBinding();
|
||||
platformFFI.setBindingForTesting(binding);
|
||||
final fetcher = FileFetcher(() => _sessionId);
|
||||
final first = expectLater(
|
||||
fetcher.readEmptyDirs(path, false, false),
|
||||
scenario == 'completion'
|
||||
? completion(isNotEmpty)
|
||||
: throwsA(isA<StateError>()));
|
||||
try {
|
||||
if (scenario != 'dispatch reconnect')
|
||||
binding.emptyDirsDispatch.complete();
|
||||
await tester.pump(const Duration(seconds: 3));
|
||||
if (scenario != 'completion') {
|
||||
fetcher.beginRemoteSession();
|
||||
} else {
|
||||
fetcher.tryCompleteEmptyDirsTask(response, 'false');
|
||||
}
|
||||
if (scenario == 'dispatch reconnect')
|
||||
binding.emptyDirsDispatch.complete();
|
||||
await tester.pump();
|
||||
final retry = expectLater(
|
||||
fetcher.readEmptyDirs(path, false, false).then((directories) =>
|
||||
directories.map((directory) => directory.path)),
|
||||
completion(['$path/empty']));
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(seconds: 28));
|
||||
fetcher.tryCompleteEmptyDirsTask(response, 'false');
|
||||
await tester.pump(const Duration(seconds: 2));
|
||||
await retry;
|
||||
} finally {
|
||||
await tester.pump(const Duration(seconds: 30));
|
||||
}
|
||||
await first;
|
||||
});
|
||||
}
|
||||
|
||||
test('deletion confirms all five files despite refreshed selection',
|
||||
() async {
|
||||
platformFFI.setBindingForTesting(_FileBinding());
|
||||
final controller = _DeletingController();
|
||||
final files = ['a.txt', 'b.txt', 'c.txt', 'd.txt', 'e.txt']
|
||||
.map((name) => Entry()
|
||||
..name = name
|
||||
..path = '/selected/$name')
|
||||
.toList();
|
||||
controller.selectedItems.selectAll(files);
|
||||
|
||||
await controller.removeAction(controller.selectedItems);
|
||||
|
||||
expect(controller.confirmations, files.map((file) => file.path));
|
||||
expect(controller.selectedItems.items, isEmpty);
|
||||
});
|
||||
|
||||
test('a fast remote response is matched after registration', () async {
|
||||
late final FileFetcher fileFetcher;
|
||||
fileFetcher = FileFetcher(
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
import 'dart:ui' show PointerDeviceKind, SemanticsAction;
|
||||
|
||||
import 'package:flutter/gestures.dart' show kSecondaryMouseButton;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_hbb/common/widgets/peer_card.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
const doubleClickInterval = Duration(milliseconds: 75);
|
||||
const dragOffset = Offset(150, 0);
|
||||
// Keep pointer cases semantics-off to cover parent/child gesture competition.
|
||||
// VM taps bypass browser click-to-semantics conversion; verify that in a browser.
|
||||
for (final action in ['physical clicks', 'semantic tap', 'keyboard']) {
|
||||
testWidgets('More $action opens once without connecting the card',
|
||||
(tester) async {
|
||||
var opened = 0;
|
||||
var connected = 0;
|
||||
await tester.pumpWidget(MaterialApp(
|
||||
home: Material(
|
||||
child: GestureDetector(
|
||||
excludeFromSemantics: true,
|
||||
onTap: () {},
|
||||
onDoubleTap: () => connected++,
|
||||
onLongPress: () {},
|
||||
child: Builder(builder: (context) {
|
||||
return Center(
|
||||
child: build_more(context, onTap: () {
|
||||
opened++;
|
||||
showMenu<void>(
|
||||
context: context,
|
||||
position: RelativeRect.fill,
|
||||
items: const [PopupMenuItem(child: Text('Connect'))],
|
||||
);
|
||||
}));
|
||||
}),
|
||||
),
|
||||
),
|
||||
));
|
||||
final button = find.byIcon(Icons.more_vert);
|
||||
final position = tester.getCenter(button);
|
||||
if (action == 'semantic tap') {
|
||||
final node = tester.getSemantics(button);
|
||||
node.owner!.performAction(node.id, SemanticsAction.tap);
|
||||
} else if (action == 'keyboard') {
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.tab);
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
|
||||
} else {
|
||||
await tester.tapAt(position,
|
||||
kind: PointerDeviceKind.mouse, buttons: kSecondaryMouseButton);
|
||||
await tester.pumpAndSettle();
|
||||
expect(opened, 0, reason: 'A secondary click must not open More');
|
||||
await tester.dragFrom(position, dragOffset,
|
||||
kind: PointerDeviceKind.mouse);
|
||||
await tester.pumpAndSettle();
|
||||
expect(opened, 0, reason: 'Dragging out must cancel the More tap');
|
||||
await tester.tapAt(position, kind: PointerDeviceKind.mouse);
|
||||
}
|
||||
expect(opened, 1,
|
||||
reason: 'More must not wait for a possible double click');
|
||||
await tester.pump();
|
||||
if (action == 'physical clicks') {
|
||||
await tester.pump(doubleClickInterval);
|
||||
await tester.tapAt(position, kind: PointerDeviceKind.mouse);
|
||||
}
|
||||
await tester.pumpAndSettle();
|
||||
expect({'menu': opened, 'connection': connected},
|
||||
{'menu': 1, 'connection': 0});
|
||||
}, semanticsEnabled: action != 'physical clicks');
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "win32_desktop.h"
|
||||
#include "flutter_window.h"
|
||||
#include "utils.h"
|
||||
#include "service_control.h"
|
||||
|
||||
typedef char** (*FUNC_RUSTDESK_CORE_MAIN)(int*);
|
||||
typedef void (*FUNC_RUSTDESK_FREE_ARGS)( char**, int);
|
||||
@@ -23,6 +24,9 @@ const wchar_t* getWindowClassName();
|
||||
int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
|
||||
_In_ wchar_t *command_line, _In_ int show_command)
|
||||
{
|
||||
if (auto result = service_control::HandleCommand(command_line)) {
|
||||
return static_cast<int>(*result);
|
||||
}
|
||||
HINSTANCE hInstance = LoadLibraryA("librustdesk.dll");
|
||||
if (!hInstance)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
#ifndef RUSTDESK_RUNNER_SERVICE_CONTROL_H_
|
||||
#define RUSTDESK_RUNNER_SERVICE_CONTROL_H_
|
||||
|
||||
#include <windows.h>
|
||||
#include <shellapi.h>
|
||||
#include <winsvc.h>
|
||||
|
||||
#include <cstdio>
|
||||
#include <cwchar>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <type_traits>
|
||||
|
||||
namespace service_control {
|
||||
|
||||
using ServiceHandle = std::unique_ptr<std::remove_pointer_t<SC_HANDLE>,
|
||||
decltype(&CloseServiceHandle)>;
|
||||
constexpr DWORD kStopTimeoutMilliseconds = 30000;
|
||||
constexpr DWORD kPollIntervalMilliseconds = 100;
|
||||
|
||||
inline DWORD StopService(SC_HANDLE service) {
|
||||
SERVICE_STATUS_PROCESS status{};
|
||||
DWORD bytes_needed = 0;
|
||||
if (!QueryServiceStatusEx(service, SC_STATUS_PROCESS_INFO,
|
||||
reinterpret_cast<BYTE*>(&status), sizeof(status),
|
||||
&bytes_needed)) {
|
||||
return GetLastError();
|
||||
}
|
||||
if (status.dwCurrentState == SERVICE_STOPPED) {
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
if (status.dwCurrentState != SERVICE_STOP_PENDING) {
|
||||
SERVICE_STATUS stopped{};
|
||||
if (!ControlService(service, SERVICE_CONTROL_STOP, &stopped)) {
|
||||
const DWORD error = GetLastError();
|
||||
return error == ERROR_SERVICE_NOT_ACTIVE ? ERROR_SUCCESS : error;
|
||||
}
|
||||
}
|
||||
// The installer may remove files next; accepting STOP alone does not mean
|
||||
// the service has reached SERVICE_STOPPED.
|
||||
const ULONGLONG started = GetTickCount64();
|
||||
while (status.dwCurrentState != SERVICE_STOPPED) {
|
||||
if (GetTickCount64() - started >= kStopTimeoutMilliseconds) {
|
||||
return ERROR_TIMEOUT;
|
||||
}
|
||||
Sleep(kPollIntervalMilliseconds);
|
||||
if (!QueryServiceStatusEx(service, SC_STATUS_PROCESS_INFO,
|
||||
reinterpret_cast<BYTE*>(&status), sizeof(status),
|
||||
&bytes_needed)) {
|
||||
return GetLastError();
|
||||
}
|
||||
}
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
inline DWORD RemoveService(const wchar_t* name) {
|
||||
ServiceHandle manager(OpenSCManagerW(nullptr, nullptr, SC_MANAGER_CONNECT),
|
||||
CloseServiceHandle);
|
||||
if (!manager) {
|
||||
return GetLastError();
|
||||
}
|
||||
ServiceHandle service(
|
||||
OpenServiceW(manager.get(), name,
|
||||
SERVICE_STOP | SERVICE_QUERY_STATUS | DELETE),
|
||||
CloseServiceHandle);
|
||||
if (!service) {
|
||||
const DWORD error = GetLastError();
|
||||
return error == ERROR_SERVICE_DOES_NOT_EXIST ? ERROR_SUCCESS : error;
|
||||
}
|
||||
const DWORD stopped = StopService(service.get());
|
||||
if (stopped != ERROR_SUCCESS) {
|
||||
// The uninstall script must still reach its taskkill cleanup.
|
||||
std::fwprintf(stderr,
|
||||
L"Service did not stop cleanly: Windows error %lu\n", stopped);
|
||||
}
|
||||
if (DeleteService(service.get())) {
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
const DWORD error = GetLastError();
|
||||
return error == ERROR_SERVICE_MARKED_FOR_DELETE ? ERROR_SUCCESS : error;
|
||||
}
|
||||
|
||||
inline DWORD InstallService(const wchar_t* name, const wchar_t* executable,
|
||||
bool rollback_on_failure) {
|
||||
if (!*executable || wcschr(executable, L'"')) {
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
const std::wstring binary_path =
|
||||
L"\"" + std::wstring(executable) + L"\" --service";
|
||||
const std::wstring display_name = std::wstring(name) + L" Service";
|
||||
ServiceHandle manager(
|
||||
OpenSCManagerW(nullptr, nullptr,
|
||||
SC_MANAGER_CONNECT | SC_MANAGER_CREATE_SERVICE),
|
||||
CloseServiceHandle);
|
||||
if (!manager) {
|
||||
return GetLastError();
|
||||
}
|
||||
ServiceHandle service(
|
||||
CreateServiceW(manager.get(), name, display_name.c_str(),
|
||||
SERVICE_START | DELETE, SERVICE_WIN32_OWN_PROCESS,
|
||||
SERVICE_AUTO_START, SERVICE_ERROR_NORMAL,
|
||||
binary_path.c_str(), nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr),
|
||||
CloseServiceHandle);
|
||||
const bool created = service != nullptr;
|
||||
// --after-install can reuse a registration. Preserve its executable and
|
||||
// account, as the previous create-then-start script did.
|
||||
if (!service && GetLastError() == ERROR_SERVICE_EXISTS) {
|
||||
service.reset(OpenServiceW(manager.get(), name, SERVICE_START));
|
||||
}
|
||||
if (!service) {
|
||||
return GetLastError();
|
||||
}
|
||||
if (StartServiceW(service.get(), 0, nullptr)) {
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
const DWORD error = GetLastError();
|
||||
// Only manual Start Service restores stop-service=Y on failure. Other
|
||||
// installation paths retain the registration for a later startup attempt.
|
||||
if (rollback_on_failure && created && error != ERROR_SERVICE_ALREADY_RUNNING &&
|
||||
!DeleteService(service.get())) {
|
||||
const DWORD rollback_error = GetLastError();
|
||||
std::fwprintf(stderr,
|
||||
L"Failed to roll back newly created service: Windows error %lu\n",
|
||||
rollback_error);
|
||||
}
|
||||
return error == ERROR_SERVICE_ALREADY_RUNNING ? ERROR_SUCCESS : error;
|
||||
}
|
||||
|
||||
inline DWORD RunCommand(int count, wchar_t** args) {
|
||||
constexpr int kRemoveArgumentCount = 4;
|
||||
constexpr int kInstallArgumentCount = 5;
|
||||
if (count < kRemoveArgumentCount) {
|
||||
return ERROR_BAD_ARGUMENTS;
|
||||
}
|
||||
if (!*args[3]) {
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
const std::wstring_view operation(args[2]);
|
||||
const bool rollback_on_failure = operation == L"create-service-with-rollback";
|
||||
if ((operation == L"create-service" || rollback_on_failure) &&
|
||||
count == kInstallArgumentCount) {
|
||||
return InstallService(args[3], args[4], rollback_on_failure);
|
||||
}
|
||||
if (operation == L"remove" && count == kRemoveArgumentCount) {
|
||||
return RemoveService(args[3]);
|
||||
}
|
||||
return ERROR_BAD_ARGUMENTS;
|
||||
}
|
||||
|
||||
// Keep these commands in the existing runner so installation/removal can control
|
||||
// services before loading librustdesk.dll or initializing the UI. A Rust-side
|
||||
// handler would first require that DLL to load. The header-only implementation
|
||||
// keeps main.cpp as a dispatch hook without adding a CMake source entry; it is
|
||||
// compiled into the existing EXE, not a separately packaged helper.
|
||||
inline std::optional<DWORD> HandleCommand(const wchar_t* command_line) {
|
||||
constexpr std::wstring_view option = L"--service-control";
|
||||
const std::wstring_view arguments(command_line);
|
||||
if (arguments.compare(0, option.size(), option) != 0 ||
|
||||
(arguments.size() > option.size() && arguments[option.size()] != L' ' &&
|
||||
arguments[option.size()] != L'\t')) {
|
||||
return std::nullopt;
|
||||
}
|
||||
int count = 0;
|
||||
wchar_t** args = CommandLineToArgvW(GetCommandLineW(), &count);
|
||||
if (!args) {
|
||||
return GetLastError();
|
||||
}
|
||||
const DWORD result = RunCommand(count, args);
|
||||
LocalFree(args);
|
||||
if (result != ERROR_SUCCESS) {
|
||||
std::fwprintf(stderr,
|
||||
L"RustDesk service control failed with Windows error %lu\n",
|
||||
result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace service_control
|
||||
|
||||
#endif // RUSTDESK_RUNNER_SERVICE_CONTROL_H_
|
||||
@@ -84,6 +84,8 @@ message LoginRequest {
|
||||
string my_platform = 13;
|
||||
bytes hwid = 14;
|
||||
string avatar = 17;
|
||||
bytes trusted_device_v2_token = 18;
|
||||
bool trusted_device_v2_supported = 19;
|
||||
}
|
||||
|
||||
message Terminal {
|
||||
@@ -93,6 +95,7 @@ message Terminal {
|
||||
message Auth2FA {
|
||||
string code = 1;
|
||||
bytes hwid = 2;
|
||||
bool trust_this_device = 3;
|
||||
}
|
||||
|
||||
message ChatMessage { string text = 1; }
|
||||
@@ -147,6 +150,8 @@ message LoginResponse {
|
||||
PeerInfo peer_info = 2;
|
||||
}
|
||||
bool enable_trusted_devices = 3;
|
||||
bool trusted_device_v2_supported = 4;
|
||||
bytes trusted_device_v2_token = 5;
|
||||
}
|
||||
|
||||
message TouchScaleUpdate {
|
||||
|
||||
@@ -88,6 +88,7 @@ pub const OPTION_ENABLE_DIRECTX_CAPTURE: &str = "enable-directx-capture";
|
||||
pub const OPTION_ENABLE_ANDROID_SOFTWARE_ENCODING_HALF_SCALE: &str =
|
||||
"enable-android-software-encoding-half-scale";
|
||||
pub const OPTION_ENABLE_TRUSTED_DEVICES: &str = "enable-trusted-devices";
|
||||
pub const OPTION_TRUSTED_DEVICE_EXPIRATION: &str = "trusted-device-expiration-days";
|
||||
pub const OPTION_AV1_TEST: &str = "av1-test";
|
||||
/// Maximum number of files allowed during a single file transfer request.
|
||||
///
|
||||
@@ -311,6 +312,7 @@ pub const KEYS_SETTINGS: &[&str] = &[
|
||||
OPTION_API_SERVER,
|
||||
OPTION_KEY,
|
||||
OPTION_ALLOW_WEBSOCKET,
|
||||
OPTION_WEBSOCKET_PORT,
|
||||
OPTION_PRESET_ADDRESS_BOOK_NAME,
|
||||
OPTION_PRESET_ADDRESS_BOOK_TAG,
|
||||
OPTION_PRESET_ADDRESS_BOOK_ALIAS,
|
||||
@@ -322,6 +324,7 @@ pub const KEYS_SETTINGS: &[&str] = &[
|
||||
OPTION_ENABLE_DIRECTX_CAPTURE,
|
||||
OPTION_ENABLE_ANDROID_SOFTWARE_ENCODING_HALF_SCALE,
|
||||
OPTION_ENABLE_TRUSTED_DEVICES,
|
||||
OPTION_TRUSTED_DEVICE_EXPIRATION,
|
||||
OPTION_RELAY_SERVER,
|
||||
OPTION_ICE_SERVERS,
|
||||
OPTION_DISABLE_UDP,
|
||||
|
||||
+170
-1
@@ -27,6 +27,21 @@ use hbb_common::{
|
||||
|
||||
static NEXT_JOB_ID: AtomicI32 = AtomicI32::new(1);
|
||||
|
||||
#[cfg(any(target_os = "android", test))]
|
||||
pub mod android;
|
||||
|
||||
#[cfg(any(target_os = "android", all(test, unix)))]
|
||||
mod android_transfer;
|
||||
|
||||
#[cfg(any(target_os = "android", all(test, unix)))]
|
||||
mod android_descriptor;
|
||||
|
||||
pub mod download;
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "fs/download_tests.rs"]
|
||||
mod download_tests;
|
||||
|
||||
pub fn get_next_job_id() -> i32 {
|
||||
NEXT_JOB_ID.fetch_add(1, Ordering::SeqCst)
|
||||
}
|
||||
@@ -36,6 +51,10 @@ pub fn update_next_job_id(id: i32) {
|
||||
}
|
||||
|
||||
pub fn read_dir(path: &Path, include_hidden: bool) -> ResultType<FileDirectory> {
|
||||
#[cfg(any(target_os = "android", test))]
|
||||
if android::is_path(path) {
|
||||
return android::read_dir(&get_string(path), include_hidden);
|
||||
}
|
||||
let mut dir = FileDirectory {
|
||||
path: get_string(path),
|
||||
..Default::default()
|
||||
@@ -140,6 +159,15 @@ pub fn get_path(path: &str) -> PathBuf {
|
||||
|
||||
#[inline]
|
||||
pub fn get_home_as_string() -> String {
|
||||
#[cfg(target_os = "android")]
|
||||
match android::home() {
|
||||
Ok(Some(path)) => return path,
|
||||
Ok(None) => {}
|
||||
Err(error) => {
|
||||
log::trace!("Unable to load the selected document location: {}", error);
|
||||
return android::ROOT.trim_end_matches('/').to_owned();
|
||||
}
|
||||
}
|
||||
get_string(&Config::get_home())
|
||||
}
|
||||
|
||||
@@ -203,6 +231,10 @@ fn read_dir_recursive(
|
||||
}
|
||||
|
||||
pub fn get_recursive_files(path: &str, include_hidden: bool) -> ResultType<Vec<FileEntry>> {
|
||||
#[cfg(any(target_os = "android", test))]
|
||||
if android::is_path(Path::new(path)) {
|
||||
return android::recursive_files(path, include_hidden);
|
||||
}
|
||||
read_dir_recursive(&get_path(path), &get_path(""), include_hidden)
|
||||
}
|
||||
|
||||
@@ -248,6 +280,10 @@ pub fn get_empty_dirs_recursive(
|
||||
path: &str,
|
||||
include_hidden: bool,
|
||||
) -> ResultType<Vec<FileDirectory>> {
|
||||
#[cfg(any(target_os = "android", test))]
|
||||
if android::is_path(Path::new(path)) {
|
||||
return android::empty_dirs(path, include_hidden);
|
||||
}
|
||||
read_empty_dirs_recursive(&get_path(path), &get_path(""), include_hidden)
|
||||
}
|
||||
|
||||
@@ -391,6 +427,9 @@ pub struct FileDigest {
|
||||
#[derive(Default, Serialize, Debug)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct TransferJob {
|
||||
#[cfg(any(target_os = "android", all(test, unix)))]
|
||||
#[serde(skip)]
|
||||
document_transfer: android_transfer::DocumentTransfer,
|
||||
pub id: i32,
|
||||
pub r#type: JobType,
|
||||
pub remote: String,
|
||||
@@ -417,6 +456,8 @@ pub struct TransferJob {
|
||||
default_overwrite_strategy: Option<bool>,
|
||||
#[serde(skip_serializing)]
|
||||
digest: FileDigest,
|
||||
#[serde(skip)]
|
||||
download: Option<download::DownloadState>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Serialize, Deserialize, Clone)]
|
||||
@@ -517,6 +558,11 @@ fn validate_fs_path_argument(path: &str, arg_name: &str) -> ResultType<()> {
|
||||
}
|
||||
|
||||
fn validate_no_symlink_components(base: &PathBuf, name: &str) -> ResultType<()> {
|
||||
#[cfg(any(target_os = "android", test))]
|
||||
if android::is_path(base) {
|
||||
// Document IDs are resolved and confined to their grant by Android, not the OS filesystem.
|
||||
return Ok(());
|
||||
}
|
||||
if name.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
@@ -576,6 +622,10 @@ impl TransferJob {
|
||||
enable_overwrite_detection: bool,
|
||||
) -> Self {
|
||||
log::info!("new write {}", data_source);
|
||||
let is_download = is_remote && r#type == JobType::Generic;
|
||||
#[cfg(any(target_os = "android", all(test, unix)))]
|
||||
let is_download = is_download
|
||||
&& !matches!(&data_source, DataSource::FilePath(path) if android::is_path(path));
|
||||
Self {
|
||||
id,
|
||||
r#type,
|
||||
@@ -587,6 +637,7 @@ impl TransferJob {
|
||||
files: Vec::new(),
|
||||
total_size: 0,
|
||||
enable_overwrite_detection,
|
||||
download: is_download.then(Default::default),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
@@ -648,6 +699,17 @@ impl TransferJob {
|
||||
|
||||
#[inline]
|
||||
pub fn set_files(&mut self, files: Vec<FileEntry>) -> ResultType<()> {
|
||||
if self.is_download() && !self.files.is_empty() {
|
||||
bail!("cannot replace an accepted download file list");
|
||||
}
|
||||
#[cfg(any(target_os = "android", all(test, unix)))]
|
||||
if self.is_remote
|
||||
&& self.r#type == JobType::Generic
|
||||
&& self.is_document()
|
||||
&& !self.files.is_empty()
|
||||
{
|
||||
bail!("cannot replace an accepted download file list");
|
||||
}
|
||||
validate_transfer_file_names(&files)?;
|
||||
if let DataSource::FilePath(base) = &self.data_source {
|
||||
for file in &files {
|
||||
@@ -692,7 +754,12 @@ impl TransferJob {
|
||||
|
||||
fn resolve_entry_path(&self, base: &PathBuf, name: &str) -> Option<PathBuf> {
|
||||
if self.r#type == JobType::Generic {
|
||||
match join_validated_path(base, name) {
|
||||
let result = if self.is_download() {
|
||||
download::validated_target(base, name)
|
||||
} else {
|
||||
join_validated_path(base, name)
|
||||
};
|
||||
match result {
|
||||
Ok(path) => Some(path),
|
||||
Err(err) => {
|
||||
log::error!("Invalid file name in transfer job {}: {}", self.id, err);
|
||||
@@ -705,6 +772,16 @@ impl TransferJob {
|
||||
}
|
||||
|
||||
pub fn modify_time(&self) {
|
||||
#[cfg(any(target_os = "android", all(test, unix)))]
|
||||
if self.is_document() {
|
||||
return;
|
||||
}
|
||||
if self.is_download() {
|
||||
if let Err(err) = self.finish_download() {
|
||||
log::error!("Failed to finish download {}: {}", self.id, err);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if self.r#type == JobType::Printer {
|
||||
return;
|
||||
}
|
||||
@@ -729,6 +806,13 @@ impl TransferJob {
|
||||
}
|
||||
|
||||
pub fn remove_download_file(&self) {
|
||||
#[cfg(any(target_os = "android", all(test, unix)))]
|
||||
if self.is_document() {
|
||||
return;
|
||||
}
|
||||
if self.is_download() && self.data_stream.is_none() {
|
||||
return;
|
||||
}
|
||||
if self.r#type == JobType::Printer {
|
||||
return;
|
||||
}
|
||||
@@ -761,9 +845,16 @@ impl TransferJob {
|
||||
}
|
||||
|
||||
pub async fn write(&mut self, block: FileTransferBlock) -> ResultType<()> {
|
||||
if self.is_download() {
|
||||
return self.write_download(block).await;
|
||||
}
|
||||
if block.id != self.id {
|
||||
bail!("Wrong id");
|
||||
}
|
||||
#[cfg(any(target_os = "android", all(test, unix)))]
|
||||
if self.is_document() {
|
||||
return self.write_document(block).await;
|
||||
}
|
||||
match &self.data_source {
|
||||
DataSource::FilePath(p) => {
|
||||
let file_num = block.file_num as usize;
|
||||
@@ -843,6 +934,10 @@ impl TransferJob {
|
||||
/// Open the data stream for the current file.
|
||||
/// Returns Ok(true) if job is done, Ok(false) otherwise.
|
||||
async fn open_data_stream(&mut self) -> ResultType<bool> {
|
||||
#[cfg(any(target_os = "android", all(test, unix)))]
|
||||
if self.is_document() {
|
||||
return self.open_document_stream().await;
|
||||
}
|
||||
let file_num = self.file_num as usize;
|
||||
match &mut self.data_source {
|
||||
DataSource::FilePath(p) => {
|
||||
@@ -882,6 +977,14 @@ impl TransferJob {
|
||||
|
||||
/// Get current file's digest (last_modified, file_size) for overwrite detection.
|
||||
async fn get_current_digest(&self) -> ResultType<(u64, u64)> {
|
||||
#[cfg(any(target_os = "android", all(test, unix)))]
|
||||
if self.is_document() {
|
||||
let entry = self
|
||||
.files
|
||||
.get(self.file_num as usize)
|
||||
.ok_or(anyhow!("Wrong file number"))?;
|
||||
return Ok((entry.modified_time, entry.size));
|
||||
}
|
||||
let meta = match self.data_stream.as_ref().ok_or(anyhow!("file is None"))? {
|
||||
DataStream::FileStream(file) => file.metadata().await?,
|
||||
DataStream::BufStream(_) => bail!("No digest for buf stream"),
|
||||
@@ -970,6 +1073,10 @@ impl TransferJob {
|
||||
self.data_stream = None;
|
||||
self.file_confirmed = false;
|
||||
self.file_is_waiting = false;
|
||||
#[cfg(any(target_os = "android", all(test, unix)))]
|
||||
if self.is_document() {
|
||||
self.fail_document_read(err.to_string());
|
||||
}
|
||||
return Err(err.into());
|
||||
}
|
||||
Ok(n) => {
|
||||
@@ -982,6 +1089,10 @@ impl TransferJob {
|
||||
}
|
||||
unsafe { buf.set_len(offset) };
|
||||
if offset == 0 {
|
||||
#[cfg(any(target_os = "android", all(test, unix)))]
|
||||
if self.is_document() {
|
||||
self.finish_document_read().await?;
|
||||
}
|
||||
if matches!(self.data_source, DataSource::MemoryCursor(_)) {
|
||||
self.data_stream.take();
|
||||
return Ok(None);
|
||||
@@ -1089,6 +1200,10 @@ impl TransferJob {
|
||||
|
||||
/// Get job error message, useful for getting status when job had finished
|
||||
pub fn job_error(&self) -> Option<String> {
|
||||
#[cfg(any(target_os = "android", all(test, unix)))]
|
||||
if let Some(error) = &self.document_transfer.error {
|
||||
return Some(error.clone());
|
||||
}
|
||||
if self.job_skipped() {
|
||||
return Some("skipped".to_string());
|
||||
}
|
||||
@@ -1106,6 +1221,13 @@ impl TransferJob {
|
||||
}
|
||||
|
||||
async fn set_stream_offset(&mut self, file_num: usize, offset: u64) {
|
||||
#[cfg(any(target_os = "android", all(test, unix)))]
|
||||
if self.is_document() {
|
||||
if let Err(error) = self.seek_document(offset).await {
|
||||
self.fail_document_read(error.to_string());
|
||||
}
|
||||
return;
|
||||
}
|
||||
if file_num >= self.files.len() {
|
||||
return;
|
||||
}
|
||||
@@ -1160,6 +1282,17 @@ impl TransferJob {
|
||||
}
|
||||
|
||||
pub async fn confirm(&mut self, r: &FileTransferSendConfirmRequest) -> bool {
|
||||
#[cfg(any(target_os = "android", all(test, unix)))]
|
||||
if self.is_document() && self.is_remote {
|
||||
self.confirm_document(r);
|
||||
}
|
||||
if self.is_download() {
|
||||
self.confirm_download(r);
|
||||
// Open receiver resume streams in write() so validation errors reach the caller.
|
||||
if matches!(r.union, Some(file_transfer_send_confirm_request::Union::OffsetBlk(offset)) if offset > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if self.file_num() != r.file_num {
|
||||
// This branch will always be hit if:
|
||||
// 1. `confirm()` is called in `ui_cm_interface.rs`
|
||||
@@ -1388,6 +1521,10 @@ pub async fn handle_read_jobs(
|
||||
}
|
||||
|
||||
pub fn remove_all_empty_dir(path: &Path) -> ResultType<()> {
|
||||
#[cfg(any(target_os = "android", test))]
|
||||
if android::is_path(path) {
|
||||
return android::remove_empty_tree(&get_string(path));
|
||||
}
|
||||
let fd = read_dir(path, true)?;
|
||||
for entry in fd.entries.iter() {
|
||||
match entry.entry_type.enum_value() {
|
||||
@@ -1406,6 +1543,10 @@ pub fn remove_all_empty_dir(path: &Path) -> ResultType<()> {
|
||||
|
||||
#[inline]
|
||||
pub fn remove_file(file: &str) -> ResultType<()> {
|
||||
#[cfg(any(target_os = "android", test))]
|
||||
if android::is_path(Path::new(file)) {
|
||||
return android::remove_file(file);
|
||||
}
|
||||
validate_fs_path_argument(file, "file path")?;
|
||||
std::fs::remove_file(get_path(file))?;
|
||||
Ok(())
|
||||
@@ -1413,6 +1554,10 @@ pub fn remove_file(file: &str) -> ResultType<()> {
|
||||
|
||||
#[inline]
|
||||
pub fn create_dir(dir: &str) -> ResultType<()> {
|
||||
#[cfg(any(target_os = "android", test))]
|
||||
if android::is_path(Path::new(dir)) {
|
||||
return android::operation("mkdir", dir);
|
||||
}
|
||||
validate_fs_path_argument(dir, "directory path")?;
|
||||
std::fs::create_dir_all(get_path(dir))?;
|
||||
Ok(())
|
||||
@@ -1420,6 +1565,10 @@ pub fn create_dir(dir: &str) -> ResultType<()> {
|
||||
|
||||
#[inline]
|
||||
pub fn rename_file(path: &str, new_name: &str) -> ResultType<()> {
|
||||
#[cfg(any(target_os = "android", test))]
|
||||
if android::is_path(Path::new(path)) {
|
||||
return android::rename(path, new_name);
|
||||
}
|
||||
validate_fs_path_argument(path, "path")?;
|
||||
if new_name.is_empty() {
|
||||
bail!("new file name cannot be empty");
|
||||
@@ -1457,6 +1606,26 @@ pub fn is_write_need_confirmation(
|
||||
file_path: &str,
|
||||
digest: &FileTransferDigest,
|
||||
) -> ResultType<DigestCheckResult> {
|
||||
#[cfg(any(target_os = "android", test))]
|
||||
if android::is_path(Path::new(file_path)) {
|
||||
android::validate(file_path)?;
|
||||
if is_resume {
|
||||
bail!("Document transfers must be restarted after interruption");
|
||||
}
|
||||
return match android::stat(file_path)? {
|
||||
Some(entry) => Ok(DigestCheckResult::NeedConfirm(FileTransferDigest {
|
||||
id: digest.id,
|
||||
file_num: digest.file_num,
|
||||
last_modified: entry.modified_time,
|
||||
file_size: entry.size,
|
||||
is_identical: entry.modified_time != 0
|
||||
&& entry.modified_time == digest.last_modified
|
||||
&& entry.size == digest.file_size,
|
||||
..Default::default()
|
||||
})),
|
||||
None => Ok(DigestCheckResult::NoSuchFile),
|
||||
};
|
||||
}
|
||||
let path = Path::new(file_path);
|
||||
let digest_file = format!("{}.digest", file_path);
|
||||
let download_file = format!("{}.download", file_path);
|
||||
|
||||
@@ -0,0 +1,280 @@
|
||||
use super::{FileDirectory, FileEntry, FileType};
|
||||
use hbb_common::{anyhow::anyhow, bail, ResultType};
|
||||
use serde_derive::Deserialize;
|
||||
use serde_json::{json, Value};
|
||||
use std::{path::Path, sync::OnceLock};
|
||||
|
||||
pub const ROOT: &str = "/@rustdesk/";
|
||||
type Request = Box<dyn Fn(&str) -> ResultType<String> + Send + Sync>;
|
||||
static BACKEND: OnceLock<Request> = OnceLock::new();
|
||||
|
||||
pub fn initialize(
|
||||
request: impl Fn(&str) -> ResultType<String> + Send + Sync + 'static,
|
||||
) -> ResultType<()> {
|
||||
BACKEND
|
||||
.set(Box::new(request))
|
||||
.map_err(|_| anyhow!("Document storage already initialized"))
|
||||
}
|
||||
|
||||
pub fn is_path(path: &Path) -> bool {
|
||||
path.to_str().map_or(false, |p| {
|
||||
p == ROOT.trim_end_matches('/') || p.starts_with(ROOT)
|
||||
})
|
||||
}
|
||||
|
||||
pub(super) fn validate(path: &str) -> ResultType<()> {
|
||||
let relative = path
|
||||
.strip_prefix(ROOT)
|
||||
.and_then(|path| path.strip_prefix("tree/"))
|
||||
.ok_or(anyhow!("Invalid document path"))?;
|
||||
if relative
|
||||
.split('/')
|
||||
.any(|p| p.is_empty() || p == "." || p == ".." || p.contains(['\\', '\0']))
|
||||
{
|
||||
bail!("Invalid document path");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn request(value: Value) -> ResultType<Value> {
|
||||
if let Some(path) = value.get("path").and_then(Value::as_str) {
|
||||
validate(path)?;
|
||||
}
|
||||
let backend = BACKEND
|
||||
.get()
|
||||
.ok_or(anyhow!("Android document storage is unavailable"))?;
|
||||
let response: Value = serde_json::from_str(&backend(&value.to_string())?)?;
|
||||
if let Some(error) = response.get("error").and_then(Value::as_str) {
|
||||
bail!("{}", error);
|
||||
}
|
||||
response
|
||||
.get("value")
|
||||
.cloned()
|
||||
.ok_or(anyhow!("Invalid document provider response"))
|
||||
}
|
||||
|
||||
pub fn home() -> ResultType<Option<String>> {
|
||||
let value = request(json!({"op": "home"}))?;
|
||||
if value.is_null() {
|
||||
return Ok(None);
|
||||
}
|
||||
let path = value.as_str().ok_or(anyhow!("Invalid document home"))?;
|
||||
validate(path)?;
|
||||
Ok(Some(path.to_owned()))
|
||||
}
|
||||
|
||||
pub fn allowed(path: &str) -> ResultType<bool> {
|
||||
if !home()?.map_or(false, |home| Path::new(path).starts_with(home)) {
|
||||
return Ok(false);
|
||||
}
|
||||
request(json!({"op": "allowed", "path": path}))?
|
||||
.as_bool()
|
||||
.ok_or(anyhow!("Invalid document permission response"))
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct Metadata {
|
||||
name: String,
|
||||
directory: bool,
|
||||
size: i64,
|
||||
modified: i64,
|
||||
}
|
||||
|
||||
fn entry(value: Value) -> ResultType<FileEntry> {
|
||||
let meta: Metadata = serde_json::from_value(value)?;
|
||||
super::validate_file_name_no_traversal(&meta.name)?;
|
||||
if meta.name.contains('/') || (!meta.directory && meta.size < 0) {
|
||||
bail!("The provider did not supply a transferable file name or size");
|
||||
}
|
||||
Ok(FileEntry {
|
||||
entry_type: if meta.directory {
|
||||
FileType::Dir
|
||||
} else {
|
||||
FileType::File
|
||||
}
|
||||
.into(),
|
||||
is_hidden: meta.name.starts_with('.'),
|
||||
name: meta.name,
|
||||
size: if meta.directory { 0 } else { meta.size as u64 },
|
||||
modified_time: meta.modified.max(0) as u64,
|
||||
..Default::default()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn stat(path: &str) -> ResultType<Option<FileEntry>> {
|
||||
let value = request(json!({"op": "stat", "path": path}))?;
|
||||
if value.is_null() {
|
||||
Ok(None)
|
||||
} else {
|
||||
entry(value).map(Some)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn read_dir(path: &str, hidden: bool) -> ResultType<FileDirectory> {
|
||||
let values: Vec<Value> = serde_json::from_value(request(json!({"op": "list", "path": path}))?)?;
|
||||
let mut entries = Vec::new();
|
||||
for value in values {
|
||||
let entry = entry(value)?;
|
||||
if hidden || !entry.is_hidden {
|
||||
entries.push(entry);
|
||||
}
|
||||
}
|
||||
Ok(FileDirectory {
|
||||
path: path.to_owned(),
|
||||
entries,
|
||||
..Default::default()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn recursive_files(path: &str, hidden: bool) -> ResultType<Vec<FileEntry>> {
|
||||
let meta = stat(path)?.ok_or(anyhow!("Document does not exist"))?;
|
||||
if meta.entry_type.enum_value() == Ok(FileType::File) {
|
||||
return Ok(vec![FileEntry {
|
||||
name: String::new(),
|
||||
..meta
|
||||
}]);
|
||||
}
|
||||
let mut files = Vec::new();
|
||||
let mut pending = vec![(path.to_owned(), String::new())];
|
||||
while let Some((directory, prefix)) = pending.pop() {
|
||||
for mut entry in read_dir(&directory, hidden)?.entries {
|
||||
let path = format!("{}/{}", directory, entry.name);
|
||||
entry.name = if prefix.is_empty() {
|
||||
entry.name
|
||||
} else {
|
||||
format!("{}/{}", prefix, entry.name)
|
||||
};
|
||||
if entry.entry_type.enum_value() == Ok(FileType::Dir) {
|
||||
pending.push((path, entry.name));
|
||||
} else {
|
||||
files.push(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(files)
|
||||
}
|
||||
|
||||
pub fn empty_dirs(path: &str, hidden: bool) -> ResultType<Vec<FileDirectory>> {
|
||||
let mut result = Vec::new();
|
||||
let mut pending = vec![path.to_owned()];
|
||||
while let Some(path) = pending.pop() {
|
||||
let directory = read_dir(&path, hidden)?;
|
||||
if directory.entries.is_empty() {
|
||||
result.push(directory);
|
||||
continue;
|
||||
}
|
||||
for entry in directory.entries {
|
||||
if entry.entry_type.enum_value() == Ok(FileType::Dir) {
|
||||
pending.push(format!("{}/{}", path, entry.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
pub fn operation(op: &str, path: &str) -> ResultType<()> {
|
||||
request(json!({"op": op, "path": path}))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn remove_empty_dir(path: &str) -> ResultType<()> {
|
||||
if !read_dir(path, true)?.entries.is_empty() {
|
||||
bail!("Directory is not empty");
|
||||
}
|
||||
operation("delete", path)
|
||||
}
|
||||
|
||||
pub fn remove_file(path: &str) -> ResultType<()> {
|
||||
let entry = stat(path)?.ok_or(anyhow!("Document does not exist"))?;
|
||||
if entry.entry_type.enum_value() != Ok(FileType::File) {
|
||||
bail!("Cannot remove a directory as a file");
|
||||
}
|
||||
operation("delete", path)
|
||||
}
|
||||
|
||||
pub fn remove_empty_tree(path: &str) -> ResultType<()> {
|
||||
validate(path)?;
|
||||
let tree_prefix = Path::new(ROOT).join("tree");
|
||||
if Path::new(path).parent().and_then(Path::parent) == Some(tree_prefix.as_path()) {
|
||||
bail!("Cannot delete a shared root");
|
||||
}
|
||||
let mut directories = vec![path.to_owned()];
|
||||
let mut index = 0;
|
||||
while index < directories.len() {
|
||||
for entry in read_dir(&directories[index], true)?.entries {
|
||||
if entry.entry_type.enum_value() != Ok(FileType::Dir) {
|
||||
bail!("Directory is not empty");
|
||||
}
|
||||
directories.push(format!("{}/{}", directories[index], entry.name));
|
||||
}
|
||||
index += 1;
|
||||
}
|
||||
for directory in directories.into_iter().rev() {
|
||||
remove_empty_dir(&directory)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn rename(path: &str, name: &str) -> ResultType<()> {
|
||||
super::validate_file_name_no_traversal(name)?;
|
||||
request(json!({"op": "rename", "path": path, "name": name}))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "android", all(test, unix)))]
|
||||
pub fn take_file(value: &Value) -> ResultType<std::fs::File> {
|
||||
use std::convert::TryFrom;
|
||||
use std::os::fd::FromRawFd;
|
||||
let fd = value
|
||||
.as_i64()
|
||||
.and_then(|fd| i32::try_from(fd).ok())
|
||||
.filter(|fd| *fd >= 0)
|
||||
.ok_or(anyhow!("Invalid document descriptor"))?;
|
||||
// Android hands off a duplicate; Java retains the provider's close/error channel.
|
||||
Ok(unsafe { std::fs::File::from_raw_fd(fd) })
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "android", all(test, unix)))]
|
||||
pub(super) async fn open(
|
||||
path: String,
|
||||
) -> ResultType<(
|
||||
tokio::fs::File,
|
||||
super::android_descriptor::DocumentDescriptor,
|
||||
Option<(u64, u64)>,
|
||||
)> {
|
||||
use std::os::unix::fs::MetadataExt;
|
||||
|
||||
let (file, descriptor, digest) = tokio::task::spawn_blocking(move || {
|
||||
let token = request(json!({"op": "open", "path": path}))?;
|
||||
let file = take_file(&token["fd"])?;
|
||||
let descriptor = super::android_descriptor::DocumentDescriptor::new(&token)?;
|
||||
let metadata = file.metadata()?;
|
||||
// Stream inode timestamps do not identify the source document's version.
|
||||
let digest = metadata
|
||||
.is_file()
|
||||
.then(|| (metadata.mtime().max(0) as u64, metadata.len()));
|
||||
Ok::<_, hbb_common::anyhow::Error>((file, descriptor, digest))
|
||||
})
|
||||
.await??;
|
||||
Ok((tokio::fs::File::from_std(file), descriptor, digest))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "tests/android_tests.rs"]
|
||||
mod tests;
|
||||
|
||||
#[cfg(test)]
|
||||
mod metadata_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn negative_modification_time_is_unknown() {
|
||||
for modified in [-1, 0, 1] {
|
||||
let metadata = entry(json!({
|
||||
"name": "notes.txt", "directory": false, "size": 12, "modified": modified
|
||||
}))
|
||||
.unwrap();
|
||||
assert_eq!(metadata.modified_time, modified.max(0) as u64);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
use super::android;
|
||||
use hbb_common::{anyhow::anyhow, ResultType};
|
||||
use serde_json::{json, Value};
|
||||
use std::time::Duration;
|
||||
|
||||
const CLOSE_ERROR_LOG_INTERVAL: Duration = Duration::from_secs(60);
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(super) struct DocumentDescriptor {
|
||||
id: Option<String>,
|
||||
}
|
||||
|
||||
impl DocumentDescriptor {
|
||||
pub(super) fn new(token: &Value) -> ResultType<Self> {
|
||||
let id = token["descriptor"]
|
||||
.as_str()
|
||||
.ok_or(anyhow!("Missing document descriptor"))?;
|
||||
Ok(Self {
|
||||
id: Some(id.to_owned()),
|
||||
})
|
||||
}
|
||||
|
||||
pub(super) async fn close(mut self, error: &str) -> ResultType<()> {
|
||||
let id = self.id.take().ok_or(anyhow!("Document already closed"))?;
|
||||
let error = error.to_owned();
|
||||
tokio::task::spawn_blocking(move || {
|
||||
android::request(json!({
|
||||
"op": "close", "descriptor": id, "error": error
|
||||
}))
|
||||
})
|
||||
.await??;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for DocumentDescriptor {
|
||||
fn drop(&mut self) {
|
||||
let Some(id) = self.id.take() else {
|
||||
return;
|
||||
};
|
||||
// Aborted jobs must also release the provider's retained descriptor.
|
||||
tokio::task::spawn_blocking(move || {
|
||||
if let Err(error) = android::request(json!({
|
||||
"op": "close", "descriptor": id, "error": "Document transfer interrupted"
|
||||
})) {
|
||||
hbb_common::throttled_log!(
|
||||
CLOSE_ERROR_LOG_INTERVAL,
|
||||
warn,
|
||||
"Unable to release document descriptor: {}",
|
||||
error
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,296 @@
|
||||
use super::{
|
||||
android, android_descriptor::DocumentDescriptor, file_transfer_send_confirm_request,
|
||||
DataSource, DataStream, FileTransferBlock, FileTransferSendConfirmRequest, TransferJob,
|
||||
};
|
||||
use hbb_common::{anyhow::anyhow, bail, compress::decompress, ResultType};
|
||||
use serde_json::{json, Value};
|
||||
use tokio::{
|
||||
fs::File,
|
||||
io::{AsyncSeekExt, AsyncWriteExt},
|
||||
task::spawn_blocking,
|
||||
};
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub(super) struct DocumentTransfer {
|
||||
reader: Option<DocumentDescriptor>,
|
||||
pending: Option<PendingWrite>,
|
||||
confirmed_file: Option<i32>,
|
||||
pub error: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct PendingWrite {
|
||||
file: File,
|
||||
descriptor: DocumentDescriptor,
|
||||
token: Value,
|
||||
path: String,
|
||||
}
|
||||
|
||||
impl TransferJob {
|
||||
pub fn is_document(&self) -> bool {
|
||||
matches!(&self.data_source, DataSource::FilePath(path) if android::is_path(path))
|
||||
}
|
||||
|
||||
pub(super) fn confirm_document(&mut self, request: &FileTransferSendConfirmRequest) {
|
||||
if request.id != self.id {
|
||||
return;
|
||||
}
|
||||
let overwrite = matches!(
|
||||
request.union,
|
||||
Some(file_transfer_send_confirm_request::Union::OffsetBlk(0))
|
||||
| Some(file_transfer_send_confirm_request::Union::Skip(false))
|
||||
);
|
||||
self.document_transfer.confirmed_file = (overwrite
|
||||
&& self.files.get(request.file_num as usize).is_some())
|
||||
.then_some(request.file_num);
|
||||
}
|
||||
|
||||
fn document_path(&self, file_num: usize) -> ResultType<String> {
|
||||
let DataSource::FilePath(base) = &self.data_source else {
|
||||
bail!("Not a document transfer");
|
||||
};
|
||||
let entry = self
|
||||
.files
|
||||
.get(file_num)
|
||||
.ok_or(anyhow!("Wrong file number"))?;
|
||||
super::validate_file_name_no_traversal(&entry.name)?;
|
||||
Ok(Self::join(base, &entry.name).to_string_lossy().into_owned())
|
||||
}
|
||||
|
||||
pub(super) async fn open_document_stream(&mut self) -> ResultType<bool> {
|
||||
if let Some(error) = &self.document_transfer.error {
|
||||
self.file_num = self.files.len() as i32;
|
||||
self.data_stream.take();
|
||||
bail!("{}", error);
|
||||
}
|
||||
if self.file_num as usize >= self.files.len() {
|
||||
self.data_stream.take();
|
||||
return Ok(true);
|
||||
}
|
||||
if self.data_stream.is_some() {
|
||||
return Ok(false);
|
||||
}
|
||||
let result = android::open(self.document_path(self.file_num as usize)?).await;
|
||||
self.file_confirmed = false;
|
||||
self.file_is_waiting = false;
|
||||
match result {
|
||||
Ok((file, descriptor, digest)) => {
|
||||
let entry = self
|
||||
.files
|
||||
.get_mut(self.file_num as usize)
|
||||
.ok_or(anyhow!("Wrong file number"))?;
|
||||
entry.modified_time = digest.map_or(0, |(modified, _)| modified);
|
||||
entry.size = digest.map_or(entry.size, |(_, size)| size);
|
||||
self.data_stream = Some(DataStream::FileStream(file));
|
||||
self.document_transfer.reader = Some(descriptor);
|
||||
}
|
||||
Err(error) => {
|
||||
self.fail_document_read(error.to_string());
|
||||
return Err(error);
|
||||
}
|
||||
}
|
||||
Ok(false)
|
||||
}
|
||||
|
||||
pub(super) async fn finish_document_read(&mut self) -> ResultType<()> {
|
||||
self.data_stream.take();
|
||||
let descriptor = self
|
||||
.document_transfer
|
||||
.reader
|
||||
.take()
|
||||
.ok_or(anyhow!("No open document reader"))?;
|
||||
let result = descriptor.close("").await;
|
||||
if let Err(error) = &result {
|
||||
self.fail_document_read(error.to_string());
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
pub(super) fn fail_document_read(&mut self, error: String) {
|
||||
self.document_transfer.error = Some(error);
|
||||
self.file_num = self.files.len() as i32;
|
||||
self.file_confirmed = false;
|
||||
self.file_is_waiting = false;
|
||||
self.document_transfer.reader.take();
|
||||
}
|
||||
|
||||
pub(super) async fn write_document(&mut self, block: FileTransferBlock) -> ResultType<()> {
|
||||
if let Some(error) = &self.document_transfer.error {
|
||||
bail!("{}", error);
|
||||
}
|
||||
let result = self.write_document_block(&block).await;
|
||||
if let Err(error) = &result {
|
||||
self.document_transfer.error = Some(error.to_string());
|
||||
if let Err(cleanup_error) = self.cancel_document().await {
|
||||
const CLEANUP_ERROR_LOG_INTERVAL: std::time::Duration =
|
||||
std::time::Duration::from_secs(60);
|
||||
hbb_common::throttled_log!(
|
||||
CLEANUP_ERROR_LOG_INTERVAL,
|
||||
warn,
|
||||
"Failed to clean up document transfer {}: {}",
|
||||
self.id,
|
||||
cleanup_error
|
||||
);
|
||||
}
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
async fn write_document_block(&mut self, block: &FileTransferBlock) -> ResultType<()> {
|
||||
if self.is_resume {
|
||||
bail!("Document transfers must be restarted after interruption");
|
||||
}
|
||||
let path = self.document_path(block.file_num as usize)?;
|
||||
if self.document_transfer.pending.as_ref().map(|p| &p.path) != Some(&path) {
|
||||
self.finish_document().await?;
|
||||
// Upload senders handle confirmation when overwrite detection is supported.
|
||||
let overwrite = (!self.is_remote && self.enable_overwrite_detection)
|
||||
|| self.document_transfer.confirmed_file.take() == Some(block.file_num);
|
||||
self.document_transfer.pending = Some(begin_write(path, overwrite).await?);
|
||||
self.file_num = block.file_num;
|
||||
}
|
||||
let pending = self
|
||||
.document_transfer
|
||||
.pending
|
||||
.as_mut()
|
||||
.ok_or(anyhow!("No open document"))?;
|
||||
let data = if block.compressed {
|
||||
std::borrow::Cow::Owned(decompress(&block.data))
|
||||
} else {
|
||||
std::borrow::Cow::Borrowed(block.data.as_ref())
|
||||
};
|
||||
pending.file.write_all(&data).await?;
|
||||
self.finished_size += data.len() as u64;
|
||||
self.transferred += block.data.len() as u64;
|
||||
if block.data.is_empty() {
|
||||
self.finish_document().await?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn finish_document(&mut self) -> ResultType<()> {
|
||||
if let Some(error) = &self.document_transfer.error {
|
||||
bail!("{}", error);
|
||||
}
|
||||
let Some(pending) = self.document_transfer.pending.take() else {
|
||||
return Ok(());
|
||||
};
|
||||
let result = finish_write(pending).await;
|
||||
if let Err(error) = &result {
|
||||
self.document_transfer.error = Some(error.to_string());
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
pub async fn cancel_document(&mut self) -> ResultType<()> {
|
||||
let Some(pending) = self.document_transfer.pending.take() else {
|
||||
return Ok(());
|
||||
};
|
||||
let PendingWrite {
|
||||
file,
|
||||
descriptor,
|
||||
path,
|
||||
token,
|
||||
} = pending;
|
||||
drop(file);
|
||||
let result = descriptor.close("Document transfer canceled").await;
|
||||
discard_write(path, token, result).await
|
||||
}
|
||||
|
||||
pub(super) async fn seek_document(&mut self, offset: u64) -> ResultType<()> {
|
||||
let Some(DataStream::FileStream(file)) = self.data_stream.as_mut() else {
|
||||
bail!("Document receives must be restarted after interruption");
|
||||
};
|
||||
let entry = self
|
||||
.files
|
||||
.get(self.file_num as usize)
|
||||
.ok_or(anyhow!("Wrong file number"))?;
|
||||
if offset > 0 && entry.modified_time == 0 {
|
||||
bail!(
|
||||
"Cannot resume a document with an unknown modification time; restart the transfer"
|
||||
);
|
||||
}
|
||||
file.seek(std::io::SeekFrom::Start(offset)).await?;
|
||||
self.finished_size += offset;
|
||||
self.transferred += offset;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
async fn begin_write(path: String, overwrite: bool) -> ResultType<PendingWrite> {
|
||||
spawn_blocking(move || {
|
||||
let token = android::request(json!({
|
||||
"op": "begin", "path": path, "overwrite": overwrite
|
||||
}))?;
|
||||
let file = android::take_file(&token["fd"])?;
|
||||
let descriptor = DocumentDescriptor::new(&token)?;
|
||||
Ok(PendingWrite {
|
||||
file: File::from_std(file),
|
||||
descriptor,
|
||||
token,
|
||||
path,
|
||||
})
|
||||
})
|
||||
.await?
|
||||
}
|
||||
|
||||
async fn finish_write(pending: PendingWrite) -> ResultType<()> {
|
||||
let PendingWrite {
|
||||
mut file,
|
||||
descriptor,
|
||||
path,
|
||||
token,
|
||||
} = pending;
|
||||
let written: ResultType<()> = async {
|
||||
file.flush().await?;
|
||||
file.sync_all().await?;
|
||||
Ok(())
|
||||
}
|
||||
.await;
|
||||
drop(file);
|
||||
let message = written
|
||||
.as_ref()
|
||||
.err()
|
||||
.map(ToString::to_string)
|
||||
.unwrap_or_default();
|
||||
let closed = descriptor.close(&message).await;
|
||||
let result = match (written, closed) {
|
||||
(Err(error), Err(close_error)) => Err(anyhow!(
|
||||
"{}; closing document failed: {}",
|
||||
error,
|
||||
close_error
|
||||
)),
|
||||
(Err(error), _) | (_, Err(error)) => Err(error),
|
||||
_ => Ok(()),
|
||||
};
|
||||
if result.is_err() {
|
||||
return discard_write(path, token, result).await;
|
||||
}
|
||||
spawn_blocking(move || {
|
||||
android::request(json!({
|
||||
"op": "finish", "path": path, "token": token
|
||||
}))
|
||||
})
|
||||
.await??;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn discard_write(path: String, token: Value, result: ResultType<()>) -> ResultType<()> {
|
||||
let cleanup: ResultType<()> = async {
|
||||
spawn_blocking(move || {
|
||||
android::request(json!({
|
||||
"op": "discard", "path": path, "token": token
|
||||
}))
|
||||
})
|
||||
.await??;
|
||||
Ok(())
|
||||
}
|
||||
.await;
|
||||
match (result, cleanup) {
|
||||
(Err(error), Err(cleanup)) => {
|
||||
bail!("{}; temporary document cleanup failed: {}", error, cleanup)
|
||||
}
|
||||
(Err(error), _) | (_, Err(error)) => Err(error),
|
||||
_ => Ok(()),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,331 @@
|
||||
use super::{
|
||||
get_string, is_write_need_confirmation, join_validated_path, validate_file_name_no_traversal,
|
||||
validate_no_symlink_components, DataSource, DataStream, DigestCheckResult, TransferJob,
|
||||
};
|
||||
use crate::message_proto::{
|
||||
file_transfer_send_confirm_request, FileEntry, FileTransferBlock, FileTransferDigest,
|
||||
FileTransferSendConfirmRequest, FileType,
|
||||
};
|
||||
use hbb_common::{anyhow::anyhow, bail, compress::decompress, ResultType};
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
io::ErrorKind,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
use tokio::{
|
||||
fs::{self, OpenOptions},
|
||||
io::{AsyncSeekExt, AsyncWriteExt},
|
||||
};
|
||||
|
||||
const SINGLE_LINK_COUNT: u64 = 1;
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
pub(super) struct DownloadState {
|
||||
pub(super) confirmation: Option<(i32, u32)>,
|
||||
}
|
||||
|
||||
pub fn validate_listing(entries: &[FileEntry], peer_windows: bool) -> ResultType<()> {
|
||||
for entry in entries {
|
||||
let name = &entry.name;
|
||||
if entry.entry_type.enum_value() == Ok(FileType::DirDrive)
|
||||
&& matches!(name.as_bytes(), [drive, b':'] if drive.is_ascii_alphabetic())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if name.is_empty()
|
||||
|| name == "."
|
||||
|| name == ".."
|
||||
|| name.contains('\0')
|
||||
|| name.contains('/')
|
||||
|| (peer_windows
|
||||
&& (name.contains('\\')
|
||||
|| matches!(name.as_bytes(), [drive, b':', ..] if drive.is_ascii_alphabetic())))
|
||||
{
|
||||
bail!("invalid file name in remote directory listing: {name}");
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn validate_download_name(path: &str, peer_windows: bool) -> ResultType<()> {
|
||||
let separator = |c| c == '/' || (peer_windows && c == '\\');
|
||||
let path = path.trim_end_matches(separator);
|
||||
validate_component(path.rsplit(separator).next().unwrap_or(""))
|
||||
}
|
||||
|
||||
fn validate_component(name: &str) -> ResultType<()> {
|
||||
validate_file_name_no_traversal(name)?;
|
||||
if name.is_empty() || name == "." || name.contains('/') {
|
||||
bail!("invalid download file name: {name}");
|
||||
}
|
||||
#[cfg(windows)]
|
||||
if name.contains(['\\', ':', '<', '>', '"', '|', '?', '*'])
|
||||
|| name.ends_with('.')
|
||||
|| name.ends_with(' ')
|
||||
{
|
||||
bail!("invalid Windows download file name: {name}");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn validated_target(base: &PathBuf, name: &str) -> ResultType<PathBuf> {
|
||||
let parent = base
|
||||
.parent()
|
||||
.ok_or_else(|| anyhow!("download destination has no parent"))?;
|
||||
let leaf = base
|
||||
.file_name()
|
||||
.and_then(|name| name.to_str())
|
||||
.ok_or_else(|| anyhow!("invalid download destination"))?;
|
||||
validate_component(leaf)?;
|
||||
#[cfg(windows)]
|
||||
for component in name.split(['/', '\\']).filter(|part| !part.is_empty()) {
|
||||
validate_component(component)?;
|
||||
}
|
||||
validate_no_symlink_components(&parent.to_path_buf(), leaf)?;
|
||||
let target = join_validated_path(base, name)?;
|
||||
let parent = target
|
||||
.parent()
|
||||
.ok_or_else(|| anyhow!("download file has no parent"))?;
|
||||
let leaf = target
|
||||
.file_name()
|
||||
.and_then(|name| name.to_str())
|
||||
.ok_or_else(|| anyhow!("invalid download file name"))?;
|
||||
for suffix in ["download", "digest"] {
|
||||
validate_no_symlink_components(&parent.to_path_buf(), &format!("{leaf}.{suffix}"))?;
|
||||
}
|
||||
Ok(target)
|
||||
}
|
||||
|
||||
fn remove_if_exists(path: &Path) -> ResultType<()> {
|
||||
match std::fs::remove_file(path) {
|
||||
Ok(()) => Ok(()),
|
||||
Err(err) if err.kind() == ErrorKind::NotFound => Ok(()),
|
||||
Err(err) => Err(err.into()),
|
||||
}
|
||||
}
|
||||
|
||||
async fn remove_if_exists_async(path: &Path) -> ResultType<()> {
|
||||
match fs::remove_file(path).await {
|
||||
Ok(()) => Ok(()),
|
||||
Err(err) if err.kind() == ErrorKind::NotFound => Ok(()),
|
||||
Err(err) => Err(err.into()),
|
||||
}
|
||||
}
|
||||
|
||||
async fn validate_resume_file(file: &tokio::fs::File) -> ResultType<()> {
|
||||
let metadata = file.metadata().await?;
|
||||
if !metadata.is_file() {
|
||||
bail!("download resume staging path is not a regular file");
|
||||
}
|
||||
#[cfg(unix)]
|
||||
let links = std::os::unix::fs::MetadataExt::nlink(&metadata);
|
||||
#[cfg(windows)]
|
||||
let links = {
|
||||
use std::{mem::MaybeUninit, os::windows::io::AsRawHandle};
|
||||
use winapi::{
|
||||
shared::minwindef::FALSE,
|
||||
um::fileapi::{GetFileInformationByHandle, BY_HANDLE_FILE_INFORMATION},
|
||||
};
|
||||
let file = file.try_clone().await?;
|
||||
tokio::task::spawn_blocking(move || -> ResultType<u64> {
|
||||
let mut information = MaybeUninit::<BY_HANDLE_FILE_INFORMATION>::uninit();
|
||||
if unsafe {
|
||||
GetFileInformationByHandle(file.as_raw_handle() as _, information.as_mut_ptr())
|
||||
} == FALSE
|
||||
{
|
||||
return Err(std::io::Error::last_os_error().into());
|
||||
}
|
||||
Ok(u64::from(
|
||||
unsafe { information.assume_init() }.nNumberOfLinks,
|
||||
))
|
||||
})
|
||||
.await??
|
||||
};
|
||||
if links != SINGLE_LINK_COUNT {
|
||||
bail!("hard-linked download resume staging file is not allowed");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
impl TransferJob {
|
||||
pub(super) fn is_download(&self) -> bool {
|
||||
self.download.is_some()
|
||||
}
|
||||
|
||||
pub fn download_target(&self, file_num: i32) -> ResultType<PathBuf> {
|
||||
let entry = self
|
||||
.files
|
||||
.get(file_num as usize)
|
||||
.ok_or_else(|| anyhow!("Wrong file number"))?;
|
||||
let DataSource::FilePath(base) = &self.data_source else {
|
||||
bail!("download destination is not a file path");
|
||||
};
|
||||
validated_target(base, &entry.name)
|
||||
}
|
||||
|
||||
pub fn download_digest(
|
||||
&mut self,
|
||||
can_resume: bool,
|
||||
digest: &FileTransferDigest,
|
||||
) -> ResultType<DigestCheckResult> {
|
||||
if self.file_num != digest.file_num && self.data_stream.is_some() {
|
||||
let result = self.finish_download();
|
||||
self.data_stream.take();
|
||||
result?;
|
||||
}
|
||||
let target = self.download_target(digest.file_num)?;
|
||||
let resume = can_resume && self.is_resume && !target.try_exists()?;
|
||||
let result = is_write_need_confirmation(resume, &get_string(&target), digest)?;
|
||||
if matches!(result, DigestCheckResult::NoSuchFile)
|
||||
&& (Path::new(&format!("{}.download", target.display())).try_exists()?
|
||||
|| Path::new(&format!("{}.digest", target.display())).try_exists()?)
|
||||
{
|
||||
return Ok(DigestCheckResult::NeedConfirm(FileTransferDigest {
|
||||
id: digest.id,
|
||||
file_num: digest.file_num,
|
||||
..Default::default()
|
||||
}));
|
||||
}
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
pub(super) fn confirm_download(&mut self, request: &FileTransferSendConfirmRequest) {
|
||||
if request.id != self.id {
|
||||
return;
|
||||
}
|
||||
let Some(download) = self.download.as_mut() else {
|
||||
return;
|
||||
};
|
||||
download.confirmation = self.files.get(request.file_num as usize).and_then(|_| {
|
||||
let offset = match request.union {
|
||||
Some(file_transfer_send_confirm_request::Union::OffsetBlk(offset)) => offset,
|
||||
Some(file_transfer_send_confirm_request::Union::Skip(false)) => 0,
|
||||
_ => return None,
|
||||
};
|
||||
Some((request.file_num, offset))
|
||||
});
|
||||
}
|
||||
|
||||
fn download_confirmation_offset(&self, file_num: i32) -> Option<u32> {
|
||||
let (confirmed, offset) = self.download.as_ref()?.confirmation.as_ref()?;
|
||||
(*confirmed == file_num).then_some(*offset)
|
||||
}
|
||||
|
||||
async fn start_download_file(&mut self, file_num: i32) -> ResultType<()> {
|
||||
let result = self.finish_download();
|
||||
self.data_stream.take();
|
||||
result?;
|
||||
let target = self.download_target(file_num)?;
|
||||
let staging = PathBuf::from(format!("{}.download", target.display()));
|
||||
let digest = PathBuf::from(format!("{}.digest", target.display()));
|
||||
let confirmation = self.download_confirmation_offset(file_num);
|
||||
if (fs::try_exists(&target).await?
|
||||
|| fs::try_exists(&staging).await?
|
||||
|| fs::try_exists(&digest).await?)
|
||||
&& confirmation.is_none()
|
||||
{
|
||||
bail!("download overwrite requires confirmation");
|
||||
}
|
||||
if let Some(offset) = confirmation.filter(|offset| *offset > 0) {
|
||||
return self.resume_download(file_num, offset).await;
|
||||
}
|
||||
if let Some(parent) = target.parent() {
|
||||
fs::create_dir_all(parent).await?;
|
||||
}
|
||||
remove_if_exists_async(&staging).await?;
|
||||
let file = OpenOptions::new()
|
||||
.write(true)
|
||||
.create_new(true)
|
||||
.open(&staging)
|
||||
.await?;
|
||||
self.file_num = file_num;
|
||||
self.data_stream = Some(DataStream::FileStream(file));
|
||||
remove_if_exists_async(&digest).await?;
|
||||
let mut metadata = OpenOptions::new()
|
||||
.write(true)
|
||||
.create_new(true)
|
||||
.open(&digest)
|
||||
.await?;
|
||||
metadata
|
||||
.write_all(serde_json::to_string(&self.digest)?.as_bytes())
|
||||
.await?;
|
||||
metadata.flush().await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn resume_download(&mut self, file_num: i32, offset: u32) -> ResultType<()> {
|
||||
let target = self.download_target(file_num)?;
|
||||
if fs::try_exists(&target).await? {
|
||||
bail!("download overwrite requires confirmation");
|
||||
}
|
||||
let digest = fs::metadata(format!("{}.digest", target.display())).await?;
|
||||
if !digest.is_file() {
|
||||
bail!("download resume metadata is not a regular file");
|
||||
}
|
||||
let mut file = OpenOptions::new()
|
||||
.write(true)
|
||||
.open(format!("{}.download", target.display()))
|
||||
.await?;
|
||||
validate_resume_file(&file).await?;
|
||||
if file.metadata().await?.len() != u64::from(offset) {
|
||||
bail!("download resume offset does not match staging file size");
|
||||
}
|
||||
file.seek(std::io::SeekFrom::Start(u64::from(offset)))
|
||||
.await?;
|
||||
self.file_num = file_num;
|
||||
self.data_stream = Some(DataStream::FileStream(file));
|
||||
self.transferred += u64::from(offset);
|
||||
self.finished_size += u64::from(offset);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) async fn write_download(&mut self, block: FileTransferBlock) -> ResultType<()> {
|
||||
if block.id != self.id {
|
||||
bail!("Wrong id");
|
||||
}
|
||||
if block.file_num as usize >= self.files.len() {
|
||||
bail!("Wrong file number");
|
||||
}
|
||||
if block.file_num != self.file_num || self.data_stream.is_none() {
|
||||
self.start_download_file(block.file_num).await?;
|
||||
}
|
||||
let data = if block.compressed {
|
||||
Cow::Owned(decompress(&block.data))
|
||||
} else {
|
||||
Cow::Borrowed(block.data.as_ref())
|
||||
};
|
||||
let Some(DataStream::FileStream(stream)) = self.data_stream.as_mut() else {
|
||||
bail!("download file stream is missing");
|
||||
};
|
||||
stream.write_all(&data).await?;
|
||||
stream.flush().await?;
|
||||
self.finished_size += data.len() as u64;
|
||||
self.transferred += block.data.len() as u64;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn finish_download(&self) -> ResultType<()> {
|
||||
if !self.is_download() {
|
||||
self.modify_time();
|
||||
return Ok(());
|
||||
}
|
||||
if self.data_stream.is_none() {
|
||||
return Ok(());
|
||||
}
|
||||
let target = self.download_target(self.file_num)?;
|
||||
if target.try_exists()? && self.download_confirmation_offset(self.file_num) != Some(0) {
|
||||
bail!("download overwrite requires confirmation");
|
||||
}
|
||||
std::fs::rename(format!("{}.download", target.display()), &target)?;
|
||||
remove_if_exists(&PathBuf::from(format!("{}.digest", target.display())))?;
|
||||
let entry = self
|
||||
.files
|
||||
.get(self.file_num as usize)
|
||||
.ok_or_else(|| anyhow!("Wrong file number"))?;
|
||||
filetime::set_file_mtime(
|
||||
&target,
|
||||
filetime::FileTime::from_unix_time(entry.modified_time as _, 0),
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,324 @@
|
||||
use super::*;
|
||||
|
||||
struct DownloadDir(PathBuf);
|
||||
|
||||
impl DownloadDir {
|
||||
fn new() -> Self {
|
||||
static NEXT_DIRECTORY: AtomicI32 = AtomicI32::new(1);
|
||||
let sequence = NEXT_DIRECTORY.fetch_add(1, Ordering::Relaxed);
|
||||
let nonce = SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_nanos();
|
||||
let path = std::env::temp_dir().join(format!(
|
||||
"rustdesk_download_{}_{nonce}_{sequence}",
|
||||
std::process::id()
|
||||
));
|
||||
std::fs::create_dir(&path).unwrap();
|
||||
Self(path)
|
||||
}
|
||||
|
||||
fn job(&self) -> TransferJob {
|
||||
self.job_with_files(vec![FileEntry::default()])
|
||||
}
|
||||
|
||||
fn job_with_files(&self, files: Vec<FileEntry>) -> TransferJob {
|
||||
TransferJob::new_write(
|
||||
1,
|
||||
JobType::Generic,
|
||||
"/remote/file.txt".into(),
|
||||
DataSource::FilePath(self.0.join("file.txt")),
|
||||
0,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
)
|
||||
.with_files(files)
|
||||
.unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for DownloadDir {
|
||||
fn drop(&mut self) {
|
||||
std::fs::remove_dir_all(&self.0).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
fn block() -> FileTransferBlock {
|
||||
FileTransferBlock {
|
||||
id: 1,
|
||||
file_num: 0,
|
||||
data: b"received".to_vec().into(),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
fn approval(file_num: i32, offset: u32) -> FileTransferSendConfirmRequest {
|
||||
FileTransferSendConfirmRequest {
|
||||
id: 1,
|
||||
file_num,
|
||||
union: Some(file_transfer_send_confirm_request::Union::OffsetBlk(offset)),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn download_listing_rejects_unsafe_names_and_keeps_drive_rows() {
|
||||
for name in ["../outside", "/outside", ".", "..", "", "dir/file"] {
|
||||
let entry = FileEntry {
|
||||
name: name.into(),
|
||||
..Default::default()
|
||||
};
|
||||
assert!(
|
||||
download::validate_listing(&[entry], false).is_err(),
|
||||
"{}",
|
||||
name
|
||||
);
|
||||
}
|
||||
let entries = [
|
||||
FileEntry {
|
||||
name: "report.txt".into(),
|
||||
..Default::default()
|
||||
},
|
||||
FileEntry {
|
||||
name: "report:notes".into(),
|
||||
..Default::default()
|
||||
},
|
||||
FileEntry {
|
||||
name: "C:".into(),
|
||||
entry_type: FileType::DirDrive.into(),
|
||||
..Default::default()
|
||||
},
|
||||
];
|
||||
download::validate_listing(&entries, true).unwrap();
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn download_requires_confirmation_to_overwrite() {
|
||||
let dir = DownloadDir::new();
|
||||
let target = dir.0.join("file.txt");
|
||||
std::fs::write(&target, b"original").unwrap();
|
||||
let mut job = dir.job();
|
||||
assert!(job.write(block()).await.is_err());
|
||||
assert_eq!(std::fs::read(&target).unwrap(), b"original");
|
||||
assert!(!dir.0.join("file.txt.download").exists());
|
||||
|
||||
job.confirm(&approval(0, 0)).await;
|
||||
job.write(block()).await.unwrap();
|
||||
assert!(job.set_files(vec![FileEntry::default()]).is_err());
|
||||
job.finish_download().unwrap();
|
||||
assert_eq!(std::fs::read(&target).unwrap(), b"received");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn download_requires_separate_confirmation_for_each_existing_file() {
|
||||
let dir = DownloadDir::new();
|
||||
let mut job = dir.job_with_files(vec![
|
||||
FileEntry {
|
||||
name: "first.txt".into(),
|
||||
..Default::default()
|
||||
},
|
||||
FileEntry {
|
||||
name: "second.txt".into(),
|
||||
..Default::default()
|
||||
},
|
||||
]);
|
||||
job.write(block()).await.unwrap();
|
||||
let second = dir.0.join("file.txt/second.txt");
|
||||
std::fs::write(&second, b"original").unwrap();
|
||||
assert!(job
|
||||
.write(FileTransferBlock {
|
||||
file_num: 1,
|
||||
..block()
|
||||
})
|
||||
.await
|
||||
.is_err());
|
||||
assert_eq!(std::fs::read(&second).unwrap(), b"original");
|
||||
assert_eq!(
|
||||
std::fs::read(dir.0.join("file.txt/first.txt")).unwrap(),
|
||||
b"received"
|
||||
);
|
||||
job.confirm(&approval(1, 0)).await;
|
||||
job.write(FileTransferBlock {
|
||||
file_num: 1,
|
||||
..block()
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
job.finish_download().unwrap();
|
||||
assert_eq!(std::fs::read(&second).unwrap(), b"received");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn download_preserves_received_files_when_publication_fails() {
|
||||
for next_is_digest in [false, true] {
|
||||
let dir = DownloadDir::new();
|
||||
let files = ["first.txt", "second.txt"]
|
||||
.iter()
|
||||
.map(|&name| FileEntry {
|
||||
name: name.into(),
|
||||
..Default::default()
|
||||
})
|
||||
.collect();
|
||||
let mut job = dir.job_with_files(files);
|
||||
job.write(block()).await.unwrap();
|
||||
let target = dir.0.join("file.txt/first.txt");
|
||||
std::fs::write(&target, b"existing").unwrap();
|
||||
if next_is_digest {
|
||||
assert!(job
|
||||
.download_digest(
|
||||
true,
|
||||
&FileTransferDigest {
|
||||
id: 1,
|
||||
file_num: 1,
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
.is_err());
|
||||
} else {
|
||||
assert!(job
|
||||
.write(FileTransferBlock {
|
||||
file_num: 1,
|
||||
..block()
|
||||
})
|
||||
.await
|
||||
.is_err());
|
||||
}
|
||||
job.remove_download_file();
|
||||
assert_eq!(std::fs::read(target).unwrap(), b"existing");
|
||||
assert_eq!(
|
||||
std::fs::read(dir.0.join("file.txt/first.txt.download")).unwrap(),
|
||||
b"received"
|
||||
);
|
||||
assert!(dir.0.join("file.txt/first.txt.digest").exists());
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn download_recovers_interrupted_transfer() {
|
||||
for (resuming, changed) in [(false, false), (true, true), (true, false)] {
|
||||
let dir = DownloadDir::new();
|
||||
let mut digest = FileTransferDigest {
|
||||
id: 1,
|
||||
file_size: block().data.len() as _,
|
||||
last_modified: 1,
|
||||
..Default::default()
|
||||
};
|
||||
let mut interrupted = dir.job();
|
||||
interrupted.set_digest(digest.file_size, digest.last_modified);
|
||||
let partial = FileTransferBlock {
|
||||
data: b"rec".to_vec().into(),
|
||||
..block()
|
||||
};
|
||||
interrupted.write(partial).await.unwrap();
|
||||
drop(interrupted);
|
||||
|
||||
let mut job = dir.job();
|
||||
job.is_resume = resuming;
|
||||
digest.last_modified += u64::from(changed);
|
||||
job.set_digest(digest.file_size, digest.last_modified);
|
||||
let confirmation = match job.download_digest(true, &digest).unwrap() {
|
||||
DigestCheckResult::NeedConfirm(confirmation) => confirmation,
|
||||
_ => panic!("interrupted download must require confirmation"),
|
||||
};
|
||||
let offset = if resuming && !changed {
|
||||
b"rec".len()
|
||||
} else {
|
||||
0
|
||||
};
|
||||
assert_eq!(confirmation.is_identical, offset > 0);
|
||||
assert_eq!(confirmation.transferred_size, offset as u64);
|
||||
assert!(job.write(block()).await.is_err());
|
||||
assert_eq!(
|
||||
std::fs::read(dir.0.join("file.txt.download")).unwrap(),
|
||||
b"rec"
|
||||
);
|
||||
job.confirm(&approval(0, offset as _)).await;
|
||||
job.write(FileTransferBlock {
|
||||
data: block().data.slice(offset..),
|
||||
..block()
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
job.finish_download().unwrap();
|
||||
assert_eq!(std::fs::read(dir.0.join("file.txt")).unwrap(), b"received");
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn download_does_not_publish_or_remove_unreceived_staging_files() {
|
||||
let dir = DownloadDir::new();
|
||||
let target = dir.0.join("file.txt");
|
||||
let staging = dir.0.join("file.txt.download");
|
||||
std::fs::write(&target, b"original").unwrap();
|
||||
std::fs::write(&staging, b"another transfer").unwrap();
|
||||
let job = dir.job();
|
||||
job.modify_time();
|
||||
job.remove_download_file();
|
||||
assert_eq!(std::fs::read(&target).unwrap(), b"original");
|
||||
assert_eq!(std::fs::read(&staging).unwrap(), b"another transfer");
|
||||
|
||||
let metadata_only = DownloadDir::new();
|
||||
let metadata = metadata_only.0.join("file.txt.digest");
|
||||
std::fs::write(&metadata, b"unrelated file").unwrap();
|
||||
assert!(metadata_only.job().write(block()).await.is_err());
|
||||
assert_eq!(std::fs::read(metadata).unwrap(), b"unrelated file");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(windows)]
|
||||
fn download_rejects_windows_streams_and_ambiguous_components() {
|
||||
let dir = DownloadDir::new();
|
||||
for name in ["nested/file:stream", "nested/.. /outside", "nested/file."] {
|
||||
assert!(
|
||||
download::validated_target(&dir.0.join("docs"), name).is_err(),
|
||||
"{}",
|
||||
name
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg_attr(windows, ignore = "requires symlink privilege")]
|
||||
async fn download_refuses_symlink_destination_directory() {
|
||||
let dir = DownloadDir::new();
|
||||
let outside = dir.0.join("outside");
|
||||
let link = dir.0.join("file.txt");
|
||||
std::fs::create_dir_all(&outside).unwrap();
|
||||
#[cfg(unix)]
|
||||
std::os::unix::fs::symlink(&outside, &link).unwrap();
|
||||
#[cfg(windows)]
|
||||
std::os::windows::fs::symlink_dir(&outside, &link).unwrap();
|
||||
let mut job = dir.job_with_files(vec![FileEntry {
|
||||
name: "child.txt".into(),
|
||||
..Default::default()
|
||||
}]);
|
||||
assert!(job.write(block()).await.is_err());
|
||||
job.modify_time();
|
||||
assert!(!outside.join("child.txt").exists());
|
||||
assert!(!outside.join("child.txt.download").exists());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg_attr(windows, ignore = "requires symlink privilege")]
|
||||
async fn download_refuses_linked_target_and_staging_files() {
|
||||
for suffix in ["", ".download", ".digest"] {
|
||||
let dir = DownloadDir::new();
|
||||
let outside = dir.0.join("outside.txt");
|
||||
let link = dir.0.join(format!("file.txt{suffix}"));
|
||||
std::fs::write(&outside, b"original").unwrap();
|
||||
#[cfg(unix)]
|
||||
std::os::unix::fs::symlink(&outside, &link).unwrap();
|
||||
#[cfg(windows)]
|
||||
std::os::windows::fs::symlink_file(&outside, &link).unwrap();
|
||||
let mut job = dir.job();
|
||||
assert!(job.write(block()).await.is_err());
|
||||
job.modify_time();
|
||||
job.remove_download_file();
|
||||
assert_eq!(std::fs::read(&outside).unwrap(), b"original");
|
||||
assert!(std::fs::symlink_metadata(link)
|
||||
.unwrap()
|
||||
.file_type()
|
||||
.is_symlink());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,288 @@
|
||||
use super::*;
|
||||
|
||||
#[cfg(unix)]
|
||||
#[path = "android_write_tests.rs"]
|
||||
mod write_tests;
|
||||
|
||||
#[cfg(unix)]
|
||||
use super::super::{
|
||||
DataSource, FileTransferBlock, FileTransferSendConfirmRequest, JobType, TransferJob,
|
||||
};
|
||||
|
||||
#[cfg(unix)]
|
||||
fn provider(output: &Path, request: &str) -> ResultType<String> {
|
||||
use std::{fs::File, os::fd::IntoRawFd};
|
||||
|
||||
let request: Value = serde_json::from_str(request)?;
|
||||
let modified = output.metadata().map_or(0, |m| std::os::unix::fs::MetadataExt::mtime(&m));
|
||||
let metadata = json!({"name": "notes.txt", "directory": false, "size": 12, "modified": modified});
|
||||
let value = match request["op"].as_str() {
|
||||
Some("home") => json!("/@rustdesk/tree/selected/Documents"),
|
||||
Some("allowed") => json!(true),
|
||||
Some("list") => json!([metadata]),
|
||||
Some("stat") if request["path"].as_str().unwrap().ends_with(".txt") => metadata,
|
||||
Some("stat") => json!({"name": "Documents", "directory": true, "size": 0, "modified": 0}),
|
||||
Some("begin") if request["path"].as_str().unwrap().contains("write-error") => {
|
||||
std::fs::write(output, b"partial")?;
|
||||
json!({"fd": File::open(output)?.into_raw_fd(), "descriptor": request["path"]})
|
||||
}
|
||||
Some("begin") => {
|
||||
if output.exists() && request["overwrite"].as_bool() == Some(false) {
|
||||
return Ok(json!({"error": "Document overwrite requires confirmation"}).to_string());
|
||||
}
|
||||
json!({"fd": File::create(output)?.into_raw_fd(), "descriptor": request["path"]})
|
||||
}
|
||||
Some("open") => write_tests::open_source(output, &request)?,
|
||||
Some("close")
|
||||
if request["descriptor"]
|
||||
.as_str()
|
||||
.unwrap()
|
||||
.ends_with("broken.txt") =>
|
||||
{
|
||||
return Ok(json!({"error": "Provider read failed"}).to_string())
|
||||
}
|
||||
Some("close") => json!(true),
|
||||
Some("finish") if request["path"].as_str().unwrap().ends_with("failed.txt") => {
|
||||
return Ok(json!({"error": "Publishing failed"}).to_string())
|
||||
}
|
||||
Some("finish") => json!(true),
|
||||
Some("discard") => {
|
||||
if request["path"].as_str().unwrap().contains("discard-error") {
|
||||
bail!("Provider cleanup failed");
|
||||
}
|
||||
std::fs::remove_file(output)?;
|
||||
json!(true)
|
||||
}
|
||||
_ => bail!("Unexpected operation"),
|
||||
};
|
||||
Ok(json!({"value": value}).to_string())
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
fn receiving(path: &str) -> TransferJob {
|
||||
receiving_files(path, vec![FileEntry::default()])
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
fn receiving_files(path: &str, files: Vec<FileEntry>) -> TransferJob {
|
||||
TransferJob::new_write(
|
||||
1,
|
||||
JobType::Generic,
|
||||
String::new(),
|
||||
DataSource::FilePath(path.into()),
|
||||
0,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
)
|
||||
.with_files(files)
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
fn block(file_num: i32, data: &[u8]) -> FileTransferBlock {
|
||||
FileTransferBlock {
|
||||
id: 1,
|
||||
file_num,
|
||||
data: data.to_vec().into(),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
fn sending(path: &str, overwrite_detection: bool) -> TransferJob {
|
||||
TransferJob::new_read(
|
||||
2,
|
||||
JobType::Generic,
|
||||
String::new(),
|
||||
DataSource::FilePath(path.into()),
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
overwrite_detection,
|
||||
)
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
async fn receive(path: &str, succeeds: bool, output: &Path) {
|
||||
let mut job = receiving(path);
|
||||
confirm_overwrite(&mut job, 0).await;
|
||||
job.write(block(0, b"hello, world")).await.unwrap();
|
||||
let eof = job.write(block(0, b"")).await;
|
||||
assert_eq!(eof.is_ok(), succeeds);
|
||||
assert_eq!(job.finish_document().await.is_ok(), succeeds);
|
||||
assert_eq!(job.job_error().is_some(), !succeeds);
|
||||
job.cancel_document().await.unwrap();
|
||||
assert_eq!(std::fs::read(output).unwrap(), b"hello, world");
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
async fn confirm_overwrite(job: &mut TransferJob, file_num: i32) {
|
||||
let mut confirmation = FileTransferSendConfirmRequest {
|
||||
id: job.id(),
|
||||
file_num,
|
||||
..Default::default()
|
||||
};
|
||||
confirmation.set_offset_blk(0);
|
||||
job.confirm(&confirmation).await;
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
async fn overwrite_requires_matching_confirmation(path: &str, output: &Path) {
|
||||
std::fs::write(output, b"original").unwrap();
|
||||
let mut job = receiving(&format!("{path}/notes.txt"));
|
||||
assert!(job.write(block(0, b"")).await.is_err());
|
||||
assert_eq!(std::fs::read(output).unwrap(), b"original");
|
||||
|
||||
let files = ["first.txt", "second.txt"]
|
||||
.map(|name| FileEntry {
|
||||
name: name.into(),
|
||||
..Default::default()
|
||||
})
|
||||
.to_vec();
|
||||
let mut job = receiving_files(path, files.clone());
|
||||
confirm_overwrite(&mut job, 0).await;
|
||||
assert!(job.set_files(vec![files[1].clone()]).is_err());
|
||||
assert_eq!(job.files(), &files);
|
||||
job.write(block(0, b"")).await.unwrap();
|
||||
std::fs::write(output, b"second original").unwrap();
|
||||
assert!(job.write(block(1, b"")).await.is_err());
|
||||
assert_eq!(std::fs::read(output).unwrap(), b"second original");
|
||||
|
||||
let mut job = receiving_files(path, files);
|
||||
confirm_overwrite(&mut job, 1).await;
|
||||
job.write(block(1, b"")).await.unwrap();
|
||||
assert!(std::fs::read(output).unwrap().is_empty());
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
async fn host_upload_respects_overwrite_support(path: &str, output: &Path) {
|
||||
for (overwrite_detection, exists) in [(false, false), (false, true), (true, true)] {
|
||||
if exists {
|
||||
std::fs::write(output, b"original").unwrap();
|
||||
}
|
||||
let mut job = TransferJob::new_write(
|
||||
1,
|
||||
JobType::Generic,
|
||||
String::new(),
|
||||
DataSource::FilePath(format!("{path}/notes.txt").into()),
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
overwrite_detection,
|
||||
)
|
||||
.with_files(vec![FileEntry::default()])
|
||||
.unwrap();
|
||||
let result = job.write(block(0, b"replacement")).await;
|
||||
if exists && !overwrite_detection {
|
||||
assert_eq!(
|
||||
result.unwrap_err().to_string(),
|
||||
"Document overwrite requires confirmation"
|
||||
);
|
||||
assert_eq!(std::fs::read(output).unwrap(), b"original");
|
||||
} else {
|
||||
result.unwrap();
|
||||
job.finish_document().await.unwrap();
|
||||
assert_eq!(std::fs::read(output).unwrap(), b"replacement");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[tokio::test]
|
||||
async fn selected_folder_transfers_directly_and_preserves_data_on_publish_failure() {
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
|
||||
let output = std::env::temp_dir().join(format!(
|
||||
"rustdesk-documents-{}",
|
||||
SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_nanos()
|
||||
));
|
||||
let provider_output = output.clone();
|
||||
initialize(move |request| provider(&provider_output, request)).unwrap();
|
||||
let path = "/@rustdesk/tree/selected/Documents";
|
||||
assert!(allowed(path).unwrap() && allowed(&format!("{path}/notes.txt")).unwrap());
|
||||
assert!(!allowed(&format!("{path}-private/notes.txt")).unwrap());
|
||||
assert!(!allowed("/@rustdesk/tree/previous/Documents/notes.txt").unwrap());
|
||||
let directory = super::super::read_dir(Path::new(path), false).unwrap();
|
||||
assert_eq!(directory.path, path);
|
||||
assert_eq!(directory.entries[0].name, "notes.txt");
|
||||
let files = super::super::get_recursive_files(path, false).unwrap();
|
||||
assert_eq!(files[0].name, "notes.txt");
|
||||
assert_eq!(files[0].size, 12);
|
||||
assert!(remove_empty_tree(path).unwrap_err().to_string() == "Cannot delete a shared root");
|
||||
assert!(super::super::remove_file(path).is_err());
|
||||
host_upload_respects_overwrite_support(path, &output).await;
|
||||
overwrite_requires_matching_confirmation(path, &output).await;
|
||||
for (name, succeeds) in [("notes.txt", true), ("failed.txt", false)] {
|
||||
receive(&format!("{path}/{name}"), succeeds, &output).await;
|
||||
}
|
||||
let destination = format!("{path}/notes.txt");
|
||||
let entry = stat(&destination).unwrap().unwrap();
|
||||
let digest = super::super::FileTransferDigest {
|
||||
file_size: entry.size,
|
||||
last_modified: entry.modified_time,
|
||||
..Default::default()
|
||||
};
|
||||
assert!(matches!(
|
||||
super::super::is_write_need_confirmation(false, &destination, &digest).unwrap(),
|
||||
super::super::DigestCheckResult::NeedConfirm(digest) if digest.is_identical
|
||||
));
|
||||
provider_error_at_eof(path).await;
|
||||
send_and_cancel(path, &output).await;
|
||||
write_tests::failed_block_cleans_pending_receive(path, &output).await;
|
||||
write_tests::failed_finalization_discards_partial_data(path, &output).await;
|
||||
write_tests::replacement_preserves_opened_digest(path, &output).await;
|
||||
write_tests::changed_source_without_timestamp_rejects_resume(path, &output).await;
|
||||
let mut empty = receiving(&format!("{path}/empty.txt"));
|
||||
empty.write(block(0, b"")).await.unwrap();
|
||||
assert_eq!(std::fs::metadata(&output).unwrap().len(), 0);
|
||||
std::fs::remove_file(output).unwrap();
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
async fn send_and_cancel(path: &str, output: &Path) {
|
||||
let mut sender = sending(&format!("{path}/notes.txt"), false);
|
||||
sender.init_data_stream_for_cm().await.unwrap();
|
||||
assert_eq!(
|
||||
sender.read().await.unwrap().unwrap().data.as_ref(),
|
||||
b"hello, world"
|
||||
);
|
||||
assert!(sender.read().await.unwrap().unwrap().data.is_empty());
|
||||
let mut canceled = receiving(&format!("{path}/canceled.txt"));
|
||||
confirm_overwrite(&mut canceled, 0).await;
|
||||
canceled.write(block(0, b"partial")).await.unwrap();
|
||||
canceled.cancel_document().await.unwrap();
|
||||
assert!(!output.exists());
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
async fn provider_error_at_eof(path: &str) {
|
||||
let mut sender = sending(&format!("{path}/broken.txt"), true);
|
||||
assert!(sender.init_data_stream_for_cm().await.unwrap().is_some());
|
||||
confirm_overwrite(&mut sender, 0).await;
|
||||
assert!(sender.read().await.unwrap().is_some());
|
||||
assert!(sender.read().await.is_err());
|
||||
assert!(sender.init_data_stream_for_cm().await.is_err());
|
||||
assert!(sender.read().await.unwrap().is_none());
|
||||
assert!(sender.job_completed());
|
||||
assert_eq!(sender.job_error().as_deref(), Some("Provider read failed"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn document_paths_cannot_escape_the_selected_location() {
|
||||
for path in [
|
||||
"/@rustdesk/tree/id/folder/../secret",
|
||||
"/@rustdesk//Download",
|
||||
"/@rustdesk/tree/id/a\\b",
|
||||
"/@rustdesk/file/id/report.txt",
|
||||
"/@rustdesk/save/id/report.txt",
|
||||
"/@rustdesk/Download/report.txt",
|
||||
] {
|
||||
assert!(validate(path).is_err(), "{}", path);
|
||||
}
|
||||
assert!(validate("/@rustdesk/tree/id/folder/report.txt").is_ok());
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
use super::*;
|
||||
|
||||
pub(super) fn open_source(output: &Path, request: &Value) -> ResultType<Value> {
|
||||
use std::{fs::File, io::Write, os::fd::IntoRawFd};
|
||||
|
||||
let fd = if request["path"].as_str().unwrap().ends_with("stream.txt") {
|
||||
let (reader, mut writer) = std::os::unix::net::UnixStream::pair()?;
|
||||
writer.write_all(&std::fs::read(output)?)?;
|
||||
reader.into_raw_fd()
|
||||
} else {
|
||||
let file = File::open(output)?;
|
||||
let replacement = output.with_extension("replacement");
|
||||
if replacement.exists() {
|
||||
std::fs::rename(replacement, output)?;
|
||||
}
|
||||
file.into_raw_fd()
|
||||
};
|
||||
Ok(json!({"fd": fd, "descriptor": request["path"]}))
|
||||
}
|
||||
|
||||
pub(super) async fn replacement_preserves_opened_digest(path: &str, output: &Path) {
|
||||
use filetime::{set_file_mtime, FileTime};
|
||||
|
||||
std::fs::write(output, b"old contents").unwrap();
|
||||
set_file_mtime(output, FileTime::from_unix_time(1, 0)).unwrap();
|
||||
let replacement = output.with_extension("replacement");
|
||||
std::fs::write(&replacement, b"new contents").unwrap();
|
||||
set_file_mtime(&replacement, FileTime::from_unix_time(2, 0)).unwrap();
|
||||
let path = format!("{path}/notes.txt");
|
||||
let mut sender = sending(&path, true);
|
||||
assert_eq!(
|
||||
sender.init_data_stream_for_cm().await.unwrap(),
|
||||
Some((1, 12))
|
||||
);
|
||||
confirm_overwrite(&mut sender, 0).await;
|
||||
assert_eq!(
|
||||
sender.read().await.unwrap().unwrap().data.as_ref(),
|
||||
b"old contents"
|
||||
);
|
||||
assert!(sender.read().await.unwrap().unwrap().data.is_empty());
|
||||
let mut next = sending(&path, true);
|
||||
assert_eq!(next.init_data_stream_for_cm().await.unwrap(), Some((2, 12)));
|
||||
}
|
||||
|
||||
pub(super) async fn failed_block_cleans_pending_receive(path: &str, output: &Path) {
|
||||
for name in ["write-error.txt", "write-error-broken.txt"] {
|
||||
let mut job = receiving(&format!("{path}/{name}"));
|
||||
job.is_remote = false;
|
||||
let block = block(0, b"more data");
|
||||
// Tokio queues the first write and reports its I/O failure on the next block.
|
||||
job.write(block.clone()).await.unwrap();
|
||||
assert_eq!(std::fs::read(output).unwrap(), b"partial");
|
||||
let error = job.write(block).await.unwrap_err();
|
||||
assert!(error.downcast_ref::<std::io::Error>().is_some());
|
||||
assert_eq!(job.job_error(), Some(error.to_string()));
|
||||
assert!(
|
||||
!output.exists(),
|
||||
"A failed receive must discard partial data"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) async fn failed_finalization_discards_partial_data(path: &str, output: &Path) {
|
||||
for name in ["write-error.txt", "broken.txt", "discard-error-broken.txt"] {
|
||||
let mut job = receiving(&format!("{path}/{name}"));
|
||||
confirm_overwrite(&mut job, 0).await;
|
||||
job.write(block(0, b"partial data")).await.unwrap();
|
||||
let error = job.finish_document().await.unwrap_err();
|
||||
assert_eq!(job.job_error(), Some(error.to_string()));
|
||||
if name.ends_with("broken.txt") {
|
||||
assert!(error.to_string().contains("Provider read failed"));
|
||||
} else {
|
||||
assert!(error.downcast_ref::<std::io::Error>().is_some());
|
||||
}
|
||||
if name.starts_with("discard-error") {
|
||||
assert!(error.to_string().contains("Provider cleanup failed"));
|
||||
assert!(output.exists());
|
||||
std::fs::remove_file(output).unwrap();
|
||||
} else {
|
||||
assert!(
|
||||
!output.exists(),
|
||||
"A failed finalization must discard partial data"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) async fn changed_source_without_timestamp_rejects_resume(path: &str, output: &Path) {
|
||||
std::fs::write(output, b"old contents").unwrap();
|
||||
filetime::set_file_mtime(output, filetime::FileTime::from_unix_time(0, 0)).unwrap();
|
||||
stale_metadata_uses_current_digest(&format!("{path}/notes.txt")).await;
|
||||
let path = format!("{path}/stream.txt");
|
||||
let mut sender = sending(&path, true);
|
||||
let original_digest = sender.init_data_stream_for_cm().await.unwrap();
|
||||
assert_eq!(original_digest, Some((0, b"old contents".len() as u64)));
|
||||
confirm_overwrite(&mut sender, 0).await;
|
||||
assert_eq!(
|
||||
sender.read().await.unwrap().unwrap().data.as_ref(),
|
||||
b"old contents"
|
||||
);
|
||||
drop(sender);
|
||||
|
||||
std::fs::write(output, b"new contents").unwrap();
|
||||
let mut resumed = sending(&path, true);
|
||||
assert_eq!(
|
||||
resumed.init_data_stream_for_cm().await.unwrap(),
|
||||
original_digest
|
||||
);
|
||||
let mut confirmation = FileTransferSendConfirmRequest {
|
||||
id: resumed.id(),
|
||||
..Default::default()
|
||||
};
|
||||
confirmation.set_offset_blk(b"old ".len() as u32);
|
||||
resumed.confirm(&confirmation).await;
|
||||
assert_eq!(
|
||||
resumed.job_error().as_deref(),
|
||||
Some("Cannot resume a document with an unknown modification time; restart the transfer")
|
||||
);
|
||||
assert!(resumed.read().await.unwrap().is_none());
|
||||
assert!(resumed.job_completed());
|
||||
|
||||
let mut fresh = sending(&path, true);
|
||||
fresh.init_data_stream_for_cm().await.unwrap();
|
||||
confirm_overwrite(&mut fresh, 0).await;
|
||||
assert_eq!(
|
||||
fresh.read().await.unwrap().unwrap().data.as_ref(),
|
||||
b"new contents"
|
||||
);
|
||||
assert!(fresh.read().await.unwrap().unwrap().data.is_empty());
|
||||
std::fs::remove_file(output).unwrap();
|
||||
}
|
||||
|
||||
async fn stale_metadata_uses_current_digest(path: &str) {
|
||||
for (size, modified_time) in [(12, 1), (13, 0)] {
|
||||
let mut sender = sending(path, true)
|
||||
.with_files(vec![FileEntry {
|
||||
size,
|
||||
modified_time,
|
||||
..Default::default()
|
||||
}])
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
sender.init_data_stream_for_cm().await.unwrap(),
|
||||
Some((0, b"old contents".len() as u64))
|
||||
);
|
||||
confirm_overwrite(&mut sender, 0).await;
|
||||
assert_eq!(
|
||||
sender.read().await.unwrap().unwrap().data.as_ref(),
|
||||
b"old contents"
|
||||
);
|
||||
assert!(sender.read().await.unwrap().unwrap().data.is_empty());
|
||||
}
|
||||
}
|
||||
+1
-1
Submodule libs/hbb_common updated: 5d52530b63...fae47e024d
@@ -506,7 +506,43 @@ pub extern "system" fn Java_ffi_FFI_onAppStart(mut env: JNIEnv, _class: JClass,
|
||||
let java_vm = jvm.get_java_vm_pointer() as *mut c_void;
|
||||
let context_jobject = context.as_obj().as_raw() as *mut c_void;
|
||||
*APPLICATION_CONTEXT.write().unwrap() = Some(context);
|
||||
*JVM.write().unwrap() = Some(jvm);
|
||||
if let Err(error) = base::fs::android::initialize(call_document_storage) {
|
||||
log::error!("Unable to initialize document storage: {}", error);
|
||||
}
|
||||
try_init_rustls_platform_verifier(&mut env, context_jobject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn call_document_storage(request: &str) -> hbb_common::ResultType<String> {
|
||||
use hbb_common::anyhow::anyhow;
|
||||
|
||||
const LOCAL_REFS: i32 = 4;
|
||||
let context = APPLICATION_CONTEXT
|
||||
.read()
|
||||
.unwrap()
|
||||
.clone()
|
||||
.ok_or(anyhow!("Android application context is unavailable"))?;
|
||||
let jvm = JVM.read().unwrap();
|
||||
let jvm = jvm.as_ref().ok_or(anyhow!("Android VM is unavailable"))?;
|
||||
let mut env = jvm.attach_current_thread_as_daemon()?;
|
||||
let result = env.with_local_frame(LOCAL_REFS, |env| -> JniResult<String> {
|
||||
let request = env.new_string(request)?;
|
||||
let value = env
|
||||
.call_method(
|
||||
&context,
|
||||
"rustDocumentStorage",
|
||||
"(Ljava/lang/String;)Ljava/lang/String;",
|
||||
&[JValue::Object(&JObject::from(request))],
|
||||
)?
|
||||
.l()?;
|
||||
let value = JString::from(value);
|
||||
let value = env.get_string(&value)?;
|
||||
Ok(value.into())
|
||||
});
|
||||
if result.is_err() && env.exception_check()? {
|
||||
env.exception_clear()?;
|
||||
}
|
||||
Ok(result?)
|
||||
}
|
||||
|
||||
@@ -25,6 +25,9 @@ use hwcodec::{
|
||||
},
|
||||
};
|
||||
|
||||
#[cfg(all(test, windows, feature = "vram"))]
|
||||
mod tests;
|
||||
|
||||
const DEFAULT_PIXFMT: AVPixelFormat = AVPixelFormat::AV_PIX_FMT_NV12;
|
||||
pub const DEFAULT_FPS: i32 = 30;
|
||||
const DEFAULT_GOP: i32 = i32::MAX;
|
||||
@@ -236,7 +239,7 @@ impl HwRamEncoder {
|
||||
data.append(v);
|
||||
Ok(data)
|
||||
}
|
||||
Err(_) => Ok(Vec::<EncodeFrame>::new()),
|
||||
Err(code) => Err(anyhow!("RAM encode failed: {}", code)),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
use super::{CodecInfo, HwCodecConfig, CONFIG, CONFIG_SET_BY_IPC};
|
||||
use crate::{
|
||||
codec::enable_vram_option,
|
||||
vram::{VRamDecoder, VRamEncoder},
|
||||
AdapterDevice, CodecFormat,
|
||||
};
|
||||
use base::config::keys::{OPTION_ALLOW_D3D_RENDER, OPTION_ENABLE_HWCODEC};
|
||||
use hbb_common::config::{OVERWRITE_LOCAL_SETTINGS, OVERWRITE_SETTINGS};
|
||||
use hwcodec::{
|
||||
common::{DataFormat, Driver},
|
||||
vram::{DecodeContext, FeatureContext},
|
||||
};
|
||||
use std::{collections::HashMap, mem};
|
||||
|
||||
struct RestoreConfig {
|
||||
config: Option<HwCodecConfig>,
|
||||
set_by_ipc: bool,
|
||||
options: HashMap<String, String>,
|
||||
local_options: HashMap<String, String>,
|
||||
}
|
||||
|
||||
impl Drop for RestoreConfig {
|
||||
fn drop(&mut self) {
|
||||
*CONFIG.lock().unwrap() = self.config.take();
|
||||
*CONFIG_SET_BY_IPC.lock().unwrap() = self.set_by_ipc;
|
||||
*OVERWRITE_SETTINGS.write().unwrap() = mem::take(&mut self.options);
|
||||
*OVERWRITE_LOCAL_SETTINGS.write().unwrap() = mem::take(&mut self.local_options);
|
||||
}
|
||||
}
|
||||
|
||||
fn add_backend(config: &mut HwCodecConfig, driver: Driver, vendor: Driver, format: DataFormat) {
|
||||
let luid = match vendor {
|
||||
Driver::NV => 1,
|
||||
Driver::MFX => 2,
|
||||
Driver::AMF => 3,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
config.vram_encode.push(FeatureContext {
|
||||
driver: driver.clone(),
|
||||
vendor: vendor.clone(),
|
||||
luid,
|
||||
data_format: format,
|
||||
});
|
||||
config.vram_decode.push(DecodeContext {
|
||||
device: None,
|
||||
driver,
|
||||
vendor,
|
||||
luid,
|
||||
data_format: format,
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cached_sdk_entries_are_ignored_before_check_completes() {
|
||||
let _restore = RestoreConfig {
|
||||
config: CONFIG.lock().unwrap().take(),
|
||||
set_by_ipc: mem::replace(&mut *CONFIG_SET_BY_IPC.lock().unwrap(), false),
|
||||
options: mem::take(&mut *OVERWRITE_SETTINGS.write().unwrap()),
|
||||
local_options: mem::take(&mut *OVERWRITE_LOCAL_SETTINGS.write().unwrap()),
|
||||
};
|
||||
OVERWRITE_SETTINGS
|
||||
.write()
|
||||
.unwrap()
|
||||
.insert(OPTION_ENABLE_HWCODEC.into(), "Y".into());
|
||||
OVERWRITE_LOCAL_SETTINGS
|
||||
.write()
|
||||
.unwrap()
|
||||
.insert(OPTION_ALLOW_D3D_RENDER.into(), "Y".into());
|
||||
assert!(enable_vram_option(false));
|
||||
|
||||
let formats = [
|
||||
(CodecFormat::H264, DataFormat::H264),
|
||||
(CodecFormat::H265, DataFormat::H265),
|
||||
];
|
||||
let mut cached = HwCodecConfig::default();
|
||||
for (_, format) in formats {
|
||||
// A RAM fallback keeps this selection test independent of attached displays.
|
||||
cached.ram_encode.push(CodecInfo {
|
||||
format,
|
||||
..Default::default()
|
||||
});
|
||||
for vendor in [Driver::NV, Driver::MFX, Driver::AMF] {
|
||||
add_backend(&mut cached, vendor.clone(), vendor, format);
|
||||
}
|
||||
}
|
||||
*CONFIG.lock().unwrap() = Some(cached.clone());
|
||||
assert!(!HwCodecConfig::already_set());
|
||||
for (format, _) in formats {
|
||||
assert!(VRamEncoder::available(format).is_empty());
|
||||
for luid in 1..=3 {
|
||||
assert!(VRamDecoder::try_get(format, Some(luid)).is_none());
|
||||
}
|
||||
}
|
||||
assert_eq!(
|
||||
VRamDecoder::possible_available_without_check(),
|
||||
(false, false)
|
||||
);
|
||||
|
||||
for (index, &(format, data_format)) in formats.iter().enumerate() {
|
||||
for vendor in [Driver::NV, Driver::MFX, Driver::AMF] {
|
||||
add_backend(&mut cached, Driver::FFMPEG, vendor, data_format);
|
||||
}
|
||||
*CONFIG.lock().unwrap() = Some(cached.clone());
|
||||
let encoders = VRamEncoder::available(format);
|
||||
assert_eq!(encoders.len(), 3);
|
||||
for encoder in encoders {
|
||||
assert_eq!(encoder.driver, Driver::FFMPEG);
|
||||
let device = AdapterDevice {
|
||||
luid: encoder.luid,
|
||||
..Default::default()
|
||||
};
|
||||
assert_eq!(VRamEncoder::try_get(&device, format), Some(encoder.clone()));
|
||||
let decoder = VRamDecoder::try_get(format, Some(encoder.luid)).unwrap();
|
||||
assert_eq!(decoder.driver, Driver::FFMPEG);
|
||||
assert_eq!(decoder.vendor, encoder.vendor);
|
||||
assert_eq!(decoder.data_format, data_format);
|
||||
}
|
||||
assert!(VRamDecoder::available(format, Some(99)).is_empty());
|
||||
assert!(VRamDecoder::available(format, None).is_empty());
|
||||
assert_eq!(
|
||||
VRamDecoder::possible_available_without_check(),
|
||||
(true, index == 1)
|
||||
);
|
||||
}
|
||||
assert!(!HwCodecConfig::already_set());
|
||||
assert_eq!(
|
||||
HwCodecConfig::get().vram_encode.len(),
|
||||
cached.vram_encode.len()
|
||||
);
|
||||
}
|
||||
@@ -209,6 +209,8 @@ impl Frame<'_> {
|
||||
pub enum EncodeInput<'a> {
|
||||
YUV(&'a [u8]),
|
||||
Texture((*mut c_void, usize)),
|
||||
#[cfg(all(windows, feature = "vram"))]
|
||||
Repeat,
|
||||
}
|
||||
|
||||
impl<'a> EncodeInput<'a> {
|
||||
|
||||
@@ -20,6 +20,17 @@ use std::{ptr, slice};
|
||||
generate_call_macro!(call_vpx, false);
|
||||
generate_call_ptr_macro!(call_vpx_ptr);
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct VpxNoOutput;
|
||||
|
||||
impl std::fmt::Display for VpxNoOutput {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str("no valid frame")
|
||||
}
|
||||
}
|
||||
|
||||
impl std::error::Error for VpxNoOutput {}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum VpxVideoCodecId {
|
||||
VP8,
|
||||
@@ -187,7 +198,7 @@ impl EncoderApi for VpxEncoder {
|
||||
if frames.len() > 0 {
|
||||
Ok(VpxEncoder::create_video_frame(self.id, frames))
|
||||
} else {
|
||||
Err(anyhow!("no valid frame"))
|
||||
Err(VpxNoOutput.into())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,9 @@ use hbb_common::{
|
||||
bytes::Bytes,
|
||||
log, ResultType,
|
||||
};
|
||||
pub use hwcodec::common::Driver;
|
||||
use hwcodec::{
|
||||
common::{DataFormat, Driver, MAX_GOP},
|
||||
common::{DataFormat, MAX_GOP},
|
||||
vram::{
|
||||
decode::{self, DecodeFrame, Decoder},
|
||||
encode::{self, EncodeFrame, Encoder},
|
||||
@@ -24,6 +25,9 @@ use hwcodec::{
|
||||
},
|
||||
};
|
||||
|
||||
#[cfg(test)]
|
||||
mod repeat_tests;
|
||||
|
||||
// https://www.reddit.com/r/buildapc/comments/d2m4ny/two_graphics_cards_two_monitors/
|
||||
// https://www.reddit.com/r/techsupport/comments/t2v9u6/dual_monitor_setup_with_dual_gpu/
|
||||
// https://cybersided.com/two-monitors-two-gpus/
|
||||
@@ -48,8 +52,6 @@ pub struct VRamEncoder {
|
||||
pub format: DataFormat,
|
||||
ctx: EncodeContext,
|
||||
bitrate: u32,
|
||||
last_frame_len: usize,
|
||||
same_bad_len_counter: usize,
|
||||
}
|
||||
|
||||
impl EncoderApi for VRamEncoder {
|
||||
@@ -83,8 +85,6 @@ impl EncoderApi for VRamEncoder {
|
||||
ctx,
|
||||
format: config.feature.data_format,
|
||||
bitrate,
|
||||
last_frame_len: 0,
|
||||
same_bad_len_counter: 0,
|
||||
}),
|
||||
Err(_) => Err(anyhow!(format!("Failed to create encoder"))),
|
||||
}
|
||||
@@ -98,7 +98,15 @@ impl EncoderApi for VRamEncoder {
|
||||
frame: EncodeInput,
|
||||
ms: i64,
|
||||
) -> ResultType<base::message_proto::VideoFrame> {
|
||||
let (texture, rotation) = frame.texture()?;
|
||||
#[cfg(all(windows, feature = "vram"))]
|
||||
let repeated = matches!(&frame, EncodeInput::Repeat);
|
||||
#[cfg(not(all(windows, feature = "vram")))]
|
||||
let repeated = false;
|
||||
let (texture, rotation) = if repeated {
|
||||
(std::ptr::null_mut(), 0)
|
||||
} else {
|
||||
frame.texture()?
|
||||
};
|
||||
if rotation != 0 {
|
||||
// to-do: support rotation
|
||||
// Both the encoder and display(w,h) information need to be changed.
|
||||
@@ -106,10 +114,12 @@ impl EncoderApi for VRamEncoder {
|
||||
}
|
||||
let mut vf = VideoFrame::new();
|
||||
let mut frames = Vec::new();
|
||||
for frame in self
|
||||
.encode(texture, ms)
|
||||
.with_context(|| "Failed to encode")?
|
||||
{
|
||||
let result = if repeated {
|
||||
self.encode_repeat(ms)
|
||||
} else {
|
||||
self.encode(texture, ms)
|
||||
};
|
||||
for frame in result.with_context(|| "Failed to encode")? {
|
||||
frames.push(EncodedVideoFrame {
|
||||
data: Bytes::from(frame.data),
|
||||
pts: frame.pts,
|
||||
@@ -117,29 +127,10 @@ impl EncoderApi for VRamEncoder {
|
||||
..Default::default()
|
||||
});
|
||||
}
|
||||
if repeated && frames.is_empty() {
|
||||
return Ok(vf);
|
||||
}
|
||||
if frames.len() > 0 {
|
||||
// This kind of problem is occurred after a period of time when using the AMD SDK,
|
||||
// the encoding length is fixed at about 40, and the picture is still
|
||||
const MIN_BAD_LEN: usize = 100;
|
||||
const MAX_BAD_COUNTER: usize = 30;
|
||||
let this_frame_len = frames[0].data.len();
|
||||
if self.ctx.f.driver == Driver::AMF
|
||||
&& this_frame_len < MIN_BAD_LEN
|
||||
&& this_frame_len == self.last_frame_len
|
||||
{
|
||||
self.same_bad_len_counter += 1;
|
||||
if self.same_bad_len_counter >= MAX_BAD_COUNTER {
|
||||
log::info!(
|
||||
"{} times encoding len is {}, switch",
|
||||
self.same_bad_len_counter,
|
||||
self.last_frame_len
|
||||
);
|
||||
bail!(crate::codec::ENCODE_NEED_SWITCH);
|
||||
}
|
||||
} else {
|
||||
self.same_bad_len_counter = 0;
|
||||
}
|
||||
self.last_frame_len = this_frame_len;
|
||||
let frames = EncodedVideoFrames {
|
||||
frames: frames.into(),
|
||||
..Default::default()
|
||||
@@ -244,6 +235,7 @@ impl VRamEncoder {
|
||||
let v: Vec<_> = crate::hwcodec::HwCodecConfig::get()
|
||||
.vram_encode
|
||||
.drain(..)
|
||||
.filter(|c| c.driver == Driver::FFMPEG)
|
||||
.filter(|c| c.data_format == data_format)
|
||||
.collect();
|
||||
if crate::hwcodec::HwRamEncoder::try_get(format).is_some() {
|
||||
@@ -274,14 +266,21 @@ impl VRamEncoder {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn encode(&mut self, texture: *mut c_void, ms: i64) -> ResultType<Vec<EncodeFrame>> {
|
||||
pub fn encode(
|
||||
&mut self,
|
||||
texture: *mut c_void,
|
||||
ms: i64,
|
||||
) -> ResultType<std::vec::Drain<'_, EncodeFrame>> {
|
||||
match self.encoder.encode(texture, ms) {
|
||||
Ok(v) => {
|
||||
let mut data = Vec::<EncodeFrame>::new();
|
||||
data.append(v);
|
||||
Ok(data)
|
||||
}
|
||||
Err(_) => Ok(Vec::<EncodeFrame>::new()),
|
||||
Ok(frames) => Ok(frames.drain(..)),
|
||||
Err(code) => Err(anyhow!("VRAM encode failed: {}", code)),
|
||||
}
|
||||
}
|
||||
|
||||
fn encode_repeat(&mut self, ms: i64) -> ResultType<std::vec::Drain<'_, EncodeFrame>> {
|
||||
match self.encoder.encode_repeat(ms) {
|
||||
Ok(frames) => Ok(frames.drain(..)),
|
||||
Err(code) => Err(anyhow!("VRAM repeat encode failed: {}", code)),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,6 +339,7 @@ impl VRamDecoder {
|
||||
crate::hwcodec::HwCodecConfig::get()
|
||||
.vram_decode
|
||||
.drain(..)
|
||||
.filter(|c| c.driver == Driver::FFMPEG)
|
||||
.filter(|c| c.data_format == data_format && c.luid == luid && luid != 0)
|
||||
.collect()
|
||||
}
|
||||
@@ -350,8 +350,10 @@ impl VRamDecoder {
|
||||
}
|
||||
let v = crate::hwcodec::HwCodecConfig::get().vram_decode;
|
||||
(
|
||||
v.iter().any(|d| d.data_format == DataFormat::H264),
|
||||
v.iter().any(|d| d.data_format == DataFormat::H265),
|
||||
v.iter()
|
||||
.any(|d| d.driver == Driver::FFMPEG && d.data_format == DataFormat::H264),
|
||||
v.iter()
|
||||
.any(|d| d.driver == Driver::FFMPEG && d.data_format == DataFormat::H265),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,244 @@
|
||||
use super::VRamEncoder;
|
||||
use crate::{codec::EncoderApi, EncodeInput};
|
||||
use base::message_proto::{video_frame, VideoFrame};
|
||||
use hwcodec::{
|
||||
common::{DataFormat, Driver, MAX_GOP},
|
||||
ffmpeg::AVHWDeviceType,
|
||||
ffmpeg_ram::decode::{DecodeContext, Decoder},
|
||||
vram::{encode::Encoder, DynamicContext, EncodeContext, FeatureContext},
|
||||
};
|
||||
use std::{mem, ptr};
|
||||
use winapi::{
|
||||
shared::{
|
||||
dxgi::{CreateDXGIFactory1, IDXGIFactory1},
|
||||
dxgiformat::DXGI_FORMAT_B8G8R8A8_UNORM,
|
||||
dxgitype::DXGI_SAMPLE_DESC,
|
||||
winerror::DXGI_ERROR_NOT_FOUND,
|
||||
},
|
||||
um::{d3d11::*, d3dcommon::D3D_DRIVER_TYPE_UNKNOWN, unknwnbase::IUnknown},
|
||||
Interface,
|
||||
};
|
||||
|
||||
struct Com<T>(*mut T);
|
||||
|
||||
impl<T> Drop for Com<T> {
|
||||
fn drop(&mut self) {
|
||||
if !self.0.is_null() {
|
||||
unsafe { (*(self.0 as *mut IUnknown)).Release() };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn texture(
|
||||
device: *mut ID3D11Device,
|
||||
width: u32,
|
||||
height: u32,
|
||||
shade: u8,
|
||||
) -> Com<ID3D11Texture2D> {
|
||||
let pixels = pixels(width, height, shade);
|
||||
let desc = D3D11_TEXTURE2D_DESC {
|
||||
Width: width,
|
||||
Height: height,
|
||||
MipLevels: 1,
|
||||
ArraySize: 1,
|
||||
Format: DXGI_FORMAT_B8G8R8A8_UNORM,
|
||||
SampleDesc: DXGI_SAMPLE_DESC {
|
||||
Count: 1,
|
||||
Quality: 0,
|
||||
},
|
||||
Usage: D3D11_USAGE_DEFAULT,
|
||||
BindFlags: D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET,
|
||||
CPUAccessFlags: 0,
|
||||
MiscFlags: D3D11_RESOURCE_MISC_SHARED,
|
||||
};
|
||||
let data = D3D11_SUBRESOURCE_DATA {
|
||||
pSysMem: pixels.as_ptr() as _,
|
||||
SysMemPitch: width * 4,
|
||||
SysMemSlicePitch: 0,
|
||||
};
|
||||
let mut raw = ptr::null_mut();
|
||||
assert_eq!((*device).CreateTexture2D(&desc, &data, &mut raw), 0);
|
||||
Com(raw)
|
||||
}
|
||||
|
||||
fn pixels(width: u32, height: u32, shade: u8) -> Vec<u8> {
|
||||
[shade, shade, shade, 255].repeat((width * height) as usize)
|
||||
}
|
||||
|
||||
fn check_picture(
|
||||
decoder: &mut Decoder,
|
||||
frame: VideoFrame,
|
||||
width: u32,
|
||||
height: u32,
|
||||
bright: bool,
|
||||
pts: i64,
|
||||
) {
|
||||
let frames = match frame.union.unwrap() {
|
||||
video_frame::Union::H264s(frames) | video_frame::Union::H265s(frames) => frames,
|
||||
_ => panic!("unexpected codec"),
|
||||
};
|
||||
let mut decoded = 0;
|
||||
for packet in frames.frames {
|
||||
assert_eq!(packet.pts, pts);
|
||||
for picture in decoder.decode(&packet.data).unwrap() {
|
||||
assert_eq!((picture.width, picture.height), (width as _, height as _));
|
||||
let center = (height as usize / 2) * picture.linesize[0] as usize + width as usize / 2;
|
||||
let y = picture.data[0][center];
|
||||
assert!(
|
||||
if bright { y > 160 } else { y < 90 },
|
||||
"stale or overwritten pixels: expected bright={}, got Y={}",
|
||||
bright,
|
||||
y
|
||||
);
|
||||
decoded += 1;
|
||||
}
|
||||
}
|
||||
assert!(decoded > 0, "encoder output did not decode to a picture");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "requires hardware H.264/H.265 encoders; run explicitly on GPU hosts"]
|
||||
fn hardware_repeats_own_pixels_and_reset_on_recreation() {
|
||||
unsafe {
|
||||
let mut raw_factory = ptr::null_mut();
|
||||
assert_eq!(
|
||||
CreateDXGIFactory1(&IDXGIFactory1::uuidof(), &mut raw_factory),
|
||||
0
|
||||
);
|
||||
let factory = Com(raw_factory as *mut IDXGIFactory1);
|
||||
let mut tested = 0;
|
||||
for index in 0.. {
|
||||
let mut raw_adapter = ptr::null_mut();
|
||||
let result = (*factory.0).EnumAdapters1(index, &mut raw_adapter);
|
||||
if result == DXGI_ERROR_NOT_FOUND {
|
||||
break;
|
||||
}
|
||||
assert_eq!(result, 0);
|
||||
let adapter = Com(raw_adapter);
|
||||
let mut desc = mem::zeroed();
|
||||
assert_eq!((*adapter.0).GetDesc1(&mut desc), 0);
|
||||
let vendor = match desc.VendorId {
|
||||
0x10de => Driver::NV,
|
||||
0x1002 => Driver::AMF,
|
||||
0x8086 => Driver::MFX,
|
||||
_ => continue,
|
||||
};
|
||||
let luid = ((desc.AdapterLuid.HighPart as i64) << 32) | desc.AdapterLuid.LowPart as i64;
|
||||
let mut raw_device = ptr::null_mut();
|
||||
let mut raw_context = ptr::null_mut();
|
||||
assert_eq!(
|
||||
D3D11CreateDevice(
|
||||
adapter.0 as _,
|
||||
D3D_DRIVER_TYPE_UNKNOWN,
|
||||
ptr::null_mut(),
|
||||
D3D11_CREATE_DEVICE_BGRA_SUPPORT | D3D11_CREATE_DEVICE_VIDEO_SUPPORT,
|
||||
ptr::null(),
|
||||
0,
|
||||
D3D11_SDK_VERSION,
|
||||
&mut raw_device,
|
||||
ptr::null_mut(),
|
||||
&mut raw_context,
|
||||
),
|
||||
0
|
||||
);
|
||||
let device = Com(raw_device);
|
||||
let context = Com(raw_context);
|
||||
for driver in [Driver::FFMPEG, vendor.clone()] {
|
||||
for format in [DataFormat::H264, DataFormat::H265] {
|
||||
for (width, height) in [(320, 240), (640, 360)] {
|
||||
let ctx = EncodeContext {
|
||||
f: FeatureContext {
|
||||
driver: driver.clone(),
|
||||
vendor: vendor.clone(),
|
||||
luid,
|
||||
data_format: format,
|
||||
},
|
||||
d: DynamicContext {
|
||||
device: Some(device.0 as _),
|
||||
width: width as _,
|
||||
height: height as _,
|
||||
kbitrate: 1000,
|
||||
framerate: 30,
|
||||
gop: MAX_GOP as _,
|
||||
},
|
||||
};
|
||||
let native = match Encoder::new(ctx.clone()) {
|
||||
Ok(encoder) => encoder,
|
||||
Err(()) => {
|
||||
eprintln!(
|
||||
"SKIP unavailable {:?} {:?} {:?} adapter={luid:#x}",
|
||||
vendor, driver, format
|
||||
);
|
||||
continue;
|
||||
}
|
||||
};
|
||||
let mut encoder = VRamEncoder {
|
||||
encoder: native,
|
||||
format,
|
||||
ctx,
|
||||
bitrate: 1000,
|
||||
};
|
||||
assert!(encoder.encode_to_message(EncodeInput::Repeat, 0).is_err());
|
||||
assert!(encoder
|
||||
.encode_to_message(EncodeInput::Texture((ptr::null_mut(), 0)), 0)
|
||||
.is_err());
|
||||
let mut decoder = Decoder::new(DecodeContext {
|
||||
name: if format == DataFormat::H264 {
|
||||
"h264"
|
||||
} else {
|
||||
"hevc"
|
||||
}
|
||||
.into(),
|
||||
device_type: AVHWDeviceType::AV_HWDEVICE_TYPE_NONE,
|
||||
thread_count: 1,
|
||||
})
|
||||
.unwrap();
|
||||
let source = texture(device.0, width, height, 32);
|
||||
let frame = encoder
|
||||
.encode_to_message(EncodeInput::Texture((source.0 as _, 0)), 0)
|
||||
.unwrap();
|
||||
check_picture(&mut decoder, frame, width, height, false, 0);
|
||||
|
||||
// Overwrite and release the capture resource before any repeats.
|
||||
let overwritten = pixels(width, height, 224);
|
||||
(*context.0).UpdateSubresource(
|
||||
source.0 as _,
|
||||
0,
|
||||
ptr::null(),
|
||||
overwritten.as_ptr() as _,
|
||||
width * 4,
|
||||
0,
|
||||
);
|
||||
(*context.0).Flush();
|
||||
drop(source);
|
||||
for count in 1..=100 {
|
||||
let pts = count * 100;
|
||||
let frame =
|
||||
encoder.encode_to_message(EncodeInput::Repeat, pts).unwrap();
|
||||
check_picture(&mut decoder, frame, width, height, false, pts);
|
||||
}
|
||||
|
||||
let source = texture(device.0, width, height, 224);
|
||||
let frame = encoder
|
||||
.encode_to_message(EncodeInput::Texture((source.0 as _, 0)), 10100)
|
||||
.unwrap();
|
||||
check_picture(&mut decoder, frame, width, height, true, 10100);
|
||||
drop(source);
|
||||
encoder.encoder.set_bitrate(1500).unwrap();
|
||||
let frame = encoder
|
||||
.encode_to_message(EncodeInput::Repeat, 10200)
|
||||
.unwrap();
|
||||
check_picture(&mut decoder, frame, width, height, true, 10200);
|
||||
eprintln!(
|
||||
"PASS {:?} {:?} {:?} {width}x{height} adapter={luid:#x}",
|
||||
vendor, driver, format
|
||||
);
|
||||
tested += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
assert!(tested > 0, "no hardware encoders were tested");
|
||||
eprintln!("Validated {tested} encoder/codec/resolution combinations");
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,12 @@ use super::{Display, Rect, Server};
|
||||
|
||||
pub struct DisplayIter {
|
||||
outer: xcb_screen_iterator_t,
|
||||
inner: Option<(xcb_randr_monitor_info_iterator_t, xcb_window_t)>,
|
||||
// The monitor iterator points into the reply, so the reply is freed only when moving on.
|
||||
inner: Option<(
|
||||
xcb_randr_monitor_info_iterator_t,
|
||||
xcb_window_t,
|
||||
*mut xcb_randr_get_monitors_reply_t,
|
||||
)>,
|
||||
server: Rc<Server>,
|
||||
}
|
||||
|
||||
@@ -30,7 +35,11 @@ impl DisplayIter {
|
||||
fn next_screen(
|
||||
outer: &mut xcb_screen_iterator_t,
|
||||
server: &Server,
|
||||
) -> Option<(xcb_randr_monitor_info_iterator_t, xcb_window_t)> {
|
||||
) -> Option<(
|
||||
xcb_randr_monitor_info_iterator_t,
|
||||
xcb_window_t,
|
||||
*mut xcb_randr_get_monitors_reply_t,
|
||||
)> {
|
||||
if outer.rem == 0 {
|
||||
return None;
|
||||
}
|
||||
@@ -48,10 +57,17 @@ impl DisplayIter {
|
||||
|
||||
let inner = xcb_randr_get_monitors_monitors_iterator(response);
|
||||
|
||||
libc::free(response as *mut _);
|
||||
xcb_screen_next(outer);
|
||||
|
||||
Some((inner, root))
|
||||
Some((inner, root, response))
|
||||
}
|
||||
}
|
||||
|
||||
fn free_reply(&mut self) {
|
||||
if let Some((_, _, response)) = self.inner.take() {
|
||||
unsafe {
|
||||
libc::free(response as *mut _);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,7 +77,7 @@ impl Iterator for DisplayIter {
|
||||
|
||||
fn next(&mut self) -> Option<Display> {
|
||||
loop {
|
||||
if let Some((ref mut inner, root)) = self.inner {
|
||||
if let Some((ref mut inner, root, _)) = self.inner {
|
||||
// If there is something in the current screen, return that.
|
||||
if inner.rem != 0 {
|
||||
unsafe {
|
||||
@@ -92,11 +108,18 @@ impl Iterator for DisplayIter {
|
||||
}
|
||||
|
||||
// The current screen was empty, so try the next screen.
|
||||
self.free_reply();
|
||||
self.inner = Self::next_screen(&mut self.outer, &self.server);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for DisplayIter {
|
||||
fn drop(&mut self) {
|
||||
self.free_reply();
|
||||
}
|
||||
}
|
||||
|
||||
fn get_atom_name(conn: *mut xcb_connection_t, atom: xcb_atom_t) -> String {
|
||||
let empty = "".to_owned();
|
||||
if atom == 0 {
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
|
||||
--- a/libavcodec/qsvenc.c
|
||||
+++ b/libavcodec/qsvenc.c
|
||||
@@ -43,6 +43,9 @@
|
||||
#include "qsv_internal.h"
|
||||
#include "qsvenc.h"
|
||||
#include "refstruct.h"
|
||||
+
|
||||
+#define QSV_MAX_ENCODE_RETRIES 100
|
||||
+#define QSV_SYNC_TIMEOUT_US 2000000
|
||||
|
||||
struct profile_names {
|
||||
mfxU16 profile;
|
||||
@@ -2468,6 +2471,7 @@
|
||||
QSVFrame *qsv_frame = NULL;
|
||||
mfxEncodeCtrl* enc_ctrl = NULL;
|
||||
int ret;
|
||||
+ int retries = 0;
|
||||
|
||||
if (frame) {
|
||||
ret = submit_frame(q, frame, &qsv_frame);
|
||||
@@ -2538,6 +2542,18 @@
|
||||
|
||||
do {
|
||||
ret = MFXVideoENCODE_EncodeFrameAsync(q->session, enc_ctrl, surf, pkt.bs, pkt.sync);
|
||||
+ if ((ret == MFX_WRN_DEVICE_BUSY || ret == MFX_WRN_IN_EXECUTION) &&
|
||||
+ retries++ >= QSV_MAX_ENCODE_RETRIES) {
|
||||
+ av_log(avctx, AV_LOG_ERROR, "QSV encoder submission retry limit exceeded\n");
|
||||
+ ret = AVERROR_EXTERNAL;
|
||||
+ goto free;
|
||||
+ }
|
||||
+#ifdef _WIN32
|
||||
+ // Sub-millisecond waits become Sleep(0) on Windows.
|
||||
+ if (ret == MFX_WRN_DEVICE_BUSY || ret == MFX_WRN_IN_EXECUTION)
|
||||
+ av_usleep(1000);
|
||||
+#else
|
||||
if (ret == MFX_WRN_DEVICE_BUSY)
|
||||
av_usleep(500);
|
||||
+#endif
|
||||
} while (ret == MFX_WRN_DEVICE_BUSY || ret == MFX_WRN_IN_EXECUTION);
|
||||
@@ -2656,12 +2672,23 @@
|
||||
mfxExtAVCEncodedFrameInfo *enc_info;
|
||||
mfxExtBuffer **enc_buf;
|
||||
enum AVPictureType pict_type;
|
||||
-
|
||||
- av_fifo_read(q->async_fifo, &qpkt, 1);
|
||||
+ int64_t sync_deadline = av_gettime_relative() + QSV_SYNC_TIMEOUT_US;
|
||||
+
|
||||
+ // The SDK may still use these buffers after a synchronization timeout.
|
||||
+ av_fifo_peek(q->async_fifo, &qpkt, 1, 0);
|
||||
|
||||
do {
|
||||
- ret = MFXVideoCORE_SyncOperation(q->session, *qpkt.sync, 1000);
|
||||
+ int64_t remaining = sync_deadline - av_gettime_relative();
|
||||
+ if (remaining <= 0) {
|
||||
+ av_log(avctx, AV_LOG_ERROR, "QSV encoder synchronization timed out\n");
|
||||
+ return AVERROR_EXTERNAL;
|
||||
+ }
|
||||
+ ret = MFXVideoCORE_SyncOperation(q->session, *qpkt.sync,
|
||||
+ FFMIN(1000, (remaining + 999) / 1000));
|
||||
+ if (ret == MFX_WRN_IN_EXECUTION)
|
||||
+ av_usleep(1000);
|
||||
} while (ret == MFX_WRN_IN_EXECUTION);
|
||||
+ av_fifo_drain2(q->async_fifo, 1);
|
||||
|
||||
qpkt.pkt.dts = av_rescale_q(qpkt.bs->DecodeTimeStamp, (AVRational){1, 90000}, avctx->time_base);
|
||||
qpkt.pkt.pts = av_rescale_q(qpkt.bs->TimeStamp, (AVRational){1, 90000}, avctx->time_base);
|
||||
@@ -0,0 +1,64 @@
|
||||
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
|
||||
--- a/libavcodec/qsvenc.c
|
||||
+++ b/libavcodec/qsvenc.c
|
||||
@@ -1419,6 +1419,18 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int qsv_update_packet_size(QSVEncContext *q, const mfxInfoMFX *mfx)
|
||||
+{
|
||||
+ // Intel documents a larger buffer for complex CQP frames.
|
||||
+ // https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk_release_notes.md
|
||||
+ int64_t packet_size = (int64_t)mfx->BufferSizeInKB * mfx->BRCParamMultiplier * 1000 * 4;
|
||||
+
|
||||
+ if (packet_size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
|
||||
+ return AVERROR(ENOMEM);
|
||||
+ q->packet_size = FFMAX(q->packet_size, packet_size);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int qsv_retrieve_enc_params(AVCodecContext *avctx, QSVEncContext *q)
|
||||
{
|
||||
AVCPBProperties *cpb_props;
|
||||
@@ -1508,7 +1520,13 @@
|
||||
return ff_qsv_print_error(avctx, ret,
|
||||
"Error calling GetVideoParam");
|
||||
|
||||
- q->packet_size = q->param.mfx.BufferSizeInKB * q->param.mfx.BRCParamMultiplier * 1000;
|
||||
+ if (avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_HEVC) {
|
||||
+ ret = qsv_update_packet_size(q, &q->param.mfx);
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
+ } else {
|
||||
+ q->packet_size = q->param.mfx.BufferSizeInKB * q->param.mfx.BRCParamMultiplier * 1000;
|
||||
+ }
|
||||
|
||||
if (!extradata.SPSBufSize || (need_pps && !extradata.PPSBufSize)
|
||||
|| (q->hevc_vps && !extradata_vps.VPSBufSize)
|
||||
@@ -2650,6 +2668,17 @@
|
||||
if (ret < 0)
|
||||
return ff_qsv_print_error(avctx, ret, "Error during resetting");
|
||||
|
||||
+ if (avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_HEVC) {
|
||||
+ mfxVideoParam param = { 0 };
|
||||
+
|
||||
+ ret = MFXVideoENCODE_GetVideoParam(q->session, ¶m);
|
||||
+ if (ret < 0)
|
||||
+ return ff_qsv_print_error(avctx, ret, "Error querying parameters after reset");
|
||||
+ ret = qsv_update_packet_size(q, ¶m.mfx);
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2688,6 +2717,8 @@
|
||||
if (ret == MFX_WRN_IN_EXECUTION)
|
||||
av_usleep(1000);
|
||||
} while (ret == MFX_WRN_IN_EXECUTION);
|
||||
+ if (ret < 0)
|
||||
+ return ff_qsv_print_error(avctx, ret, "Error synchronizing encoded frame");
|
||||
av_fifo_drain2(q->async_fifo, 1);
|
||||
|
||||
qpkt.pkt.dts = av_rescale_q(qpkt.bs->DecodeTimeStamp, (AVRational){1, 90000}, avctx->time_base);
|
||||
@@ -0,0 +1,89 @@
|
||||
From: Martin Storsjö
|
||||
Subject: movenc: Make the hybrid_fragmented mode more robust
|
||||
Source: https://github.com/FFmpeg/FFmpeg/commit/36896af64a9ecf6835758186e7161a2e954c364d
|
||||
|
||||
movenc: Make the hybrid_fragmented mode more robust
|
||||
|
||||
Write the moov tag at the end first, before overwriting the mdat size
|
||||
at the start of the file.
|
||||
|
||||
In case writing the final moov box fails (e.g. due to being out
|
||||
of disk), we haven't broken the initial moov box yet.
|
||||
|
||||
Thus if writing stops between these steps, we could end up with
|
||||
a file with two moov boxes - which arguably is more feasible to
|
||||
recover from, than from a file with no moov boxes at all.
|
||||
|
||||
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
|
||||
--- a/libavformat/movenc.c
|
||||
+++ b/libavformat/movenc.c
|
||||
@@ -8546,6 +8546,28 @@ static int shift_data(AVFormatContext *s)
|
||||
return ff_format_shift_data(s, mov->reserved_header_pos, moov_size);
|
||||
}
|
||||
|
||||
+static void mov_write_mdat_size(AVFormatContext *s)
|
||||
+{
|
||||
+ MOVMuxContext *mov = s->priv_data;
|
||||
+ AVIOContext *pb = s->pb;
|
||||
+
|
||||
+ /* Write size of mdat tag */
|
||||
+ if (mov->mdat_size + 8 <= UINT32_MAX) {
|
||||
+ avio_seek(pb, mov->mdat_pos, SEEK_SET);
|
||||
+ avio_wb32(pb, mov->mdat_size + 8);
|
||||
+ if (mov->flags & FF_MOV_FLAG_HYBRID_FRAGMENTED)
|
||||
+ ffio_wfourcc(pb, "mdat"); // overwrite the original moov into a mdat
|
||||
+ } else {
|
||||
+ /* overwrite 'wide' placeholder atom */
|
||||
+ avio_seek(pb, mov->mdat_pos - 8, SEEK_SET);
|
||||
+ /* special value: real atom size will be 64 bit value after
|
||||
+ * tag field */
|
||||
+ avio_wb32(pb, 1);
|
||||
+ ffio_wfourcc(pb, "mdat");
|
||||
+ avio_wb64(pb, mov->mdat_size + 16);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static int mov_write_trailer(AVFormatContext *s)
|
||||
{
|
||||
MOVMuxContext *mov = s->priv_data;
|
||||
@@ -8605,21 +8627,9 @@ static int mov_write_trailer(AVFormatContext *s)
|
||||
|
||||
moov_pos = avio_tell(pb);
|
||||
|
||||
- /* Write size of mdat tag */
|
||||
- if (mov->mdat_size + 8 <= UINT32_MAX) {
|
||||
- avio_seek(pb, mov->mdat_pos, SEEK_SET);
|
||||
- avio_wb32(pb, mov->mdat_size + 8);
|
||||
- if (mov->flags & FF_MOV_FLAG_HYBRID_FRAGMENTED)
|
||||
- ffio_wfourcc(pb, "mdat"); // overwrite the original moov into a mdat
|
||||
- } else {
|
||||
- /* overwrite 'wide' placeholder atom */
|
||||
- avio_seek(pb, mov->mdat_pos - 8, SEEK_SET);
|
||||
- /* special value: real atom size will be 64 bit value after
|
||||
- * tag field */
|
||||
- avio_wb32(pb, 1);
|
||||
- ffio_wfourcc(pb, "mdat");
|
||||
- avio_wb64(pb, mov->mdat_size + 16);
|
||||
- }
|
||||
+ if (!(mov->flags & FF_MOV_FLAG_HYBRID_FRAGMENTED))
|
||||
+ mov_write_mdat_size(s);
|
||||
+
|
||||
avio_seek(pb, mov->reserved_moov_size > 0 ? mov->reserved_header_pos : moov_pos, SEEK_SET);
|
||||
|
||||
if (mov->flags & FF_MOV_FLAG_FASTSTART) {
|
||||
@@ -8647,6 +8657,15 @@ static int mov_write_trailer(AVFormatContext *s)
|
||||
if ((res = mov_write_moov_tag(pb, mov, s)) < 0)
|
||||
return res;
|
||||
}
|
||||
+
|
||||
+ if (mov->flags & FF_MOV_FLAG_HYBRID_FRAGMENTED) {
|
||||
+ // With hybrid fragmentation, only write the mdat size (hiding
|
||||
+ // the original moov and all the fragments within the mdat)
|
||||
+ // after we've successfully written the complete moov, to avoid
|
||||
+ // risk for an unreadable file if writing the final moov fails.
|
||||
+ mov_write_mdat_size(s);
|
||||
+ }
|
||||
+
|
||||
res = 0;
|
||||
} else {
|
||||
mov_auto_flush_fragment(s, 1);
|
||||
@@ -30,6 +30,9 @@ vcpkg_from_github(
|
||||
patch/0010.disable-loading-DLLs-from-app-dir.patch
|
||||
patch/0011-android-mediacodec-encode-align-64.patch
|
||||
patch/0012-fix-macos-big-sur-CVBufferCopyAttachments.patch
|
||||
patch/0013-fix-qsv-encode-timeouts.patch
|
||||
patch/0014-fix-qsv-encode-buffer.patch
|
||||
patch/0015-fix-hybrid-mp4-finalization.patch
|
||||
)
|
||||
|
||||
if(SOURCE_PATH MATCHES " ")
|
||||
|
||||
+4
-4
@@ -93,10 +93,10 @@ pub fn verify2fa(code: String) -> bool {
|
||||
if let Ok(res) = totp.check_current(&code) {
|
||||
if res {
|
||||
if let Ok(v) = info.into_string() {
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
crate::ipc::set_option("2fa", &v);
|
||||
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||
Config::set_option("2fa".to_owned(), v);
|
||||
if let Err(error) = crate::ui_interface::set_auth_option("2fa".to_owned(), v) {
|
||||
hbb_common::log::error!("2FA configuration update rejected: {error}");
|
||||
return false;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
+41
-7
@@ -2872,7 +2872,6 @@ pub struct LoginConfigHandler {
|
||||
pub save_ab_password_to_recent: bool, // true: connected with ab password
|
||||
pub other_server: Option<(String, String, String)>,
|
||||
pub custom_fps: Arc<Mutex<Option<usize>>>,
|
||||
pub last_auto_fps: Option<usize>,
|
||||
pub adapter_luid: Option<i64>,
|
||||
pub mark_unsupported: Vec<CodecFormat>,
|
||||
pub selected_windows_session_id: Option<u32>,
|
||||
@@ -4638,6 +4637,7 @@ pub async fn handle_hash(
|
||||
password_preset: &str,
|
||||
hash: Hash,
|
||||
interface: &impl Interface,
|
||||
trust: &mut crate::trusted_devices::client::Session,
|
||||
peer: &mut Stream,
|
||||
) -> bool {
|
||||
lc.write().unwrap().hash = hash.clone();
|
||||
@@ -4756,7 +4756,19 @@ pub async fn handle_hash(
|
||||
hasher.finalize()[..].into()
|
||||
};
|
||||
|
||||
send_login(lc.clone(), String::new(), String::new(), password, peer).await;
|
||||
if let Err(error) = send_login(
|
||||
lc.clone(),
|
||||
String::new(),
|
||||
String::new(),
|
||||
password,
|
||||
trust,
|
||||
peer,
|
||||
)
|
||||
.await
|
||||
{
|
||||
interface.on_error(&error.to_string());
|
||||
return false;
|
||||
}
|
||||
lc.write().unwrap().hash = hash;
|
||||
true
|
||||
}
|
||||
@@ -4800,13 +4812,15 @@ async fn send_login(
|
||||
os_username: String,
|
||||
os_password: String,
|
||||
password: Vec<u8>,
|
||||
trust: &mut crate::trusted_devices::client::Session,
|
||||
peer: &mut Stream,
|
||||
) {
|
||||
) -> ResultType<()> {
|
||||
let msg_out = lc
|
||||
.read()
|
||||
.unwrap()
|
||||
.create_login_msg(os_username, os_password, password);
|
||||
allow_err!(peer.send(&msg_out).await);
|
||||
let msg_out = trust.login(msg_out).await?;
|
||||
peer.send(&msg_out).await
|
||||
}
|
||||
|
||||
/// Handle login request made from ui.
|
||||
@@ -4825,8 +4839,9 @@ pub async fn handle_login_from_ui(
|
||||
os_password: String,
|
||||
password: String,
|
||||
remember: bool,
|
||||
trust: &mut crate::trusted_devices::client::Session,
|
||||
peer: &mut Stream,
|
||||
) {
|
||||
) -> ResultType<()> {
|
||||
let mut hash_password = if password.is_empty() {
|
||||
let mut password2 = lc.read().unwrap().password.clone();
|
||||
if password2.is_empty() {
|
||||
@@ -4851,7 +4866,15 @@ pub async fn handle_login_from_ui(
|
||||
hasher2.update(&lc.read().unwrap().hash.challenge);
|
||||
hash_password = hasher2.finalize()[..].to_vec();
|
||||
|
||||
send_login(lc.clone(), os_username, os_password, hash_password, peer).await;
|
||||
send_login(
|
||||
lc.clone(),
|
||||
os_username,
|
||||
os_password,
|
||||
hash_password,
|
||||
trust,
|
||||
peer,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
async fn send_switch_login_request(
|
||||
@@ -4886,13 +4909,20 @@ pub trait Interface: Send + Clone + 'static + Sized {
|
||||
fn on_error(&self, err: &str) {
|
||||
self.msgbox("error", "Error", err, "");
|
||||
}
|
||||
async fn handle_hash(&self, pass: &str, hash: Hash, peer: &mut Stream) -> bool;
|
||||
async fn handle_hash(
|
||||
&self,
|
||||
pass: &str,
|
||||
hash: Hash,
|
||||
trust: &mut crate::trusted_devices::client::Session,
|
||||
peer: &mut Stream,
|
||||
) -> bool;
|
||||
async fn handle_login_from_ui(
|
||||
&self,
|
||||
os_username: String,
|
||||
os_password: String,
|
||||
password: String,
|
||||
remember: bool,
|
||||
trust: &mut crate::trusted_devices::client::Session,
|
||||
peer: &mut Stream,
|
||||
);
|
||||
async fn handle_test_delay(&self, t: TestDelay, peer: &mut Stream);
|
||||
@@ -5737,6 +5767,10 @@ mod webrtc_race_tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "client/tests/trusted_devices_tests.rs"]
|
||||
mod trusted_devices_tests;
|
||||
|
||||
#[cfg(test)]
|
||||
mod kx_tests {
|
||||
use super::*;
|
||||
|
||||
+304
-32
@@ -98,10 +98,12 @@ pub struct Remote<T: InvokeUiSession> {
|
||||
elevation_requested: bool,
|
||||
peer_info: ParsedPeerInfo,
|
||||
video_threads: HashMap<usize, VideoThread>,
|
||||
last_auto_fps: Option<usize>,
|
||||
chroma: Arc<RwLock<Option<Chroma>>>,
|
||||
last_record_state: bool,
|
||||
sent_close_reason: bool,
|
||||
cursor_dedupe: CursorDedupe,
|
||||
trusted_device: crate::trusted_devices::client::Session,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
@@ -150,10 +152,12 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
elevation_requested: false,
|
||||
peer_info: Default::default(),
|
||||
video_threads: Default::default(),
|
||||
last_auto_fps: None,
|
||||
chroma: Default::default(),
|
||||
last_record_state: false,
|
||||
sent_close_reason: false,
|
||||
cursor_dedupe: Default::default(),
|
||||
trusted_device: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,6 +211,22 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
.unwrap()
|
||||
.set_connected();
|
||||
let is_secured = peer.is_secured();
|
||||
let trust = crate::trusted_devices::client::Session::new(
|
||||
&self.handler.lc.read().unwrap(),
|
||||
is_secured,
|
||||
pk.as_deref(),
|
||||
);
|
||||
match trust {
|
||||
Ok(trust) => {
|
||||
self.trusted_device = trust;
|
||||
self.handler.lc.write().unwrap().enable_trusted_devices = false;
|
||||
}
|
||||
Err(error) => {
|
||||
self.handler.on_error(&error.to_string());
|
||||
self.handle_disconnected(round);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Only WebRTC needs refining: its label names the transport that won the race,
|
||||
// not the family ICE ended up nominating, and it is the one path where the two
|
||||
// can disagree with the address the rendezvous observed.
|
||||
@@ -382,7 +402,7 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
self.video_threads.iter().for_each(|(_, v)| {
|
||||
*v.frame_count.write().unwrap() = 0;
|
||||
});
|
||||
self.fps_control(direct, fps.clone());
|
||||
self.fps_control(direct, fps.clone(), &mut peer).await;
|
||||
let chroma = self.chroma.read().unwrap().clone();
|
||||
let chroma = match chroma {
|
||||
Some(Chroma::I444) => "4:4:4",
|
||||
@@ -428,6 +448,19 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
}
|
||||
}
|
||||
self.handle_disconnected(round);
|
||||
#[cfg(target_os = "android")]
|
||||
for job in &mut self.write_jobs {
|
||||
if let Err(error) = job.cancel_document().await {
|
||||
const CLEANUP_ERROR_LOG_INTERVAL: Duration = Duration::from_secs(60);
|
||||
hbb_common::throttled_log!(
|
||||
CLEANUP_ERROR_LOG_INTERVAL,
|
||||
warn,
|
||||
"Failed to clean up document transfer {} on disconnect: {}",
|
||||
job.id(),
|
||||
error
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_disconnected(&self, round: u32) {
|
||||
@@ -729,7 +762,14 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
}
|
||||
Data::Login((os_username, os_password, password, remember)) => {
|
||||
self.handler
|
||||
.handle_login_from_ui(os_username, os_password, password, remember, peer)
|
||||
.handle_login_from_ui(
|
||||
os_username,
|
||||
os_password,
|
||||
password,
|
||||
remember,
|
||||
&mut self.trusted_device,
|
||||
peer,
|
||||
)
|
||||
.await;
|
||||
}
|
||||
#[cfg(all(target_os = "windows", not(feature = "flutter")))]
|
||||
@@ -758,6 +798,7 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
}
|
||||
}
|
||||
Data::Message(msg) => {
|
||||
let msg = self.trusted_device.outgoing(msg);
|
||||
// The Flutter clipboard broadcast is process-wide, so a clipboard can reach this
|
||||
// round's queue before the round has logged in; it is dropped here, on the round
|
||||
// itself.
|
||||
@@ -787,6 +828,11 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
self.initial_clipboard_pending = false;
|
||||
}
|
||||
Some(message::Union::Misc(misc)) => match misc.union {
|
||||
Some(misc::Union::Option(ref option)) => {
|
||||
if option.custom_fps > 0 {
|
||||
self.last_auto_fps = None;
|
||||
}
|
||||
}
|
||||
Some(misc::Union::RefreshVideo(_)) => {
|
||||
self.video_threads.iter().for_each(|(_, v)| {
|
||||
*v.discard_queue.write().unwrap() = true;
|
||||
@@ -809,7 +855,16 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
if is_remote {
|
||||
log::debug!("New job {}, write to {} from remote {}", id, to, path);
|
||||
let to = match r#type {
|
||||
fs::JobType::Generic => fs::DataSource::FilePath(PathBuf::from(&to)),
|
||||
fs::JobType::Generic => {
|
||||
if let Err(err) = fs::download::validate_download_name(
|
||||
&path,
|
||||
self.handler.peer_platform() == "Windows",
|
||||
) {
|
||||
self.handle_job_status(id, -1, Some(err.to_string()));
|
||||
return true;
|
||||
}
|
||||
fs::DataSource::FilePath(PathBuf::from(&to))
|
||||
}
|
||||
fs::JobType::Printer => {
|
||||
fs::DataSource::MemoryCursor(std::io::Cursor::new(Vec::new()))
|
||||
}
|
||||
@@ -829,7 +884,33 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
.await
|
||||
);
|
||||
} else {
|
||||
match fs::TransferJob::new_read(
|
||||
#[cfg(target_os = "android")]
|
||||
let result = {
|
||||
let source = fs::DataSource::FilePath(PathBuf::from(&path));
|
||||
let destination = to.clone();
|
||||
let read = move || {
|
||||
fs::TransferJob::new_read(
|
||||
id,
|
||||
r#type,
|
||||
destination,
|
||||
source,
|
||||
file_num,
|
||||
include_hidden,
|
||||
is_remote,
|
||||
od,
|
||||
)
|
||||
};
|
||||
if fs::android::is_path(path.as_ref()) {
|
||||
tokio::task::spawn_blocking(read)
|
||||
.await
|
||||
.map_err(hbb_common::anyhow::Error::from)
|
||||
.and_then(|result| result)
|
||||
} else {
|
||||
read()
|
||||
}
|
||||
};
|
||||
#[cfg(not(target_os = "android"))]
|
||||
let result = fs::TransferJob::new_read(
|
||||
id,
|
||||
r#type,
|
||||
to.clone(),
|
||||
@@ -838,7 +919,8 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
include_hidden,
|
||||
is_remote,
|
||||
od,
|
||||
) {
|
||||
);
|
||||
match result {
|
||||
Err(err) => {
|
||||
self.handle_job_status(id, -1, Some(err.to_string()));
|
||||
}
|
||||
@@ -899,7 +981,33 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
job.is_last_job = true;
|
||||
self.write_jobs.push(job);
|
||||
} else {
|
||||
match fs::TransferJob::new_read(
|
||||
#[cfg(target_os = "android")]
|
||||
let result = {
|
||||
let source = fs::DataSource::FilePath(PathBuf::from(&path));
|
||||
let destination = to.clone();
|
||||
let read = move || {
|
||||
fs::TransferJob::new_read(
|
||||
id,
|
||||
r#type,
|
||||
destination,
|
||||
source,
|
||||
file_num,
|
||||
include_hidden,
|
||||
is_remote,
|
||||
od,
|
||||
)
|
||||
};
|
||||
if fs::android::is_path(path.as_ref()) {
|
||||
tokio::task::spawn_blocking(read)
|
||||
.await
|
||||
.map_err(hbb_common::anyhow::Error::from)
|
||||
.and_then(|result| result)
|
||||
} else {
|
||||
read()
|
||||
}
|
||||
};
|
||||
#[cfg(not(target_os = "android"))]
|
||||
let result = fs::TransferJob::new_read(
|
||||
id,
|
||||
r#type,
|
||||
to.clone(),
|
||||
@@ -908,7 +1016,8 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
include_hidden,
|
||||
is_remote,
|
||||
od,
|
||||
) {
|
||||
);
|
||||
match result {
|
||||
Err(err) => {
|
||||
self.handle_job_status(id, -1, Some(err.to_string()));
|
||||
}
|
||||
@@ -1060,7 +1169,21 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
self.remove_jobs
|
||||
.insert(id, RemoveJob::new(Vec::new(), path, sep, is_remote));
|
||||
} else {
|
||||
match fs::get_recursive_files(&path, include_hidden) {
|
||||
#[cfg(target_os = "android")]
|
||||
let result = if fs::android::is_path(path.as_ref()) {
|
||||
let path = path.clone();
|
||||
tokio::task::spawn_blocking(move || {
|
||||
fs::get_recursive_files(&path, include_hidden)
|
||||
})
|
||||
.await
|
||||
.map_err(hbb_common::anyhow::Error::from)
|
||||
.and_then(|result| result)
|
||||
} else {
|
||||
fs::get_recursive_files(&path, include_hidden)
|
||||
};
|
||||
#[cfg(not(target_os = "android"))]
|
||||
let result = fs::get_recursive_files(&path, include_hidden);
|
||||
match result {
|
||||
Ok(entries) => {
|
||||
self.handler.update_folder_files(
|
||||
id,
|
||||
@@ -1106,7 +1229,18 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
msg_out.set_file_action(file_action);
|
||||
allow_err!(peer.send(&msg_out).await);
|
||||
} else {
|
||||
match fs::remove_file(&path) {
|
||||
#[cfg(target_os = "android")]
|
||||
let result = if fs::android::is_path(path.as_ref()) {
|
||||
tokio::task::spawn_blocking(move || fs::remove_file(&path))
|
||||
.await
|
||||
.map_err(hbb_common::anyhow::Error::from)
|
||||
.and_then(|result| result)
|
||||
} else {
|
||||
fs::remove_file(&path)
|
||||
};
|
||||
#[cfg(not(target_os = "android"))]
|
||||
let result = fs::remove_file(&path);
|
||||
match result {
|
||||
Err(err) => {
|
||||
self.handle_job_status(id, file_num, Some(err.to_string()));
|
||||
}
|
||||
@@ -1128,7 +1262,18 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
msg_out.set_file_action(file_action);
|
||||
allow_err!(peer.send(&msg_out).await);
|
||||
} else {
|
||||
match fs::create_dir(&path) {
|
||||
#[cfg(target_os = "android")]
|
||||
let result = if fs::android::is_path(path.as_ref()) {
|
||||
tokio::task::spawn_blocking(move || fs::create_dir(&path))
|
||||
.await
|
||||
.map_err(hbb_common::anyhow::Error::from)
|
||||
.and_then(|result| result)
|
||||
} else {
|
||||
fs::create_dir(&path)
|
||||
};
|
||||
#[cfg(not(target_os = "android"))]
|
||||
let result = fs::create_dir(&path);
|
||||
match result {
|
||||
Err(err) => {
|
||||
self.handle_job_status(id, -1, Some(err.to_string()));
|
||||
}
|
||||
@@ -1151,6 +1296,18 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
msg_out.set_file_action(file_action);
|
||||
allow_err!(peer.send(&msg_out).await);
|
||||
} else {
|
||||
#[cfg(target_os = "android")]
|
||||
let err = if fs::android::is_path(path.as_ref()) {
|
||||
tokio::task::spawn_blocking(move || fs::rename_file(&path, &new_name))
|
||||
.await
|
||||
.map_err(hbb_common::anyhow::Error::from)
|
||||
.and_then(|result| result)
|
||||
} else {
|
||||
fs::rename_file(&path, &new_name)
|
||||
}
|
||||
.err()
|
||||
.map(|e| e.to_string());
|
||||
#[cfg(not(target_os = "android"))]
|
||||
let err = fs::rename_file(&path, &new_name)
|
||||
.err()
|
||||
.map(|e| e.to_string());
|
||||
@@ -1285,6 +1442,12 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
msg_out.set_file_action(file_action);
|
||||
allow_err!(peer.send(&msg_out).await);
|
||||
if let Some(job) = fs::remove_job(id, &mut self.write_jobs) {
|
||||
#[cfg(target_os = "android")]
|
||||
let mut job = job;
|
||||
#[cfg(target_os = "android")]
|
||||
if let Err(error) = job.cancel_document().await {
|
||||
self.handle_job_status(id, job.file_num(), Some(error.to_string()));
|
||||
}
|
||||
job.remove_download_file();
|
||||
}
|
||||
let _ = fs::remove_job(id, &mut self.read_jobs);
|
||||
@@ -1377,7 +1540,12 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
// Currently, this function only considers decoding speed and queue length, not network delay.
|
||||
// The controlled end can consider auto fps as the maximum decoding fps.
|
||||
#[inline]
|
||||
fn fps_control(&mut self, direct: bool, real_fps_map: HashMap<usize, i32>) {
|
||||
async fn fps_control(
|
||||
&mut self,
|
||||
direct: bool,
|
||||
real_fps_map: HashMap<usize, i32>,
|
||||
peer: &mut Stream,
|
||||
) {
|
||||
self.video_threads.iter_mut().for_each(|(k, v)| {
|
||||
let real_fps = real_fps_map.get(k).cloned().unwrap_or_default();
|
||||
if real_fps == 0 {
|
||||
@@ -1417,7 +1585,7 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
if limited_fps > custom_fps {
|
||||
limited_fps = custom_fps;
|
||||
}
|
||||
let last_auto_fps = self.handler.lc.read().unwrap().last_auto_fps.clone();
|
||||
let last_auto_fps = self.last_auto_fps;
|
||||
let displays = self.video_threads.keys().cloned().collect::<Vec<_>>();
|
||||
let mut fps_trending = |display: usize| {
|
||||
let thread = self.video_threads.get_mut(&display)?;
|
||||
@@ -1463,9 +1631,10 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
});
|
||||
let mut msg = Message::new();
|
||||
msg.set_misc(misc);
|
||||
self.sender.send(Data::Message(msg)).ok();
|
||||
// Send inline so a queued manual FPS update is applied after this decision.
|
||||
allow_err!(peer.send(&msg).await);
|
||||
log::info!("Set fps to {}", auto_fps);
|
||||
self.handler.lc.write().unwrap().last_auto_fps = Some(auto_fps);
|
||||
self.last_auto_fps = Some(auto_fps);
|
||||
}
|
||||
}
|
||||
// send refresh
|
||||
@@ -1562,18 +1731,24 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
Some(message::Union::Hash(hash)) => {
|
||||
if !self
|
||||
.handler
|
||||
.handle_hash(&self.handler.password.clone(), hash, peer)
|
||||
.handle_hash(
|
||||
&self.handler.password.clone(),
|
||||
hash,
|
||||
&mut self.trusted_device,
|
||||
peer,
|
||||
)
|
||||
.await
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Some(message::Union::LoginResponse(lr)) => match lr.union {
|
||||
Some(message::Union::LoginResponse(lr)) => match self
|
||||
.trusted_device
|
||||
.respond(lr, &self.handler)
|
||||
.await
|
||||
.union
|
||||
{
|
||||
Some(login_response::Union::Error(err)) => {
|
||||
if err == client::REQUIRE_2FA {
|
||||
self.handler.lc.write().unwrap().enable_trusted_devices =
|
||||
lr.enable_trusted_devices;
|
||||
}
|
||||
if !self.handler.handle_login_error(&err) {
|
||||
return false;
|
||||
}
|
||||
@@ -1782,6 +1957,15 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
fs::transform_windows_path(&mut entries);
|
||||
}
|
||||
}
|
||||
if fd.id <= 0 {
|
||||
if let Err(err) = fs::download::validate_listing(
|
||||
&entries,
|
||||
self.handler.peer_platform() == "Windows",
|
||||
) {
|
||||
self.handle_job_status(fd.id, -1, Some(err.to_string()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// We cannot call cancel_transfer_job/handle_job_status while holding
|
||||
// a mutable borrow from fs::get_job(&mut self.write_jobs), so defer
|
||||
// the error handling until after the borrow scope ends.
|
||||
@@ -1877,11 +2061,26 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
crate::is_support_file_transfer_resume_num(
|
||||
peer_ver,
|
||||
);
|
||||
match fs::is_write_need_confirmation(
|
||||
is_support_resume && job.is_resume,
|
||||
&write_path,
|
||||
&digest,
|
||||
) {
|
||||
#[cfg(target_os = "android")]
|
||||
let digest_result = if job.is_document() {
|
||||
let path = write_path.clone();
|
||||
let digest = digest.clone();
|
||||
let resume = is_support_resume && job.is_resume;
|
||||
tokio::task::spawn_blocking(move || {
|
||||
fs::is_write_need_confirmation(
|
||||
resume, &path, &digest,
|
||||
)
|
||||
})
|
||||
.await
|
||||
.map_err(hbb_common::anyhow::Error::from)
|
||||
.and_then(|result| result)
|
||||
} else {
|
||||
job.download_digest(is_support_resume, &digest)
|
||||
};
|
||||
#[cfg(not(target_os = "android"))]
|
||||
let digest_result =
|
||||
job.download_digest(is_support_resume, &digest);
|
||||
match digest_result {
|
||||
Ok(res) => match res {
|
||||
DigestCheckResult::IsSame => {
|
||||
let req = FileTransferSendConfirmRequest {
|
||||
@@ -1938,13 +2137,19 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
union: Some(file_transfer_send_confirm_request::Union::OffsetBlk(0)),
|
||||
..Default::default()
|
||||
};
|
||||
job.confirm(&req).await;
|
||||
// This did not approve replacing an existing local file.
|
||||
let msg = new_send_confirm(req);
|
||||
allow_err!(peer.send(&msg).await);
|
||||
}
|
||||
},
|
||||
Err(err) => {
|
||||
println!("error receiving digest: {}", err);
|
||||
self.cancel_transfer_job(digest.id, peer).await;
|
||||
self.handle_job_status(
|
||||
digest.id,
|
||||
-1,
|
||||
Some(err.to_string()),
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1953,22 +2158,36 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
}
|
||||
}
|
||||
Some(file_response::Union::Block(block)) => {
|
||||
let id = block.id;
|
||||
let mut write_error = None;
|
||||
if let Some(job) = fs::get_job(block.id, &mut self.write_jobs) {
|
||||
if let Err(_err) = job.write(block).await {
|
||||
// to-do: add "skip" for writing job
|
||||
}
|
||||
let result = job.write(block).await;
|
||||
if job.r#type == fs::JobType::Generic {
|
||||
write_error = result.err().map(|err| err.to_string());
|
||||
self.update_jobs_status();
|
||||
}
|
||||
}
|
||||
if let Some(err) = write_error {
|
||||
self.cancel_transfer_job(id, peer).await;
|
||||
self.handle_job_status(id, -1, Some(err));
|
||||
}
|
||||
}
|
||||
Some(file_response::Union::Done(d)) => {
|
||||
let mut err: Option<String> = None;
|
||||
let mut job_type = fs::JobType::Generic;
|
||||
let mut printer_data = None;
|
||||
if let Some(job) = fs::remove_job(d.id, &mut self.write_jobs) {
|
||||
job.modify_time();
|
||||
err = job.job_error();
|
||||
#[cfg(target_os = "android")]
|
||||
let mut job = job;
|
||||
err = job
|
||||
.finish_download()
|
||||
.err()
|
||||
.map(|err| err.to_string())
|
||||
.or_else(|| job.job_error());
|
||||
#[cfg(target_os = "android")]
|
||||
if let Err(error) = job.finish_document().await {
|
||||
err = Some(error.to_string());
|
||||
}
|
||||
job_type = job.r#type;
|
||||
printer_data = match job.get_buf_data().await {
|
||||
Ok(d) => d,
|
||||
@@ -2016,6 +2235,20 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
}
|
||||
}
|
||||
Some(file_response::Union::Error(e)) => {
|
||||
#[cfg(target_os = "android")]
|
||||
if let Some(job) = fs::get_job(e.id, &mut self.write_jobs) {
|
||||
if let Err(error) = job.cancel_document().await {
|
||||
const CLEANUP_ERROR_LOG_INTERVAL: Duration =
|
||||
Duration::from_secs(60);
|
||||
hbb_common::throttled_log!(
|
||||
CLEANUP_ERROR_LOG_INTERVAL,
|
||||
warn,
|
||||
"Failed to clean up document transfer {}: {}",
|
||||
e.id,
|
||||
error
|
||||
);
|
||||
}
|
||||
}
|
||||
let job_type = fs::remove_job(e.id, &mut self.write_jobs)
|
||||
.or_else(|| fs::remove_job(e.id, &mut self.read_jobs))
|
||||
.map(|j| j.r#type)
|
||||
@@ -2359,6 +2592,7 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
}
|
||||
|
||||
fn set_peer_info(&mut self, pi: &PeerInfo) {
|
||||
self.last_auto_fps = None;
|
||||
self.peer_info.platform = pi.platform.clone();
|
||||
|
||||
// Check features field for terminal support
|
||||
@@ -2991,6 +3225,44 @@ mod tests {
|
||||
"a clipboard after the login was held back"
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn manual_fps_update_allows_the_same_automatic_limit_again() {
|
||||
let (mut remote, mut peer, mut far) = remote_and_peer().await;
|
||||
let (video_sender, _video_receiver) = std::sync::mpsc::channel();
|
||||
remote.video_threads.insert(
|
||||
0,
|
||||
VideoThread {
|
||||
video_queue: Arc::new(RwLock::new(ArrayQueue::new(client::VIDEO_QUEUE_SIZE))),
|
||||
video_sender,
|
||||
decode_fps: Arc::new(RwLock::new(Some(23))),
|
||||
frame_count: Default::default(),
|
||||
discard_queue: Default::default(),
|
||||
fps_control: Default::default(),
|
||||
},
|
||||
);
|
||||
|
||||
for (manual_fps, expected) in [(None, 20), (Some(90), 90), (None, 20)] {
|
||||
if let Some(fps) = manual_fps {
|
||||
let lc = &remote.handler.lc;
|
||||
let msg = lc.write().unwrap().set_custom_fps(fps, false);
|
||||
remote
|
||||
.handle_msg_from_ui(Data::Message(msg), &mut peer)
|
||||
.await;
|
||||
} else {
|
||||
remote
|
||||
.fps_control(true, HashMap::from([(0, 20)]), &mut peer)
|
||||
.await;
|
||||
}
|
||||
let bytes = timeout(1000, far.next())
|
||||
.await
|
||||
.expect("FPS update was not sent")
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
let msg = Message::parse_from_bytes(&bytes).unwrap();
|
||||
assert_eq!(msg.misc().option().custom_fps, expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
use super::*;
|
||||
use hbb_common::tcp::FramedStream;
|
||||
|
||||
#[tokio::test]
|
||||
async fn existing_legacy_consent_is_preserved_across_upgrades() {
|
||||
crate::trusted_devices::tests::initialize_config();
|
||||
let mut login = LoginConfigHandler::default();
|
||||
login.id = uuid::Uuid::new_v4().to_string();
|
||||
login
|
||||
.config
|
||||
.options
|
||||
.insert("trust-this-device".into(), "Y".into());
|
||||
let request = login.create_login_msg(String::new(), String::new(), vec![1; 32]);
|
||||
let Some(message::Union::LoginRequest(request)) = request.union else {
|
||||
panic!("expected a login request");
|
||||
};
|
||||
assert!(
|
||||
request.hwid == crate::get_hwid(),
|
||||
"an existing legacy consent must remain usable with old hosts"
|
||||
);
|
||||
verified_channel_controls_tokens(&login).await;
|
||||
corrupt_credentials_do_not_block_password_login(&login).await;
|
||||
}
|
||||
|
||||
async fn corrupt_credentials_do_not_block_password_login(login: &LoginConfigHandler) {
|
||||
use crate::trusted_devices::client::Session;
|
||||
let path = Config::path(format!("peers/{}.toml", login.id));
|
||||
let saved = std::fs::read(&path).unwrap();
|
||||
std::fs::write(&path, b"invalid cached credential").unwrap();
|
||||
let mut trust = Session::new(login, true, Some(&[1; 32])).unwrap();
|
||||
let request = login.create_login_msg(String::new(), String::new(), vec![1; 32]);
|
||||
let outgoing = trust.login(request.clone()).await;
|
||||
let stored = std::fs::read(&path).unwrap();
|
||||
std::fs::write(&path, saved).unwrap();
|
||||
assert_eq!(outgoing.unwrap(), request);
|
||||
assert_eq!(stored, b"invalid cached credential");
|
||||
let mut response = LoginResponse::new();
|
||||
response.set_error(REQUIRE_2FA.into());
|
||||
response.trusted_device_v2_supported = true;
|
||||
assert!(!trust.response(&response).await.unwrap());
|
||||
let mut auth = Message::new();
|
||||
auth.set_auth_2fa(Auth2FA {
|
||||
trust_this_device: true,
|
||||
..Default::default()
|
||||
});
|
||||
assert!(!trust.outgoing(auth).auth_2fa().trust_this_device);
|
||||
}
|
||||
|
||||
async fn verified_channel_controls_tokens(login: &LoginConfigHandler) {
|
||||
use crate::trusted_devices::client::Session;
|
||||
let token = vec![9; crate::trusted_devices::TOKEN_BYTES];
|
||||
let mut trust = Session::new(login, true, Some(&[1; 32])).unwrap();
|
||||
let mut response = LoginResponse::new();
|
||||
response.set_error(REQUIRE_2FA.into());
|
||||
response.trusted_device_v2_supported = true;
|
||||
assert!(trust.response(&response).await.unwrap());
|
||||
let mut auth = Message::new();
|
||||
auth.set_auth_2fa(Auth2FA {
|
||||
trust_this_device: true,
|
||||
..Default::default()
|
||||
});
|
||||
assert!(trust.outgoing(auth).auth_2fa().trust_this_device);
|
||||
let mut success = LoginResponse::new();
|
||||
success.set_peer_info(PeerInfo {
|
||||
platform: "Windows".into(),
|
||||
..Default::default()
|
||||
});
|
||||
success.trusted_device_v2_token = token.clone().into();
|
||||
trust.response(&success).await.unwrap();
|
||||
assert_eq!(PeerConfig::peers(Some(vec![login.id.clone()])).len(), 1);
|
||||
another_connection_cannot_supply_this_streams_token(&mut trust).await;
|
||||
let request = login.create_login_msg(String::new(), String::new(), vec![1; 32]);
|
||||
assert_eq!(sent_token(&mut trust, &request).await, token);
|
||||
for mut unverified in [
|
||||
Session::new(login, false, Some(&[1; 32])).unwrap(),
|
||||
Session::new(login, true, None).unwrap(),
|
||||
] {
|
||||
assert!(sent_token(&mut unverified, &request).await.is_empty());
|
||||
}
|
||||
response.trusted_device_v2_supported = false;
|
||||
response.enable_trusted_devices = true;
|
||||
assert!(!trust.response(&response).await.unwrap());
|
||||
assert_eq!(sent_token(&mut trust, &request).await, token);
|
||||
response.trusted_device_v2_supported = true;
|
||||
trust.response(&response).await.unwrap();
|
||||
assert_eq!(sent_token(&mut trust, &request).await, token);
|
||||
let mut migration = Session::new(login, true, Some(&[1; 32])).unwrap();
|
||||
let outgoing = migration.login(request).await.unwrap();
|
||||
assert!(outgoing.login_request().trusted_device_v2_supported);
|
||||
success.trusted_device_v2_supported = true;
|
||||
migration.response(&success).await.unwrap();
|
||||
let mut no_consent = Session::new(login, true, Some(&[1; 32])).unwrap();
|
||||
assert!(no_consent.response(&success).await.is_err());
|
||||
}
|
||||
|
||||
async fn another_connection_cannot_supply_this_streams_token(
|
||||
trust: &mut crate::trusted_devices::client::Session,
|
||||
) {
|
||||
let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap();
|
||||
let addr = listener.local_addr().unwrap();
|
||||
let socket = tokio::net::TcpStream::connect(addr).await.unwrap();
|
||||
let (remote, _) = listener.accept().await.unwrap();
|
||||
let mut peer = Stream::Tcp(FramedStream::from(socket, addr));
|
||||
let mut remote = Stream::Tcp(FramedStream::from(remote, addr));
|
||||
let login = Arc::new(RwLock::new(LoginConfigHandler::default()));
|
||||
let mut old_connection = crate::trusted_devices::client::Session::new(
|
||||
&login.read().unwrap(),
|
||||
peer.is_secured(),
|
||||
None,
|
||||
)
|
||||
.unwrap();
|
||||
let request = login
|
||||
.read()
|
||||
.unwrap()
|
||||
.create_login_msg(String::new(), String::new(), vec![1; 32]);
|
||||
assert!(!sent_token(trust, &request).await.is_empty());
|
||||
assert!(!peer.is_secured());
|
||||
send_login(
|
||||
login,
|
||||
String::new(),
|
||||
String::new(),
|
||||
vec![1; 32],
|
||||
&mut old_connection,
|
||||
&mut peer,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let bytes = remote.next().await.unwrap().unwrap();
|
||||
let message = Message::parse_from_bytes(&bytes).unwrap();
|
||||
assert!(
|
||||
message.login_request().trusted_device_v2_token.is_empty(),
|
||||
"another connection's credential was sent on this unsecured stream"
|
||||
);
|
||||
}
|
||||
|
||||
async fn sent_token(trust: &mut crate::trusted_devices::client::Session, request: &Message) -> Vec<u8> {
|
||||
trust
|
||||
.login(request.clone())
|
||||
.await
|
||||
.unwrap()
|
||||
.login_request()
|
||||
.trusted_device_v2_token
|
||||
.to_vec()
|
||||
}
|
||||
+49
-3
@@ -239,8 +239,7 @@ pub fn need_fs_cm_send_files() -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
/// Android is scoped-storage only: the peer may never touch anything outside the app
|
||||
/// workspace (`Config::get_home()`, i.e. the app-specific external files directory).
|
||||
/// Android peers may access only the current shared file-transfer location.
|
||||
///
|
||||
/// Every peer supplied path must be validated with this before it reaches the
|
||||
/// filesystem, for reads, writes, renames, creations and deletions alike. The path is
|
||||
@@ -253,6 +252,22 @@ pub fn need_fs_cm_send_files() -> bool {
|
||||
pub fn is_peer_path_allowed(path: &str, allow_empty: bool) -> bool {
|
||||
use std::path::{Component, Path, PathBuf};
|
||||
|
||||
if base::fs::android::is_path(Path::new(path)) {
|
||||
return match base::fs::android::allowed(path) {
|
||||
Ok(allowed) => allowed,
|
||||
Err(error) => {
|
||||
const ERROR_LOG_INTERVAL: Duration = Duration::from_secs(60);
|
||||
hbb_common::throttled_log!(
|
||||
ERROR_LOG_INTERVAL,
|
||||
warn,
|
||||
"Document access denied: {}",
|
||||
error
|
||||
);
|
||||
false
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Canonicalize the deepest existing ancestor and re-append the missing tail.
|
||||
fn resolve(path: &Path) -> Option<PathBuf> {
|
||||
let mut tail: Vec<std::ffi::OsString> = Vec::new();
|
||||
@@ -279,7 +294,7 @@ pub fn is_peer_path_allowed(path: &str, allow_empty: bool) -> bool {
|
||||
if !path.is_absolute() || path.components().any(|c| c == Component::ParentDir) {
|
||||
return false;
|
||||
}
|
||||
let home = Config::get_home();
|
||||
let home = base::fs::get_path(&base::fs::get_home_as_string());
|
||||
let home = home.canonicalize().unwrap_or(home);
|
||||
if home.as_os_str().is_empty() {
|
||||
return false;
|
||||
@@ -294,6 +309,24 @@ pub fn is_peer_path_allowed(_path: &str, _allow_empty: bool) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
pub async fn is_peer_path_allowed_async(path: &str, allow_empty: bool) -> bool {
|
||||
let path = path.to_owned();
|
||||
match tokio::task::spawn_blocking(move || is_peer_path_allowed(&path, allow_empty)).await {
|
||||
Ok(allowed) => allowed,
|
||||
Err(error) => {
|
||||
const ERROR_LOG_INTERVAL: Duration = Duration::from_secs(60);
|
||||
hbb_common::throttled_log!(
|
||||
ERROR_LOG_INTERVAL,
|
||||
error,
|
||||
"File-transfer access check failed: {}",
|
||||
error
|
||||
);
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_main() -> bool {
|
||||
*IS_MAIN
|
||||
@@ -1251,6 +1284,11 @@ fn get_api_server_(api: String, custom: String) -> String {
|
||||
if !s0.is_empty() {
|
||||
let s = crate::increase_port(&s0, -2);
|
||||
if s == s0 {
|
||||
let s = if hbb_common::is_ipv6_str(&s) && !s.starts_with('[') {
|
||||
format!("[{s}]")
|
||||
} else {
|
||||
s
|
||||
};
|
||||
return format!("http://{}:{}", s, config::RENDEZVOUS_PORT - 2);
|
||||
} else {
|
||||
return format!("http://{}", s);
|
||||
@@ -3209,6 +3247,14 @@ mod tests {
|
||||
assert!(!is_public("https://rustdesk.com@evil.test"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_api_server_from_bare_ipv6_rendezvous_server() {
|
||||
assert_eq!(
|
||||
get_api_server_("".to_owned(), "2001:db8::1".to_owned()),
|
||||
"http://[2001:db8::1]:21114"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_should_use_tcp_proxy_for_api_url() {
|
||||
assert!(should_use_tcp_proxy_for_api_url(
|
||||
|
||||
@@ -993,6 +993,19 @@ impl InvokeUiSession for FlutterHandler {
|
||||
fn on_connected(&self, _conn_type: ConnType) {}
|
||||
|
||||
fn msgbox(&self, msgtype: &str, title: &str, text: &str, link: &str, retry: bool) {
|
||||
if msgtype == "custom-error-trusted-device" {
|
||||
const ERROR_DURATION_MS: u32 = 10_000;
|
||||
self.push_event(
|
||||
"toast",
|
||||
&[
|
||||
("type", json!("error")),
|
||||
("text", json!(text)),
|
||||
("dur_msec", json!(ERROR_DURATION_MS)),
|
||||
],
|
||||
&[],
|
||||
);
|
||||
return;
|
||||
}
|
||||
let has_retry = if retry { "true" } else { "" };
|
||||
self.push_event(
|
||||
"msgbox",
|
||||
|
||||
+94
-15
@@ -1,5 +1,8 @@
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
use crate::keyboard::input_source::{change_input_source, get_cur_session_input_source};
|
||||
use crate::{
|
||||
keyboard::input_source::{change_input_source, get_cur_session_input_source},
|
||||
trusted_devices::authority,
|
||||
};
|
||||
#[cfg(target_os = "linux")]
|
||||
use crate::platform::linux::is_x11;
|
||||
use crate::{
|
||||
@@ -60,7 +63,7 @@ fn initialize(app_dir: &str, custom_client_config: &str) {
|
||||
.with_tag("ffi"), // logs will show under mytag tag
|
||||
);
|
||||
#[cfg(not(debug_assertions))]
|
||||
hbb_common::init_log(false, "");
|
||||
crate::platform::android_log::initialize();
|
||||
#[cfg(feature = "mediacodec")]
|
||||
scrap::mediacodec::check_mediacodec();
|
||||
crate::common::test_rendezvous_server();
|
||||
@@ -854,6 +857,13 @@ pub fn session_read_local_dir_sync(
|
||||
path: String,
|
||||
show_hidden: bool,
|
||||
) -> String {
|
||||
#[cfg(target_os = "android")]
|
||||
if fs::android::is_path(&fs::get_path(&path)) {
|
||||
return match fs::read_dir(&fs::get_path(&path), show_hidden) {
|
||||
Ok(fd) => make_fd_to_json(fd.id, path, &fd.entries),
|
||||
Err(error) => serde_json::json!({"error": error.to_string()}).to_string(),
|
||||
};
|
||||
}
|
||||
if let Ok(fd) = fs::read_dir(&fs::get_path(&path), show_hidden) {
|
||||
return make_fd_to_json(fd.id, path, &fd.entries);
|
||||
}
|
||||
@@ -1009,7 +1019,13 @@ pub fn main_get_error() -> String {
|
||||
get_error()
|
||||
}
|
||||
|
||||
pub fn main_set_option(key: String, value: String) {
|
||||
pub fn main_set_option(key: String, value: String) -> hbb_common::anyhow::Result<()> {
|
||||
if key == "2fa"
|
||||
|| key == keys::OPTION_ENABLE_TRUSTED_DEVICES
|
||||
|| key == keys::OPTION_TRUSTED_DEVICE_EXPIRATION
|
||||
{
|
||||
return set_auth_option(key, value);
|
||||
}
|
||||
#[cfg(target_os = "android")]
|
||||
{
|
||||
let is_permission_option = key.eq(keys::OPTION_ENABLE_CLIPBOARD)
|
||||
@@ -1028,7 +1044,7 @@ pub fn main_set_option(key: String, value: String) {
|
||||
key,
|
||||
value
|
||||
);
|
||||
return;
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
#[cfg(target_os = "android")]
|
||||
@@ -1067,6 +1083,7 @@ pub fn main_set_option(key: String, value: String) {
|
||||
} else {
|
||||
set_option(key, value.clone());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn main_get_options() -> String {
|
||||
@@ -1077,7 +1094,7 @@ pub fn main_get_options_sync() -> SyncReturn<String> {
|
||||
SyncReturn(get_options())
|
||||
}
|
||||
|
||||
pub fn main_set_options(json: String) {
|
||||
pub fn main_set_options(json: String) -> hbb_common::anyhow::Result<()> {
|
||||
let mut map: HashMap<String, String> = serde_json::from_str(&json).unwrap_or(HashMap::new());
|
||||
#[cfg(target_os = "android")]
|
||||
{
|
||||
@@ -1102,8 +1119,9 @@ pub fn main_set_options(json: String) {
|
||||
}
|
||||
}
|
||||
if !map.is_empty() {
|
||||
set_options(map)
|
||||
try_set_options(map)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn main_test_if_valid_server(server: String, test_with_proxy: bool) -> String {
|
||||
@@ -1454,6 +1472,17 @@ pub fn main_peer_exists(id: String) -> bool {
|
||||
peer_exists(&id)
|
||||
}
|
||||
|
||||
// `Config::path` resolves through `APP_DIR` only on mobile, where loading peers before it is set
|
||||
// would read the wrong place. Elsewhere the peer path never consults it, so an unset `APP_DIR`
|
||||
// must not stop the peers from loading.
|
||||
fn peer_config_path_ready() -> bool {
|
||||
if cfg!(any(target_os = "android", target_os = "ios")) {
|
||||
!config::APP_DIR.read().unwrap().is_empty()
|
||||
} else {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
fn load_recent_peers(
|
||||
vec_id_modified_time_path: &Vec<(String, SystemTime, std::path::PathBuf)>,
|
||||
to_end: bool,
|
||||
@@ -1485,7 +1514,7 @@ pub fn main_load_recent_peers() {
|
||||
);
|
||||
};
|
||||
|
||||
if !config::APP_DIR.read().unwrap().is_empty() {
|
||||
if peer_config_path_ready() {
|
||||
let vec_id_modified_time_path = PeerConfig::get_vec_id_modified_time_path(&None);
|
||||
if vec_id_modified_time_path.is_empty() {
|
||||
push_to_flutter("".to_owned(), None);
|
||||
@@ -1533,7 +1562,7 @@ pub fn main_load_recent_peers_for_ab(filter: String) -> String {
|
||||
} else {
|
||||
Some(id_filters)
|
||||
};
|
||||
if !config::APP_DIR.read().unwrap().is_empty() {
|
||||
if peer_config_path_ready() {
|
||||
let peers: Vec<HashMap<&str, String>> = PeerConfig::peers(id_filters)
|
||||
.drain(..)
|
||||
.map(|(id, _, p)| peer_to_map(id, p))
|
||||
@@ -1551,7 +1580,7 @@ pub fn main_load_fav_peers() {
|
||||
serde_json::ser::to_string(&data).unwrap_or("".to_owned()),
|
||||
);
|
||||
};
|
||||
if !config::APP_DIR.read().unwrap().is_empty() {
|
||||
if peer_config_path_ready() {
|
||||
let favs = get_fav();
|
||||
let mut recent = PeerConfig::peers(Some(favs.clone()));
|
||||
let mut lan = config::LanPeers::load()
|
||||
@@ -2651,16 +2680,54 @@ pub fn main_check_hwcodec() {
|
||||
check_hwcodec()
|
||||
}
|
||||
|
||||
pub fn main_get_trusted_devices() -> String {
|
||||
get_trusted_devices()
|
||||
// The bridge uses ordinary worker threads; desktop IPC needs a runtime at this boundary.
|
||||
pub fn main_get_trusted_devices() -> hbb_common::anyhow::Result<String> {
|
||||
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||
return crate::trusted_devices::devices();
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
hbb_common::tokio::runtime::Builder::new_current_thread()
|
||||
.enable_all()
|
||||
.build()?
|
||||
.block_on(crate::ipc::trusted_devices(authority::Request::List))
|
||||
}
|
||||
|
||||
pub fn main_remove_trusted_devices(json: String) {
|
||||
remove_trusted_devices(&json)
|
||||
pub fn main_remove_trusted_devices(json: String) -> hbb_common::anyhow::Result<()> {
|
||||
let record_ids = serde_json::from_str::<Vec<[u8; crate::trusted_devices::TOKEN_BYTES]>>(&json)?;
|
||||
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||
return crate::trusted_devices::remove(&record_ids);
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
hbb_common::tokio::runtime::Builder::new_current_thread()
|
||||
.enable_all()
|
||||
.build()?
|
||||
.block_on(crate::ipc::trusted_devices(authority::Request::Remove(
|
||||
record_ids,
|
||||
)))
|
||||
.map(|_| ())
|
||||
}
|
||||
|
||||
pub fn main_clear_trusted_devices() {
|
||||
clear_trusted_devices()
|
||||
pub fn main_renew_trusted_devices(json: String) -> hbb_common::anyhow::Result<()> {
|
||||
let record_ids = serde_json::from_str::<Vec<[u8; crate::trusted_devices::TOKEN_BYTES]>>(&json)?;
|
||||
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||
return crate::trusted_devices::renew(&record_ids);
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
hbb_common::tokio::runtime::Builder::new_current_thread()
|
||||
.enable_all()
|
||||
.build()?
|
||||
.block_on(crate::ipc::trusted_devices(authority::Request::Renew(
|
||||
record_ids,
|
||||
)))
|
||||
.map(|_| ())
|
||||
}
|
||||
|
||||
pub fn main_clear_trusted_devices() -> hbb_common::anyhow::Result<()> {
|
||||
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||
return crate::trusted_devices::clear();
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
hbb_common::tokio::runtime::Builder::new_current_thread()
|
||||
.enable_all()
|
||||
.build()?
|
||||
.block_on(crate::ipc::trusted_devices(authority::Request::Clear))
|
||||
.map(|_| ())
|
||||
}
|
||||
|
||||
pub fn main_max_encrypt_len() -> SyncReturn<usize> {
|
||||
@@ -2763,6 +2830,16 @@ pub fn main_get_common(key: String) -> String {
|
||||
}
|
||||
|
||||
pub fn main_get_common_sync(key: String) -> SyncReturn<String> {
|
||||
if let Some(args) = key.strip_prefix("resolve-api-server:") {
|
||||
let response = match serde_json::from_str::<(String, String)>(args) {
|
||||
Ok((api, custom)) => serde_json::json!({"url": crate::get_api_server(api, custom)}),
|
||||
Err(err) => {
|
||||
log::trace!("Invalid API server preview arguments: {err}");
|
||||
serde_json::json!({"error": err.to_string()})
|
||||
}
|
||||
};
|
||||
return SyncReturn(response.to_string());
|
||||
}
|
||||
// Metadata verification performs blocking network requests. Keep this key on
|
||||
// the asynchronous FFI path to avoid blocking the calling Flutter isolate.
|
||||
if key.starts_with("verified-download-url-") {
|
||||
@@ -3013,6 +3090,8 @@ pub mod server_side {
|
||||
if let Ok(home_dir) = env.get_string(&home_dir) {
|
||||
*config::APP_HOME_DIR.write().unwrap() = home_dir.into();
|
||||
}
|
||||
#[cfg(not(debug_assertions))]
|
||||
crate::platform::android_log::initialize();
|
||||
if let Ok(custom_client_config) = env.get_string(&custom_client_config) {
|
||||
if !custom_client_config.is_empty() {
|
||||
let custom_client_config: String = custom_client_config.into();
|
||||
|
||||
+34
-7
@@ -258,6 +258,15 @@ async fn start_hbbs_sync_async() {
|
||||
SENDER.lock().unwrap().send(conns).ok();
|
||||
}
|
||||
}
|
||||
if let Some(strategy) = rsp.remove("strategy") {
|
||||
if let Ok(strategy) = serde_json::from_value::<StrategyOptions>(strategy) {
|
||||
if let Err(error) = handle_config_options(strategy.config_options).await {
|
||||
hbb_common::throttled_log!(API_LOG_INTERVAL, error, "Strategy update rejected: {error}");
|
||||
continue;
|
||||
}
|
||||
log::info!("strategy updated");
|
||||
}
|
||||
}
|
||||
if let Some(rsp_modified_at) = rsp.remove("modified_at") {
|
||||
if let Ok(rsp_modified_at) = serde_json::from_value::<i64>(rsp_modified_at) {
|
||||
if rsp_modified_at != modified_at {
|
||||
@@ -265,12 +274,6 @@ async fn start_hbbs_sync_async() {
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(strategy) = rsp.remove("strategy") {
|
||||
if let Ok(strategy) = serde_json::from_value::<StrategyOptions>(strategy) {
|
||||
log::info!("strategy updated");
|
||||
handle_config_options(strategy.config_options);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -289,7 +292,9 @@ fn heartbeat_url() -> String {
|
||||
format!("{}/api/heartbeat", url)
|
||||
}
|
||||
|
||||
fn handle_config_options(config_options: HashMap<String, String>) {
|
||||
async fn handle_config_options(
|
||||
config_options: HashMap<String, String>,
|
||||
) -> hbb_common::ResultType<()> {
|
||||
let mut options = Config::get_options();
|
||||
let default_settings = config::DEFAULT_SETTINGS.read().unwrap().clone();
|
||||
config_options
|
||||
@@ -305,7 +310,29 @@ fn handle_config_options(config_options: HashMap<String, String>) {
|
||||
}
|
||||
})
|
||||
.count();
|
||||
if crate::trusted_devices::config::changes_authentication(&options) {
|
||||
let current = Config::get_options();
|
||||
let mut non_auth_options = options.clone();
|
||||
for key in [
|
||||
"2fa",
|
||||
keys::OPTION_ENABLE_TRUSTED_DEVICES,
|
||||
keys::OPTION_TRUSTED_DEVICE_EXPIRATION,
|
||||
] {
|
||||
match current.get(key) {
|
||||
Some(value) => {
|
||||
non_auth_options.insert(key.to_owned(), value.clone());
|
||||
}
|
||||
None => {
|
||||
non_auth_options.remove(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Authentication update failures must not block unrelated strategy options.
|
||||
Config::set_options(non_auth_options);
|
||||
return crate::trusted_devices::config::update_options(options).await;
|
||||
}
|
||||
Config::set_options(options);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
|
||||
+160
-36
@@ -24,6 +24,7 @@ use crate::{
|
||||
privacy_mode,
|
||||
privacy_mode::PrivacyModeState,
|
||||
rendezvous_mediator::RendezvousMediator,
|
||||
trusted_devices::authority,
|
||||
ui_interface::{get_local_option, set_local_option},
|
||||
};
|
||||
use bytes::Bytes;
|
||||
@@ -137,6 +138,19 @@ pub async fn connect_service(ms_timeout: u64) -> ResultType<ConnectionTmpl<ConnC
|
||||
connect(ms_timeout, crate::POSTFIX_SERVICE).await
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||
pub(crate) async fn connect_trusted_device_service(
|
||||
ms_timeout: u64,
|
||||
) -> ResultType<ConnectionTmpl<ConnClient>> {
|
||||
let connection = connect_service(ms_timeout)
|
||||
.await
|
||||
.map_err(crate::trusted_devices::authority::Unavailable)?;
|
||||
if connection.peer_uid() != Some(0) {
|
||||
bail!("Trusted-device system service is not an authenticated root peer");
|
||||
}
|
||||
Ok(connection)
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[serde(tag = "t", content = "c")]
|
||||
pub enum FS {
|
||||
@@ -482,8 +496,9 @@ pub enum Data {
|
||||
// Although the key is not necessary, it is used to avoid hardcoding the key.
|
||||
WaylandScreencastRestoreToken((String, String)),
|
||||
HwCodecConfig(Option<String>),
|
||||
RemoveTrustedDevices(Vec<Bytes>),
|
||||
ClearTrustedDevices,
|
||||
TrustedDeviceManagement(Box<authority::Request>),
|
||||
TrustedDeviceResponse(Result<crate::trusted_devices::authority::Response, String>),
|
||||
SecurityConfigError(String),
|
||||
#[cfg(all(target_os = "windows", feature = "flutter"))]
|
||||
PrinterData(Vec<u8>),
|
||||
InstallOption(Option<(String, String)>),
|
||||
@@ -986,8 +1001,6 @@ async fn handle(data: Data, stream: &mut Connection) {
|
||||
value = crate::audio_service::get_voice_call_input_device();
|
||||
} else if name == "unlock-pin" {
|
||||
value = Some(Config::get_unlock_pin());
|
||||
} else if name == "trusted-devices" {
|
||||
value = Some(Config::get_trusted_devices_json());
|
||||
} else {
|
||||
value = None;
|
||||
}
|
||||
@@ -1011,7 +1024,19 @@ async fn handle(data: Data, stream: &mut Connection) {
|
||||
log::warn!("Changing permanent password is disabled");
|
||||
updated = false;
|
||||
} else {
|
||||
updated = Config::set_permanent_password(&value);
|
||||
let affected = crate::trusted_devices::config::changes_password(&value);
|
||||
updated =
|
||||
match crate::trusted_devices::config::update_auth(affected, move || {
|
||||
crate::trusted_devices::config::set_password(&value)
|
||||
})
|
||||
.await
|
||||
{
|
||||
Ok(updated) => updated,
|
||||
Err(error) => {
|
||||
log::error!("Password change rejected: {error}");
|
||||
false
|
||||
}
|
||||
};
|
||||
}
|
||||
// Explicitly ACK/NACK permanent-password writes. This allows UIs/FFI to
|
||||
// distinguish "accepted by daemon" vs "IPC send succeeded" without
|
||||
@@ -1019,7 +1044,21 @@ async fn handle(data: Data, stream: &mut Connection) {
|
||||
let ack = if updated { "Y" } else { "N" }.to_owned();
|
||||
allow_err!(stream.send(&Data::Config((name.clone(), Some(ack)))).await);
|
||||
} else if name == "salt" {
|
||||
Config::set_salt(&value);
|
||||
let affected =
|
||||
Config::get_local_permanent_password_storage_and_salt().1 != value;
|
||||
if let Err(error) =
|
||||
crate::trusted_devices::config::update_auth(affected, move || {
|
||||
crate::trusted_devices::config::set_salt(&value)
|
||||
})
|
||||
.await
|
||||
{
|
||||
allow_err!(
|
||||
stream
|
||||
.send(&Data::SecurityConfigError(error.to_string()))
|
||||
.await
|
||||
);
|
||||
return;
|
||||
}
|
||||
} else if name == "voice-call-input" {
|
||||
crate::audio_service::set_voice_call_input_device(Some(value), true);
|
||||
} else if name == "unlock-pin" {
|
||||
@@ -1043,7 +1082,14 @@ async fn handle(data: Data, stream: &mut Connection) {
|
||||
if let Some(v) = value.get("privacy-mode-impl-key") {
|
||||
crate::privacy_mode::switch(v);
|
||||
}
|
||||
Config::set_options(value);
|
||||
if let Err(error) = crate::trusted_devices::config::update_options(value).await {
|
||||
allow_err!(
|
||||
stream
|
||||
.send(&Data::SecurityConfigError(error.to_string()))
|
||||
.await
|
||||
);
|
||||
return;
|
||||
}
|
||||
allow_err!(stream.send(&Data::Options(None)).await);
|
||||
}
|
||||
},
|
||||
@@ -1054,16 +1100,47 @@ async fn handle(data: Data, stream: &mut Connection) {
|
||||
Data::SyncConfig(Some(configs)) => {
|
||||
let (config, config2) = *configs;
|
||||
let _chk = CheckIfRestart::new();
|
||||
Config::set(config);
|
||||
Config2::set(config2);
|
||||
if let Err(error) = crate::trusted_devices::config::update(move || {
|
||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||
{
|
||||
crate::trusted_devices::config::sync_config(config, config2)
|
||||
}
|
||||
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
|
||||
{
|
||||
crate::trusted_devices::config::set_config(config)
|
||||
.and_then(|_| crate::trusted_devices::config::set_config2(config2))
|
||||
}
|
||||
})
|
||||
.await
|
||||
{
|
||||
allow_err!(
|
||||
stream
|
||||
.send(&Data::SecurityConfigError(error.to_string()))
|
||||
.await
|
||||
);
|
||||
return;
|
||||
}
|
||||
allow_err!(stream.send(&Data::SyncConfig(None)).await);
|
||||
}
|
||||
Data::SyncConfig(None) => {
|
||||
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||
let config2 = match crate::trusted_devices::config::update(Config2::get_for_sync).await
|
||||
{
|
||||
Ok(config2) => config2,
|
||||
Err(error) => {
|
||||
allow_err!(
|
||||
stream
|
||||
.send(&Data::SecurityConfigError(error.to_string()))
|
||||
.await
|
||||
);
|
||||
return;
|
||||
}
|
||||
};
|
||||
#[cfg(not(any(target_os = "windows", target_os = "linux", target_os = "macos")))]
|
||||
let config2 = Config2::get();
|
||||
allow_err!(
|
||||
stream
|
||||
.send(&Data::SyncConfig(Some(
|
||||
(Config::get(), Config2::get()).into()
|
||||
)))
|
||||
.send(&Data::SyncConfig(Some((Config::get(), config2).into())))
|
||||
.await
|
||||
);
|
||||
}
|
||||
@@ -1214,11 +1291,11 @@ async fn handle(data: Data, stream: &mut Connection) {
|
||||
);
|
||||
}
|
||||
}
|
||||
Data::RemoveTrustedDevices(v) => {
|
||||
Config::remove_trusted_devices(&v);
|
||||
}
|
||||
Data::ClearTrustedDevices => {
|
||||
Config::clear_trusted_devices();
|
||||
Data::TrustedDeviceManagement(request) => {
|
||||
let result = authority::request(*request)
|
||||
.await
|
||||
.map_err(|error| error.to_string());
|
||||
allow_err!(stream.send(&Data::TrustedDeviceResponse(result)).await);
|
||||
}
|
||||
Data::InstallOption(opt) => match opt {
|
||||
Some((_k, _v)) => {
|
||||
@@ -1708,6 +1785,7 @@ pub fn sync_permanent_password_storage_from_daemon() -> ResultType<()> {
|
||||
apply_permanent_password_storage_and_salt_payload(v.as_deref())
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
async fn sync_permanent_password_storage_from_daemon_async() -> ResultType<()> {
|
||||
let ms_timeout = 1_000;
|
||||
let v = get_config_async("permanent-password-storage-and-salt", ms_timeout).await?;
|
||||
@@ -1771,8 +1849,11 @@ async fn set_permanent_password_with_ack_async(v: String) -> ResultType<bool> {
|
||||
let v = v.trim();
|
||||
let ok = v == "Y";
|
||||
if ok {
|
||||
#[cfg(target_os = "windows")]
|
||||
sync_security_config_from_server(&mut c).await?;
|
||||
// Ensure the hashed permanent password storage is written to the user config file.
|
||||
// This sync must not affect the daemon ACK outcome.
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
if let Err(err) = sync_permanent_password_storage_from_daemon_async().await {
|
||||
log::warn!("Failed to sync permanent password storage from daemon: {err}");
|
||||
}
|
||||
@@ -1823,26 +1904,54 @@ pub fn get_unlock_pin() -> String {
|
||||
|
||||
#[cfg(feature = "flutter")]
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
pub fn get_trusted_devices() -> String {
|
||||
if let Ok(Some(v)) = get_config("trusted-devices") {
|
||||
v
|
||||
} else {
|
||||
Config::get_trusted_devices_json()
|
||||
pub async fn trusted_devices(request: authority::Request) -> ResultType<String> {
|
||||
const TIMEOUT_MS: u64 = 1000;
|
||||
let list = matches!(request, authority::Request::List);
|
||||
let mut connection = connect(TIMEOUT_MS, "").await?;
|
||||
connection
|
||||
.send(&Data::TrustedDeviceManagement(Box::new(request)))
|
||||
.await?;
|
||||
let response = match connection.next_timeout(TIMEOUT_MS).await? {
|
||||
Some(Data::TrustedDeviceResponse(result)) => {
|
||||
match result.map_err(|error| hbb_common::anyhow::anyhow!(error))? {
|
||||
authority::Response::Devices(devices) if list => devices,
|
||||
authority::Response::Done if !list => String::new(),
|
||||
_ => bail!("Invalid trusted-device management response"),
|
||||
}
|
||||
}
|
||||
_ => bail!("The host did not confirm the trusted-device operation"),
|
||||
};
|
||||
#[cfg(target_os = "windows")]
|
||||
if !list {
|
||||
sync_security_config_from_server(&mut connection).await?;
|
||||
}
|
||||
Ok(response)
|
||||
}
|
||||
|
||||
#[cfg(feature = "flutter")]
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
pub fn remove_trusted_devices(hwids: Vec<Bytes>) {
|
||||
Config::remove_trusted_devices(&hwids);
|
||||
allow_err!(set_data(&Data::RemoveTrustedDevices(hwids)));
|
||||
}
|
||||
#[cfg(target_os = "windows")]
|
||||
async fn sync_security_config_from_server(
|
||||
connection: &mut ConnectionTmpl<ConnClient>,
|
||||
) -> ResultType<()> {
|
||||
use hbb_common::anyhow::Context;
|
||||
|
||||
#[cfg(feature = "flutter")]
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
pub fn clear_trusted_devices() {
|
||||
Config::clear_trusted_devices();
|
||||
allow_err!(set_data(&Data::ClearTrustedDevices));
|
||||
const TIMEOUT_MS: u64 = 1000;
|
||||
// MSI removal can reactivate this user copy without running our uninstall hooks.
|
||||
async {
|
||||
connection.send(&Data::SyncConfig(None)).await?;
|
||||
match connection.next_timeout(TIMEOUT_MS).await? {
|
||||
Some(Data::SyncConfig(Some(configs))) => {
|
||||
let (config, config2) = *configs;
|
||||
crate::trusted_devices::config::update(move || {
|
||||
crate::trusted_devices::config::sync_config(config, config2)
|
||||
})
|
||||
.await
|
||||
}
|
||||
Some(Data::SecurityConfigError(error)) => bail!(error),
|
||||
_ => bail!("The host did not provide its current configuration"),
|
||||
}
|
||||
}
|
||||
.await
|
||||
.context("Host security update succeeded, but updating the local configuration failed")
|
||||
}
|
||||
|
||||
pub fn get_id() -> String {
|
||||
@@ -1915,16 +2024,31 @@ pub fn set_option(key: &str, value: &str) {
|
||||
} else {
|
||||
options.insert(key.to_owned(), value.to_owned());
|
||||
}
|
||||
set_options(options).ok();
|
||||
allow_err!(set_options(options));
|
||||
}
|
||||
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
pub async fn set_options(value: HashMap<String, String>) -> ResultType<()> {
|
||||
let _nat = CheckTestNatType::new();
|
||||
if let Ok(mut c) = connect(1000, "").await {
|
||||
let affected = crate::trusted_devices::config::changes_authentication(&value);
|
||||
let connection = connect(1000, "").await;
|
||||
if affected && connection.is_err() {
|
||||
bail!("The host is unavailable; authentication settings were not changed");
|
||||
}
|
||||
if let Ok(mut c) = connection {
|
||||
c.send(&Data::Options(Some(value.clone()))).await?;
|
||||
// do not put below before connect, because we need to check should_exit
|
||||
c.next_timeout(1000).await.ok();
|
||||
match c.next_timeout(1000).await {
|
||||
#[cfg(target_os = "windows")]
|
||||
Ok(Some(Data::Options(None))) if affected => {
|
||||
sync_security_config_from_server(&mut c).await?;
|
||||
}
|
||||
Ok(Some(Data::Options(None))) => {}
|
||||
Ok(Some(Data::SecurityConfigError(error))) => bail!(error),
|
||||
Err(error) if affected => return Err(error),
|
||||
_ if affected => bail!("The host did not confirm the configuration update"),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
Config::set_options(value);
|
||||
Ok(())
|
||||
|
||||
+4
-1
@@ -659,9 +659,12 @@ async fn probe_existing_listener(postfix: &str) -> bool {
|
||||
if stream.send(&Data::SyncConfig(None)).await.is_err() {
|
||||
return false;
|
||||
}
|
||||
// A configuration error still confirms that the service is alive.
|
||||
matches!(
|
||||
stream.next_timeout(1000).await,
|
||||
Ok(Some(Data::SyncConfig(Some(_))))
|
||||
Ok(Some(
|
||||
Data::SyncConfig(Some(_)) | Data::SecurityConfigError(_)
|
||||
))
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+45
@@ -143,6 +143,10 @@ fn resolve_lang(saved_lang: &str, locale: &str, cjk_fallback: bool) -> String {
|
||||
"zh-cn"
|
||||
})
|
||||
.to_owned();
|
||||
// Hong Kong, Macao and the Hant script use Traditional Chinese.
|
||||
if !locale.contains("hans") && ["hk", "mo", "hant"].iter().any(|x| locale.contains(x)) {
|
||||
lang = "zh-tw".to_owned();
|
||||
}
|
||||
}
|
||||
}
|
||||
if lang.is_empty() {
|
||||
@@ -167,6 +171,12 @@ fn resolve_lang(saved_lang: &str, locale: &str, cjk_fallback: bool) -> String {
|
||||
.map(|x| x.split("_").next().unwrap_or_default())
|
||||
.unwrap_or_default()
|
||||
.to_owned();
|
||||
// The Kazakh and Georgian tables are keyed by country code, not by language code.
|
||||
if lang == "kk" {
|
||||
lang = "kz".to_owned();
|
||||
} else if lang == "ka" {
|
||||
lang = "ge".to_owned();
|
||||
}
|
||||
}
|
||||
if cjk_fallback && is_cjk_lang(&lang) {
|
||||
"en".to_owned()
|
||||
@@ -365,4 +375,39 @@ mod test {
|
||||
assert_eq!(f("", "pt-AO", false), "pt-pt");
|
||||
assert_eq!(f("", "pt-MZ", false), "pt-pt");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_resolve_lang_detects_kazakh_and_georgian_from_locale() {
|
||||
use super::resolve_lang as f;
|
||||
|
||||
assert_eq!(f("", "kk_KZ.UTF-8", false), "kz");
|
||||
assert_eq!(f("", "kk-KZ", false), "kz");
|
||||
assert_eq!(f("", "ka_GE.UTF-8", false), "ge");
|
||||
assert_eq!(f("", "ka-GE", false), "ge");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_resolve_lang_detects_traditional_chinese_for_hong_kong_and_macao() {
|
||||
use super::resolve_lang as f;
|
||||
|
||||
assert_eq!(f("", "zh_HK.UTF-8", false), "zh-tw");
|
||||
assert_eq!(f("", "zh-Hant-HK", false), "zh-tw");
|
||||
assert_eq!(f("", "zh-Hant", false), "zh-tw");
|
||||
assert_eq!(f("", "zh_MO", false), "zh-tw");
|
||||
assert_eq!(f("", "zh-Hans-HK", false), "zh-cn");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_translations_keep_the_placeholder_of_their_key() {
|
||||
use super::*;
|
||||
|
||||
// translate() puts the caller's value where `{}` is, so a translation without `{}` drops it.
|
||||
for table in [&*ru::T, &*sc::T, &*vi::T] {
|
||||
for (key, value) in table.iter() {
|
||||
if key.contains("{}") && !value.is_empty() {
|
||||
assert!(value.contains("{}"), "{key:?} => {value:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+45
-35
@@ -763,8 +763,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Lock canvas", "قفل اللوحة"),
|
||||
("Sync clipboard between sessions", "مزامنة الحافظة بين الجلسات"),
|
||||
("sync-clipboard-between-sessions-tip", "النص أو الصور المنسوخة في جلسة بعيدة واحدة تُرسَل أيضًا إلى حافظة جلساتك المتصلة الأخرى."),
|
||||
("terminal-clipboard-write-tip", ""),
|
||||
("Allow terminal apps to copy to clipboard", ""),
|
||||
("terminal-clipboard-write-tip", "يريد تطبيق في الطرفية نسخ نص إلى حافظة هذا الجهاز. عند منح هذا الإذن، يُطبَّق على تطبيقات الطرفية في جميع الاتصالات حتى تقوم بإيقافه في الإعدادات. لا يتأثر النسخ واللصق اليدوي."),
|
||||
("Allow terminal apps to copy to clipboard", "السماح لتطبيقات الطرفية بالنسخ إلى الحافظة"),
|
||||
("Enable", "تفعيل"),
|
||||
("Reuse one connection for port forwarding", "إعادة استخدام اتصال واحد لإعادة توجيه المنافذ"),
|
||||
("port-forward-mux-tip", "تمرير جميع اتصالات إعادة توجيه المنافذ عبر اتصال واحد بالجهاز الآخر، بدلاً من الاتصال وتسجيل الدخول من جديد لكل اتصال."),
|
||||
@@ -780,38 +780,48 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("RustDesk could not load a GStreamer component needed for screen capture ({})", "تعذّر على RustDesk تحميل مكوّن GStreamer اللازم لالتقاط الشاشة ({})"),
|
||||
("Relay fallback delay in seconds", "مهلة التراجع إلى الترحيل بالثواني"),
|
||||
("relay-fallback-delay-tip", "المدة التي ينتظرها اتصال الترحيل القائم بالفعل الاتصالَ المباشر عبر WebRTC قبل أن يُستخدم بدلًا منه. زِدها لمنح الاتصال المباشر البطيء فرصة أكبر للفوز؛ وقلّلها للاستقرار على الترحيل أسرع في الشبكات التي يتعذر فيها الاتصال المباشر. اتركها فارغة للقيمة الافتراضية 2.5 ثانية."),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", ""),
|
||||
("Keyboard shortcuts", ""),
|
||||
("Configure shortcuts...", ""),
|
||||
("Enable keyboard shortcuts in remote session", ""),
|
||||
("shortcut-page-description", ""),
|
||||
("shortcut-passthrough-tip", ""),
|
||||
("Pass-through to remote", ""),
|
||||
("Reset to defaults", ""),
|
||||
("shortcut-reset-confirm-tip", ""),
|
||||
("Monitor", ""),
|
||||
("Keyboard", ""),
|
||||
("Toggle fullscreen", ""),
|
||||
("Switch to next display", ""),
|
||||
("Switch to previous display", ""),
|
||||
("Switch to next tab", ""),
|
||||
("Switch to previous tab", ""),
|
||||
("Toggle session recording", ""),
|
||||
("Close tab", ""),
|
||||
("Toggle toolbar", ""),
|
||||
("Toggle input source", ""),
|
||||
("Edit", ""),
|
||||
("Save", ""),
|
||||
("Set shortcut", ""),
|
||||
("shortcut-recording-instruction", ""),
|
||||
("shortcut-recording-press-keys-tip", ""),
|
||||
("shortcut-must-include-modifiers", ""),
|
||||
("shortcut-already-bound-to", ""),
|
||||
("Replace", ""),
|
||||
("Valid", ""),
|
||||
("shortcut-mobile-physical-keyboard-tip", ""),
|
||||
("shortcut-key-not-supported", ""),
|
||||
("On", ""),
|
||||
("Off", ""),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", "لبدء مكالمة صوتية، فعّل «لقط الصوت» في صفحة «مشاركة الشاشة»."),
|
||||
("Keyboard shortcuts", "اختصارات لوحة المفاتيح"),
|
||||
("Configure shortcuts...", "تهيئة الاختصارات..."),
|
||||
("Enable keyboard shortcuts in remote session", "تفعيل اختصارات لوحة المفاتيح في الجلسة عن بُعد"),
|
||||
("shortcut-page-description", "اربط مجموعة مفاتيح بكل إجراء من إجراءات الجلسة أدناه. يجب أن يتضمن كل ربط مفتاح تعديل واحدًا على الأقل."),
|
||||
("shortcut-passthrough-tip", "عند التشغيل، تُمرَّر كل مجموعات المفاتيح المربوطة إلى الجهاز البعيد. يفيد ذلك عندما يتعارض ربط ما مع شيء تحتاجه على الجهاز البعيد."),
|
||||
("Pass-through to remote", "تمرير إلى الجهاز البعيد"),
|
||||
("Reset to defaults", "إعادة التعيين إلى الافتراضي"),
|
||||
("shortcut-reset-confirm-tip", "سيؤدي هذا إلى استبدال جميع الروابط الحالية بالمجموعة الافتراضية. هل تريد المتابعة؟"),
|
||||
("Monitor", "الشاشة"),
|
||||
("Keyboard", "لوحة المفاتيح"),
|
||||
("Toggle fullscreen", "تبديل ملء الشاشة"),
|
||||
("Switch to next display", "التبديل إلى الشاشة التالية"),
|
||||
("Switch to previous display", "التبديل إلى الشاشة السابقة"),
|
||||
("Switch to next tab", "التبديل إلى التبويب التالي"),
|
||||
("Switch to previous tab", "التبديل إلى التبويب السابق"),
|
||||
("Toggle session recording", "تبديل تسجيل الجلسة"),
|
||||
("Close tab", "إغلاق التبويب"),
|
||||
("Toggle toolbar", "تبديل شريط الأدوات"),
|
||||
("Toggle input source", "تبديل مصدر الإدخال"),
|
||||
("Edit", "تعديل"),
|
||||
("Save", "حفظ"),
|
||||
("Set shortcut", "تعيين اختصار"),
|
||||
("shortcut-recording-instruction", "اضغط على مجموعة المفاتيح التي تريد استخدامها."),
|
||||
("shortcut-recording-press-keys-tip", "اضغط على مجموعة مفاتيح..."),
|
||||
("shortcut-must-include-modifiers", "يجب أن يتضمن مفتاح تعديل واحدًا على الأقل: {}"),
|
||||
("shortcut-already-bound-to", "مرتبط بالفعل بالإجراء"),
|
||||
("Replace", "استبدال"),
|
||||
("Valid", "صالح"),
|
||||
("shortcut-mobile-physical-keyboard-tip", "يتطلب تسجيل الاختصار لوحة مفاتيح فعلية. لوحات المفاتيح الافتراضية غير مدعومة."),
|
||||
("shortcut-key-not-supported", "لا يمكن استخدام «{}» كاختصار."),
|
||||
("On", "تشغيل"),
|
||||
("Off", "إيقاف"),
|
||||
("api_server_connection_tip", "يستخدم خادمك المخصص HTTP غير المشفر. تواصل مع المسؤول لتفعيل HTTPS."),
|
||||
("api_server_empty_tip", "عندما يكون «خادم API» فارغًا، يستخدم خادمك المخصص HTTP افتراضيًا. تواصل مع المسؤول لتفعيل HTTPS."),
|
||||
("RustDesk storage", "تخزين RustDesk"),
|
||||
("Other folders", "مجلدات أخرى"),
|
||||
("Choose which folder remote devices can access.", "اختر المجلد الذي يمكن للأجهزة البعيدة الوصول إليه."),
|
||||
("android-logs-folder-tip", "اختر Android → media لتخزين ملفات السجل."),
|
||||
("Choose folder", "اختيار مجلد"),
|
||||
("Please select Android → media.", "الرجاء اختيار Android → media."),
|
||||
("Trust duration (days)", "مدة الثقة (بالأيام)"),
|
||||
("Renew trust", "تجديد الثقة"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
+51
-41
@@ -770,48 +770,58 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("port-forward-mux-tip", "Port yönləndirmə xəritələnməsinin hər əlaqəsini qarşı tərəfə açılan tək əlaqə üzərindən daşıyır, hər biri üçün yenidən qoşulub giriş etmək əvəzinə."),
|
||||
("Enable WebRTC P2P connection", "WebRTC P2P əlaqəsini aktivləşdir"),
|
||||
("Enable TCP hole punching", "TCP deşik açmanı aktivləşdir"),
|
||||
("The screen sharing request was declined on the remote device", ""),
|
||||
("The screen sharing request timed out on the remote device", ""),
|
||||
("RustDesk cannot reach the desktop session on the remote device, check that a desktop session is running and that RustDesk can use it", ""),
|
||||
("The desktop portal on the remote device is missing a capability needed for screen sharing or remote control, its backend may not be installed", ""),
|
||||
("Screen sharing was approved on the remote device, but the PipeWire connection could not be opened", ""),
|
||||
("The screen sharing request ended without completing on the remote device", ""),
|
||||
("RustDesk could not obtain a usable screen from the XDG Desktop Portal, the PipeWire library may be too old", ""),
|
||||
("RustDesk could not load a GStreamer component needed for screen capture ({})", ""),
|
||||
("The screen sharing request was declined on the remote device", "Ekran paylaşımı sorğusu uzaq cihazda rədd edildi"),
|
||||
("The screen sharing request timed out on the remote device", "Uzaq cihazda ekran paylaşımı sorğusunun vaxtı bitdi"),
|
||||
("RustDesk cannot reach the desktop session on the remote device, check that a desktop session is running and that RustDesk can use it", "RustDesk uzaq cihazdakı masaüstü sessiyasına çata bilmir, masaüstü sessiyasının işlədiyini və RustDesk-in ondan istifadə edə bildiyini yoxlayın"),
|
||||
("The desktop portal on the remote device is missing a capability needed for screen sharing or remote control, its backend may not be installed", "Uzaq cihazdakı masaüstü portalında ekran paylaşımı və ya uzaqdan idarəetmə üçün lazım olan imkan yoxdur, onun backend-i quraşdırılmamış ola bilər"),
|
||||
("Screen sharing was approved on the remote device, but the PipeWire connection could not be opened", "Ekran paylaşımı uzaq cihazda təsdiqləndi, lakin PipeWire əlaqəsini açmaq alınmadı"),
|
||||
("The screen sharing request ended without completing on the remote device", "Ekran paylaşımı sorğusu uzaq cihazda tamamlanmadan sona çatdı"),
|
||||
("RustDesk could not obtain a usable screen from the XDG Desktop Portal, the PipeWire library may be too old", "RustDesk XDG Desktop Portal-dan istifadəyə yararlı ekran əldə edə bilmədi, PipeWire kitabxanası çox köhnə ola bilər"),
|
||||
("RustDesk could not load a GStreamer component needed for screen capture ({})", "RustDesk ekran çəkilişi üçün lazım olan GStreamer komponentini yükləyə bilmədi ({})"),
|
||||
("Relay fallback delay in seconds", "Ötürücüyə keçid gecikməsi, saniyə"),
|
||||
("relay-fallback-delay-tip", "Artıq qurulmuş ötürücü bağlantı birbaşa WebRTC bağlantısını nə qədər gözləyir, sonra onun əvəzinə istifadə olunur. Yavaş birbaşa bağlantıya daha çox vaxt vermək üçün artırın; birbaşa bağlantının mümkün olmadığı şəbəkələrdə ötürücüyə daha tez keçmək üçün azaldın. Standart 2.5 saniyə üçün boş buraxın."),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", ""),
|
||||
("Keyboard shortcuts", ""),
|
||||
("Configure shortcuts...", ""),
|
||||
("Enable keyboard shortcuts in remote session", ""),
|
||||
("shortcut-page-description", ""),
|
||||
("shortcut-passthrough-tip", ""),
|
||||
("Pass-through to remote", ""),
|
||||
("Reset to defaults", ""),
|
||||
("shortcut-reset-confirm-tip", ""),
|
||||
("Monitor", ""),
|
||||
("Keyboard", ""),
|
||||
("Toggle fullscreen", ""),
|
||||
("Switch to next display", ""),
|
||||
("Switch to previous display", ""),
|
||||
("Switch to next tab", ""),
|
||||
("Switch to previous tab", ""),
|
||||
("Toggle session recording", ""),
|
||||
("Close tab", ""),
|
||||
("Toggle toolbar", ""),
|
||||
("Toggle input source", ""),
|
||||
("Edit", ""),
|
||||
("Save", ""),
|
||||
("Set shortcut", ""),
|
||||
("shortcut-recording-instruction", ""),
|
||||
("shortcut-recording-press-keys-tip", ""),
|
||||
("shortcut-must-include-modifiers", ""),
|
||||
("shortcut-already-bound-to", ""),
|
||||
("Replace", ""),
|
||||
("Valid", ""),
|
||||
("shortcut-mobile-physical-keyboard-tip", ""),
|
||||
("shortcut-key-not-supported", ""),
|
||||
("On", ""),
|
||||
("Off", ""),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", "Səsli zəngə başlamaq üçün «Ekranı paylaş» səhifəsində «Audio çəkilişi» seçimini aktivləşdirin."),
|
||||
("Keyboard shortcuts", "Klaviatura qısayolları"),
|
||||
("Configure shortcuts...", "Qısayolları tənzimlə..."),
|
||||
("Enable keyboard shortcuts in remote session", "Uzaq sessiyada klaviatura qısayollarını aktivləşdir"),
|
||||
("shortcut-page-description", "Aşağıdakı hər sessiya əməliyyatına düymə kombinasiyası təyin edin. Hər təyinatda ən azı bir modifikator düyməsi olmalıdır."),
|
||||
("shortcut-passthrough-tip", "Aktiv olduqda, təyin edilmiş bütün kombinasiyalar uzaq tərəfə ötürülür. Təyinat uzaq tərəfdə sizə lazım olan nə iləsə toqquşduqda faydalıdır."),
|
||||
("Pass-through to remote", "Uzaq tərəfə ötür"),
|
||||
("Reset to defaults", "Standartlara sıfırla"),
|
||||
("shortcut-reset-confirm-tip", "Bu, bütün cari təyinatları standart dəstlə əvəz edəcək. Davam edilsin?"),
|
||||
("Monitor", "Monitor"),
|
||||
("Keyboard", "Klaviatura"),
|
||||
("Toggle fullscreen", "Tam ekranı aç/bağla"),
|
||||
("Switch to next display", "Növbəti ekrana keç"),
|
||||
("Switch to previous display", "Əvvəlki ekrana keç"),
|
||||
("Switch to next tab", "Növbəti taba keç"),
|
||||
("Switch to previous tab", "Əvvəlki taba keç"),
|
||||
("Toggle session recording", "Sessiya yazısını başlat/dayandır"),
|
||||
("Close tab", "Tabı bağla"),
|
||||
("Toggle toolbar", "Alətlər panelini göstər/gizlət"),
|
||||
("Toggle input source", "Giriş mənbəyini dəyiş"),
|
||||
("Edit", "Redaktə et"),
|
||||
("Save", "Yadda saxla"),
|
||||
("Set shortcut", "Qısayol təyin et"),
|
||||
("shortcut-recording-instruction", "İstifadə etmək istədiyiniz düymə kombinasiyasını basın."),
|
||||
("shortcut-recording-press-keys-tip", "Düymə kombinasiyasını basın..."),
|
||||
("shortcut-must-include-modifiers", "Ən azı bir modifikator düyməsi olmalıdır: {}"),
|
||||
("shortcut-already-bound-to", "Artıq təyin edilib:"),
|
||||
("Replace", "Əvəz et"),
|
||||
("Valid", "Keçərlidir"),
|
||||
("shortcut-mobile-physical-keyboard-tip", "Qısayolu qeydə almaq üçün fiziki klaviatura tələb olunur. Ekran klaviaturaları dəstəklənmir."),
|
||||
("shortcut-key-not-supported", "«{}» qısayol kimi istifadə edilə bilməz."),
|
||||
("On", "Açıq"),
|
||||
("Off", "Bağlı"),
|
||||
("api_server_connection_tip", "Fərdi serveriniz şifrələnməmiş HTTP istifadə edir. HTTPS-i aktivləşdirmək üçün administratorunuzla əlaqə saxlayın."),
|
||||
("api_server_empty_tip", "«API serveri» boş olduqda fərdi serveriniz standart olaraq HTTP istifadə edir. HTTPS-i aktivləşdirmək üçün administratorunuzla əlaqə saxlayın."),
|
||||
("RustDesk storage", "RustDesk yaddaşı"),
|
||||
("Other folders", "Digər qovluqlar"),
|
||||
("Choose which folder remote devices can access.", "Uzaq cihazların hansı qovluğa giriş edə biləcəyini seçin."),
|
||||
("android-logs-folder-tip", "Jurnal fayllarını saxlamaq üçün Android → media seçin."),
|
||||
("Choose folder", "Qovluq seç"),
|
||||
("Please select Android → media.", "Zəhmət olmasa, Android → media seçin."),
|
||||
("Trust duration (days)", "Etibar müddəti (gün)"),
|
||||
("Renew trust", "Etibarı yenilə"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
+45
-35
@@ -763,8 +763,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Lock canvas", "Заблакіраваць палатно"),
|
||||
("Sync clipboard between sessions", "Сінхранізаваць буфер абмену паміж сеансамі"),
|
||||
("sync-clipboard-between-sessions-tip", "Тэкст або відарысы, скапіяваныя ў адным аддаленым сеансе, таксама адпраўляюцца ў буфер абмену іншых вашых падключаных сеансаў."),
|
||||
("terminal-clipboard-write-tip", ""),
|
||||
("Allow terminal apps to copy to clipboard", ""),
|
||||
("terminal-clipboard-write-tip", "Праграма ў тэрмінале хоча скапіяваць тэкст у буфер абмену гэтай прылады. Калі даць дазвол, ён будзе дзейнічаць для праграм у тэрмінале ва ўсіх падключэннях, пакуль вы не адключыце яго ў наладах. Ручное капіраванне і ўстаўка не закранаюцца."),
|
||||
("Allow terminal apps to copy to clipboard", "Дазволіць праграмам у тэрмінале капіраваць у буфер абмену"),
|
||||
("Enable", "Уключыць"),
|
||||
("Reuse one connection for port forwarding", "Выкарыстоўваць адно злучэнне для перанакіравання партоў"),
|
||||
("port-forward-mux-tip", "Перадаваць усе злучэнні аднаго перанакіравання партоў праз адно злучэнне з аддаленай прыладай замест паўторнага падлучэння і ўваходу для кожнага з іх."),
|
||||
@@ -780,38 +780,48 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("RustDesk could not load a GStreamer component needed for screen capture ({})", "RustDesk не змог загрузіць кампанент GStreamer, патрэбны для захопу экрана ({})"),
|
||||
("Relay fallback delay in seconds", "Затрымка пераходу на рэтранслятар у секундах"),
|
||||
("relay-fallback-delay-tip", "Колькі часу ўжо ўсталяванае злучэнне праз рэтранслятар чакае прамога злучэння WebRTC, перш чым будзе выкарыстана замест яго. Павялічце, каб даць павольнаму прамому злучэнню больш часу; паменшыце, каб хутчэй пераходзіць на рэтранслятар у сетках, дзе прамое злучэнне немагчымае. Пакіньце пустым для значэння па змаўчанні 2.5 секунды."),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", ""),
|
||||
("Keyboard shortcuts", ""),
|
||||
("Configure shortcuts...", ""),
|
||||
("Enable keyboard shortcuts in remote session", ""),
|
||||
("shortcut-page-description", ""),
|
||||
("shortcut-passthrough-tip", ""),
|
||||
("Pass-through to remote", ""),
|
||||
("Reset to defaults", ""),
|
||||
("shortcut-reset-confirm-tip", ""),
|
||||
("Monitor", ""),
|
||||
("Keyboard", ""),
|
||||
("Toggle fullscreen", ""),
|
||||
("Switch to next display", ""),
|
||||
("Switch to previous display", ""),
|
||||
("Switch to next tab", ""),
|
||||
("Switch to previous tab", ""),
|
||||
("Toggle session recording", ""),
|
||||
("Close tab", ""),
|
||||
("Toggle toolbar", ""),
|
||||
("Toggle input source", ""),
|
||||
("Edit", ""),
|
||||
("Save", ""),
|
||||
("Set shortcut", ""),
|
||||
("shortcut-recording-instruction", ""),
|
||||
("shortcut-recording-press-keys-tip", ""),
|
||||
("shortcut-must-include-modifiers", ""),
|
||||
("shortcut-already-bound-to", ""),
|
||||
("Replace", ""),
|
||||
("Valid", ""),
|
||||
("shortcut-mobile-physical-keyboard-tip", ""),
|
||||
("shortcut-key-not-supported", ""),
|
||||
("On", ""),
|
||||
("Off", ""),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", "Каб пачаць галасавы выклік, уключыце «Захоп аўдыя» на старонцы «Дэманстрацыя экрана»."),
|
||||
("Keyboard shortcuts", "Спалучэнні клавіш"),
|
||||
("Configure shortcuts...", "Наладзіць спалучэнні клавіш..."),
|
||||
("Enable keyboard shortcuts in remote session", "Выкарыстоўваць спалучэнні клавіш у аддаленым сеансе"),
|
||||
("shortcut-page-description", "Прызначце спалучэнне клавіш кожнаму дзеянню сеанса ніжэй. Кожнае прызначэнне павінна ўключаць хаця б адзін мадыфікатар."),
|
||||
("shortcut-passthrough-tip", "Калі ўключана, кожнае прызначанае спалучэнне клавіш перадаецца на аддаленую прыладу. Карысна, калі прызначэнне канфліктуе з чымсьці, што вам патрэбна на аддаленай прыладзе."),
|
||||
("Pass-through to remote", "Перадаваць на аддаленую прыладу"),
|
||||
("Reset to defaults", "Скінуць да стандартных"),
|
||||
("shortcut-reset-confirm-tip", "Усе бягучыя прызначэнні будуць заменены стандартным наборам. Працягнуць?"),
|
||||
("Monitor", "Манітор"),
|
||||
("Keyboard", "Клавіятура"),
|
||||
("Toggle fullscreen", "Пераключыць поўнаэкранны рэжым"),
|
||||
("Switch to next display", "Пераключыцца на наступны дысплэй"),
|
||||
("Switch to previous display", "Пераключыцца на папярэдні дысплэй"),
|
||||
("Switch to next tab", "Пераключыцца на наступную ўкладку"),
|
||||
("Switch to previous tab", "Пераключыцца на папярэднюю ўкладку"),
|
||||
("Toggle session recording", "Пераключыць запіс сеанса"),
|
||||
("Close tab", "Закрыць укладку"),
|
||||
("Toggle toolbar", "Пераключыць панэль інструментаў"),
|
||||
("Toggle input source", "Пераключыць крыніцу ўводу"),
|
||||
("Edit", "Змяніць"),
|
||||
("Save", "Захаваць"),
|
||||
("Set shortcut", "Прызначыць спалучэнне клавіш"),
|
||||
("shortcut-recording-instruction", "Націсніце спалучэнне клавіш, якое хочаце выкарыстоўваць."),
|
||||
("shortcut-recording-press-keys-tip", "Націсніце спалучэнне клавіш..."),
|
||||
("shortcut-must-include-modifiers", "Павінна ўключаць хаця б адзін мадыфікатар: {}"),
|
||||
("shortcut-already-bound-to", "Ужо прызначана для"),
|
||||
("Replace", "Замяніць"),
|
||||
("Valid", "Дапушчальна"),
|
||||
("shortcut-mobile-physical-keyboard-tip", "Для запісу патрэбна фізічная клавіятура. Экранныя клавіятуры не падтрымліваюцца."),
|
||||
("shortcut-key-not-supported", "«{}» нельга выкарыстоўваць як спалучэнне клавіш."),
|
||||
("On", "Укл."),
|
||||
("Off", "Выкл."),
|
||||
("api_server_connection_tip", "Ваш уласны сервер выкарыстоўвае незашыфраваны HTTP. Звярніцеся да адміністратара, каб уключыць HTTPS."),
|
||||
("api_server_empty_tip", "Калі поле «Сервер API» пустое, ваш уласны сервер па змаўчанні выкарыстоўвае HTTP. Звярніцеся да адміністратара, каб уключыць HTTPS."),
|
||||
("RustDesk storage", "Сховішча RustDesk"),
|
||||
("Other folders", "Іншыя папкі"),
|
||||
("Choose which folder remote devices can access.", "Выберыце папку, да якой аддаленыя прылады змогуць атрымаць доступ."),
|
||||
("android-logs-folder-tip", "Выберыце Android → media для захоўвання файлаў журналаў."),
|
||||
("Choose folder", "Выбраць папку"),
|
||||
("Please select Android → media.", "Выберыце Android → media."),
|
||||
("Trust duration (days)", "Тэрмін даверу (у днях)"),
|
||||
("Renew trust", "Падоўжыць давер"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
+45
-35
@@ -763,8 +763,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Lock canvas", "Заключване на платното"),
|
||||
("Sync clipboard between sessions", "Синхронизиране на клипборда между сесиите"),
|
||||
("sync-clipboard-between-sessions-tip", "Текст или изображения, копирани в една отдалечена сесия, се изпращат и към клипборда на другите ви свързани сесии."),
|
||||
("terminal-clipboard-write-tip", ""),
|
||||
("Allow terminal apps to copy to clipboard", ""),
|
||||
("terminal-clipboard-write-tip", "Приложение в терминала иска да копира текст в клипборда на това устройство. Ако бъде дадено, това разрешение важи за терминалните приложения във всички връзки, докато не го изключите от Настройки. Ръчното копиране и поставяне не се засягат."),
|
||||
("Allow terminal apps to copy to clipboard", "Позволяване на терминалните приложения да копират в клипборда"),
|
||||
("Enable", "Активирай"),
|
||||
("Reuse one connection for port forwarding", "Използване на една връзка за пренасочване на портове"),
|
||||
("port-forward-mux-tip", "Всички връзки на едно пренасочване на портове минават през една връзка към отсрещния компютър, вместо да се свързвате и влизате отново за всяка от тях."),
|
||||
@@ -780,38 +780,48 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("RustDesk could not load a GStreamer component needed for screen capture ({})", "RustDesk не можа да зареди компонент на GStreamer, необходим за заснемане на екрана ({})"),
|
||||
("Relay fallback delay in seconds", "Забавяне преди преминаване към препредаване в секунди"),
|
||||
("relay-fallback-delay-tip", "Колко време вече установената връзка чрез препредаване изчаква директната WebRTC връзка, преди да бъде използвана вместо нея. Увеличете, за да дадете повече време на бавна директна връзка; намалете, за да се премине по-бързо към препредаване в мрежи, където директна връзка е невъзможна. Оставете празно за стойността по подразбиране 2.5 секунди."),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", ""),
|
||||
("Keyboard shortcuts", ""),
|
||||
("Configure shortcuts...", ""),
|
||||
("Enable keyboard shortcuts in remote session", ""),
|
||||
("shortcut-page-description", ""),
|
||||
("shortcut-passthrough-tip", ""),
|
||||
("Pass-through to remote", ""),
|
||||
("Reset to defaults", ""),
|
||||
("shortcut-reset-confirm-tip", ""),
|
||||
("Monitor", ""),
|
||||
("Keyboard", ""),
|
||||
("Toggle fullscreen", ""),
|
||||
("Switch to next display", ""),
|
||||
("Switch to previous display", ""),
|
||||
("Switch to next tab", ""),
|
||||
("Switch to previous tab", ""),
|
||||
("Toggle session recording", ""),
|
||||
("Close tab", ""),
|
||||
("Toggle toolbar", ""),
|
||||
("Toggle input source", ""),
|
||||
("Edit", ""),
|
||||
("Save", ""),
|
||||
("Set shortcut", ""),
|
||||
("shortcut-recording-instruction", ""),
|
||||
("shortcut-recording-press-keys-tip", ""),
|
||||
("shortcut-must-include-modifiers", ""),
|
||||
("shortcut-already-bound-to", ""),
|
||||
("Replace", ""),
|
||||
("Valid", ""),
|
||||
("shortcut-mobile-physical-keyboard-tip", ""),
|
||||
("shortcut-key-not-supported", ""),
|
||||
("On", ""),
|
||||
("Off", ""),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", "За да започнете гласово обаждане, включете „Аудиозапис“ на страницата „Сподели екран“."),
|
||||
("Keyboard shortcuts", "Клавишни комбинации"),
|
||||
("Configure shortcuts...", "Настройка на клавишните комбинации..."),
|
||||
("Enable keyboard shortcuts in remote session", "Позволяване на клавишни комбинации в отдалечена сесия"),
|
||||
("shortcut-page-description", "Задайте клавишна комбинация за всяко от действията в сесията по-долу. Всяка комбинация трябва да включва поне един модифициращ клавиш."),
|
||||
("shortcut-passthrough-tip", "Когато е включено, всяка зададена комбинация се препраща към отдалеченото устройство. Полезно е, когато комбинация съвпада с нещо, което ви трябва на отдалеченото устройство."),
|
||||
("Pass-through to remote", "Препращане към отдалеченото устройство"),
|
||||
("Reset to defaults", "Възстановяване по подразбиране"),
|
||||
("shortcut-reset-confirm-tip", "Всички текущи комбинации ще бъдат заменени с тези по подразбиране. Да се продължи ли?"),
|
||||
("Monitor", "Монитор"),
|
||||
("Keyboard", "Клавиатура"),
|
||||
("Toggle fullscreen", "Превключване на цял екран"),
|
||||
("Switch to next display", "Превключване към следващия екран"),
|
||||
("Switch to previous display", "Превключване към предишния екран"),
|
||||
("Switch to next tab", "Превключване към следващия раздел"),
|
||||
("Switch to previous tab", "Превключване към предишния раздел"),
|
||||
("Toggle session recording", "Превключване на записа на сесията"),
|
||||
("Close tab", "Затваряне на раздела"),
|
||||
("Toggle toolbar", "Превключване на лентата с инструменти"),
|
||||
("Toggle input source", "Превключване на източника на въвеждане"),
|
||||
("Edit", "Редактиране"),
|
||||
("Save", "Запазване"),
|
||||
("Set shortcut", "Задаване на комбинация"),
|
||||
("shortcut-recording-instruction", "Натиснете клавишната комбинация, която искате да използвате."),
|
||||
("shortcut-recording-press-keys-tip", "Натиснете клавишна комбинация..."),
|
||||
("shortcut-must-include-modifiers", "Трябва да включва поне един модифициращ клавиш: {}"),
|
||||
("shortcut-already-bound-to", "Вече е зададена за"),
|
||||
("Replace", "Замяна"),
|
||||
("Valid", "Валидна"),
|
||||
("shortcut-mobile-physical-keyboard-tip", "Записването изисква физическа клавиатура. Екранните клавиатури не се поддържат."),
|
||||
("shortcut-key-not-supported", "„{}“ не може да се използва като клавишна комбинация."),
|
||||
("On", "Вкл."),
|
||||
("Off", "Изкл."),
|
||||
("api_server_connection_tip", "Вашият собствен сървър използва некриптиран HTTP. Свържете се с администратора си, за да включи HTTPS."),
|
||||
("api_server_empty_tip", "Когато полето „API сървър“ е празно, вашият собствен сървър по подразбиране използва HTTP. Свържете се с администратора си, за да включи HTTPS."),
|
||||
("RustDesk storage", "Хранилище на RustDesk"),
|
||||
("Other folders", "Други папки"),
|
||||
("Choose which folder remote devices can access.", "Изберете до коя папка да имат достъп отдалечените устройства."),
|
||||
("android-logs-folder-tip", "Изберете Android → media за съхраняване на файловете с дневници."),
|
||||
("Choose folder", "Избор на папка"),
|
||||
("Please select Android → media.", "Моля, изберете Android → media."),
|
||||
("Trust duration (days)", "Срок на доверие (дни)"),
|
||||
("Renew trust", "Подновяване на доверието"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
+45
-35
@@ -763,8 +763,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Lock canvas", "Bloca el llenç"),
|
||||
("Sync clipboard between sessions", "Sincronitza el porta-retalls entre sessions"),
|
||||
("sync-clipboard-between-sessions-tip", "El text o les imatges copiats en una sessió remota també s'envien al porta-retalls de les altres sessions connectades."),
|
||||
("terminal-clipboard-write-tip", ""),
|
||||
("Allow terminal apps to copy to clipboard", ""),
|
||||
("terminal-clipboard-write-tip", "Una aplicació del terminal vol copiar text al porta-retalls d'aquest dispositiu. Si ho permeteu, aquest permís s'aplica a les aplicacions de terminal en totes les connexions fins que el desactiveu a Configuració. Copiar i enganxar manualment no es veu afectat."),
|
||||
("Allow terminal apps to copy to clipboard", "Permet que les aplicacions de terminal copiïn al porta-retalls"),
|
||||
("Enable", "Habilita"),
|
||||
("Reuse one connection for port forwarding", "Reutilitza una connexió per a la redirecció de ports"),
|
||||
("port-forward-mux-tip", "Fa passar totes les connexions d'una redirecció de ports per una única connexió amb l'altre equip, en lloc de connectar i iniciar la sessió de nou per a cadascuna."),
|
||||
@@ -780,38 +780,48 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("RustDesk could not load a GStreamer component needed for screen capture ({})", "El RustDesk no ha pogut carregar un component del GStreamer necessari per capturar la pantalla ({})"),
|
||||
("Relay fallback delay in seconds", "Retard abans de recórrer al relé en segons"),
|
||||
("relay-fallback-delay-tip", "Quant de temps espera una connexió de relé ja establerta la connexió directa WebRTC abans d'utilitzar-se en lloc seu. Augmenteu-lo per donar més temps a una connexió directa lenta; reduïu-lo per passar abans al relé en xarxes on no es pot fer una connexió directa. Deixeu-lo buit per al valor predeterminat de 2.5 segons."),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", ""),
|
||||
("Keyboard shortcuts", ""),
|
||||
("Configure shortcuts...", ""),
|
||||
("Enable keyboard shortcuts in remote session", ""),
|
||||
("shortcut-page-description", ""),
|
||||
("shortcut-passthrough-tip", ""),
|
||||
("Pass-through to remote", ""),
|
||||
("Reset to defaults", ""),
|
||||
("shortcut-reset-confirm-tip", ""),
|
||||
("Monitor", ""),
|
||||
("Keyboard", ""),
|
||||
("Toggle fullscreen", ""),
|
||||
("Switch to next display", ""),
|
||||
("Switch to previous display", ""),
|
||||
("Switch to next tab", ""),
|
||||
("Switch to previous tab", ""),
|
||||
("Toggle session recording", ""),
|
||||
("Close tab", ""),
|
||||
("Toggle toolbar", ""),
|
||||
("Toggle input source", ""),
|
||||
("Edit", ""),
|
||||
("Save", ""),
|
||||
("Set shortcut", ""),
|
||||
("shortcut-recording-instruction", ""),
|
||||
("shortcut-recording-press-keys-tip", ""),
|
||||
("shortcut-must-include-modifiers", ""),
|
||||
("shortcut-already-bound-to", ""),
|
||||
("Replace", ""),
|
||||
("Valid", ""),
|
||||
("shortcut-mobile-physical-keyboard-tip", ""),
|
||||
("shortcut-key-not-supported", ""),
|
||||
("On", ""),
|
||||
("Off", ""),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", "Per iniciar una trucada de veu, habiliteu «Captura d'àudio» a la pàgina «Compartició de pantalla»."),
|
||||
("Keyboard shortcuts", "Dreceres de teclat"),
|
||||
("Configure shortcuts...", "Configura les dreceres..."),
|
||||
("Enable keyboard shortcuts in remote session", "Habilita les dreceres de teclat a la sessió remota"),
|
||||
("shortcut-page-description", "Assigneu una combinació de tecles a cadascuna de les accions de sessió següents. Cada assignació ha d'incloure almenys una tecla modificadora."),
|
||||
("shortcut-passthrough-tip", "Quan està activat, totes les combinacions assignades s'envien al dispositiu remot. És útil quan una assignació entra en conflicte amb alguna cosa que necessiteu al dispositiu remot."),
|
||||
("Pass-through to remote", "Envia al dispositiu remot"),
|
||||
("Reset to defaults", "Restableix els valors per defecte"),
|
||||
("shortcut-reset-confirm-tip", "Això substituirà totes les assignacions actuals per les predeterminades. Voleu continuar?"),
|
||||
("Monitor", "Monitor"),
|
||||
("Keyboard", "Teclat"),
|
||||
("Toggle fullscreen", "Commuta la pantalla completa"),
|
||||
("Switch to next display", "Canvia a la pantalla següent"),
|
||||
("Switch to previous display", "Canvia a la pantalla anterior"),
|
||||
("Switch to next tab", "Canvia a la pestanya següent"),
|
||||
("Switch to previous tab", "Canvia a la pestanya anterior"),
|
||||
("Toggle session recording", "Inicia/atura la gravació de la sessió"),
|
||||
("Close tab", "Tanca la pestanya"),
|
||||
("Toggle toolbar", "Mostra/amaga la barra d'eines"),
|
||||
("Toggle input source", "Commuta la font d'entrada"),
|
||||
("Edit", "Edita"),
|
||||
("Save", "Desa"),
|
||||
("Set shortcut", "Defineix la drecera"),
|
||||
("shortcut-recording-instruction", "Premeu la combinació de tecles que voleu utilitzar."),
|
||||
("shortcut-recording-press-keys-tip", "Premeu una combinació de tecles..."),
|
||||
("shortcut-must-include-modifiers", "Ha d'incloure almenys una tecla modificadora: {}"),
|
||||
("shortcut-already-bound-to", "Ja assignada a"),
|
||||
("Replace", "Substitueix"),
|
||||
("Valid", "Vàlida"),
|
||||
("shortcut-mobile-physical-keyboard-tip", "Per gravar una drecera cal un teclat físic. Els teclats virtuals no són compatibles."),
|
||||
("shortcut-key-not-supported", "«{}» no es pot utilitzar com a drecera."),
|
||||
("On", "Activat"),
|
||||
("Off", "Desactivat"),
|
||||
("api_server_connection_tip", "El vostre servidor personalitzat utilitza HTTP sense xifrar. Contacteu amb l'administrador per habilitar HTTPS."),
|
||||
("api_server_empty_tip", "Si el camp «Clau API del servidor» és buit, el vostre servidor personalitzat utilitza HTTP per defecte. Contacteu amb l'administrador per habilitar HTTPS."),
|
||||
("RustDesk storage", "Emmagatzematge del RustDesk"),
|
||||
("Other folders", "Altres carpetes"),
|
||||
("Choose which folder remote devices can access.", "Trieu a quina carpeta poden accedir els dispositius remots."),
|
||||
("android-logs-folder-tip", "Trieu Android → media per desar els fitxers de registre."),
|
||||
("Choose folder", "Tria una carpeta"),
|
||||
("Please select Android → media.", "Seleccioneu Android → media."),
|
||||
("Trust duration (days)", "Durada de la confiança (dies)"),
|
||||
("Renew trust", "Renova la confiança"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -813,5 +813,15 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("shortcut-key-not-supported", "“{}” 不能用作快捷键。"),
|
||||
("On", "开"),
|
||||
("Off", "关"),
|
||||
("api_server_connection_tip", "自定义服务器正在使用未加密的 HTTP。请联系管理员启用 HTTPS。"),
|
||||
("api_server_empty_tip", "API 服务器留空时,自定义服务器默认使用 HTTP。请联系管理员启用 HTTPS。"),
|
||||
("RustDesk storage", "RustDesk 存储空间"),
|
||||
("Other folders", "其他文件夹"),
|
||||
("Choose which folder remote devices can access.", "选择允许远程设备访问的文件夹。"),
|
||||
("android-logs-folder-tip", "请选择 Android → media,用于保存日志。"),
|
||||
("Choose folder", "选择文件夹"),
|
||||
("Please select Android → media.", "请选择 Android → media。"),
|
||||
("Trust duration (days)", "信任有效期(天)"),
|
||||
("Renew trust", "延长信任有效期"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
+45
-35
@@ -763,8 +763,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Lock canvas", "Zamknout zobrazení"),
|
||||
("Sync clipboard between sessions", "Synchronizovat schránku mezi relacemi"),
|
||||
("sync-clipboard-between-sessions-tip", "Text nebo obrázky zkopírované v jedné vzdálené relaci se odešlou i do schránky ostatních připojených relací."),
|
||||
("terminal-clipboard-write-tip", ""),
|
||||
("Allow terminal apps to copy to clipboard", ""),
|
||||
("terminal-clipboard-write-tip", "Aplikace v terminálu chce zkopírovat text do schránky tohoto zařízení. Pokud to povolíte, toto oprávnění bude platit pro terminálové aplikace ve všech připojeních, dokud ho nevypnete v Nastavení. Ruční kopírování a vkládání tím není ovlivněno."),
|
||||
("Allow terminal apps to copy to clipboard", "Povolit terminálovým aplikacím kopírovat do schránky"),
|
||||
("Enable", "Povolit"),
|
||||
("Reuse one connection for port forwarding", "Znovu použít jedno připojení pro přesměrování portů"),
|
||||
("port-forward-mux-tip", "Vede všechna připojení jednoho přesměrování portů přes jediné připojení k protějšku místo opakovaného připojování a přihlašování pro každé z nich."),
|
||||
@@ -780,38 +780,48 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("RustDesk could not load a GStreamer component needed for screen capture ({})", "RustDesk nemohl načíst komponentu GStreameru potřebnou k zachycení obrazovky ({})"),
|
||||
("Relay fallback delay in seconds", "Prodleva před přepnutím na přenos v sekundách"),
|
||||
("relay-fallback-delay-tip", "Jak dlouho již navázané spojení přes přenos čeká na přímé spojení WebRTC, než bude použito místo něj. Zvyšte, aby pomalé přímé spojení mělo více času uspět; snižte, aby se v sítích, kde přímé spojení není možné, dříve přešlo na přenos. Ponechte prázdné pro výchozí hodnotu 2.5 sekundy."),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", ""),
|
||||
("Keyboard shortcuts", ""),
|
||||
("Configure shortcuts...", ""),
|
||||
("Enable keyboard shortcuts in remote session", ""),
|
||||
("shortcut-page-description", ""),
|
||||
("shortcut-passthrough-tip", ""),
|
||||
("Pass-through to remote", ""),
|
||||
("Reset to defaults", ""),
|
||||
("shortcut-reset-confirm-tip", ""),
|
||||
("Monitor", ""),
|
||||
("Keyboard", ""),
|
||||
("Toggle fullscreen", ""),
|
||||
("Switch to next display", ""),
|
||||
("Switch to previous display", ""),
|
||||
("Switch to next tab", ""),
|
||||
("Switch to previous tab", ""),
|
||||
("Toggle session recording", ""),
|
||||
("Close tab", ""),
|
||||
("Toggle toolbar", ""),
|
||||
("Toggle input source", ""),
|
||||
("Edit", ""),
|
||||
("Save", ""),
|
||||
("Set shortcut", ""),
|
||||
("shortcut-recording-instruction", ""),
|
||||
("shortcut-recording-press-keys-tip", ""),
|
||||
("shortcut-must-include-modifiers", ""),
|
||||
("shortcut-already-bound-to", ""),
|
||||
("Replace", ""),
|
||||
("Valid", ""),
|
||||
("shortcut-mobile-physical-keyboard-tip", ""),
|
||||
("shortcut-key-not-supported", ""),
|
||||
("On", ""),
|
||||
("Off", ""),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", "Pro zahájení hlasového volání povolte „Zachytávání zvuku“ na stránce „Sdílet obrazovku“."),
|
||||
("Keyboard shortcuts", "Klávesové zkratky"),
|
||||
("Configure shortcuts...", "Nastavit zkratky..."),
|
||||
("Enable keyboard shortcuts in remote session", "Povolit klávesové zkratky ve vzdálené relaci"),
|
||||
("shortcut-page-description", "Přiřaďte kombinaci kláves ke každé z níže uvedených akcí relace. Každá zkratka musí obsahovat alespoň jednu modifikační klávesu."),
|
||||
("shortcut-passthrough-tip", "Je-li zapnuto, každá přiřazená kombinace se předá vzdálené straně. Hodí se, když zkratka koliduje s něčím, co potřebujete na vzdálené straně."),
|
||||
("Pass-through to remote", "Předávat vzdálené straně"),
|
||||
("Reset to defaults", "Obnovit výchozí"),
|
||||
("shortcut-reset-confirm-tip", "Všechna aktuální přiřazení budou nahrazena výchozí sadou. Pokračovat?"),
|
||||
("Monitor", "Monitor"),
|
||||
("Keyboard", "Klávesnice"),
|
||||
("Toggle fullscreen", "Přepnout celou obrazovku"),
|
||||
("Switch to next display", "Přepnout na další obrazovku"),
|
||||
("Switch to previous display", "Přepnout na předchozí obrazovku"),
|
||||
("Switch to next tab", "Přepnout na další kartu"),
|
||||
("Switch to previous tab", "Přepnout na předchozí kartu"),
|
||||
("Toggle session recording", "Spustit/zastavit záznam relace"),
|
||||
("Close tab", "Zavřít kartu"),
|
||||
("Toggle toolbar", "Zobrazit/skrýt panel nástrojů"),
|
||||
("Toggle input source", "Přepnout zdroj vstupu"),
|
||||
("Edit", "Upravit"),
|
||||
("Save", "Uložit"),
|
||||
("Set shortcut", "Nastavit zkratku"),
|
||||
("shortcut-recording-instruction", "Stiskněte kombinaci kláves, kterou chcete použít."),
|
||||
("shortcut-recording-press-keys-tip", "Stiskněte kombinaci kláves..."),
|
||||
("shortcut-must-include-modifiers", "Musí obsahovat alespoň jednu modifikační klávesu: {}"),
|
||||
("shortcut-already-bound-to", "Již přiřazeno akci"),
|
||||
("Replace", "Nahradit"),
|
||||
("Valid", "Platná"),
|
||||
("shortcut-mobile-physical-keyboard-tip", "Záznam vyžaduje fyzickou klávesnici. Softwarové klávesnice nejsou podporovány."),
|
||||
("shortcut-key-not-supported", "„{}“ nelze použít jako zkratku."),
|
||||
("On", "Zapnuto"),
|
||||
("Off", "Vypnuto"),
|
||||
("api_server_connection_tip", "Váš vlastní server používá nešifrovaný HTTP. Pro povolení HTTPS kontaktujte svého správce."),
|
||||
("api_server_empty_tip", "Pokud je API Server prázdný, váš vlastní server ve výchozím nastavení používá HTTP. Pro povolení HTTPS kontaktujte svého správce."),
|
||||
("RustDesk storage", "Úložiště RustDesk"),
|
||||
("Other folders", "Jiné složky"),
|
||||
("Choose which folder remote devices can access.", "Vyberte složku, ke které mohou mít vzdálená zařízení přístup."),
|
||||
("android-logs-folder-tip", "Pro ukládání souborů protokolu vyberte Android → media."),
|
||||
("Choose folder", "Vybrat složku"),
|
||||
("Please select Android → media.", "Vyberte prosím Android → media."),
|
||||
("Trust duration (days)", "Doba důvěry (dny)"),
|
||||
("Renew trust", "Obnovit důvěru"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
+45
-35
@@ -763,8 +763,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Lock canvas", "Lås lærred"),
|
||||
("Sync clipboard between sessions", "Synkroniser udklipsholder mellem sessioner"),
|
||||
("sync-clipboard-between-sessions-tip", "Tekst eller billeder, der kopieres i én fjernsession, sendes også til udklipsholderen i dine andre forbundne sessioner."),
|
||||
("terminal-clipboard-write-tip", ""),
|
||||
("Allow terminal apps to copy to clipboard", ""),
|
||||
("terminal-clipboard-write-tip", "En app i terminalen vil kopiere tekst til denne enheds udklipsholder. Hvis du giver tilladelse, gælder den for terminalapps i alle forbindelser, indtil du slår den fra i Indstillinger. Manuel kopiering og indsættelse påvirkes ikke."),
|
||||
("Allow terminal apps to copy to clipboard", "Tillad terminalapps at kopiere til udklipsholderen"),
|
||||
("Enable", "Aktivér"),
|
||||
("Reuse one connection for port forwarding", "Genbrug én forbindelse til portvideresendelse"),
|
||||
("port-forward-mux-tip", "Fører alle forbindelser i en portvideresendelse gennem én enkelt forbindelse til modparten i stedet for at forbinde og logge ind igen for hver enkelt."),
|
||||
@@ -780,38 +780,48 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("RustDesk could not load a GStreamer component needed for screen capture ({})", "RustDesk kunne ikke indlæse en GStreamer-komponent, der kræves til skærmoptagelse ({})"),
|
||||
("Relay fallback delay in seconds", "Forsinkelse før brug af relæ i sekunder"),
|
||||
("relay-fallback-delay-tip", "Hvor længe en allerede oprettet relæforbindelse venter på den direkte WebRTC-forbindelse, før den bruges i stedet. Forøg for at give en langsom direkte forbindelse mere tid; sænk for hurtigere at falde tilbage til relæet på netværk, hvor en direkte forbindelse ikke kan oprettes. Lad feltet stå tomt for standardværdien 2.5 sekunder."),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", ""),
|
||||
("Keyboard shortcuts", ""),
|
||||
("Configure shortcuts...", ""),
|
||||
("Enable keyboard shortcuts in remote session", ""),
|
||||
("shortcut-page-description", ""),
|
||||
("shortcut-passthrough-tip", ""),
|
||||
("Pass-through to remote", ""),
|
||||
("Reset to defaults", ""),
|
||||
("shortcut-reset-confirm-tip", ""),
|
||||
("Monitor", ""),
|
||||
("Keyboard", ""),
|
||||
("Toggle fullscreen", ""),
|
||||
("Switch to next display", ""),
|
||||
("Switch to previous display", ""),
|
||||
("Switch to next tab", ""),
|
||||
("Switch to previous tab", ""),
|
||||
("Toggle session recording", ""),
|
||||
("Close tab", ""),
|
||||
("Toggle toolbar", ""),
|
||||
("Toggle input source", ""),
|
||||
("Edit", ""),
|
||||
("Save", ""),
|
||||
("Set shortcut", ""),
|
||||
("shortcut-recording-instruction", ""),
|
||||
("shortcut-recording-press-keys-tip", ""),
|
||||
("shortcut-must-include-modifiers", ""),
|
||||
("shortcut-already-bound-to", ""),
|
||||
("Replace", ""),
|
||||
("Valid", ""),
|
||||
("shortcut-mobile-physical-keyboard-tip", ""),
|
||||
("shortcut-key-not-supported", ""),
|
||||
("On", ""),
|
||||
("Off", ""),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", "Aktivér \"Lydoptagelse\" på siden \"Del skærmen\" for at starte et stemmeopkald."),
|
||||
("Keyboard shortcuts", "Tastaturgenveje"),
|
||||
("Configure shortcuts...", "Konfigurér genveje..."),
|
||||
("Enable keyboard shortcuts in remote session", "Aktivér tastaturgenveje i fjernsessionen"),
|
||||
("shortcut-page-description", "Tildel en tastekombination til hver sessionshandling nedenfor. Hver tildeling skal indeholde mindst én modifikatortast."),
|
||||
("shortcut-passthrough-tip", "Når denne er slået til, videresendes alle tildelte kombinationer til fjernenheden. Nyttigt, når en tildeling kolliderer med noget, du har brug for på fjernenheden."),
|
||||
("Pass-through to remote", "Videresend til fjernenheden"),
|
||||
("Reset to defaults", "Nulstil til standard"),
|
||||
("shortcut-reset-confirm-tip", "Dette erstatter alle nuværende tildelinger med standardsættet. Vil du fortsætte?"),
|
||||
("Monitor", "Skærm"),
|
||||
("Keyboard", "Tastatur"),
|
||||
("Toggle fullscreen", "Slå fuld skærm til/fra"),
|
||||
("Switch to next display", "Skift til næste skærm"),
|
||||
("Switch to previous display", "Skift til forrige skærm"),
|
||||
("Switch to next tab", "Skift til næste fane"),
|
||||
("Switch to previous tab", "Skift til forrige fane"),
|
||||
("Toggle session recording", "Slå sessionsoptagelse til/fra"),
|
||||
("Close tab", "Luk fane"),
|
||||
("Toggle toolbar", "Vis/skjul værktøjslinje"),
|
||||
("Toggle input source", "Skift inputkilde"),
|
||||
("Edit", "Redigér"),
|
||||
("Save", "Gem"),
|
||||
("Set shortcut", "Angiv genvej"),
|
||||
("shortcut-recording-instruction", "Tryk på den tastekombination, du vil bruge."),
|
||||
("shortcut-recording-press-keys-tip", "Tryk på en tastekombination..."),
|
||||
("shortcut-must-include-modifiers", "Skal indeholde mindst én modifikatortast: {}"),
|
||||
("shortcut-already-bound-to", "Allerede tildelt til"),
|
||||
("Replace", "Erstat"),
|
||||
("Valid", "Gyldig"),
|
||||
("shortcut-mobile-physical-keyboard-tip", "Optagelse kræver et fysisk tastatur. Skærmtastaturer understøttes ikke."),
|
||||
("shortcut-key-not-supported", "\"{}\" kan ikke bruges som genvej."),
|
||||
("On", "Til"),
|
||||
("Off", "Fra"),
|
||||
("api_server_connection_tip", "Din brugerdefinerede server bruger ukrypteret HTTP. Kontakt din administrator for at aktivere HTTPS."),
|
||||
("api_server_empty_tip", "Når API Server er tom, bruger din brugerdefinerede server HTTP som standard. Kontakt din administrator for at aktivere HTTPS."),
|
||||
("RustDesk storage", "RustDesk-lager"),
|
||||
("Other folders", "Andre mapper"),
|
||||
("Choose which folder remote devices can access.", "Vælg, hvilken mappe fjernenheder kan få adgang til."),
|
||||
("android-logs-folder-tip", "Vælg Android → media for at gemme logfiler."),
|
||||
("Choose folder", "Vælg mappe"),
|
||||
("Please select Android → media.", "Vælg Android → media."),
|
||||
("Trust duration (days)", "Tillidsperiode (dage)"),
|
||||
("Renew trust", "Forny tillid"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
+45
-35
@@ -763,8 +763,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Lock canvas", "Sichtfeld sperren"),
|
||||
("Sync clipboard between sessions", "Zwischenablage zwischen Sitzungen synchronisieren"),
|
||||
("sync-clipboard-between-sessions-tip", "In einer Remote-Sitzung kopierter Text oder kopierte Bilder werden auch an die Zwischenablage Ihrer anderen verbundenen Sitzungen gesendet."),
|
||||
("terminal-clipboard-write-tip", ""),
|
||||
("Allow terminal apps to copy to clipboard", ""),
|
||||
("terminal-clipboard-write-tip", "Eine App im Terminal möchte Text in die Zwischenablage dieses Geräts kopieren. Wenn Sie dies erlauben, gilt diese Berechtigung für Terminal-Apps in allen Verbindungen, bis Sie sie in den Einstellungen deaktivieren. Manuelles Kopieren und Einfügen ist davon nicht betroffen."),
|
||||
("Allow terminal apps to copy to clipboard", "Terminal-Apps das Kopieren in die Zwischenablage erlauben"),
|
||||
("Enable", "Aktivieren"),
|
||||
("Reuse one connection for port forwarding", "Eine Verbindung für die Portweiterleitung wiederverwenden"),
|
||||
("port-forward-mux-tip", "Alle Verbindungen einer Portweiterleitung über eine einzige Verbindung zur Gegenstelle führen, statt sich für jede einzelne neu zu verbinden und anzumelden."),
|
||||
@@ -780,38 +780,48 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("RustDesk could not load a GStreamer component needed for screen capture ({})", "RustDesk konnte eine für die Bildschirmaufnahme benötigte GStreamer-Komponente nicht laden ({})"),
|
||||
("Relay fallback delay in seconds", "Verzögerung bis zum Relais in Sekunden"),
|
||||
("relay-fallback-delay-tip", "Wie lange eine bereits aufgebaute Relaisverbindung auf die direkte WebRTC-Verbindung wartet, bevor sie stattdessen verwendet wird. Erhöhen Sie den Wert, um einer langsamen direkten Verbindung mehr Zeit zu geben; verringern Sie ihn, um in Netzwerken ohne mögliche Direktverbindung schneller auf das Relais zurückzufallen. Leer lassen für den Standardwert von 2.5 Sekunden."),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", ""),
|
||||
("Keyboard shortcuts", ""),
|
||||
("Configure shortcuts...", ""),
|
||||
("Enable keyboard shortcuts in remote session", ""),
|
||||
("shortcut-page-description", ""),
|
||||
("shortcut-passthrough-tip", ""),
|
||||
("Pass-through to remote", ""),
|
||||
("Reset to defaults", ""),
|
||||
("shortcut-reset-confirm-tip", ""),
|
||||
("Monitor", ""),
|
||||
("Keyboard", ""),
|
||||
("Toggle fullscreen", ""),
|
||||
("Switch to next display", ""),
|
||||
("Switch to previous display", ""),
|
||||
("Switch to next tab", ""),
|
||||
("Switch to previous tab", ""),
|
||||
("Toggle session recording", ""),
|
||||
("Close tab", ""),
|
||||
("Toggle toolbar", ""),
|
||||
("Toggle input source", ""),
|
||||
("Edit", ""),
|
||||
("Save", ""),
|
||||
("Set shortcut", ""),
|
||||
("shortcut-recording-instruction", ""),
|
||||
("shortcut-recording-press-keys-tip", ""),
|
||||
("shortcut-must-include-modifiers", ""),
|
||||
("shortcut-already-bound-to", ""),
|
||||
("Replace", ""),
|
||||
("Valid", ""),
|
||||
("shortcut-mobile-physical-keyboard-tip", ""),
|
||||
("shortcut-key-not-supported", ""),
|
||||
("On", ""),
|
||||
("Off", ""),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", "Um einen Sprachanruf zu starten, aktivieren Sie \"Audioaufnahme\" auf der Seite \"Bildschirm freigeben\"."),
|
||||
("Keyboard shortcuts", "Tastenkürzel"),
|
||||
("Configure shortcuts...", "Tastenkürzel konfigurieren …"),
|
||||
("Enable keyboard shortcuts in remote session", "Tastenkürzel in der Remote-Sitzung aktivieren"),
|
||||
("shortcut-page-description", "Weisen Sie jeder der folgenden Sitzungsaktionen eine Tastenkombination zu. Jede Belegung muss mindestens eine Modifikatortaste enthalten."),
|
||||
("shortcut-passthrough-tip", "Wenn aktiviert, werden alle belegten Tastenkombinationen an die Gegenstelle weitergeleitet. Nützlich, wenn eine Belegung mit etwas kollidiert, das Sie auf der Gegenstelle benötigen."),
|
||||
("Pass-through to remote", "An Gegenstelle weiterleiten"),
|
||||
("Reset to defaults", "Auf Standard zurücksetzen"),
|
||||
("shortcut-reset-confirm-tip", "Dadurch werden alle aktuellen Belegungen durch die Standardbelegung ersetzt. Fortfahren?"),
|
||||
("Monitor", "Monitor"),
|
||||
("Keyboard", "Tastatur"),
|
||||
("Toggle fullscreen", "Vollbild umschalten"),
|
||||
("Switch to next display", "Zum nächsten Bildschirm wechseln"),
|
||||
("Switch to previous display", "Zum vorherigen Bildschirm wechseln"),
|
||||
("Switch to next tab", "Zum nächsten Tab wechseln"),
|
||||
("Switch to previous tab", "Zum vorherigen Tab wechseln"),
|
||||
("Toggle session recording", "Sitzungsaufzeichnung starten/beenden"),
|
||||
("Close tab", "Tab schließen"),
|
||||
("Toggle toolbar", "Symbolleiste ein-/ausblenden"),
|
||||
("Toggle input source", "Eingangsquelle umschalten"),
|
||||
("Edit", "Bearbeiten"),
|
||||
("Save", "Speichern"),
|
||||
("Set shortcut", "Tastenkürzel festlegen"),
|
||||
("shortcut-recording-instruction", "Drücken Sie die Tastenkombination, die Sie verwenden möchten."),
|
||||
("shortcut-recording-press-keys-tip", "Tastenkombination drücken …"),
|
||||
("shortcut-must-include-modifiers", "Muss mindestens eine Modifikatortaste enthalten: {}"),
|
||||
("shortcut-already-bound-to", "Bereits zugewiesen an"),
|
||||
("Replace", "Ersetzen"),
|
||||
("Valid", "Gültig"),
|
||||
("shortcut-mobile-physical-keyboard-tip", "Zum Erfassen ist eine physische Tastatur erforderlich. Bildschirmtastaturen werden nicht unterstützt."),
|
||||
("shortcut-key-not-supported", "\"{}\" kann nicht als Tastenkürzel verwendet werden."),
|
||||
("On", "Ein"),
|
||||
("Off", "Aus"),
|
||||
("api_server_connection_tip", "Ihr benutzerdefinierter Server verwendet unverschlüsseltes HTTP. Wenden Sie sich an Ihren Administrator, um HTTPS zu aktivieren."),
|
||||
("api_server_empty_tip", "Wenn der API-Server leer ist, verwendet Ihr benutzerdefinierter Server standardmäßig HTTP. Wenden Sie sich an Ihren Administrator, um HTTPS zu aktivieren."),
|
||||
("RustDesk storage", "RustDesk-Speicher"),
|
||||
("Other folders", "Andere Ordner"),
|
||||
("Choose which folder remote devices can access.", "Wählen Sie, auf welchen Ordner entfernte Geräte zugreifen können."),
|
||||
("android-logs-folder-tip", "Wählen Sie Android → media, um Protokolldateien zu speichern."),
|
||||
("Choose folder", "Ordner auswählen"),
|
||||
("Please select Android → media.", "Bitte wählen Sie Android → media."),
|
||||
("Trust duration (days)", "Vertrauensdauer (Tage)"),
|
||||
("Renew trust", "Vertrauen erneuern"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
+45
-35
@@ -763,8 +763,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Lock canvas", "Κλείδωμα καμβά"),
|
||||
("Sync clipboard between sessions", "Συγχρονισμός προχείρου μεταξύ συνεδριών"),
|
||||
("sync-clipboard-between-sessions-tip", "Κείμενο ή εικόνες που αντιγράφονται σε μία απομακρυσμένη συνεδρία αποστέλλονται και στο πρόχειρο των άλλων συνδεδεμένων συνεδριών σας."),
|
||||
("terminal-clipboard-write-tip", ""),
|
||||
("Allow terminal apps to copy to clipboard", ""),
|
||||
("terminal-clipboard-write-tip", "Μια εφαρμογή στο τερματικό θέλει να αντιγράψει κείμενο στο πρόχειρο αυτής της συσκευής. Αν επιτραπεί, αυτή η άδεια ισχύει για τις εφαρμογές τερματικού σε όλες τις συνδέσεις μέχρι να την απενεργοποιήσετε στις Ρυθμίσεις. Η χειροκίνητη αντιγραφή και επικόλληση δεν επηρεάζονται."),
|
||||
("Allow terminal apps to copy to clipboard", "Να επιτρέπεται στις εφαρμογές τερματικού η αντιγραφή στο πρόχειρο"),
|
||||
("Enable", "Ενεργοποίηση"),
|
||||
("Reuse one connection for port forwarding", "Επαναχρησιμοποίηση μίας σύνδεσης για την προώθηση θυρών"),
|
||||
("port-forward-mux-tip", "Όλες οι συνδέσεις μιας προώθησης θυρών περνούν από μία μόνο σύνδεση προς τον απομακρυσμένο υπολογιστή, αντί να πραγματοποιείται νέα σύνδεση και ταυτοποίηση για κάθε μία."),
|
||||
@@ -780,38 +780,48 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("RustDesk could not load a GStreamer component needed for screen capture ({})", "Το RustDesk δεν μπόρεσε να φορτώσει ένα στοιχείο του GStreamer που απαιτείται για την καταγραφή οθόνης ({})"),
|
||||
("Relay fallback delay in seconds", "Καθυστέρηση πριν από τη χρήση αναμεταδότη σε δευτερόλεπτα"),
|
||||
("relay-fallback-delay-tip", "Πόσο χρόνο περιμένει μια ήδη ενεργή σύνδεση αναμεταδότη την απευθείας σύνδεση WebRTC πριν χρησιμοποιηθεί στη θέση της. Αυξήστε το για να δώσετε σε μια αργή απευθείας σύνδεση περισσότερο χρόνο. Μειώστε το για ταχύτερη επιστροφή στον αναμεταδότη σε δίκτυα όπου δεν είναι δυνατή η απευθείας σύνδεση. Αφήστε το κενό για την προεπιλογή των 2.5 δευτερολέπτων."),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", ""),
|
||||
("Keyboard shortcuts", ""),
|
||||
("Configure shortcuts...", ""),
|
||||
("Enable keyboard shortcuts in remote session", ""),
|
||||
("shortcut-page-description", ""),
|
||||
("shortcut-passthrough-tip", ""),
|
||||
("Pass-through to remote", ""),
|
||||
("Reset to defaults", ""),
|
||||
("shortcut-reset-confirm-tip", ""),
|
||||
("Monitor", ""),
|
||||
("Keyboard", ""),
|
||||
("Toggle fullscreen", ""),
|
||||
("Switch to next display", ""),
|
||||
("Switch to previous display", ""),
|
||||
("Switch to next tab", ""),
|
||||
("Switch to previous tab", ""),
|
||||
("Toggle session recording", ""),
|
||||
("Close tab", ""),
|
||||
("Toggle toolbar", ""),
|
||||
("Toggle input source", ""),
|
||||
("Edit", ""),
|
||||
("Save", ""),
|
||||
("Set shortcut", ""),
|
||||
("shortcut-recording-instruction", ""),
|
||||
("shortcut-recording-press-keys-tip", ""),
|
||||
("shortcut-must-include-modifiers", ""),
|
||||
("shortcut-already-bound-to", ""),
|
||||
("Replace", ""),
|
||||
("Valid", ""),
|
||||
("shortcut-mobile-physical-keyboard-tip", ""),
|
||||
("shortcut-key-not-supported", ""),
|
||||
("On", ""),
|
||||
("Off", ""),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", "Για να ξεκινήσετε φωνητική κλήση, ενεργοποιήστε την «Εγγραφή ήχου» στη σελίδα «Κοινή χρήση οθόνης»."),
|
||||
("Keyboard shortcuts", "Συντομεύσεις πληκτρολογίου"),
|
||||
("Configure shortcuts...", "Διαμόρφωση συντομεύσεων..."),
|
||||
("Enable keyboard shortcuts in remote session", "Ενεργοποίηση συντομεύσεων πληκτρολογίου στην απομακρυσμένη συνεδρία"),
|
||||
("shortcut-page-description", "Αντιστοιχίστε έναν συνδυασμό πλήκτρων σε κάθε ενέργεια συνεδρίας παρακάτω. Κάθε αντιστοίχιση πρέπει να περιλαμβάνει τουλάχιστον ένα πλήκτρο τροποποίησης."),
|
||||
("shortcut-passthrough-tip", "Όταν είναι ενεργό, κάθε αντιστοιχισμένος συνδυασμός προωθείται στον απομακρυσμένο υπολογιστή. Χρήσιμο όταν μια αντιστοίχιση συγκρούεται με κάτι που χρειάζεστε στον απομακρυσμένο υπολογιστή."),
|
||||
("Pass-through to remote", "Προώθηση στον απομακρυσμένο υπολογιστή"),
|
||||
("Reset to defaults", "Επαναφορά προεπιλογών"),
|
||||
("shortcut-reset-confirm-tip", "Όλες οι τρέχουσες αντιστοιχίσεις θα αντικατασταθούν με τις προεπιλεγμένες. Συνέχεια;"),
|
||||
("Monitor", "Οθόνη"),
|
||||
("Keyboard", "Πληκτρολόγιο"),
|
||||
("Toggle fullscreen", "Εναλλαγή πλήρους οθόνης"),
|
||||
("Switch to next display", "Μετάβαση στην επόμενη οθόνη"),
|
||||
("Switch to previous display", "Μετάβαση στην προηγούμενη οθόνη"),
|
||||
("Switch to next tab", "Μετάβαση στην επόμενη καρτέλα"),
|
||||
("Switch to previous tab", "Μετάβαση στην προηγούμενη καρτέλα"),
|
||||
("Toggle session recording", "Εναλλαγή εγγραφής συνεδρίας"),
|
||||
("Close tab", "Κλείσιμο καρτέλας"),
|
||||
("Toggle toolbar", "Εναλλαγή γραμμής εργαλείων"),
|
||||
("Toggle input source", "Εναλλαγή πηγής εισόδου"),
|
||||
("Edit", "Επεξεργασία"),
|
||||
("Save", "Αποθήκευση"),
|
||||
("Set shortcut", "Ορισμός συντόμευσης"),
|
||||
("shortcut-recording-instruction", "Πατήστε τον συνδυασμό πλήκτρων που θέλετε να χρησιμοποιήσετε."),
|
||||
("shortcut-recording-press-keys-tip", "Πατήστε έναν συνδυασμό πλήκτρων..."),
|
||||
("shortcut-must-include-modifiers", "Πρέπει να περιλαμβάνει τουλάχιστον ένα πλήκτρο τροποποίησης: {}"),
|
||||
("shortcut-already-bound-to", "Έχει ήδη αντιστοιχιστεί σε"),
|
||||
("Replace", "Αντικατάσταση"),
|
||||
("Valid", "Έγκυρο"),
|
||||
("shortcut-mobile-physical-keyboard-tip", "Η καταγραφή συντομεύσεων απαιτεί φυσικό πληκτρολόγιο. Τα πληκτρολόγια οθόνης δεν υποστηρίζονται."),
|
||||
("shortcut-key-not-supported", "Το «{}» δεν μπορεί να χρησιμοποιηθεί ως συντόμευση."),
|
||||
("On", "Ενεργό"),
|
||||
("Off", "Ανενεργό"),
|
||||
("api_server_connection_tip", "Ο προσαρμοσμένος διακομιστής σας χρησιμοποιεί μη κρυπτογραφημένο HTTP. Επικοινωνήστε με τον διαχειριστή σας για να ενεργοποιήσει το HTTPS."),
|
||||
("api_server_empty_tip", "Όταν το πεδίο «Διακομιστής API» είναι κενό, ο προσαρμοσμένος διακομιστής σας χρησιμοποιεί από προεπιλογή HTTP. Επικοινωνήστε με τον διαχειριστή σας για να ενεργοποιήσει το HTTPS."),
|
||||
("RustDesk storage", "Χώρος αποθήκευσης RustDesk"),
|
||||
("Other folders", "Άλλοι φάκελοι"),
|
||||
("Choose which folder remote devices can access.", "Επιλέξτε σε ποιον φάκελο μπορούν να έχουν πρόσβαση οι απομακρυσμένες συσκευές."),
|
||||
("android-logs-folder-tip", "Επιλέξτε Android → media για την αποθήκευση των αρχείων καταγραφής."),
|
||||
("Choose folder", "Επιλογή φακέλου"),
|
||||
("Please select Android → media.", "Παρακαλώ επιλέξτε Android → media."),
|
||||
("Trust duration (days)", "Διάρκεια εμπιστοσύνης (ημέρες)"),
|
||||
("Renew trust", "Ανανέωση εμπιστοσύνης"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -288,5 +288,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("shortcut-already-bound-to", "Already bound to"),
|
||||
("shortcut-mobile-physical-keyboard-tip", "Recording requires a physical keyboard. Soft keyboards are not supported."),
|
||||
("shortcut-key-not-supported", "\"{}\" can't be used as a shortcut."),
|
||||
("api_server_connection_tip", "Your custom server uses unencrypted HTTP. Contact your administrator to enable HTTPS."),
|
||||
("api_server_empty_tip", "With API Server empty, your custom server defaults to HTTP. Contact your administrator to enable HTTPS."),
|
||||
("android-logs-folder-tip", "Choose Android → media to store log files."),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
+45
-35
@@ -763,8 +763,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Lock canvas", "Ŝlosi kanvason"),
|
||||
("Sync clipboard between sessions", "Sinkronigi poŝon inter seancoj"),
|
||||
("sync-clipboard-between-sessions-tip", "Teksto aŭ bildoj kopiitaj en unu fora seanco ankaŭ sendiĝas al la poŝo de viaj aliaj konektitaj seancoj."),
|
||||
("terminal-clipboard-write-tip", ""),
|
||||
("Allow terminal apps to copy to clipboard", ""),
|
||||
("terminal-clipboard-write-tip", "Aplikaĵo en la terminalo volas kopii tekston al la poŝo de ĉi tiu aparato. Se vi permesas, ĉi tiu permeso validas por terminalaj aplikaĵoj en ĉiuj konektoj, ĝis vi malŝaltos ĝin en Agordoj. Mana kopiado kaj algluado ne estas tuŝitaj."),
|
||||
("Allow terminal apps to copy to clipboard", "Permesi al terminalaj aplikaĵoj kopii al la poŝo"),
|
||||
("Enable", "Ebligi"),
|
||||
("Reuse one connection for port forwarding", "Reuzi unu konekton por pordo-plusendado"),
|
||||
("port-forward-mux-tip", "Ĉiuj konektoj de unu pordo-plusendado iras tra unu sola konekto al la alia komputilo, anstataŭ konekti kaj ensaluti denove por ĉiu el ili."),
|
||||
@@ -780,38 +780,48 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("RustDesk could not load a GStreamer component needed for screen capture ({})", "RustDesk ne povis ŝargi komponanton de GStreamer necesan por ekrankapto ({})"),
|
||||
("Relay fallback delay in seconds", "Prokrasto antaŭ retransmisio en sekundoj"),
|
||||
("relay-fallback-delay-tip", "Kiom longe jam establita retransmisia konekto atendas la rektan WebRTC-konekton antaŭ ol esti uzata anstataŭe. Pligrandigu ĝin por doni al malrapida rekta konekto pli da tempo; malpligrandigu ĝin por pli frue uzi la retransmision en retoj kie rekta konekto ne eblas. Lasu malplena por la defaŭlta valoro de 2.5 sekundoj."),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", ""),
|
||||
("Keyboard shortcuts", ""),
|
||||
("Configure shortcuts...", ""),
|
||||
("Enable keyboard shortcuts in remote session", ""),
|
||||
("shortcut-page-description", ""),
|
||||
("shortcut-passthrough-tip", ""),
|
||||
("Pass-through to remote", ""),
|
||||
("Reset to defaults", ""),
|
||||
("shortcut-reset-confirm-tip", ""),
|
||||
("Monitor", ""),
|
||||
("Keyboard", ""),
|
||||
("Toggle fullscreen", ""),
|
||||
("Switch to next display", ""),
|
||||
("Switch to previous display", ""),
|
||||
("Switch to next tab", ""),
|
||||
("Switch to previous tab", ""),
|
||||
("Toggle session recording", ""),
|
||||
("Close tab", ""),
|
||||
("Toggle toolbar", ""),
|
||||
("Toggle input source", ""),
|
||||
("Edit", ""),
|
||||
("Save", ""),
|
||||
("Set shortcut", ""),
|
||||
("shortcut-recording-instruction", ""),
|
||||
("shortcut-recording-press-keys-tip", ""),
|
||||
("shortcut-must-include-modifiers", ""),
|
||||
("shortcut-already-bound-to", ""),
|
||||
("Replace", ""),
|
||||
("Valid", ""),
|
||||
("shortcut-mobile-physical-keyboard-tip", ""),
|
||||
("shortcut-key-not-supported", ""),
|
||||
("On", ""),
|
||||
("Off", ""),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", "Por komenci voĉvokon, ebligu \"Sonkontrolo\" en la paĝo \"Kunhavigi Ekranon\"."),
|
||||
("Keyboard shortcuts", "Fulmoklavoj"),
|
||||
("Configure shortcuts...", "Agordi fulmoklavojn..."),
|
||||
("Enable keyboard shortcuts in remote session", "Ebligi fulmoklavojn en fora sesio"),
|
||||
("shortcut-page-description", "Asignu klavkombinon al ĉiu suba sesia ago. Ĉiu asigno devas enhavi almenaŭ unu modifklavon."),
|
||||
("shortcut-passthrough-tip", "Kiam ŝaltita, ĉiu asignita kombino estas plusendata al la fora aparato. Utila, kiam asigno konfliktas kun io, kion vi bezonas ĉe la fora aparato."),
|
||||
("Pass-through to remote", "Plusendi al la fora aparato"),
|
||||
("Reset to defaults", "Restarigi implicitajn valorojn"),
|
||||
("shortcut-reset-confirm-tip", "Ĉi tio anstataŭigos ĉiujn nunajn asignojn per la implicita aro. Ĉu daŭrigi?"),
|
||||
("Monitor", "Ekrano"),
|
||||
("Keyboard", "Klavaro"),
|
||||
("Toggle fullscreen", "Baskuligi plenekranon"),
|
||||
("Switch to next display", "Iri al la sekva ekrano"),
|
||||
("Switch to previous display", "Iri al la antaŭa ekrano"),
|
||||
("Switch to next tab", "Iri al la sekva langeto"),
|
||||
("Switch to previous tab", "Iri al la antaŭa langeto"),
|
||||
("Toggle session recording", "Baskuligi sesian registradon"),
|
||||
("Close tab", "Fermi langeton"),
|
||||
("Toggle toolbar", "Baskuligi ilobreton"),
|
||||
("Toggle input source", "Baskuligi enigan fonton"),
|
||||
("Edit", "Redakti"),
|
||||
("Save", "Konservi"),
|
||||
("Set shortcut", "Agordi fulmoklavon"),
|
||||
("shortcut-recording-instruction", "Premu la klavkombinon, kiun vi volas uzi."),
|
||||
("shortcut-recording-press-keys-tip", "Premu klavkombinon..."),
|
||||
("shortcut-must-include-modifiers", "Devas enhavi almenaŭ unu modifklavon: {}"),
|
||||
("shortcut-already-bound-to", "Jam asignita al"),
|
||||
("Replace", "Anstataŭigi"),
|
||||
("Valid", "Valida"),
|
||||
("shortcut-mobile-physical-keyboard-tip", "Registrado postulas fizikan klavaron. Ekranaj klavaroj ne estas subtenataj."),
|
||||
("shortcut-key-not-supported", "\"{}\" ne uzeblas kiel fulmoklavo."),
|
||||
("On", "Ŝaltita"),
|
||||
("Off", "Malŝaltita"),
|
||||
("api_server_connection_tip", "Via propra servilo uzas neĉifritan HTTP. Kontaktu vian administranton por ebligi HTTPS."),
|
||||
("api_server_empty_tip", "Kiam \"Servilo de API\" estas malplena, via propra servilo implicite uzas HTTP. Kontaktu vian administranton por ebligi HTTPS."),
|
||||
("RustDesk storage", "Konservejo de RustDesk"),
|
||||
("Other folders", "Aliaj dosierujoj"),
|
||||
("Choose which folder remote devices can access.", "Elektu, al kiu dosierujo foraj aparatoj povas aliri."),
|
||||
("android-logs-folder-tip", "Elektu Android → media por konservi protokolajn dosierojn."),
|
||||
("Choose folder", "Elekti dosierujon"),
|
||||
("Please select Android → media.", "Bonvolu elekti Android → media."),
|
||||
("Trust duration (days)", "Daŭro de fido (tagoj)"),
|
||||
("Renew trust", "Renovigi fidon"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
+44
-34
@@ -763,8 +763,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Lock canvas", "Bloquear lienzo"),
|
||||
("Sync clipboard between sessions", "Sincronizar portapapeles entre sesiones"),
|
||||
("sync-clipboard-between-sessions-tip", "El texto o las imágenes copiados en una sesión remota también se envían al portapapeles de tus otras sesiones conectadas."),
|
||||
("terminal-clipboard-write-tip", ""),
|
||||
("Allow terminal apps to copy to clipboard", ""),
|
||||
("terminal-clipboard-write-tip", "Una aplicación del terminal quiere copiar texto al portapapeles de este dispositivo. Si lo permite, este permiso se aplica a las aplicaciones de terminal en todas las conexiones hasta que lo desactive en Ajustes. Copiar y pegar manualmente no se ve afectado."),
|
||||
("Allow terminal apps to copy to clipboard", "Permitir que las aplicaciones de terminal copien al portapapeles"),
|
||||
("Enable", "Habilitar"),
|
||||
("Reuse one connection for port forwarding", "Reutilizar una conexión para la redirección de puertos"),
|
||||
("port-forward-mux-tip", "Llevar todas las conexiones de una redirección de puertos por una única conexión con el otro equipo, en lugar de conectar e iniciar sesión de nuevo para cada una."),
|
||||
@@ -781,37 +781,47 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Relay fallback delay in seconds", "Retardo antes de usar el relé en segundos"),
|
||||
("relay-fallback-delay-tip", "Cuánto tiempo espera una conexión de relé ya establecida a la conexión directa WebRTC antes de usarse en su lugar. Auméntelo para dar más tiempo a una conexión directa lenta; redúzcalo para recurrir antes al relé en redes donde no es posible una conexión directa. Déjelo vacío para el valor predeterminado de 2.5 segundos."),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", "Para comenzar una llamada de voz activar \"Captura de audio\" en la página \"Compartir pantalla\"."),
|
||||
("Keyboard shortcuts", ""),
|
||||
("Configure shortcuts...", ""),
|
||||
("Enable keyboard shortcuts in remote session", ""),
|
||||
("shortcut-page-description", ""),
|
||||
("shortcut-passthrough-tip", ""),
|
||||
("Pass-through to remote", ""),
|
||||
("Reset to defaults", ""),
|
||||
("shortcut-reset-confirm-tip", ""),
|
||||
("Monitor", ""),
|
||||
("Keyboard", ""),
|
||||
("Toggle fullscreen", ""),
|
||||
("Switch to next display", ""),
|
||||
("Switch to previous display", ""),
|
||||
("Switch to next tab", ""),
|
||||
("Switch to previous tab", ""),
|
||||
("Toggle session recording", ""),
|
||||
("Close tab", ""),
|
||||
("Toggle toolbar", ""),
|
||||
("Toggle input source", ""),
|
||||
("Edit", ""),
|
||||
("Save", ""),
|
||||
("Set shortcut", ""),
|
||||
("shortcut-recording-instruction", ""),
|
||||
("shortcut-recording-press-keys-tip", ""),
|
||||
("shortcut-must-include-modifiers", ""),
|
||||
("shortcut-already-bound-to", ""),
|
||||
("Replace", ""),
|
||||
("Valid", ""),
|
||||
("shortcut-mobile-physical-keyboard-tip", ""),
|
||||
("shortcut-key-not-supported", ""),
|
||||
("On", ""),
|
||||
("Off", ""),
|
||||
("Keyboard shortcuts", "Atajos de teclado"),
|
||||
("Configure shortcuts...", "Configurar atajos..."),
|
||||
("Enable keyboard shortcuts in remote session", "Habilitar atajos de teclado en la sesión remota"),
|
||||
("shortcut-page-description", "Asigne una combinación de teclas a cada una de las siguientes acciones de sesión. Cada asignación debe incluir al menos una tecla modificadora."),
|
||||
("shortcut-passthrough-tip", "Si está activado, todas las combinaciones asignadas se envían al dispositivo remoto. Útil cuando una asignación coincide con algo que necesita en el dispositivo remoto."),
|
||||
("Pass-through to remote", "Enviar al dispositivo remoto"),
|
||||
("Reset to defaults", "Restablecer valores predeterminados"),
|
||||
("shortcut-reset-confirm-tip", "Esto reemplazará todas las asignaciones actuales por las predeterminadas. ¿Continuar?"),
|
||||
("Monitor", "Monitor"),
|
||||
("Keyboard", "Teclado"),
|
||||
("Toggle fullscreen", "Alternar pantalla completa"),
|
||||
("Switch to next display", "Cambiar a la pantalla siguiente"),
|
||||
("Switch to previous display", "Cambiar a la pantalla anterior"),
|
||||
("Switch to next tab", "Cambiar a la pestaña siguiente"),
|
||||
("Switch to previous tab", "Cambiar a la pestaña anterior"),
|
||||
("Toggle session recording", "Iniciar/detener grabación de sesión"),
|
||||
("Close tab", "Cerrar pestaña"),
|
||||
("Toggle toolbar", "Mostrar/ocultar barra de herramientas"),
|
||||
("Toggle input source", "Alternar fuente de entrada"),
|
||||
("Edit", "Editar"),
|
||||
("Save", "Guardar"),
|
||||
("Set shortcut", "Establecer atajo"),
|
||||
("shortcut-recording-instruction", "Pulse la combinación de teclas que desea usar."),
|
||||
("shortcut-recording-press-keys-tip", "Pulse una combinación de teclas..."),
|
||||
("shortcut-must-include-modifiers", "Debe incluir al menos una tecla modificadora: {}"),
|
||||
("shortcut-already-bound-to", "Ya asignado a"),
|
||||
("Replace", "Reemplazar"),
|
||||
("Valid", "Válido"),
|
||||
("shortcut-mobile-physical-keyboard-tip", "Para grabar un atajo se necesita un teclado físico. Los teclados virtuales no son compatibles."),
|
||||
("shortcut-key-not-supported", "\"{}\" no se puede usar como atajo."),
|
||||
("On", "Activado"),
|
||||
("Off", "Desactivado"),
|
||||
("api_server_connection_tip", "Su servidor personalizado usa HTTP sin cifrar. Contacte con su administrador para habilitar HTTPS."),
|
||||
("api_server_empty_tip", "Con el Servidor API vacío, su servidor personalizado usa HTTP de forma predeterminada. Contacte con su administrador para habilitar HTTPS."),
|
||||
("RustDesk storage", "Almacenamiento de RustDesk"),
|
||||
("Other folders", "Otras carpetas"),
|
||||
("Choose which folder remote devices can access.", "Elija a qué carpeta pueden acceder los dispositivos remotos."),
|
||||
("android-logs-folder-tip", "Elija Android → media para guardar los archivos de registro."),
|
||||
("Choose folder", "Elegir carpeta"),
|
||||
("Please select Android → media.", "Seleccione Android → media."),
|
||||
("Trust duration (days)", "Duración de la confianza (días)"),
|
||||
("Renew trust", "Renovar confianza"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
+45
-35
@@ -763,8 +763,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Lock canvas", "Lukusta lõuend"),
|
||||
("Sync clipboard between sessions", "Sünkrooni lõikelaud seansside vahel"),
|
||||
("sync-clipboard-between-sessions-tip", "Ühes kaugseansis kopeeritud tekst või pildid saadetakse ka teiste ühendatud seansside lõikelauale."),
|
||||
("terminal-clipboard-write-tip", ""),
|
||||
("Allow terminal apps to copy to clipboard", ""),
|
||||
("terminal-clipboard-write-tip", "Terminalis olev rakendus soovib kopeerida teksti selle seadme lõikelauale. Loa andmisel kehtib see kõigi ühenduste terminalirakendustele, kuni lülitad selle jaotises Seaded välja. Käsitsi kopeerimist ja kleepimist see ei mõjuta."),
|
||||
("Allow terminal apps to copy to clipboard", "Luba terminalirakendustel lõikelauale kopeerida"),
|
||||
("Enable", "Luba"),
|
||||
("Reuse one connection for port forwarding", "Kasuta pordi suunamiseks üht ühendust"),
|
||||
("port-forward-mux-tip", "Juhib ühe pordisuunamise kõik ühendused ühe teise arvutiga loodud ühenduse kaudu, selle asemel et iga ühenduse jaoks uuesti ühenduda ja sisse logida."),
|
||||
@@ -780,38 +780,48 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("RustDesk could not load a GStreamer component needed for screen capture ({})", "RustDesk ei suutnud laadida ekraani jäädvustamiseks vajalikku GStreameri komponenti ({})"),
|
||||
("Relay fallback delay in seconds", "Viivitus enne relee kasutamist sekundites"),
|
||||
("relay-fallback-delay-tip", "Kui kaua juba loodud releeühendus ootab otsest WebRTC-ühendust, enne kui seda selle asemel kasutatakse. Suurendage, et anda aeglasele otseühendusele rohkem aega; vähendage, et võrkudes, kus otseühendust luua ei saa, releele kiiremini üle minna. Jätke tühjaks vaikeväärtuse 2.5 sekundit kasutamiseks."),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", ""),
|
||||
("Keyboard shortcuts", ""),
|
||||
("Configure shortcuts...", ""),
|
||||
("Enable keyboard shortcuts in remote session", ""),
|
||||
("shortcut-page-description", ""),
|
||||
("shortcut-passthrough-tip", ""),
|
||||
("Pass-through to remote", ""),
|
||||
("Reset to defaults", ""),
|
||||
("shortcut-reset-confirm-tip", ""),
|
||||
("Monitor", ""),
|
||||
("Keyboard", ""),
|
||||
("Toggle fullscreen", ""),
|
||||
("Switch to next display", ""),
|
||||
("Switch to previous display", ""),
|
||||
("Switch to next tab", ""),
|
||||
("Switch to previous tab", ""),
|
||||
("Toggle session recording", ""),
|
||||
("Close tab", ""),
|
||||
("Toggle toolbar", ""),
|
||||
("Toggle input source", ""),
|
||||
("Edit", ""),
|
||||
("Save", ""),
|
||||
("Set shortcut", ""),
|
||||
("shortcut-recording-instruction", ""),
|
||||
("shortcut-recording-press-keys-tip", ""),
|
||||
("shortcut-must-include-modifiers", ""),
|
||||
("shortcut-already-bound-to", ""),
|
||||
("Replace", ""),
|
||||
("Valid", ""),
|
||||
("shortcut-mobile-physical-keyboard-tip", ""),
|
||||
("shortcut-key-not-supported", ""),
|
||||
("On", ""),
|
||||
("Off", ""),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", "Häälkõne alustamiseks luba lehel „Jaga ekraani“ valik „Helisalvestus“."),
|
||||
("Keyboard shortcuts", "Kiirklahvid"),
|
||||
("Configure shortcuts...", "Seadista kiirklahve..."),
|
||||
("Enable keyboard shortcuts in remote session", "Luba kiirklahvid kaugseansis"),
|
||||
("shortcut-page-description", "Seo allolevate seansitoimingutega klahvikombinatsioonid. Iga kombinatsioon peab sisaldama vähemalt ühte muuteklahvi."),
|
||||
("shortcut-passthrough-tip", "Kui see on sees, edastatakse kõik seotud kombinatsioonid kaugseadmesse. Kasulik, kui mõni kombinatsioon on vastuolus millegagi, mida kaugseadmes vajad."),
|
||||
("Pass-through to remote", "Edasta kaugseadmesse"),
|
||||
("Reset to defaults", "Lähtesta vaikeväärtustele"),
|
||||
("shortcut-reset-confirm-tip", "See asendab kõik praegused kiirklahvid vaikekomplektiga. Kas jätkata?"),
|
||||
("Monitor", "Kuvar"),
|
||||
("Keyboard", "Klaviatuur"),
|
||||
("Toggle fullscreen", "Täisekraan sisse/välja"),
|
||||
("Switch to next display", "Lülitu järgmisele kuvarile"),
|
||||
("Switch to previous display", "Lülitu eelmisele kuvarile"),
|
||||
("Switch to next tab", "Lülitu järgmisele kaardile"),
|
||||
("Switch to previous tab", "Lülitu eelmisele kaardile"),
|
||||
("Toggle session recording", "Seansisalvestus sisse/välja"),
|
||||
("Close tab", "Sulge kaart"),
|
||||
("Toggle toolbar", "Kuva/peida tööriistariba"),
|
||||
("Toggle input source", "Vaheta sisendallikat"),
|
||||
("Edit", "Muuda"),
|
||||
("Save", "Salvesta"),
|
||||
("Set shortcut", "Määra kiirklahv"),
|
||||
("shortcut-recording-instruction", "Vajuta klahvikombinatsiooni, mida soovid kasutada."),
|
||||
("shortcut-recording-press-keys-tip", "Vajuta klahvikombinatsiooni..."),
|
||||
("shortcut-must-include-modifiers", "Peab sisaldama vähemalt ühte muuteklahvi: {}"),
|
||||
("shortcut-already-bound-to", "Juba seotud toiminguga"),
|
||||
("Replace", "Asenda"),
|
||||
("Valid", "Kehtiv"),
|
||||
("shortcut-mobile-physical-keyboard-tip", "Salvestamiseks on vaja füüsilist klaviatuuri. Ekraaniklaviatuure ei toetata."),
|
||||
("shortcut-key-not-supported", "„{}“ ei saa kiirklahvina kasutada."),
|
||||
("On", "Sees"),
|
||||
("Off", "Väljas"),
|
||||
("api_server_connection_tip", "Sinu kohandatud server kasutab krüpteerimata HTTP-d. HTTPS-i lubamiseks võta ühendust administraatoriga."),
|
||||
("api_server_empty_tip", "Kui väli „Rakendusliidese server“ on tühi, kasutab sinu kohandatud server vaikimisi HTTP-d. HTTPS-i lubamiseks võta ühendust administraatoriga."),
|
||||
("RustDesk storage", "RustDeski salvestusruum"),
|
||||
("Other folders", "Muud kaustad"),
|
||||
("Choose which folder remote devices can access.", "Vali, millisele kaustale kaugseadmetel on juurdepääs."),
|
||||
("android-logs-folder-tip", "Logifailide salvestamiseks vali Android → media."),
|
||||
("Choose folder", "Vali kaust"),
|
||||
("Please select Android → media.", "Palun vali Android → media."),
|
||||
("Trust duration (days)", "Usalduse kestus (päevades)"),
|
||||
("Renew trust", "Uuenda usaldust"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
+45
-35
@@ -763,8 +763,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Lock canvas", "Blokeatu oihala"),
|
||||
("Sync clipboard between sessions", "Sinkronizatu arbela saioen artean"),
|
||||
("sync-clipboard-between-sessions-tip", "Urruneko saio batean kopiatutako testua edo irudiak konektatutako beste saioen arbelera ere bidaltzen dira."),
|
||||
("terminal-clipboard-write-tip", ""),
|
||||
("Allow terminal apps to copy to clipboard", ""),
|
||||
("terminal-clipboard-write-tip", "Terminaleko aplikazio batek testua gailu honen arbelera kopiatu nahi du. Baimena ematen baduzu, terminaleko aplikazioei aplikatuko zaie konexio guztietan, Ezarpenetan desgaitzen duzun arte. Eskuzko kopiatu eta itsatsi eragiketei ez die eragiten."),
|
||||
("Allow terminal apps to copy to clipboard", "Baimendu terminaleko aplikazioei arbelera kopiatzea"),
|
||||
("Enable", "Gaitu"),
|
||||
("Reuse one connection for port forwarding", "Berrerabili konexio bakarra portuen birbideratzerako"),
|
||||
("port-forward-mux-tip", "Portu-birbideratze baten konexio guztiak beste ordenagailurako konexio bakar batetik eramaten ditu, bakoitzerako berriro konektatu eta saioa hasi beharrean."),
|
||||
@@ -780,38 +780,48 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("RustDesk could not load a GStreamer component needed for screen capture ({})", "RustDesk-ek ezin izan du pantaila kapturatzeko beharrezkoa den GStreamer osagai bat kargatu ({})"),
|
||||
("Relay fallback delay in seconds", "Errelera itzultzeko atzerapena segundotan"),
|
||||
("relay-fallback-delay-tip", "Dagoeneko ezarritako errele-konexio batek WebRTC konexio zuzenari zenbat denbora itxaroten dion, haren ordez erabili aurretik. Handitu konexio zuzen motel bati denbora gehiago emateko; txikitu konexio zuzena egin ezin den sareetan lehenago errelera itzultzeko. Utzi hutsik 2.5 segundoko balio lehenetsirako."),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", ""),
|
||||
("Keyboard shortcuts", ""),
|
||||
("Configure shortcuts...", ""),
|
||||
("Enable keyboard shortcuts in remote session", ""),
|
||||
("shortcut-page-description", ""),
|
||||
("shortcut-passthrough-tip", ""),
|
||||
("Pass-through to remote", ""),
|
||||
("Reset to defaults", ""),
|
||||
("shortcut-reset-confirm-tip", ""),
|
||||
("Monitor", ""),
|
||||
("Keyboard", ""),
|
||||
("Toggle fullscreen", ""),
|
||||
("Switch to next display", ""),
|
||||
("Switch to previous display", ""),
|
||||
("Switch to next tab", ""),
|
||||
("Switch to previous tab", ""),
|
||||
("Toggle session recording", ""),
|
||||
("Close tab", ""),
|
||||
("Toggle toolbar", ""),
|
||||
("Toggle input source", ""),
|
||||
("Edit", ""),
|
||||
("Save", ""),
|
||||
("Set shortcut", ""),
|
||||
("shortcut-recording-instruction", ""),
|
||||
("shortcut-recording-press-keys-tip", ""),
|
||||
("shortcut-must-include-modifiers", ""),
|
||||
("shortcut-already-bound-to", ""),
|
||||
("Replace", ""),
|
||||
("Valid", ""),
|
||||
("shortcut-mobile-physical-keyboard-tip", ""),
|
||||
("shortcut-key-not-supported", ""),
|
||||
("On", ""),
|
||||
("Off", ""),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", "Ahots-dei bat hasteko, gaitu \"Audio-grabazioa\" \"Partekatu pantaila\" orrian."),
|
||||
("Keyboard shortcuts", "Laster-teklak"),
|
||||
("Configure shortcuts...", "Konfiguratu laster-teklak..."),
|
||||
("Enable keyboard shortcuts in remote session", "Gaitu laster-teklak urruneko saioan"),
|
||||
("shortcut-page-description", "Esleitu tekla-konbinazio bat beheko saio-ekintza bakoitzari. Esleipen bakoitzak gutxienez tekla aldatzaile bat izan behar du."),
|
||||
("shortcut-passthrough-tip", "Aktibatuta dagoenean, esleitutako konbinazio guztiak urruneko gailura bidaltzen dira. Erabilgarria da esleipen batek urruneko gailuan behar duzun zerbaitekin talka egiten duenean."),
|
||||
("Pass-through to remote", "Bidali urruneko gailura"),
|
||||
("Reset to defaults", "Berrezarri lehenetsiak"),
|
||||
("shortcut-reset-confirm-tip", "Uneko esleipen guztiak lehenetsiekin ordeztuko dira. Jarraitu?"),
|
||||
("Monitor", "Monitorea"),
|
||||
("Keyboard", "Teklatua"),
|
||||
("Toggle fullscreen", "Txandakatu pantaila osoa"),
|
||||
("Switch to next display", "Aldatu hurrengo pantailara"),
|
||||
("Switch to previous display", "Aldatu aurreko pantailara"),
|
||||
("Switch to next tab", "Aldatu hurrengo fitxara"),
|
||||
("Switch to previous tab", "Aldatu aurreko fitxara"),
|
||||
("Toggle session recording", "Hasi/gelditu saioaren grabaketa"),
|
||||
("Close tab", "Itxi fitxa"),
|
||||
("Toggle toolbar", "Erakutsi/ezkutatu tresna-barra"),
|
||||
("Toggle input source", "Txandakatu sarrera-iturria"),
|
||||
("Edit", "Editatu"),
|
||||
("Save", "Gorde"),
|
||||
("Set shortcut", "Ezarri laster-tekla"),
|
||||
("shortcut-recording-instruction", "Sakatu erabili nahi duzun tekla-konbinazioa."),
|
||||
("shortcut-recording-press-keys-tip", "Sakatu tekla-konbinazio bat..."),
|
||||
("shortcut-must-include-modifiers", "Gutxienez tekla aldatzaile bat izan behar du: {}"),
|
||||
("shortcut-already-bound-to", "Dagoeneko esleituta"),
|
||||
("Replace", "Ordeztu"),
|
||||
("Valid", "Baliozkoa"),
|
||||
("shortcut-mobile-physical-keyboard-tip", "Laster-tekla grabatzeko teklatu fisikoa behar da. Pantailako teklatuak ez dira onartzen."),
|
||||
("shortcut-key-not-supported", "\"{}\" ezin da laster-tekla gisa erabili."),
|
||||
("On", "Aktibatuta"),
|
||||
("Off", "Desaktibatuta"),
|
||||
("api_server_connection_tip", "Zure zerbitzari pertsonalizatuak zifratu gabeko HTTP erabiltzen du. Jarri harremanetan administratzailearekin HTTPS gaitzeko."),
|
||||
("api_server_empty_tip", "API zerbitzaria hutsik badago, zure zerbitzari pertsonalizatuak HTTP erabiltzen du lehenespenez. Jarri harremanetan administratzailearekin HTTPS gaitzeko."),
|
||||
("RustDesk storage", "RustDesk biltegiratzea"),
|
||||
("Other folders", "Beste karpeta batzuk"),
|
||||
("Choose which folder remote devices can access.", "Aukeratu urruneko gailuek zein karpeta atzi dezaketen."),
|
||||
("android-logs-folder-tip", "Aukeratu Android → media erregistro-fitxategiak gordetzeko."),
|
||||
("Choose folder", "Aukeratu karpeta"),
|
||||
("Please select Android → media.", "Hautatu Android → media."),
|
||||
("Trust duration (days)", "Konfiantzaren iraupena (egunak)"),
|
||||
("Renew trust", "Berritu konfiantza"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
+45
-35
@@ -763,8 +763,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Lock canvas", "قفل کردن صفحه"),
|
||||
("Sync clipboard between sessions", "همگامسازی کلیپبورد بین نشستها"),
|
||||
("sync-clipboard-between-sessions-tip", "متن یا تصاویری که در یک نشست راه دور کپی میشوند به کلیپبورد سایر نشستهای متصل شما نیز ارسال میشوند."),
|
||||
("terminal-clipboard-write-tip", ""),
|
||||
("Allow terminal apps to copy to clipboard", ""),
|
||||
("terminal-clipboard-write-tip", "یک برنامه در ترمینال میخواهد متنی را در کلیپبورد این دستگاه کپی کند. در صورت اجازه، این مجوز برای برنامههای ترمینال در همه اتصالها اعمال میشود تا زمانی که آن را در تنظیمات خاموش کنید. کپی و درج دستی تحت تأثیر قرار نمیگیرد."),
|
||||
("Allow terminal apps to copy to clipboard", "اجازه کپی در کلیپبورد به برنامههای ترمینال"),
|
||||
("Enable", "فعالسازی"),
|
||||
("Reuse one connection for port forwarding", "استفاده مجدد از یک اتصال برای هدایت پورت"),
|
||||
("port-forward-mux-tip", "همه اتصالهای یک هدایت پورت از یک اتصال واحد به دستگاه مقابل عبور میکنند، بهجای اتصال و ورود دوباره برای هر کدام."),
|
||||
@@ -780,38 +780,48 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("RustDesk could not load a GStreamer component needed for screen capture ({})", "RustDesk نتوانست مؤلفه GStreamer موردنیاز برای ضبط صفحه را بارگذاری کند ({})"),
|
||||
("Relay fallback delay in seconds", "تأخیر بازگشت به رله بر حسب ثانیه"),
|
||||
("relay-fallback-delay-tip", "یک اتصال رله که از قبل برقرار شده چقدر منتظر اتصال مستقیم WebRTC می ماند پیش از آنکه به جای آن استفاده شود. آن را افزایش دهید تا به اتصال مستقیم کند فرصت بیشتری داده شود؛ کاهش دهید تا در شبکه هایی که اتصال مستقیم ممکن نیست، زودتر به رله بازگردد. برای مقدار پیش فرض 2.5 ثانیه خالی بگذارید."),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", ""),
|
||||
("Keyboard shortcuts", ""),
|
||||
("Configure shortcuts...", ""),
|
||||
("Enable keyboard shortcuts in remote session", ""),
|
||||
("shortcut-page-description", ""),
|
||||
("shortcut-passthrough-tip", ""),
|
||||
("Pass-through to remote", ""),
|
||||
("Reset to defaults", ""),
|
||||
("shortcut-reset-confirm-tip", ""),
|
||||
("Monitor", ""),
|
||||
("Keyboard", ""),
|
||||
("Toggle fullscreen", ""),
|
||||
("Switch to next display", ""),
|
||||
("Switch to previous display", ""),
|
||||
("Switch to next tab", ""),
|
||||
("Switch to previous tab", ""),
|
||||
("Toggle session recording", ""),
|
||||
("Close tab", ""),
|
||||
("Toggle toolbar", ""),
|
||||
("Toggle input source", ""),
|
||||
("Edit", ""),
|
||||
("Save", ""),
|
||||
("Set shortcut", ""),
|
||||
("shortcut-recording-instruction", ""),
|
||||
("shortcut-recording-press-keys-tip", ""),
|
||||
("shortcut-must-include-modifiers", ""),
|
||||
("shortcut-already-bound-to", ""),
|
||||
("Replace", ""),
|
||||
("Valid", ""),
|
||||
("shortcut-mobile-physical-keyboard-tip", ""),
|
||||
("shortcut-key-not-supported", ""),
|
||||
("On", ""),
|
||||
("Off", ""),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", "برای شروع تماس صوتی، گزینه «ضبط صدا» را در صفحه «اشتراکگذاری صفحه» فعال کنید."),
|
||||
("Keyboard shortcuts", "میانبرهای صفحه کلید"),
|
||||
("Configure shortcuts...", "پیکربندی میانبرها..."),
|
||||
("Enable keyboard shortcuts in remote session", "فعالسازی میانبرهای صفحه کلید در جلسه راه دور"),
|
||||
("shortcut-page-description", "میانبرهای صفحه کلید را برای کارهای رایج در جلسه راه دور تنظیم کنید."),
|
||||
("shortcut-passthrough-tip", "با فعال بودن ارسال مستقیم، میانبرهای فعالشده به جای دستگاه محلی به دستگاه راه دور ارسال میشوند."),
|
||||
("Pass-through to remote", "ارسال مستقیم به راه دور"),
|
||||
("Reset to defaults", "بازنشانی به پیشفرض"),
|
||||
("shortcut-reset-confirm-tip", "همه میانبرها به مقادیر پیشفرض بازنشانی شوند؟"),
|
||||
("Monitor", "نمایشگر"),
|
||||
("Keyboard", "صفحه کلید"),
|
||||
("Toggle fullscreen", "تغییر حالت تمام صفحه"),
|
||||
("Switch to next display", "رفتن به نمایشگر بعدی"),
|
||||
("Switch to previous display", "رفتن به نمایشگر قبلی"),
|
||||
("Switch to next tab", "رفتن به زبانه بعدی"),
|
||||
("Switch to previous tab", "رفتن به زبانه قبلی"),
|
||||
("Toggle session recording", "تغییر وضعیت ضبط جلسه"),
|
||||
("Close tab", "بستن زبانه"),
|
||||
("Toggle toolbar", "نمایش/پنهان کردن نوار ابزار"),
|
||||
("Toggle input source", "تغییر منبع ورودی"),
|
||||
("Edit", "ویرایش"),
|
||||
("Save", "ذخیره"),
|
||||
("Set shortcut", "تنظیم میانبر"),
|
||||
("shortcut-recording-instruction", "کلیدهای میانبر مورد نظر را فشار دهید."),
|
||||
("shortcut-recording-press-keys-tip", "کلیدها را فشار دهید..."),
|
||||
("shortcut-must-include-modifiers", "میانبر باید شامل حداقل یک کلید تغییردهنده (Ctrl، Alt، Shift یا Meta) باشد."),
|
||||
("shortcut-already-bound-to", "این میانبر قبلاً به عملکرد دیگری اختصاص داده شده است."),
|
||||
("Replace", "جایگزینی"),
|
||||
("Valid", "معتبر"),
|
||||
("shortcut-mobile-physical-keyboard-tip", "این میانبرها فقط با صفحه کلید فیزیکی متصل کار میکنند."),
|
||||
("shortcut-key-not-supported", "این کلید برای میانبر پشتیبانی نمیشود."),
|
||||
("On", "روشن"),
|
||||
("Off", "خاموش"),
|
||||
("api_server_connection_tip", "سرور سفارشی شما از HTTP رمزنگارینشده استفاده میکند. برای فعالسازی HTTPS با مدیر سیستم خود تماس بگیرید."),
|
||||
("api_server_empty_tip", "وقتی «API سرور» خالی باشد، سرور سفارشی شما بهطور پیشفرض از HTTP استفاده میکند. برای فعالسازی HTTPS با مدیر سیستم خود تماس بگیرید."),
|
||||
("RustDesk storage", "حافظه RustDesk"),
|
||||
("Other folders", "پوشههای دیگر"),
|
||||
("Choose which folder remote devices can access.", "انتخاب کنید دستگاههای راه دور به کدام پوشه دسترسی داشته باشند."),
|
||||
("android-logs-folder-tip", "برای ذخیره فایلهای گزارش، Android → media را انتخاب کنید."),
|
||||
("Choose folder", "انتخاب پوشه"),
|
||||
("Please select Android → media.", "لطفاً Android → media را انتخاب کنید."),
|
||||
("Trust duration (days)", "مدت اعتماد (روز)"),
|
||||
("Renew trust", "تمدید اعتماد"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
+45
-35
@@ -763,8 +763,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Lock canvas", "Lukitse näkymä"),
|
||||
("Sync clipboard between sessions", "Synkronoi leikepöytä istuntojen välillä"),
|
||||
("sync-clipboard-between-sessions-tip", "Yhdessä etäistunnossa kopioitu teksti tai kuvat lähetetään myös muiden yhdistettyjen istuntojen leikepöydälle."),
|
||||
("terminal-clipboard-write-tip", ""),
|
||||
("Allow terminal apps to copy to clipboard", ""),
|
||||
("terminal-clipboard-write-tip", "Päätteessä toimiva sovellus haluaa kopioida tekstiä tämän laitteen leikepöydälle. Jos sallit sen, lupa koskee päätesovelluksia kaikissa yhteyksissä, kunnes poistat sen käytöstä kohdassa Asetukset. Manuaaliseen kopiointiin ja liittämiseen tämä ei vaikuta."),
|
||||
("Allow terminal apps to copy to clipboard", "Salli päätesovellusten kopioida leikepöydälle"),
|
||||
("Enable", "Ota käyttöön"),
|
||||
("Reuse one connection for port forwarding", "Käytä yhtä yhteyttä portin edelleenohjaukseen"),
|
||||
("port-forward-mux-tip", "Välittää kaikki yhden portin edelleenohjauksen yhteydet yhden vastapuoleen avatun yhteyden kautta sen sijaan, että jokaista varten muodostettaisiin yhteys ja kirjauduttaisiin uudelleen."),
|
||||
@@ -780,38 +780,48 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("RustDesk could not load a GStreamer component needed for screen capture ({})", "RustDesk ei voinut ladata näytön kaappaukseen tarvittavaa GStreamer-osaa ({})"),
|
||||
("Relay fallback delay in seconds", "Viive ennen välitykseen siirtymistä sekunteina"),
|
||||
("relay-fallback-delay-tip", "Kuinka kauan jo muodostettu välitysyhteys odottaa suoraa WebRTC-yhteyttä ennen kuin sitä käytetään sen sijaan. Kasvata arvoa antaaksesi hitaalle suoralle yhteydelle enemmän aikaa; pienennä sitä siirtyäksesi nopeammin välitykseen verkoissa, joissa suoraa yhteyttä ei voi muodostaa. Jätä tyhjäksi käyttääksesi oletusarvoa 2.5 sekuntia."),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", ""),
|
||||
("Keyboard shortcuts", ""),
|
||||
("Configure shortcuts...", ""),
|
||||
("Enable keyboard shortcuts in remote session", ""),
|
||||
("shortcut-page-description", ""),
|
||||
("shortcut-passthrough-tip", ""),
|
||||
("Pass-through to remote", ""),
|
||||
("Reset to defaults", ""),
|
||||
("shortcut-reset-confirm-tip", ""),
|
||||
("Monitor", ""),
|
||||
("Keyboard", ""),
|
||||
("Toggle fullscreen", ""),
|
||||
("Switch to next display", ""),
|
||||
("Switch to previous display", ""),
|
||||
("Switch to next tab", ""),
|
||||
("Switch to previous tab", ""),
|
||||
("Toggle session recording", ""),
|
||||
("Close tab", ""),
|
||||
("Toggle toolbar", ""),
|
||||
("Toggle input source", ""),
|
||||
("Edit", ""),
|
||||
("Save", ""),
|
||||
("Set shortcut", ""),
|
||||
("shortcut-recording-instruction", ""),
|
||||
("shortcut-recording-press-keys-tip", ""),
|
||||
("shortcut-must-include-modifiers", ""),
|
||||
("shortcut-already-bound-to", ""),
|
||||
("Replace", ""),
|
||||
("Valid", ""),
|
||||
("shortcut-mobile-physical-keyboard-tip", ""),
|
||||
("shortcut-key-not-supported", ""),
|
||||
("On", ""),
|
||||
("Off", ""),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", "Aloita äänipuhelu ottamalla ”Äänen tallennus” käyttöön sivulla ”Jaa näyttö”."),
|
||||
("Keyboard shortcuts", "Pikanäppäimet"),
|
||||
("Configure shortcuts...", "Määritä pikanäppäimet..."),
|
||||
("Enable keyboard shortcuts in remote session", "Ota pikanäppäimet käyttöön etäistunnossa"),
|
||||
("shortcut-page-description", "Määritä alla oleville istuntotoiminnoille näppäinyhdistelmät. Jokaisessa yhdistelmässä on oltava vähintään yksi muokkausnäppäin."),
|
||||
("shortcut-passthrough-tip", "Kun tämä on päällä, kaikki määritetyt yhdistelmät välitetään etälaitteelle. Hyödyllinen, kun yhdistelmä on ristiriidassa jonkin etälaitteella tarvitsemasi toiminnon kanssa."),
|
||||
("Pass-through to remote", "Välitä etälaitteelle"),
|
||||
("Reset to defaults", "Palauta oletukset"),
|
||||
("shortcut-reset-confirm-tip", "Tämä korvaa kaikki nykyiset pikanäppäimet oletusasetuksilla. Jatketaanko?"),
|
||||
("Monitor", "Näyttö"),
|
||||
("Keyboard", "Näppäimistö"),
|
||||
("Toggle fullscreen", "Koko näyttö päälle/pois"),
|
||||
("Switch to next display", "Siirry seuraavaan näyttöön"),
|
||||
("Switch to previous display", "Siirry edelliseen näyttöön"),
|
||||
("Switch to next tab", "Siirry seuraavaan välilehteen"),
|
||||
("Switch to previous tab", "Siirry edelliseen välilehteen"),
|
||||
("Toggle session recording", "Istunnon tallennus päälle/pois"),
|
||||
("Close tab", "Sulje välilehti"),
|
||||
("Toggle toolbar", "Näytä/piilota työkalupalkki"),
|
||||
("Toggle input source", "Vaihda syötelähde"),
|
||||
("Edit", "Muokkaa"),
|
||||
("Save", "Tallenna"),
|
||||
("Set shortcut", "Aseta pikanäppäin"),
|
||||
("shortcut-recording-instruction", "Paina näppäinyhdistelmää, jota haluat käyttää."),
|
||||
("shortcut-recording-press-keys-tip", "Paina näppäinyhdistelmää..."),
|
||||
("shortcut-must-include-modifiers", "Yhdistelmässä on oltava vähintään yksi muokkausnäppäin: {}"),
|
||||
("shortcut-already-bound-to", "Jo määritetty toiminnolle"),
|
||||
("Replace", "Korvaa"),
|
||||
("Valid", "Kelvollinen"),
|
||||
("shortcut-mobile-physical-keyboard-tip", "Tallennus vaatii fyysisen näppäimistön. Näyttönäppäimistöjä ei tueta."),
|
||||
("shortcut-key-not-supported", "Näppäintä ”{}” ei voi käyttää pikanäppäimenä."),
|
||||
("On", "Päällä"),
|
||||
("Off", "Pois"),
|
||||
("api_server_connection_tip", "Mukautettu palvelimesi käyttää salaamatonta HTTP-yhteyttä. Pyydä järjestelmänvalvojaa ottamaan HTTPS käyttöön."),
|
||||
("api_server_empty_tip", "Kun ”API palvelin” on tyhjä, mukautettu palvelimesi käyttää oletuksena HTTP:tä. Pyydä järjestelmänvalvojaa ottamaan HTTPS käyttöön."),
|
||||
("RustDesk storage", "RustDesk-tallennustila"),
|
||||
("Other folders", "Muut kansiot"),
|
||||
("Choose which folder remote devices can access.", "Valitse, mihin kansioon etälaitteet pääsevät."),
|
||||
("android-logs-folder-tip", "Valitse Android → media lokitiedostojen tallennusta varten."),
|
||||
("Choose folder", "Valitse kansio"),
|
||||
("Please select Android → media.", "Valitse Android → media."),
|
||||
("Trust duration (days)", "Luottamuksen kesto (päivää)"),
|
||||
("Renew trust", "Jatka luottamusta"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
+45
-35
@@ -763,8 +763,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Lock canvas", "Verrouiller la vue"),
|
||||
("Sync clipboard between sessions", "Synchroniser le presse-papiers entre les sessions"),
|
||||
("sync-clipboard-between-sessions-tip", "Le texte ou les images copiés dans une session distante sont également envoyés au presse-papiers de vos autres sessions connectées."),
|
||||
("terminal-clipboard-write-tip", ""),
|
||||
("Allow terminal apps to copy to clipboard", ""),
|
||||
("terminal-clipboard-write-tip", "Une application du terminal souhaite copier du texte dans le presse-papier de cet appareil. Si vous l’autorisez, cette permission s’applique aux applications du terminal dans toutes les connexions jusqu’à ce que vous la désactiviez dans les paramètres. Le copier-coller manuel n’est pas affecté."),
|
||||
("Allow terminal apps to copy to clipboard", "Autoriser les applications du terminal à copier dans le presse-papier"),
|
||||
("Enable", "Activer"),
|
||||
("Reuse one connection for port forwarding", "Réutiliser une seule connexion pour la redirection de ports"),
|
||||
("port-forward-mux-tip", "Faire passer toutes les connexions d'une redirection de ports par une seule connexion vers le pair, au lieu de se connecter et de s'authentifier à nouveau pour chacune."),
|
||||
@@ -780,38 +780,48 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("RustDesk could not load a GStreamer component needed for screen capture ({})", "RustDesk n'a pas pu charger un composant GStreamer nécessaire à la capture d'écran ({})"),
|
||||
("Relay fallback delay in seconds", "Délai avant bascule vers le relais en secondes"),
|
||||
("relay-fallback-delay-tip", "Durée pendant laquelle une connexion relais déjà établie attend la connexion directe WebRTC avant d'être utilisée à sa place. Augmentez-la pour laisser plus de temps à une connexion directe lente ; diminuez-la pour basculer plus tôt vers le relais sur les réseaux où une connexion directe est impossible. Laissez vide pour la valeur par défaut de 2.5 secondes."),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", ""),
|
||||
("Keyboard shortcuts", ""),
|
||||
("Configure shortcuts...", ""),
|
||||
("Enable keyboard shortcuts in remote session", ""),
|
||||
("shortcut-page-description", ""),
|
||||
("shortcut-passthrough-tip", ""),
|
||||
("Pass-through to remote", ""),
|
||||
("Reset to defaults", ""),
|
||||
("shortcut-reset-confirm-tip", ""),
|
||||
("Monitor", ""),
|
||||
("Keyboard", ""),
|
||||
("Toggle fullscreen", ""),
|
||||
("Switch to next display", ""),
|
||||
("Switch to previous display", ""),
|
||||
("Switch to next tab", ""),
|
||||
("Switch to previous tab", ""),
|
||||
("Toggle session recording", ""),
|
||||
("Close tab", ""),
|
||||
("Toggle toolbar", ""),
|
||||
("Toggle input source", ""),
|
||||
("Edit", ""),
|
||||
("Save", ""),
|
||||
("Set shortcut", ""),
|
||||
("shortcut-recording-instruction", ""),
|
||||
("shortcut-recording-press-keys-tip", ""),
|
||||
("shortcut-must-include-modifiers", ""),
|
||||
("shortcut-already-bound-to", ""),
|
||||
("Replace", ""),
|
||||
("Valid", ""),
|
||||
("shortcut-mobile-physical-keyboard-tip", ""),
|
||||
("shortcut-key-not-supported", ""),
|
||||
("On", ""),
|
||||
("Off", ""),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", "Pour démarrer un appel vocal, activez « Capture de l’audio » dans la page « Partage d’écran »."),
|
||||
("Keyboard shortcuts", "Raccourcis clavier"),
|
||||
("Configure shortcuts...", "Configurer les raccourcis…"),
|
||||
("Enable keyboard shortcuts in remote session", "Activer les raccourcis clavier dans la session distante"),
|
||||
("shortcut-page-description", "Associez une combinaison de touches à chacune des actions de session ci-dessous. Chaque raccourci doit inclure au moins une touche de modification."),
|
||||
("shortcut-passthrough-tip", "Lorsque cette option est activée, toutes les combinaisons associées sont transmises à l’appareil distant. Utile lorsqu’un raccourci entre en conflit avec une fonction dont vous avez besoin sur l’appareil distant."),
|
||||
("Pass-through to remote", "Transmettre à l’appareil distant"),
|
||||
("Reset to defaults", "Rétablir les valeurs par défaut"),
|
||||
("shortcut-reset-confirm-tip", "Tous les raccourcis actuels seront remplacés par ceux par défaut. Continuer ?"),
|
||||
("Monitor", "Écran"),
|
||||
("Keyboard", "Clavier"),
|
||||
("Toggle fullscreen", "Activer/désactiver le plein écran"),
|
||||
("Switch to next display", "Passer à l’écran suivant"),
|
||||
("Switch to previous display", "Passer à l’écran précédent"),
|
||||
("Switch to next tab", "Passer à l’onglet suivant"),
|
||||
("Switch to previous tab", "Passer à l’onglet précédent"),
|
||||
("Toggle session recording", "Démarrer/arrêter l’enregistrement de la session"),
|
||||
("Close tab", "Fermer l’onglet"),
|
||||
("Toggle toolbar", "Afficher/masquer la barre d’outils"),
|
||||
("Toggle input source", "Changer de source d’entrée"),
|
||||
("Edit", "Modifier"),
|
||||
("Save", "Enregistrer"),
|
||||
("Set shortcut", "Définir le raccourci"),
|
||||
("shortcut-recording-instruction", "Appuyez sur la combinaison de touches que vous souhaitez utiliser."),
|
||||
("shortcut-recording-press-keys-tip", "Appuyez sur une combinaison de touches…"),
|
||||
("shortcut-must-include-modifiers", "Doit inclure au moins une touche de modification : {}"),
|
||||
("shortcut-already-bound-to", "Déjà associé à"),
|
||||
("Replace", "Remplacer"),
|
||||
("Valid", "Valide"),
|
||||
("shortcut-mobile-physical-keyboard-tip", "La saisie d’un raccourci nécessite un clavier physique. Les claviers virtuels ne sont pas pris en charge."),
|
||||
("shortcut-key-not-supported", "« {} » ne peut pas être utilisé comme raccourci."),
|
||||
("On", "Activé"),
|
||||
("Off", "Désactivé"),
|
||||
("api_server_connection_tip", "Votre serveur personnalisé utilise HTTP non chiffré. Contactez votre administrateur pour activer HTTPS."),
|
||||
("api_server_empty_tip", "Lorsque le champ Serveur API est vide, votre serveur personnalisé utilise HTTP par défaut. Contactez votre administrateur pour activer HTTPS."),
|
||||
("RustDesk storage", "Stockage RustDesk"),
|
||||
("Other folders", "Autres dossiers"),
|
||||
("Choose which folder remote devices can access.", "Choisissez le dossier auquel les appareils distants peuvent accéder."),
|
||||
("android-logs-folder-tip", "Choisissez Android → media pour stocker les fichiers journaux."),
|
||||
("Choose folder", "Choisir un dossier"),
|
||||
("Please select Android → media.", "Veuillez sélectionner Android → media."),
|
||||
("Trust duration (days)", "Durée de confiance (jours)"),
|
||||
("Renew trust", "Renouveler la confiance"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
+45
-35
@@ -763,8 +763,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Lock canvas", "ტილოს დაბლოკვა"),
|
||||
("Sync clipboard between sessions", "გაცვლის ბუფერის სინქრონიზაცია სესიებს შორის"),
|
||||
("sync-clipboard-between-sessions-tip", "ერთ დაშორებულ სესიაში დაკოპირებული ტექსტი ან სურათები ასევე იგზავნება თქვენი სხვა დაკავშირებული სესიების გაცვლის ბუფერში."),
|
||||
("terminal-clipboard-write-tip", ""),
|
||||
("Allow terminal apps to copy to clipboard", ""),
|
||||
("terminal-clipboard-write-tip", "ტერმინალში არსებულ აპლიკაციას სურს ტექსტის კოპირება ამ მოწყობილობის გაცვლის ბუფერში. თუ ნებას დართავთ, ეს ნებართვა გავრცელდება ტერმინალის აპლიკაციებზე ყველა კავშირში, სანამ მას პარამეტრებში არ გამორთავთ. ხელით კოპირებასა და ჩასმაზე ეს გავლენას არ ახდენს."),
|
||||
("Allow terminal apps to copy to clipboard", "ტერმინალის აპლიკაციებისთვის გაცვლის ბუფერში კოპირების დაშვება"),
|
||||
("Enable", "ჩართვა"),
|
||||
("Reuse one connection for port forwarding", "პორტის გადამისამართებისთვის ერთი კავშირის ხელახლა გამოყენება"),
|
||||
("port-forward-mux-tip", "ერთი პორტის გადამისამართების ყველა კავშირი გადის მეორე კომპიუტერთან დამყარებული ერთი კავშირით, ნაცვლად იმისა, რომ თითოეულისთვის თავიდან დაუკავშირდეს და შევიდეს სისტემაში."),
|
||||
@@ -780,38 +780,48 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("RustDesk could not load a GStreamer component needed for screen capture ({})", "RustDesk-მა ვერ ჩატვირთა ეკრანის ჩაწერისთვის საჭირო GStreamer-ის კომპონენტი ({})"),
|
||||
("Relay fallback delay in seconds", "რელეზე გადასვლის დაყოვნება წამებში"),
|
||||
("relay-fallback-delay-tip", "რამდენ ხანს ელოდება უკვე დამყარებული რელე-კავშირი პირდაპირ WebRTC კავშირს, სანამ მის ნაცვლად გამოიყენება. გაზარდეთ, რომ ნელ პირდაპირ კავშირს მეტი დრო მისცეთ; შეამცირეთ, რომ ქსელებში, სადაც პირდაპირი კავშირი შეუძლებელია, უფრო სწრაფად გადავიდეს რელეზე. დატოვეთ ცარიელი ნაგულისხმევი 2.5 წამისთვის."),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", ""),
|
||||
("Keyboard shortcuts", ""),
|
||||
("Configure shortcuts...", ""),
|
||||
("Enable keyboard shortcuts in remote session", ""),
|
||||
("shortcut-page-description", ""),
|
||||
("shortcut-passthrough-tip", ""),
|
||||
("Pass-through to remote", ""),
|
||||
("Reset to defaults", ""),
|
||||
("shortcut-reset-confirm-tip", ""),
|
||||
("Monitor", ""),
|
||||
("Keyboard", ""),
|
||||
("Toggle fullscreen", ""),
|
||||
("Switch to next display", ""),
|
||||
("Switch to previous display", ""),
|
||||
("Switch to next tab", ""),
|
||||
("Switch to previous tab", ""),
|
||||
("Toggle session recording", ""),
|
||||
("Close tab", ""),
|
||||
("Toggle toolbar", ""),
|
||||
("Toggle input source", ""),
|
||||
("Edit", ""),
|
||||
("Save", ""),
|
||||
("Set shortcut", ""),
|
||||
("shortcut-recording-instruction", ""),
|
||||
("shortcut-recording-press-keys-tip", ""),
|
||||
("shortcut-must-include-modifiers", ""),
|
||||
("shortcut-already-bound-to", ""),
|
||||
("Replace", ""),
|
||||
("Valid", ""),
|
||||
("shortcut-mobile-physical-keyboard-tip", ""),
|
||||
("shortcut-key-not-supported", ""),
|
||||
("On", ""),
|
||||
("Off", ""),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", "ხმოვანი ზარის დასაწყებად ჩართეთ „აუდიოს ჩაწერა“ გვერდზე „ეკრანის დემონსტრაცია“."),
|
||||
("Keyboard shortcuts", "კლავიატურის მალსახმობები"),
|
||||
("Configure shortcuts...", "მალსახმობების კონფიგურაცია..."),
|
||||
("Enable keyboard shortcuts in remote session", "კლავიატურის მალსახმობების ჩართვა დისტანციურ სესიაში"),
|
||||
("shortcut-page-description", "ქვემოთ მოცემულ სესიის თითოეულ მოქმედებას მიანიჭეთ კლავიშების კომბინაცია. თითოეული კომბინაცია უნდა შეიცავდეს მინიმუმ ერთ მოდიფიკატორ კლავიშს."),
|
||||
("shortcut-passthrough-tip", "ჩართვისას ყველა მინიჭებული კომბინაცია გადაეგზავნება დისტანციურ მოწყობილობას. სასარგებლოა, როცა კომბინაცია ემთხვევა რამეს, რაც დისტანციურ მოწყობილობაზე გჭირდებათ."),
|
||||
("Pass-through to remote", "დისტანციურ მოწყობილობაზე გადაცემა"),
|
||||
("Reset to defaults", "ნაგულისხმევზე დაბრუნება"),
|
||||
("shortcut-reset-confirm-tip", "ეს ყველა მიმდინარე კომბინაციას ნაგულისხმევი ნაკრებით ჩაანაცვლებს. გავაგრძელოთ?"),
|
||||
("Monitor", "მონიტორი"),
|
||||
("Keyboard", "კლავიატურა"),
|
||||
("Toggle fullscreen", "სრული ეკრანის ჩართვა/გამორთვა"),
|
||||
("Switch to next display", "შემდეგ ეკრანზე გადართვა"),
|
||||
("Switch to previous display", "წინა ეკრანზე გადართვა"),
|
||||
("Switch to next tab", "შემდეგ ჩანართზე გადართვა"),
|
||||
("Switch to previous tab", "წინა ჩანართზე გადართვა"),
|
||||
("Toggle session recording", "სესიის ჩაწერის ჩართვა/გამორთვა"),
|
||||
("Close tab", "ჩანართის დახურვა"),
|
||||
("Toggle toolbar", "ხელსაწყოთა პანელის ჩვენება/დამალვა"),
|
||||
("Toggle input source", "შეყვანის წყაროს გადართვა"),
|
||||
("Edit", "რედაქტირება"),
|
||||
("Save", "შენახვა"),
|
||||
("Set shortcut", "მალსახმობის დაყენება"),
|
||||
("shortcut-recording-instruction", "დააჭირეთ კლავიშების კომბინაციას, რომლის გამოყენებაც გსურთ."),
|
||||
("shortcut-recording-press-keys-tip", "დააჭირეთ კლავიშების კომბინაციას..."),
|
||||
("shortcut-must-include-modifiers", "უნდა შეიცავდეს მინიმუმ ერთ მოდიფიკატორს: {}"),
|
||||
("shortcut-already-bound-to", "უკვე მინიჭებულია:"),
|
||||
("Replace", "ჩანაცვლება"),
|
||||
("Valid", "სწორია"),
|
||||
("shortcut-mobile-physical-keyboard-tip", "მალსახმობის ჩასაწერად საჭიროა ფიზიკური კლავიატურა. პროგრამული კლავიატურები მხარდაჭერილი არ არის."),
|
||||
("shortcut-key-not-supported", "„{}“ ვერ იქნება გამოყენებული მალსახმობად."),
|
||||
("On", "ჩართული"),
|
||||
("Off", "გამორთული"),
|
||||
("api_server_connection_tip", "თქვენი მორგებული სერვერი იყენებს დაუშიფრავ HTTP-ს. HTTPS-ის ჩასართავად დაუკავშირდით თქვენს ადმინისტრატორს."),
|
||||
("api_server_empty_tip", "როცა „API სერვერი“ ცარიელია, თქვენი მორგებული სერვერი ნაგულისხმევად იყენებს HTTP-ს. HTTPS-ის ჩასართავად დაუკავშირდით თქვენს ადმინისტრატორს."),
|
||||
("RustDesk storage", "RustDesk-ის საცავი"),
|
||||
("Other folders", "სხვა საქაღალდეები"),
|
||||
("Choose which folder remote devices can access.", "აირჩიეთ, რომელ საქაღალდეზე ექნებათ წვდომა დისტანციურ მოწყობილობებს."),
|
||||
("android-logs-folder-tip", "ჟურნალის ფაილების შესანახად აირჩიეთ Android → media."),
|
||||
("Choose folder", "საქაღალდის არჩევა"),
|
||||
("Please select Android → media.", "გთხოვთ, აირჩიოთ Android → media."),
|
||||
("Trust duration (days)", "ნდობის ხანგრძლივობა (დღე)"),
|
||||
("Renew trust", "ნდობის განახლება"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
+43
-33
@@ -780,38 +780,48 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("RustDesk could not load a GStreamer component needed for screen capture ({})", "RustDesk non puido cargar un compoñente de GStreamer necesario para capturar a pantalla ({})"),
|
||||
("Relay fallback delay in seconds", "Atraso antes de usar o relé en segundos"),
|
||||
("relay-fallback-delay-tip", "Canto tempo agarda unha conexión de relé xa establecida pola conexión directa WebRTC antes de usarse no seu lugar. Auménteo para darlle máis tempo a unha conexión directa lenta; redúzao para recorrer antes ao relé en redes onde non é posible unha conexión directa. Déixeo baleiro para o valor predeterminado de 2.5 segundos."),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", ""),
|
||||
("Keyboard shortcuts", ""),
|
||||
("Configure shortcuts...", ""),
|
||||
("Enable keyboard shortcuts in remote session", ""),
|
||||
("shortcut-page-description", ""),
|
||||
("shortcut-passthrough-tip", ""),
|
||||
("Pass-through to remote", ""),
|
||||
("Reset to defaults", ""),
|
||||
("shortcut-reset-confirm-tip", ""),
|
||||
("Monitor", ""),
|
||||
("Keyboard", ""),
|
||||
("Toggle fullscreen", ""),
|
||||
("Switch to next display", ""),
|
||||
("Switch to previous display", ""),
|
||||
("Switch to next tab", ""),
|
||||
("Switch to previous tab", ""),
|
||||
("Toggle session recording", ""),
|
||||
("Close tab", ""),
|
||||
("Toggle toolbar", ""),
|
||||
("Toggle input source", ""),
|
||||
("Edit", ""),
|
||||
("Save", ""),
|
||||
("Set shortcut", ""),
|
||||
("shortcut-recording-instruction", ""),
|
||||
("shortcut-recording-press-keys-tip", ""),
|
||||
("shortcut-must-include-modifiers", ""),
|
||||
("shortcut-already-bound-to", ""),
|
||||
("Replace", ""),
|
||||
("Valid", ""),
|
||||
("shortcut-mobile-physical-keyboard-tip", ""),
|
||||
("shortcut-key-not-supported", ""),
|
||||
("On", ""),
|
||||
("Off", ""),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", "Para iniciar unha chamada de voz, activa «Captura de audio» na páxina «Compartir pantalla»."),
|
||||
("Keyboard shortcuts", "Atallos de teclado"),
|
||||
("Configure shortcuts...", "Configurar atallos..."),
|
||||
("Enable keyboard shortcuts in remote session", "Activar os atallos de teclado na sesión remota"),
|
||||
("shortcut-page-description", "Asigna unha combinación de teclas a cada unha das seguintes accións de sesión. Cada asignación debe incluír polo menos unha tecla modificadora."),
|
||||
("shortcut-passthrough-tip", "Cando está activado, todas as combinacións asignadas envíanse ao dispositivo remoto. Útil cando unha asignación entra en conflito con algo que precisas no dispositivo remoto."),
|
||||
("Pass-through to remote", "Enviar ao dispositivo remoto"),
|
||||
("Reset to defaults", "Restablecer os valores predeterminados"),
|
||||
("shortcut-reset-confirm-tip", "Isto substituirá todas as asignacións actuais polas predeterminadas. Continuar?"),
|
||||
("Monitor", "Monitor"),
|
||||
("Keyboard", "Teclado"),
|
||||
("Toggle fullscreen", "Alternar pantalla completa"),
|
||||
("Switch to next display", "Cambiar á pantalla seguinte"),
|
||||
("Switch to previous display", "Cambiar á pantalla anterior"),
|
||||
("Switch to next tab", "Cambiar á pestana seguinte"),
|
||||
("Switch to previous tab", "Cambiar á pestana anterior"),
|
||||
("Toggle session recording", "Iniciar/deter a gravación da sesión"),
|
||||
("Close tab", "Pechar pestana"),
|
||||
("Toggle toolbar", "Amosar/agochar a barra de ferramentas"),
|
||||
("Toggle input source", "Alternar a fonte de entrada"),
|
||||
("Edit", "Editar"),
|
||||
("Save", "Gardar"),
|
||||
("Set shortcut", "Definir atallo"),
|
||||
("shortcut-recording-instruction", "Preme a combinación de teclas que queres usar."),
|
||||
("shortcut-recording-press-keys-tip", "Preme unha combinación de teclas..."),
|
||||
("shortcut-must-include-modifiers", "Debe incluír polo menos unha tecla modificadora: {}"),
|
||||
("shortcut-already-bound-to", "Xa asignado a"),
|
||||
("Replace", "Substituír"),
|
||||
("Valid", "Válido"),
|
||||
("shortcut-mobile-physical-keyboard-tip", "Para gravar un atallo cómpre un teclado físico. Os teclados virtuais non son compatibles."),
|
||||
("shortcut-key-not-supported", "«{}» non se pode usar como atallo."),
|
||||
("On", "Activado"),
|
||||
("Off", "Desactivado"),
|
||||
("api_server_connection_tip", "O teu servidor personalizado usa HTTP sen cifrar. Contacta co teu administrador para activar HTTPS."),
|
||||
("api_server_empty_tip", "Co Servidor de API baleiro, o teu servidor personalizado usa HTTP de forma predeterminada. Contacta co teu administrador para activar HTTPS."),
|
||||
("RustDesk storage", "Almacenamento de RustDesk"),
|
||||
("Other folders", "Outros cartafoles"),
|
||||
("Choose which folder remote devices can access.", "Elixe a que cartafol poden acceder os dispositivos remotos."),
|
||||
("android-logs-folder-tip", "Elixe Android → media para gardar os ficheiros de rexistro."),
|
||||
("Choose folder", "Elixir cartafol"),
|
||||
("Please select Android → media.", "Selecciona Android → media."),
|
||||
("Trust duration (days)", "Duración da confianza (días)"),
|
||||
("Renew trust", "Renovar a confianza"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
+45
-35
@@ -763,8 +763,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Lock canvas", "કેનવાસ લોક કરો"),
|
||||
("Sync clipboard between sessions", "સત્રો વચ્ચે ક્લિપબોર્ડ સિંક કરો"),
|
||||
("sync-clipboard-between-sessions-tip", "એક રિમોટ સત્રમાં કૉપિ કરેલ ટેક્સ્ટ કે છબીઓ તમારા અન્ય જોડાયેલા સત્રોના ક્લિપબોર્ડ પર પણ મોકલવામાં આવે છે."),
|
||||
("terminal-clipboard-write-tip", ""),
|
||||
("Allow terminal apps to copy to clipboard", ""),
|
||||
("terminal-clipboard-write-tip", "ટર્મિનલમાંની એક એપ આ ઉપકરણના ક્લિપબોર્ડમાં ટેક્સ્ટ કોપી કરવા માંગે છે. મંજૂરી આપશો તો, જ્યાં સુધી તમે તેને સેટિંગ્સમાં બંધ ન કરો ત્યાં સુધી આ પરવાનગી બધા કનેક્શનમાં ટર્મિનલ એપ્સ પર લાગુ રહેશે. મેન્યુઅલ કોપી અને પેસ્ટ પર કોઈ અસર થતી નથી."),
|
||||
("Allow terminal apps to copy to clipboard", "ટર્મિનલ એપ્સને ક્લિપબોર્ડમાં કોપી કરવાની મંજૂરી આપો"),
|
||||
("Enable", "સક્ષમ કરો"),
|
||||
("Reuse one connection for port forwarding", "પોર્ટ ફોરવર્ડિંગ માટે એક જ કનેક્શન ફરી વાપરો"),
|
||||
("port-forward-mux-tip", "એક પોર્ટ ફોરવર્ડિંગનાં બધાં કનેક્શન સામેના કમ્પ્યુટર સાથેના એક જ કનેક્શન મારફતે જાય છે, દરેક માટે ફરીથી કનેક્ટ અને લોગિન કરવાને બદલે."),
|
||||
@@ -780,38 +780,48 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("RustDesk could not load a GStreamer component needed for screen capture ({})", "RustDesk સ્ક્રીન કૅપ્ચર માટે જરૂરી GStreamer ઘટક લોડ કરી શક્યું નથી ({})"),
|
||||
("Relay fallback delay in seconds", "રિલે પર પાછા ફરવામાં વિલંબ સેકન્ડમાં"),
|
||||
("relay-fallback-delay-tip", "પહેલેથી સ્થાપિત રિલે કનેક્શન સીધા WebRTC કનેક્શનની કેટલો સમય રાહ જુએ છે, ત્યાર બાદ તેના બદલે વપરાય છે. ધીમા સીધા કનેક્શનને વધુ સમય આપવા માટે વધારો; જ્યાં સીધું કનેક્શન શક્ય નથી તેવા નેટવર્ક પર વહેલા રિલે પર જવા માટે ઘટાડો. મૂળભૂત 2.5 સેકન્ડ માટે ખાલી રાખો."),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", ""),
|
||||
("Keyboard shortcuts", ""),
|
||||
("Configure shortcuts...", ""),
|
||||
("Enable keyboard shortcuts in remote session", ""),
|
||||
("shortcut-page-description", ""),
|
||||
("shortcut-passthrough-tip", ""),
|
||||
("Pass-through to remote", ""),
|
||||
("Reset to defaults", ""),
|
||||
("shortcut-reset-confirm-tip", ""),
|
||||
("Monitor", ""),
|
||||
("Keyboard", ""),
|
||||
("Toggle fullscreen", ""),
|
||||
("Switch to next display", ""),
|
||||
("Switch to previous display", ""),
|
||||
("Switch to next tab", ""),
|
||||
("Switch to previous tab", ""),
|
||||
("Toggle session recording", ""),
|
||||
("Close tab", ""),
|
||||
("Toggle toolbar", ""),
|
||||
("Toggle input source", ""),
|
||||
("Edit", ""),
|
||||
("Save", ""),
|
||||
("Set shortcut", ""),
|
||||
("shortcut-recording-instruction", ""),
|
||||
("shortcut-recording-press-keys-tip", ""),
|
||||
("shortcut-must-include-modifiers", ""),
|
||||
("shortcut-already-bound-to", ""),
|
||||
("Replace", ""),
|
||||
("Valid", ""),
|
||||
("shortcut-mobile-physical-keyboard-tip", ""),
|
||||
("shortcut-key-not-supported", ""),
|
||||
("On", ""),
|
||||
("Off", ""),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", "વોઇસ કોલ શરૂ કરવા માટે, “સ્ક્રીન શેર કરો” પેજ પર “ઓડિયો કેપ્ચર” સક્ષમ કરો."),
|
||||
("Keyboard shortcuts", "કીબોર્ડ શોર્ટકટ"),
|
||||
("Configure shortcuts...", "શોર્ટકટ ગોઠવો..."),
|
||||
("Enable keyboard shortcuts in remote session", "રિમોટ સત્રમાં કીબોર્ડ શોર્ટકટ સક્ષમ કરો"),
|
||||
("shortcut-page-description", "નીચેની દરેક સત્ર ક્રિયા માટે એક કી સંયોજન સોંપો. દરેક સંયોજનમાં ઓછામાં ઓછી એક મોડિફાયર કી હોવી જોઈએ."),
|
||||
("shortcut-passthrough-tip", "ચાલુ હોય ત્યારે, દરેક સોંપેલ સંયોજન રિમોટને મોકલવામાં આવે છે. જ્યારે કોઈ શોર્ટકટ રિમોટ પર તમને જરૂરી કોઈ શોર્ટકટ સાથે ટકરાય ત્યારે ઉપયોગી."),
|
||||
("Pass-through to remote", "રિમોટને સીધું મોકલો"),
|
||||
("Reset to defaults", "ડિફોલ્ટ પર રીસેટ કરો"),
|
||||
("shortcut-reset-confirm-tip", "આ બધા વર્તમાન શોર્ટકટને ડિફોલ્ટ સેટથી બદલી દેશે. ચાલુ રાખવું છે?"),
|
||||
("Monitor", "મોનિટર"),
|
||||
("Keyboard", "કીબોર્ડ"),
|
||||
("Toggle fullscreen", "ફુલસ્ક્રીન ટૉગલ કરો"),
|
||||
("Switch to next display", "આગલા ડિસ્પ્લે પર જાઓ"),
|
||||
("Switch to previous display", "પાછલા ડિસ્પ્લે પર જાઓ"),
|
||||
("Switch to next tab", "આગલી ટેબ પર જાઓ"),
|
||||
("Switch to previous tab", "પાછલી ટેબ પર જાઓ"),
|
||||
("Toggle session recording", "સત્ર રેકોર્ડિંગ ટૉગલ કરો"),
|
||||
("Close tab", "ટેબ બંધ કરો"),
|
||||
("Toggle toolbar", "ટૂલબાર ટૉગલ કરો"),
|
||||
("Toggle input source", "ઇનપુટ સ્રોત ટૉગલ કરો"),
|
||||
("Edit", "ફેરફાર કરો"),
|
||||
("Save", "સાચવો"),
|
||||
("Set shortcut", "શોર્ટકટ સેટ કરો"),
|
||||
("shortcut-recording-instruction", "તમે જે કી સંયોજનનો ઉપયોગ કરવા માંગો છો તે દબાવો."),
|
||||
("shortcut-recording-press-keys-tip", "કોઈ કી સંયોજન દબાવો..."),
|
||||
("shortcut-must-include-modifiers", "ઓછામાં ઓછી એક મોડિફાયર કી શામેલ હોવી જોઈએ: {}"),
|
||||
("shortcut-already-bound-to", "પહેલેથી આને સોંપેલ છે"),
|
||||
("Replace", "બદલો"),
|
||||
("Valid", "માન્ય"),
|
||||
("shortcut-mobile-physical-keyboard-tip", "શોર્ટકટ રેકોર્ડ કરવા માટે ભૌતિક કીબોર્ડ જરૂરી છે. સોફ્ટ કીબોર્ડ સમર્થિત નથી."),
|
||||
("shortcut-key-not-supported", "“{}” નો શોર્ટકટ તરીકે ઉપયોગ કરી શકાતો નથી."),
|
||||
("On", "ચાલુ"),
|
||||
("Off", "બંધ"),
|
||||
("api_server_connection_tip", "તમારું કસ્ટમ સર્વર અનએન્ક્રિપ્ટેડ HTTP વાપરે છે. HTTPS સક્ષમ કરવા માટે તમારા એડમિનિસ્ટ્રેટરનો સંપર્ક કરો."),
|
||||
("api_server_empty_tip", "API સર્વર ખાલી હોય ત્યારે, તમારું કસ્ટમ સર્વર ડિફોલ્ટ રૂપે HTTP વાપરે છે. HTTPS સક્ષમ કરવા માટે તમારા એડમિનિસ્ટ્રેટરનો સંપર્ક કરો."),
|
||||
("RustDesk storage", "RustDesk સ્ટોરેજ"),
|
||||
("Other folders", "અન્ય ફોલ્ડર્સ"),
|
||||
("Choose which folder remote devices can access.", "રિમોટ ઉપકરણો કયા ફોલ્ડરને ઍક્સેસ કરી શકે તે પસંદ કરો."),
|
||||
("android-logs-folder-tip", "લોગ ફાઇલો સંગ્રહવા માટે Android → media પસંદ કરો."),
|
||||
("Choose folder", "ફોલ્ડર પસંદ કરો"),
|
||||
("Please select Android → media.", "કૃપા કરીને Android → media પસંદ કરો."),
|
||||
("Trust duration (days)", "વિશ્વાસ અવધિ (દિવસો)"),
|
||||
("Renew trust", "વિશ્વાસ નવીકરણ કરો"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
+52
-42
@@ -53,7 +53,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Audio Input", "קלט שמע"),
|
||||
("Enhancements", "שיפורים"),
|
||||
("Hardware Codec", "Hardware Codec"),
|
||||
("Adaptive bitrate", "Adaptive bitrate"),
|
||||
("Adaptive bitrate", "קצב סיביות מותאם"),
|
||||
("ID Server", "שרת ID"),
|
||||
("Relay Server", "שרת Relay"),
|
||||
("API Server", "שרת API"),
|
||||
@@ -119,7 +119,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Adjust Window", "התאם חלון"),
|
||||
("Original", "מקורי"),
|
||||
("Shrink", "הקטן"),
|
||||
("Stretch", "מתח"),
|
||||
("Stretch", "מתיחה"),
|
||||
("Scrollbar", "פס גלילה"),
|
||||
("ScrollAuto", "גלילה אוטומטית"),
|
||||
("Good image quality", "איכות תמונה טובה"),
|
||||
@@ -604,7 +604,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Power", "הפעלה"),
|
||||
("Telegram bot", "בוט טלגרם"),
|
||||
("enable-bot-tip", "אפשר שליטה או קבלת התראות דרך בוט טלגרם"),
|
||||
("enable-bot-desc", "אפשרות זו תאפשר לבוט טלגרם לבצע פעולות או לשלוח התראות עבור חשבונך"),
|
||||
("enable-bot-desc", "פתח שיחה עם @BotFather ושלח את הפקודה \"/newbot\" כדי לקבל אסימון.\nאחר כך שלח לבוט החדש הודעה שמתחילה בלוכסן,\nלמשל \"/hello\", כדי להפעיל אותו.\n"),
|
||||
("cancel-2fa-confirm-tip", "האם אתה בטוח שברצונך לבטל את האימות הדו-שלבי?"),
|
||||
("cancel-bot-confirm-tip", "האם אתה בטוח שברצונך לבטל את קישור הבוט?"),
|
||||
("About RustDesk", "אודות RustDesk"),
|
||||
@@ -667,9 +667,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Downloading {}", "מוריד את {}"),
|
||||
("{} Update", "עדכון {}"),
|
||||
("{}-to-update-tip", "קיימת גרסה חדשה של {} – מומלץ לעדכן"),
|
||||
("download-new-version-failed-tip", "נכשל בהורדת הגרסה החדשה"),
|
||||
("download-new-version-failed-tip", "הורדת הגרסה נכשלה. תוכל לנסות שוב או ללחוץ על הלחצן \"הורדה\" כדי להוריד את הגרסה מדף ההפצות ולעדכן ידנית."),
|
||||
("Auto update", "עדכון אוטומטי"),
|
||||
("update-failed-check-msi-tip", "העדכון נכשל – בדוק אם קובץ ה־MSI מותקן או הוסר"),
|
||||
("update-failed-check-msi-tip", "בדיקת שיטת ההתקנה נכשלה. אנא לחץ על הלחצן \"הורדה\" כדי להוריד את הגרסה מדף ההפצות ולעדכן ידנית."),
|
||||
("websocket_tip", "אפשר שימוש בפרוטוקול WebSocket לחיבורים"),
|
||||
("Use WebSocket", "השתמש ב־WebSocket"),
|
||||
("Trackpad speed", "מהירות משטח מגע"),
|
||||
@@ -692,7 +692,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("The user is not an administrator.", "המשתמש אינו מנהל"),
|
||||
("Failed to check if the user is an administrator.", "נכשל בבדיקה אם המשתמש הוא מנהל"),
|
||||
("Supported only in the installed version.", "נתמך רק בגרסה המותקנת"),
|
||||
("elevation_username_tip", "רמז_ליוזר_להעלאת_הרשאה"),
|
||||
("elevation_username_tip", "הזן שם משתמש או דומיין\\שם משתמש"),
|
||||
("Preparing for installation ...", "הכנה להתקנה..."),
|
||||
("Show my cursor", "הצג את הסמן שלי"),
|
||||
("Scale custom", "קנה מידה מותאם אישית"),
|
||||
@@ -739,7 +739,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("wayland-keyboard-input-disabled-tip", "לאפשר קלט מקלדת?"),
|
||||
("wayland-keyboard-input-consent-tip", "מה שאתה מקליד במחשב המרוחק הזה (כולל סיסמאות) עלול להיקרא על-ידי אפליקציות אחרות בו."),
|
||||
("wayland-keyboard-input-applies-to-tip", "בחירה זו חלה על:"),
|
||||
("wayland-soft-keyboard-input-label", "קלט מקלדת רכה"),
|
||||
("wayland-soft-keyboard-input-label", "קלט מהמקלדת הווירטואלית"),
|
||||
("wayland-keyboard-input-reset-choice-tip", "אפס את בחירת קלט המקלדת"),
|
||||
("remember-wayland-keyboard-choice-tip", "אל תשאל שוב עבור מחשב מרוחק זה"),
|
||||
("Why this happens", "מדוע זה קורה"),
|
||||
@@ -763,8 +763,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Lock canvas", "נעל לוח ציור"),
|
||||
("Sync clipboard between sessions", "סנכרן לוח בין סשנים"),
|
||||
("sync-clipboard-between-sessions-tip", "טקסט או תמונות שהועתקו בסשן מרוחק אחד נשלחים גם ללוח של שאר הסשנים המחוברים שלך."),
|
||||
("terminal-clipboard-write-tip", ""),
|
||||
("Allow terminal apps to copy to clipboard", ""),
|
||||
("terminal-clipboard-write-tip", "אפליקציה בטרמינל רוצה להעתיק טקסט ללוח הגזירים של המכשיר הזה. אם תאשר, ההרשאה תחול על אפליקציות טרמינל בכל החיבורים עד שתכבה אותה בהגדרות. העתקה והדבקה ידניות לא יושפעו."),
|
||||
("Allow terminal apps to copy to clipboard", "אפשר לאפליקציות טרמינל להעתיק ללוח הגזירים"),
|
||||
("Enable", "הפעל"),
|
||||
("Reuse one connection for port forwarding", "שימוש חוזר בחיבור אחד להעברת פורטים"),
|
||||
("port-forward-mux-tip", "כל החיבורים של העברת פורטים אחת עוברים דרך חיבור יחיד למחשב המרוחק, במקום ליצור חיבור חדש ולהיכנס מחדש עבור כל אחד מהם."),
|
||||
@@ -780,38 +780,48 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("RustDesk could not load a GStreamer component needed for screen capture ({})", "RustDesk לא הצליח לטעון רכיב GStreamer הדרוש ללכידת מסך ({})"),
|
||||
("Relay fallback delay in seconds", "השהיה לפני מעבר לממסר בשניות"),
|
||||
("relay-fallback-delay-tip", "כמה זמן חיבור ממסר שכבר נוצר ממתין לחיבור WebRTC הישיר לפני שישמש במקומו. הגדל כדי לתת לחיבור ישיר איטי יותר זמן; הקטן כדי לעבור מהר יותר לממסר ברשתות שבהן לא ניתן ליצור חיבור ישיר. השאר ריק לערך ברירת המחדל של 2.5 שניות."),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", ""),
|
||||
("Keyboard shortcuts", ""),
|
||||
("Configure shortcuts...", ""),
|
||||
("Enable keyboard shortcuts in remote session", ""),
|
||||
("shortcut-page-description", ""),
|
||||
("shortcut-passthrough-tip", ""),
|
||||
("Pass-through to remote", ""),
|
||||
("Reset to defaults", ""),
|
||||
("shortcut-reset-confirm-tip", ""),
|
||||
("Monitor", ""),
|
||||
("Keyboard", ""),
|
||||
("Toggle fullscreen", ""),
|
||||
("Switch to next display", ""),
|
||||
("Switch to previous display", ""),
|
||||
("Switch to next tab", ""),
|
||||
("Switch to previous tab", ""),
|
||||
("Toggle session recording", ""),
|
||||
("Close tab", ""),
|
||||
("Toggle toolbar", ""),
|
||||
("Toggle input source", ""),
|
||||
("Edit", ""),
|
||||
("Save", ""),
|
||||
("Set shortcut", ""),
|
||||
("shortcut-recording-instruction", ""),
|
||||
("shortcut-recording-press-keys-tip", ""),
|
||||
("shortcut-must-include-modifiers", ""),
|
||||
("shortcut-already-bound-to", ""),
|
||||
("Replace", ""),
|
||||
("Valid", ""),
|
||||
("shortcut-mobile-physical-keyboard-tip", ""),
|
||||
("shortcut-key-not-supported", ""),
|
||||
("On", ""),
|
||||
("Off", ""),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", "כדי להתחיל שיחה קולית, הפעל את האפשרות \"לכידת שמע\" בדף \"שיתוף מסך\"."),
|
||||
("Keyboard shortcuts", "קיצורי מקשים"),
|
||||
("Configure shortcuts...", "הגדר קיצורי מקשים..."),
|
||||
("Enable keyboard shortcuts in remote session", "הפעל קיצורי מקשים בהפעלה המרוחקת"),
|
||||
("shortcut-page-description", "שייך צירוף מקשים לכל אחת מפעולות ההפעלה שבהמשך. כל צירוף חייב לכלול לפחות מקש משנה אחד."),
|
||||
("shortcut-passthrough-tip", "כשהאפשרות מופעלת, כל צירופי המקשים שהגדרת יישלחו למחשב המרוחק. שימושי כשצירוף מתנגש עם קיצור שאתה צריך במחשב המרוחק."),
|
||||
("Pass-through to remote", "העבר קיצורי מקשים למחשב המרוחק"),
|
||||
("Reset to defaults", "אפס לברירות מחדל"),
|
||||
("shortcut-reset-confirm-tip", "פעולה זו תחליף את כל הצירופים שהגדרת בקבוצת ברירת המחדל. להמשיך?"),
|
||||
("Monitor", "מסך"),
|
||||
("Keyboard", "מקלדת"),
|
||||
("Toggle fullscreen", "הפעל או בטל מצב מסך מלא"),
|
||||
("Switch to next display", "עבור למסך הבא"),
|
||||
("Switch to previous display", "עבור למסך הקודם"),
|
||||
("Switch to next tab", "עבור לכרטיסייה הבאה"),
|
||||
("Switch to previous tab", "עבור לכרטיסייה הקודמת"),
|
||||
("Toggle session recording", "הפעל או הפסק את הקלטת ההפעלה"),
|
||||
("Close tab", "סגור כרטיסייה"),
|
||||
("Toggle toolbar", "הצג או הסתר את סרגל הכלים"),
|
||||
("Toggle input source", "החלף את מקור הקלט"),
|
||||
("Edit", "ערוך"),
|
||||
("Save", "שמור"),
|
||||
("Set shortcut", "הגדר קיצור מקשים"),
|
||||
("shortcut-recording-instruction", "לחץ על צירוף המקשים שבו תרצה להשתמש."),
|
||||
("shortcut-recording-press-keys-tip", "לחץ על צירוף מקשים..."),
|
||||
("shortcut-must-include-modifiers", "חובה לכלול לפחות מקש משנה אחד: {}"),
|
||||
("shortcut-already-bound-to", "צירוף המקשים כבר משויך לפעולה אחרת:"),
|
||||
("Replace", "החלף"),
|
||||
("Valid", "תקין"),
|
||||
("shortcut-mobile-physical-keyboard-tip", "ההקלטה דורשת מקלדת פיזית. אין תמיכה במקלדת וירטואלית."),
|
||||
("shortcut-key-not-supported", "לא תוכל להשתמש ב-\"{}\" כקיצור מקשים."),
|
||||
("On", "מופעל"),
|
||||
("Off", "כבוי"),
|
||||
("api_server_connection_tip", "השרת המותאם אישית שלך משתמש ב-HTTP לא מוצפן. פנה למנהל המערכת שלך כדי להפעיל HTTPS."),
|
||||
("api_server_empty_tip", "כשהשדה \"שרת API\" ריק, השרת המותאם אישית שלך משתמש ב-HTTP כברירת מחדל. פנה למנהל המערכת שלך כדי להפעיל HTTPS."),
|
||||
("RustDesk storage", "אחסון RustDesk"),
|
||||
("Other folders", "תיקיות אחרות"),
|
||||
("Choose which folder remote devices can access.", "בחר לאיזו תיקייה יוכלו מכשירים מרוחקים לגשת."),
|
||||
("android-logs-folder-tip", "בחר Android → media כדי לשמור קובצי יומן."),
|
||||
("Choose folder", "בחר תיקייה"),
|
||||
("Please select Android → media.", "אנא בחר Android → media."),
|
||||
("Trust duration (days)", "משך האמון (ימים)"),
|
||||
("Renew trust", "חידוש אמון"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
+45
-35
@@ -763,8 +763,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Lock canvas", "कैनवास लॉक करें"),
|
||||
("Sync clipboard between sessions", "सत्रों के बीच क्लिपबोर्ड सिंक करें"),
|
||||
("sync-clipboard-between-sessions-tip", "एक रिमोट सत्र में कॉपी किए गए टेक्स्ट या चित्र आपके अन्य जुड़े सत्रों के क्लिपबोर्ड पर भी भेजे जाते हैं।"),
|
||||
("terminal-clipboard-write-tip", ""),
|
||||
("Allow terminal apps to copy to clipboard", ""),
|
||||
("terminal-clipboard-write-tip", "टर्मिनल में एक ऐप इस डिवाइस के क्लिपबोर्ड पर टेक्स्ट कॉपी करना चाहता है। अनुमति देने पर, यह अनुमति सभी कनेक्शनों में टर्मिनल ऐप्स पर तब तक लागू रहेगी जब तक आप इसे सेटिंग्स में बंद नहीं करते। मैन्युअल कॉपी और पेस्ट पर कोई असर नहीं पड़ता।"),
|
||||
("Allow terminal apps to copy to clipboard", "टर्मिनल ऐप्स को क्लिपबोर्ड पर कॉपी करने की अनुमति दें"),
|
||||
("Enable", "सक्षम करें"),
|
||||
("Reuse one connection for port forwarding", "पोर्ट फ़ॉरवर्डिंग के लिए एक ही कनेक्शन दोबारा उपयोग करें"),
|
||||
("port-forward-mux-tip", "एक पोर्ट फ़ॉरवर्डिंग के सभी कनेक्शन दूसरे कंप्यूटर से बने एक ही कनेक्शन से होकर जाते हैं, हर एक के लिए दोबारा कनेक्ट और लॉगिन करने के बजाय।"),
|
||||
@@ -780,38 +780,48 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("RustDesk could not load a GStreamer component needed for screen capture ({})", "RustDesk स्क्रीन कैप्चर के लिए आवश्यक GStreamer घटक लोड नहीं कर सका ({})"),
|
||||
("Relay fallback delay in seconds", "रिले पर लौटने में विलंब सेकंड में"),
|
||||
("relay-fallback-delay-tip", "पहले से स्थापित रिले कनेक्शन सीधे WebRTC कनेक्शन की कितनी देर प्रतीक्षा करता है, उसके बाद उसके स्थान पर उपयोग किया जाता है। धीमे सीधे कनेक्शन को अधिक समय देने के लिए बढ़ाएँ; जिन नेटवर्क पर सीधा कनेक्शन संभव नहीं है वहाँ जल्दी रिले पर जाने के लिए घटाएँ। डिफ़ॉल्ट 2.5 सेकंड के लिए खाली छोड़ें।"),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", ""),
|
||||
("Keyboard shortcuts", ""),
|
||||
("Configure shortcuts...", ""),
|
||||
("Enable keyboard shortcuts in remote session", ""),
|
||||
("shortcut-page-description", ""),
|
||||
("shortcut-passthrough-tip", ""),
|
||||
("Pass-through to remote", ""),
|
||||
("Reset to defaults", ""),
|
||||
("shortcut-reset-confirm-tip", ""),
|
||||
("Monitor", ""),
|
||||
("Keyboard", ""),
|
||||
("Toggle fullscreen", ""),
|
||||
("Switch to next display", ""),
|
||||
("Switch to previous display", ""),
|
||||
("Switch to next tab", ""),
|
||||
("Switch to previous tab", ""),
|
||||
("Toggle session recording", ""),
|
||||
("Close tab", ""),
|
||||
("Toggle toolbar", ""),
|
||||
("Toggle input source", ""),
|
||||
("Edit", ""),
|
||||
("Save", ""),
|
||||
("Set shortcut", ""),
|
||||
("shortcut-recording-instruction", ""),
|
||||
("shortcut-recording-press-keys-tip", ""),
|
||||
("shortcut-must-include-modifiers", ""),
|
||||
("shortcut-already-bound-to", ""),
|
||||
("Replace", ""),
|
||||
("Valid", ""),
|
||||
("shortcut-mobile-physical-keyboard-tip", ""),
|
||||
("shortcut-key-not-supported", ""),
|
||||
("On", ""),
|
||||
("Off", ""),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", "वॉयस कॉल शुरू करने के लिए, “स्क्रीन शेयर करें” पेज पर “ऑडियो कैप्चर” सक्षम करें।"),
|
||||
("Keyboard shortcuts", "कीबोर्ड शॉर्टकट"),
|
||||
("Configure shortcuts...", "शॉर्टकट कॉन्फ़िगर करें..."),
|
||||
("Enable keyboard shortcuts in remote session", "रिमोट सत्र में कीबोर्ड शॉर्टकट सक्षम करें"),
|
||||
("shortcut-page-description", "नीचे दिए गए प्रत्येक सत्र कार्य के लिए एक कुंजी संयोजन निर्धारित करें। प्रत्येक संयोजन में कम से कम एक मॉडिफ़ायर कुंजी होनी चाहिए।"),
|
||||
("shortcut-passthrough-tip", "चालू होने पर, प्रत्येक निर्धारित संयोजन रिमोट को भेज दिया जाता है। यह तब उपयोगी है जब कोई शॉर्टकट रिमोट पर आपकी ज़रूरत के किसी शॉर्टकट से टकराता है।"),
|
||||
("Pass-through to remote", "रिमोट को सीधे भेजें"),
|
||||
("Reset to defaults", "डिफ़ॉल्ट पर रीसेट करें"),
|
||||
("shortcut-reset-confirm-tip", "यह सभी मौजूदा शॉर्टकट को डिफ़ॉल्ट सेट से बदल देगा। जारी रखें?"),
|
||||
("Monitor", "मॉनिटर"),
|
||||
("Keyboard", "कीबोर्ड"),
|
||||
("Toggle fullscreen", "फुलस्क्रीन टॉगल करें"),
|
||||
("Switch to next display", "अगले डिस्प्ले पर जाएं"),
|
||||
("Switch to previous display", "पिछले डिस्प्ले पर जाएं"),
|
||||
("Switch to next tab", "अगले टैब पर जाएं"),
|
||||
("Switch to previous tab", "पिछले टैब पर जाएं"),
|
||||
("Toggle session recording", "सत्र रिकॉर्डिंग टॉगल करें"),
|
||||
("Close tab", "टैब बंद करें"),
|
||||
("Toggle toolbar", "टूलबार टॉगल करें"),
|
||||
("Toggle input source", "इनपुट स्रोत टॉगल करें"),
|
||||
("Edit", "संपादित करें"),
|
||||
("Save", "सहेजें"),
|
||||
("Set shortcut", "शॉर्टकट सेट करें"),
|
||||
("shortcut-recording-instruction", "वह कुंजी संयोजन दबाएं जिसका आप उपयोग करना चाहते हैं।"),
|
||||
("shortcut-recording-press-keys-tip", "कोई कुंजी संयोजन दबाएं..."),
|
||||
("shortcut-must-include-modifiers", "कम से कम एक मॉडिफ़ायर कुंजी शामिल होनी चाहिए: {}"),
|
||||
("shortcut-already-bound-to", "पहले से इसके लिए निर्धारित"),
|
||||
("Replace", "बदलें"),
|
||||
("Valid", "मान्य"),
|
||||
("shortcut-mobile-physical-keyboard-tip", "शॉर्टकट रिकॉर्ड करने के लिए भौतिक कीबोर्ड आवश्यक है। सॉफ़्ट कीबोर्ड समर्थित नहीं हैं।"),
|
||||
("shortcut-key-not-supported", "“{}” को शॉर्टकट के रूप में उपयोग नहीं किया जा सकता।"),
|
||||
("On", "चालू"),
|
||||
("Off", "बंद"),
|
||||
("api_server_connection_tip", "आपका कस्टम सर्वर अनएन्क्रिप्टेड HTTP का उपयोग करता है। HTTPS सक्षम करने के लिए अपने व्यवस्थापक से संपर्क करें।"),
|
||||
("api_server_empty_tip", "API सर्वर खाली होने पर, आपका कस्टम सर्वर डिफ़ॉल्ट रूप से HTTP का उपयोग करता है। HTTPS सक्षम करने के लिए अपने व्यवस्थापक से संपर्क करें।"),
|
||||
("RustDesk storage", "RustDesk स्टोरेज"),
|
||||
("Other folders", "अन्य फ़ोल्डर"),
|
||||
("Choose which folder remote devices can access.", "चुनें कि रिमोट डिवाइस किस फ़ोल्डर तक पहुंच सकते हैं।"),
|
||||
("android-logs-folder-tip", "लॉग फ़ाइलें संग्रहीत करने के लिए Android → media चुनें।"),
|
||||
("Choose folder", "फ़ोल्डर चुनें"),
|
||||
("Please select Android → media.", "कृपया Android → media चुनें।"),
|
||||
("Trust duration (days)", "विश्वास अवधि (दिन)"),
|
||||
("Renew trust", "विश्वास नवीनीकृत करें"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
+45
-35
@@ -763,8 +763,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Lock canvas", "Zaključaj pozadinu"),
|
||||
("Sync clipboard between sessions", "Sinkroniziraj međuspremnik između sesija"),
|
||||
("sync-clipboard-between-sessions-tip", "Tekst ili slike kopirani u jednoj udaljenoj sesiji šalju se i u međuspremnik vaših ostalih povezanih sesija."),
|
||||
("terminal-clipboard-write-tip", ""),
|
||||
("Allow terminal apps to copy to clipboard", ""),
|
||||
("terminal-clipboard-write-tip", "Aplikacija u terminalu želi kopirati tekst u međuspremnik ovog uređaja. Ako to dopustite, ovo dopuštenje vrijedi za terminalske aplikacije u svim vezama dok ga ne isključite u Postavkama. Ručno kopiranje i lijepljenje ostaju nepromijenjeni."),
|
||||
("Allow terminal apps to copy to clipboard", "Dopusti terminalskim aplikacijama kopiranje u međuspremnik"),
|
||||
("Enable", "Omogući"),
|
||||
("Reuse one connection for port forwarding", "Ponovno koristi jednu vezu za prosljeđivanje portova"),
|
||||
("port-forward-mux-tip", "Sve veze jednog prosljeđivanja portova idu kroz jednu vezu prema drugoj strani, umjesto ponovnog povezivanja i prijave za svaku od njih."),
|
||||
@@ -780,38 +780,48 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("RustDesk could not load a GStreamer component needed for screen capture ({})", "RustDesk nije mogao učitati GStreamer komponentu potrebnu za snimanje zaslona ({})"),
|
||||
("Relay fallback delay in seconds", "Odgoda prije prelaska na relej u sekundama"),
|
||||
("relay-fallback-delay-tip", "Koliko dugo već uspostavljena relejna veza čeka izravnu WebRTC vezu prije nego što se upotrijebi umjesto nje. Povećajte da sporoj izravnoj vezi date više vremena; smanjite da se na mrežama gdje izravna veza nije moguća brže prijeđe na relej. Ostavite prazno za zadanu vrijednost od 2.5 sekunde."),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", ""),
|
||||
("Keyboard shortcuts", ""),
|
||||
("Configure shortcuts...", ""),
|
||||
("Enable keyboard shortcuts in remote session", ""),
|
||||
("shortcut-page-description", ""),
|
||||
("shortcut-passthrough-tip", ""),
|
||||
("Pass-through to remote", ""),
|
||||
("Reset to defaults", ""),
|
||||
("shortcut-reset-confirm-tip", ""),
|
||||
("Monitor", ""),
|
||||
("Keyboard", ""),
|
||||
("Toggle fullscreen", ""),
|
||||
("Switch to next display", ""),
|
||||
("Switch to previous display", ""),
|
||||
("Switch to next tab", ""),
|
||||
("Switch to previous tab", ""),
|
||||
("Toggle session recording", ""),
|
||||
("Close tab", ""),
|
||||
("Toggle toolbar", ""),
|
||||
("Toggle input source", ""),
|
||||
("Edit", ""),
|
||||
("Save", ""),
|
||||
("Set shortcut", ""),
|
||||
("shortcut-recording-instruction", ""),
|
||||
("shortcut-recording-press-keys-tip", ""),
|
||||
("shortcut-must-include-modifiers", ""),
|
||||
("shortcut-already-bound-to", ""),
|
||||
("Replace", ""),
|
||||
("Valid", ""),
|
||||
("shortcut-mobile-physical-keyboard-tip", ""),
|
||||
("shortcut-key-not-supported", ""),
|
||||
("On", ""),
|
||||
("Off", ""),
|
||||
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", "Za početak glasovnog poziva omogućite „Snimanje zvuka“ na stranici „Podijeli zaslon“."),
|
||||
("Keyboard shortcuts", "Tipkovnički prečaci"),
|
||||
("Configure shortcuts...", "Konfiguriraj prečace..."),
|
||||
("Enable keyboard shortcuts in remote session", "Omogući tipkovničke prečace u udaljenoj sesiji"),
|
||||
("shortcut-page-description", "Dodijelite kombinaciju tipki svakoj radnji sesije u nastavku. Svaki prečac mora sadržavati barem jednu modifikatorsku tipku."),
|
||||
("shortcut-passthrough-tip", "Kada je uključeno, svaka dodijeljena kombinacija prosljeđuje se udaljenom uređaju. Korisno kada se prečac sukobljava s nečim što vam treba na udaljenom uređaju."),
|
||||
("Pass-through to remote", "Proslijedi udaljenom uređaju"),
|
||||
("Reset to defaults", "Vrati na zadano"),
|
||||
("shortcut-reset-confirm-tip", "Sve trenutne dodjele bit će zamijenjene zadanim skupom. Nastaviti?"),
|
||||
("Monitor", "Monitor"),
|
||||
("Keyboard", "Tipkovnica"),
|
||||
("Toggle fullscreen", "Uključi/isključi cijeli zaslon"),
|
||||
("Switch to next display", "Prebaci na sljedeći zaslon"),
|
||||
("Switch to previous display", "Prebaci na prethodni zaslon"),
|
||||
("Switch to next tab", "Prebaci na sljedeću karticu"),
|
||||
("Switch to previous tab", "Prebaci na prethodnu karticu"),
|
||||
("Toggle session recording", "Pokreni/zaustavi snimanje sesije"),
|
||||
("Close tab", "Zatvori karticu"),
|
||||
("Toggle toolbar", "Prikaži/sakrij alatnu traku"),
|
||||
("Toggle input source", "Promijeni izvor unosa"),
|
||||
("Edit", "Uredi"),
|
||||
("Save", "Spremi"),
|
||||
("Set shortcut", "Postavi prečac"),
|
||||
("shortcut-recording-instruction", "Pritisnite kombinaciju tipki koju želite koristiti."),
|
||||
("shortcut-recording-press-keys-tip", "Pritisnite kombinaciju tipki..."),
|
||||
("shortcut-must-include-modifiers", "Mora sadržavati barem jednu modifikatorsku tipku: {}"),
|
||||
("shortcut-already-bound-to", "Već dodijeljeno radnji"),
|
||||
("Replace", "Zamijeni"),
|
||||
("Valid", "Valjano"),
|
||||
("shortcut-mobile-physical-keyboard-tip", "Snimanje zahtijeva fizičku tipkovnicu. Softverske tipkovnice nisu podržane."),
|
||||
("shortcut-key-not-supported", "„{}“ se ne može koristiti kao prečac."),
|
||||
("On", "Uključeno"),
|
||||
("Off", "Isključeno"),
|
||||
("api_server_connection_tip", "Vaš prilagođeni poslužitelj koristi nešifrirani HTTP. Obratite se administratoru kako biste omogućili HTTPS."),
|
||||
("api_server_empty_tip", "Kada je API poslužitelj prazan, vaš prilagođeni poslužitelj prema zadanim postavkama koristi HTTP. Obratite se administratoru kako biste omogućili HTTPS."),
|
||||
("RustDesk storage", "RustDesk pohrana"),
|
||||
("Other folders", "Ostale mape"),
|
||||
("Choose which folder remote devices can access.", "Odaberite mapu kojoj udaljeni uređaji mogu pristupiti."),
|
||||
("android-logs-folder-tip", "Odaberite Android → media za spremanje datoteka zapisnika."),
|
||||
("Choose folder", "Odaberi mapu"),
|
||||
("Please select Android → media.", "Odaberite Android → media."),
|
||||
("Trust duration (days)", "Trajanje povjerenja (dani)"),
|
||||
("Renew trust", "Obnovi povjerenje"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user