mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt.: bulk import servers (#512)
This commit is contained in:
@@ -180,6 +180,28 @@ class ServerPrivateInfo {
|
||||
String toString() {
|
||||
return id;
|
||||
}
|
||||
|
||||
static const example = ServerPrivateInfo(
|
||||
name: 'name',
|
||||
ip: 'ip',
|
||||
port: 22,
|
||||
user: 'root',
|
||||
pwd: 'pwd',
|
||||
keyId: 'private_key_id',
|
||||
tags: ['tag1', 'tag2'],
|
||||
alterUrl: 'user@ip:port',
|
||||
autoConnect: true,
|
||||
jumpId: 'jump_server_id',
|
||||
custom: ServerCustom(
|
||||
pveAddr: 'http://localhost:8006',
|
||||
pveIgnoreCert: false,
|
||||
cmds: {
|
||||
'echo': 'echo hello',
|
||||
},
|
||||
preferTempDev: 'nvme-pci-0400',
|
||||
logoUrl: 'https://example.com/logo.png',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class _IpPort {
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
"bioAuth": "Biozertifizierung",
|
||||
"browser": "Browser",
|
||||
"bulkImportServers": "Server im Batch importieren",
|
||||
"bulkImportServersTip": "Sie können das [Format]({url}) hier finden.",
|
||||
"canPullRefresh": "Danach: herunterziehen zum Aktualisieren",
|
||||
"cancel": "Abbrechen",
|
||||
"choose": "Auswählen",
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
"bioAuth": "Biometric auth",
|
||||
"browser": "Browser",
|
||||
"bulkImportServers": "Batch import servers",
|
||||
"bulkImportServersTip": "You can find the [format]({url}) here.",
|
||||
"canPullRefresh": "You can pull to refresh.",
|
||||
"cancel": "Cancel",
|
||||
"choose": "Choose",
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
"bioAuth": "Autenticación biométrica",
|
||||
"browser": "Navegador",
|
||||
"bulkImportServers": "Importar servidores en masa",
|
||||
"bulkImportServersTip": "Puede encontrar el [formato]]({url}) aquí.",
|
||||
"canPullRefresh": "Se puede deslizar hacia abajo para refrescar",
|
||||
"cancel": "Cancelar",
|
||||
"choose": "Elegir",
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
"bioAuth": "Authentification biométrique",
|
||||
"browser": "Navigateur",
|
||||
"bulkImportServers": "Importation groupée des serveurs",
|
||||
"bulkImportServersTip": "Vous pouvez trouver le [format]({url}) ici.",
|
||||
"canPullRefresh": "Vous pouvez tirer pour rafraîchir.",
|
||||
"cancel": "Annuler",
|
||||
"choose": "Choisir",
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
"bioAuth": "Biosertifikasi",
|
||||
"browser": "Peramban",
|
||||
"bulkImportServers": "Impor server secara massal",
|
||||
"bulkImportServersTip": "Anda dapat menemukan [format]({url}) di sini.",
|
||||
"canPullRefresh": "Anda dapat menarik untuk menyegarkan.",
|
||||
"cancel": "Membatalkan",
|
||||
"choose": "Memilih",
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
"bioAuth": "生体認証",
|
||||
"browser": "ブラウザ",
|
||||
"bulkImportServers": "サーバーを一括インポートする",
|
||||
"bulkImportServersTip": "[こちら]({url})でフォーマットを見つけることができます",
|
||||
"canPullRefresh": "引っ張って更新できます",
|
||||
"cancel": "キャンセル",
|
||||
"choose": "選択",
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
"bioAuth": "Biometrische authenticatie",
|
||||
"browser": "Browser",
|
||||
"bulkImportServers": "Servers batchgewijs importeren",
|
||||
"bulkImportServersTip": "U kunt het [formaat]({url}) hier vinden.",
|
||||
"canPullRefresh": "Je kunt verversen door te slepen.",
|
||||
"cancel": "Annuleren",
|
||||
"choose": "Kiezen",
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
"bioAuth": "Autenticação biométrica",
|
||||
"browser": "Navegador",
|
||||
"bulkImportServers": "Importar servidores em lote",
|
||||
"bulkImportServersTip": "Você pode encontrar o [formato]({url}) aqui.",
|
||||
"canPullRefresh": "Pode puxar para atualizar",
|
||||
"cancel": "Cancelar",
|
||||
"choose": "Escolher",
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
"bioAuth": "биометрическая аутентификация",
|
||||
"browser": "Браузер",
|
||||
"bulkImportServers": "Пакетный импорт серверов",
|
||||
"bulkImportServersTip": "[Формат]({url}) можно найти здесь.",
|
||||
"canPullRefresh": "можно обновить, потянув вниз",
|
||||
"cancel": "отмена",
|
||||
"choose": "выбрать",
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
"bioAuth": "Biyometrik kimlik doğrulama",
|
||||
"browser": "Tarayıcı",
|
||||
"bulkImportServers": "Toplu sunucu içe aktarma",
|
||||
"bulkImportServersTip": "[Formatı]({url}) burada bulabilirsiniz.",
|
||||
"canPullRefresh": "Yenilemek için aşağı çekebilirsiniz.",
|
||||
"cancel": "İptal",
|
||||
"choose": "Seç",
|
||||
@@ -345,5 +344,3 @@
|
||||
"writeScriptFailTip": "Komut dosyasına yazma başarısız oldu, muhtemelen izin eksikliğinden veya dizin mevcut olmadığından kaynaklanıyor olabilir.",
|
||||
"writeScriptTip": "Sunucuya bağlandıktan sonra, sistem durumunu izlemek için ~/.config/server_box'a bir komut dosyası yazılacaktır. Komut dosyası içeriğini inceleyebilirsiniz."
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
"bioAuth": "生物认证",
|
||||
"browser": "浏览器",
|
||||
"bulkImportServers": "批量导入服务器",
|
||||
"bulkImportServersTip": "可以在这里找到[格式]({url})",
|
||||
"canPullRefresh": "可以下拉刷新",
|
||||
"cancel": "取消",
|
||||
"choose": "选择",
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
"bioAuth": "生物認證",
|
||||
"browser": "瀏覽器",
|
||||
"bulkImportServers": "批量導入伺服器",
|
||||
"bulkImportServersTip": "您可以在此處找到[格式]({url})",
|
||||
"canPullRefresh": "可以下拉更新",
|
||||
"cancel": "取消",
|
||||
"choose": "選擇",
|
||||
|
||||
@@ -4,7 +4,6 @@ import 'dart:io';
|
||||
import 'package:computer/computer.dart';
|
||||
import 'package:fl_lib/fl_lib.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
import 'package:server_box/core/extension/context/locale.dart';
|
||||
import 'package:server_box/core/utils/sync/icloud.dart';
|
||||
import 'package:server_box/core/utils/sync/webdav.dart';
|
||||
@@ -12,7 +11,6 @@ import 'package:server_box/data/model/app/backup.dart';
|
||||
import 'package:server_box/data/model/server/server_private_info.dart';
|
||||
import 'package:server_box/data/res/misc.dart';
|
||||
import 'package:server_box/data/res/store.dart';
|
||||
import 'package:server_box/data/res/url.dart';
|
||||
|
||||
class BackupPage extends StatelessWidget {
|
||||
BackupPage({super.key});
|
||||
@@ -204,12 +202,6 @@ class BackupPage extends StatelessWidget {
|
||||
return CardX(
|
||||
child: ListTile(
|
||||
title: Text(l10n.bulkImportServers),
|
||||
subtitle: SimpleMarkdown(
|
||||
data: l10n.bulkImportServersTip(Urls.appWiki),
|
||||
styleSheet: MarkdownStyleSheet(
|
||||
p: UIs.textGrey,
|
||||
),
|
||||
),
|
||||
leading: const Icon(Icons.import_export),
|
||||
onTap: () => _onBulkImportServers(context),
|
||||
trailing: const Icon(Icons.keyboard_arrow_right),
|
||||
@@ -400,8 +392,12 @@ class BackupPage extends StatelessWidget {
|
||||
}
|
||||
|
||||
void _onBulkImportServers(BuildContext context) async {
|
||||
final text = await Pfs.pickFileString();
|
||||
if (text == null) return;
|
||||
final data = await context.showImportDialog(
|
||||
title: l10n.server,
|
||||
modelDef: ServerPrivateInfo.example.toJson(),
|
||||
);
|
||||
if (data == null) return;
|
||||
final text = String.fromCharCodes(data);
|
||||
|
||||
try {
|
||||
final (spis, err) = await context.showLoadingDialog(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:computer/computer.dart';
|
||||
import 'package:fl_lib/fl_lib.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
@@ -105,7 +106,7 @@ class _SnippetEditPageState extends State<SnippetEditPage>
|
||||
|
||||
Widget _buildBody() {
|
||||
return ListView(
|
||||
padding: const EdgeInsets.symmetric(horizontal:13),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 13),
|
||||
children: [
|
||||
_buildImport(),
|
||||
Input(
|
||||
@@ -198,8 +199,12 @@ class _SnippetEditPageState extends State<SnippetEditPage>
|
||||
);
|
||||
if (data == null) return;
|
||||
final str = String.fromCharCodes(data);
|
||||
final list = json.decode(str) as List;
|
||||
if (list.isEmpty) return;
|
||||
final (list, _) = await context.showLoadingDialog(
|
||||
fn: () => Computer.shared.start((s) {
|
||||
return json.decode(s) as List;
|
||||
}, str),
|
||||
);
|
||||
if (list == null || list.isEmpty) return;
|
||||
final snippets = <Snippet>[];
|
||||
final errs = <String>[];
|
||||
for (final item in list) {
|
||||
|
||||
@@ -52,7 +52,7 @@ class _SnippetListPageState extends State<SnippetListPage> {
|
||||
.toList();
|
||||
|
||||
return ReorderableListView.builder(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 13),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 11),
|
||||
itemCount: filtered.length,
|
||||
onReorder: (oldIdx, newIdx) => setState(() {
|
||||
provider.snippets.moveByItem(
|
||||
|
||||
Reference in New Issue
Block a user