combine upload files/folder button (#9643)

* combine upload files/folder button

Signed-off-by: 21pages <sunboeasy@gmail.com>

* web compress cache

Signed-off-by: 21pages <sunboeasy@gmail.com>

---------

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages 2024-10-14 15:46:21 +08:00 committed by GitHub
parent 498b8ba3d6
commit ce924cc0d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
46 changed files with 201 additions and 42 deletions

1
.gitignore vendored
View File

@ -54,3 +54,4 @@ examples/**/target/
vcpkg_installed
flutter/lib/generated_plugin_registrant.dart
libsciter.dylib
flutter/web/

View File

@ -490,6 +490,9 @@ class _FileManagerViewState extends State<FileManagerView> {
}
Widget headTools() {
var uploadButtonTapPosition = RelativeRect.fill;
RxBool isUploadFolder =
(bind.mainGetLocalOption(key: 'upload-folder-button') == 'Y').obs;
return Container(
child: Column(
children: [
@ -814,48 +817,64 @@ class _FileManagerViewState extends State<FileManagerView> {
),
if (isWeb)
Obx(() => ElevatedButton.icon(
style: ButtonStyle(
padding: MaterialStateProperty.all<EdgeInsetsGeometry>(
isLocal
? EdgeInsets.only(left: 10)
: EdgeInsets.only(right: 10)),
backgroundColor: MaterialStateProperty.all(
selectedItems.items.isEmpty
? MyTheme.accent80
: MyTheme.accent,
style: ButtonStyle(
padding: MaterialStateProperty.all<EdgeInsetsGeometry>(
isLocal
? EdgeInsets.only(left: 10)
: EdgeInsets.only(right: 10)),
backgroundColor: MaterialStateProperty.all(
selectedItems.items.isEmpty
? MyTheme.accent80
: MyTheme.accent,
),
),
),
onPressed: () => {webselectFiles(is_folder: true)},
icon: Offstage(),
label: Text(
translate('Upload folder'),
textAlign: TextAlign.right,
style: TextStyle(
color: Colors.white,
onPressed: () =>
{webselectFiles(is_folder: isUploadFolder.value)},
label: InkWell(
hoverColor: Colors.transparent,
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
focusColor: Colors.transparent,
onTapDown: (e) {
final x = e.globalPosition.dx;
final y = e.globalPosition.dy;
uploadButtonTapPosition =
RelativeRect.fromLTRB(x, y, x, y);
},
onTap: () async {
final value = await showMenu<bool>(
context: context,
position: uploadButtonTapPosition,
items: [
PopupMenuItem<bool>(
value: false,
child: Text(translate('Upload files')),
),
PopupMenuItem<bool>(
value: true,
child: Text(translate('Upload folder')),
),
]);
if (value != null) {
isUploadFolder.value = value;
bind.mainSetLocalOption(
key: 'upload-folder-button',
value: value ? 'Y' : '');
webselectFiles(is_folder: value);
}
},
child: Icon(Icons.arrow_drop_down),
),
))).marginOnly(left: 16),
if (isWeb)
Obx(() => ElevatedButton.icon(
style: ButtonStyle(
padding: MaterialStateProperty.all<EdgeInsetsGeometry>(
isLocal
? EdgeInsets.only(left: 10)
: EdgeInsets.only(right: 10)),
backgroundColor: MaterialStateProperty.all(
selectedItems.items.isEmpty
? MyTheme.accent80
: MyTheme.accent,
),
),
onPressed: () => {webselectFiles(is_folder: false)},
icon: Offstage(),
label: Text(
translate('Upload files'),
textAlign: TextAlign.right,
style: TextStyle(
color: Colors.white,
),
))).marginOnly(left: 16),
icon: Text(
translate(isUploadFolder.isTrue
? 'Upload folder'
: 'Upload files'),
textAlign: TextAlign.right,
style: TextStyle(
color: Colors.white,
),
).marginOnly(left: 8),
)).marginOnly(left: 16),
Obx(() => ElevatedButton.icon(
style: ButtonStyle(
padding: MaterialStateProperty.all<EdgeInsetsGeometry>(

View File

@ -1209,7 +1209,12 @@ class RustdeskImpl {
}
Future<String> mainLoadAb({dynamic hint}) {
return Future(() => js.context.callMethod('getByName', ['load_ab']));
Completer<String> completer = Completer();
js.context["onLoadAbFinished"] = (String s) {
completer.complete(s);
};
js.context.callMethod('setByName', ['load_ab']);
return completer.future;
}
Future<void> mainSaveGroup({required String json, dynamic hint}) {
@ -1222,7 +1227,12 @@ class RustdeskImpl {
}
Future<String> mainLoadGroup({dynamic hint}) {
return Future(() => js.context.callMethod('getByName', ['load_group']));
Completer<String> completer = Completer();
js.context["onLoadGroupFinished"] = (String s) {
completer.complete(s);
};
js.context.callMethod('setByName', ['load_group']);
return completer.future;
}
Future<void> sessionSendPointer(

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", "Autenticació requerida"),
("Authenticate", "Autentica"),
("web_id_input_tip", "Podeu inserir el número ID al propi servidor; l'accés directe per IP no és compatible amb el client web.\nSi voleu accedir a un dispositiu d'un altre servidor, afegiu l'adreça del servidor, com ara <id>@<adreça_del_servidor>?key=<valor_de_la_clau> (p. ex.\n9123456234@192.168.16.1:21117?key=5Qbwsde3unUcJBtrx9ZkvUmwFNoExHzpryHuPUdqlWM=.\nSi voleu accedir a un dispositiu en un servidor públic, no cal que inseriu la clau pública «<id>@» per al servidor públic."),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", "需要身份验证"),
("Authenticate", "认证"),
("web_id_input_tip", "可以输入同一个服务器内的 IDweb 客户端不支持直接 IP 访问。\n要访问另一台服务器上的设备,请附加服务器地址(<ID>@<服务器地址>?key=<密钥>)。比如,\n9123456234@192.168.16.1:21117?key=5Qbwsde3unUcJBtrx9ZkvUmwFNoExHzpryHuPUdqlWM=。\n要访问公共服务器上的设备,请输入 \"<ID>@public\",无需密钥。"),
("Download", "下载"),
("Upload folder", "上传文件夹"),
("Upload files", "上传文件"),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", "Authentifizierung erforderlich"),
("Authenticate", "Authentifizieren"),
("web_id_input_tip", "Sie können eine ID auf demselben Server eingeben, direkter IP-Zugriff wird im Web-Client nicht unterstützt.\nWenn Sie auf ein Gerät auf einem anderen Server zugreifen wollen, fügen Sie bitte die Serveradresse (<id>@<server_address>?key=<key_value>) hinzu, zum Beispiel\n9123456234@192.168.16.1:21117?key=5Qbwsde3unUcJBtrx9ZkvUmwFNoExHzpryHuPUdqlWM=.\nWenn Sie auf ein Gerät auf einem öffentlichen Server zugreifen wollen, geben Sie bitte \"<id>@public\" ein. Der Schlüssel wird für öffentliche Server nicht benötigt."),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", "Se requiere autenticación"),
("Authenticate", "Autenticar"),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", "Diperlukan autentikasi"),
("Authenticate", "Autentikasi"),
("web_id_input_tip", "Kamu bisa memasukkan ID pada server yang sama, akses IP langsung tidak didukung di klien web.\nJika Anda ingin mengakses perangkat di server lain, silakan tambahkan alamat server (<id>@<server_address>?key=<key_value>), contohnya:\n9123456234@192.168.16.1:21117?key=5Qbwsde3unUcJBtrx9ZkvUmwFNoExHzpryHuPUdqlWM=.\nUntuk mengakses perangkat di server publik, cukup masukkan \"<id>@public\", tanpa kunci/key."),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", "Richiesta autenticazione"),
("Authenticate", "Autentica"),
("web_id_input_tip", "È possibile inserire un ID nello stesso server, nel client web non è supportato l'accesso con IP diretto.\nSe vuoi accedere ad un dispositivo in un altro server, aggiungi l'indirizzo del server (<id>@<indirizzo_server>?key=<valore_chiave >), ad esempio,\n9123456234@192.168.16.1:21117?key=5Qbwsde3unUcJBtrx9ZkvUmwFNoExHzpryHuPUdqlWM=.\nSe vuoi accedere ad un dispositivo in un server pubblico, inserisci \"<id>@public\", la chiave non è necessaria per il server pubblico."),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", "인증 필요함"),
("Authenticate", "인증"),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", "Nepieciešama autentifikācija"),
("Authenticate", "Autentificēt"),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", "Verificatie vereist"),
("Authenticate", "Verificatie"),
("web_id_input_tip", "Je kunt een ID invoeren op dezelfde server, directe IP-toegang wordt niet ondersteund in de webclient.\nAls je toegang wilt tot een apparaat op een andere server, voeg je het serveradres toe (<id>@<server_adres>?key=<key_value>), bijvoorbeeld,\n9123456234@192.168.16.1:21117?key=5Qbwsde3unUcJBtrx9ZkvUmwFNoExHzpryHuPUdqlWM=.\nAls je toegang wilt krijgen tot een apparaat op een publieke server, voer dan \"<id>@public\" in, sleutel is niet nodig voor de publieke server."),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", "Требуется аутентификация"),
("Authenticate", "Аутентификация"),
("web_id_input_tip", "Можно ввести ID на том же сервере, прямой доступ по IP в веб-клиенте не поддерживается.\nЕсли вы хотите получить доступ к устройству на другом сервере, добавьте адрес сервера (<id>@<адрес_сервера>?key=<ключ>), например,\n9123456234@192.168.16.1:21117?key=5Qbwsde3unUcJBtrx9ZkvUmwFNoExHzpryHuPUdqlWM=.\nЕсли вы хотите получить доступ к устройству на публичном сервере, введите \"<id>@public\", для публичного сервера ключ не нужен."),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", "Potrebno je preverjanje pristnosti"),
("Authenticate", "Preverjanje pristnosti"),
("web_id_input_tip", "Vnesete lahko ID iz istega strežnika, neposredni dostop preko IP naslova v spletnem odjemalcu ni podprt.\nČe želite dostopati do naprave na drugem strežniku, pripnite naslov strežnika (<id>@<naslov_strežnika>?key=<ključ>), npr. 9123456234@192.168.16.1:21117?key=5Qbwsde3unUcJBtrx9ZkvUmwFNoExHzpryHuPUdqlWM=.\nČe želite dostopati do naprave na javnem strežniku, vnesite »<id>@public«; ključ za javni strežnik ni potreben."),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", "需要身分驗證"),
("Authenticate", "認證"),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", "Потрібна автентифікація"),
("Authenticate", "Автентифікувати"),
("web_id_input_tip", "Ви можете ввести ID з того самого серверу, прямий IP-доступ у веб-клієнті не підтримується.\nЯкщо ви хочете отримати доступ до пристрою на іншому сервері, будь ласка, додайте адресу сервера (<id>@<адреса_сервера>?key=<значення_ключа>), наприклад,\n9123456234@192.168.16.1:21117?key=5Qbwsde3unUcJBtrx9ZkvUmwFNoExHzpryHuPUdqlWM=.\nЯкщо ви хочете отримати доступ до пристрою на публічному сервері, будь ласка, введіть \"<id>@public\", для публічного сервера ключ не потрібен."),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}

View File

@ -648,5 +648,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Authentication Required", ""),
("Authenticate", ""),
("web_id_input_tip", ""),
("Download", ""),
("Upload folder", ""),
("Upload files", ""),
].iter().cloned().collect();
}