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() {
|
String toString() {
|
||||||
return id;
|
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 {
|
class _IpPort {
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
"bioAuth": "Biozertifizierung",
|
"bioAuth": "Biozertifizierung",
|
||||||
"browser": "Browser",
|
"browser": "Browser",
|
||||||
"bulkImportServers": "Server im Batch importieren",
|
"bulkImportServers": "Server im Batch importieren",
|
||||||
"bulkImportServersTip": "Sie können das [Format]({url}) hier finden.",
|
|
||||||
"canPullRefresh": "Danach: herunterziehen zum Aktualisieren",
|
"canPullRefresh": "Danach: herunterziehen zum Aktualisieren",
|
||||||
"cancel": "Abbrechen",
|
"cancel": "Abbrechen",
|
||||||
"choose": "Auswählen",
|
"choose": "Auswählen",
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
"bioAuth": "Biometric auth",
|
"bioAuth": "Biometric auth",
|
||||||
"browser": "Browser",
|
"browser": "Browser",
|
||||||
"bulkImportServers": "Batch import servers",
|
"bulkImportServers": "Batch import servers",
|
||||||
"bulkImportServersTip": "You can find the [format]({url}) here.",
|
|
||||||
"canPullRefresh": "You can pull to refresh.",
|
"canPullRefresh": "You can pull to refresh.",
|
||||||
"cancel": "Cancel",
|
"cancel": "Cancel",
|
||||||
"choose": "Choose",
|
"choose": "Choose",
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
"bioAuth": "Autenticación biométrica",
|
"bioAuth": "Autenticación biométrica",
|
||||||
"browser": "Navegador",
|
"browser": "Navegador",
|
||||||
"bulkImportServers": "Importar servidores en masa",
|
"bulkImportServers": "Importar servidores en masa",
|
||||||
"bulkImportServersTip": "Puede encontrar el [formato]]({url}) aquí.",
|
|
||||||
"canPullRefresh": "Se puede deslizar hacia abajo para refrescar",
|
"canPullRefresh": "Se puede deslizar hacia abajo para refrescar",
|
||||||
"cancel": "Cancelar",
|
"cancel": "Cancelar",
|
||||||
"choose": "Elegir",
|
"choose": "Elegir",
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
"bioAuth": "Authentification biométrique",
|
"bioAuth": "Authentification biométrique",
|
||||||
"browser": "Navigateur",
|
"browser": "Navigateur",
|
||||||
"bulkImportServers": "Importation groupée des serveurs",
|
"bulkImportServers": "Importation groupée des serveurs",
|
||||||
"bulkImportServersTip": "Vous pouvez trouver le [format]({url}) ici.",
|
|
||||||
"canPullRefresh": "Vous pouvez tirer pour rafraîchir.",
|
"canPullRefresh": "Vous pouvez tirer pour rafraîchir.",
|
||||||
"cancel": "Annuler",
|
"cancel": "Annuler",
|
||||||
"choose": "Choisir",
|
"choose": "Choisir",
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
"bioAuth": "Biosertifikasi",
|
"bioAuth": "Biosertifikasi",
|
||||||
"browser": "Peramban",
|
"browser": "Peramban",
|
||||||
"bulkImportServers": "Impor server secara massal",
|
"bulkImportServers": "Impor server secara massal",
|
||||||
"bulkImportServersTip": "Anda dapat menemukan [format]({url}) di sini.",
|
|
||||||
"canPullRefresh": "Anda dapat menarik untuk menyegarkan.",
|
"canPullRefresh": "Anda dapat menarik untuk menyegarkan.",
|
||||||
"cancel": "Membatalkan",
|
"cancel": "Membatalkan",
|
||||||
"choose": "Memilih",
|
"choose": "Memilih",
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
"bioAuth": "生体認証",
|
"bioAuth": "生体認証",
|
||||||
"browser": "ブラウザ",
|
"browser": "ブラウザ",
|
||||||
"bulkImportServers": "サーバーを一括インポートする",
|
"bulkImportServers": "サーバーを一括インポートする",
|
||||||
"bulkImportServersTip": "[こちら]({url})でフォーマットを見つけることができます",
|
|
||||||
"canPullRefresh": "引っ張って更新できます",
|
"canPullRefresh": "引っ張って更新できます",
|
||||||
"cancel": "キャンセル",
|
"cancel": "キャンセル",
|
||||||
"choose": "選択",
|
"choose": "選択",
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
"bioAuth": "Biometrische authenticatie",
|
"bioAuth": "Biometrische authenticatie",
|
||||||
"browser": "Browser",
|
"browser": "Browser",
|
||||||
"bulkImportServers": "Servers batchgewijs importeren",
|
"bulkImportServers": "Servers batchgewijs importeren",
|
||||||
"bulkImportServersTip": "U kunt het [formaat]({url}) hier vinden.",
|
|
||||||
"canPullRefresh": "Je kunt verversen door te slepen.",
|
"canPullRefresh": "Je kunt verversen door te slepen.",
|
||||||
"cancel": "Annuleren",
|
"cancel": "Annuleren",
|
||||||
"choose": "Kiezen",
|
"choose": "Kiezen",
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
"bioAuth": "Autenticação biométrica",
|
"bioAuth": "Autenticação biométrica",
|
||||||
"browser": "Navegador",
|
"browser": "Navegador",
|
||||||
"bulkImportServers": "Importar servidores em lote",
|
"bulkImportServers": "Importar servidores em lote",
|
||||||
"bulkImportServersTip": "Você pode encontrar o [formato]({url}) aqui.",
|
|
||||||
"canPullRefresh": "Pode puxar para atualizar",
|
"canPullRefresh": "Pode puxar para atualizar",
|
||||||
"cancel": "Cancelar",
|
"cancel": "Cancelar",
|
||||||
"choose": "Escolher",
|
"choose": "Escolher",
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
"bioAuth": "биометрическая аутентификация",
|
"bioAuth": "биометрическая аутентификация",
|
||||||
"browser": "Браузер",
|
"browser": "Браузер",
|
||||||
"bulkImportServers": "Пакетный импорт серверов",
|
"bulkImportServers": "Пакетный импорт серверов",
|
||||||
"bulkImportServersTip": "[Формат]({url}) можно найти здесь.",
|
|
||||||
"canPullRefresh": "можно обновить, потянув вниз",
|
"canPullRefresh": "можно обновить, потянув вниз",
|
||||||
"cancel": "отмена",
|
"cancel": "отмена",
|
||||||
"choose": "выбрать",
|
"choose": "выбрать",
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
"bioAuth": "Biyometrik kimlik doğrulama",
|
"bioAuth": "Biyometrik kimlik doğrulama",
|
||||||
"browser": "Tarayıcı",
|
"browser": "Tarayıcı",
|
||||||
"bulkImportServers": "Toplu sunucu içe aktarma",
|
"bulkImportServers": "Toplu sunucu içe aktarma",
|
||||||
"bulkImportServersTip": "[Formatı]({url}) burada bulabilirsiniz.",
|
|
||||||
"canPullRefresh": "Yenilemek için aşağı çekebilirsiniz.",
|
"canPullRefresh": "Yenilemek için aşağı çekebilirsiniz.",
|
||||||
"cancel": "İptal",
|
"cancel": "İptal",
|
||||||
"choose": "Seç",
|
"choose": "Seç",
|
||||||
@@ -75,7 +74,7 @@
|
|||||||
"disk": "Disk",
|
"disk": "Disk",
|
||||||
"diskIgnorePath": "Disk için göz ardı edilen yol",
|
"diskIgnorePath": "Disk için göz ardı edilen yol",
|
||||||
"displayCpuIndex": "CPU dizinini görüntüle",
|
"displayCpuIndex": "CPU dizinini görüntüle",
|
||||||
"displayName": "Görünen ad",
|
"displayName": "Görünen ad",
|
||||||
"dl2Local": "{fileName} dosyasını yerel olarak indirmek istiyor musunuz?",
|
"dl2Local": "{fileName} dosyasını yerel olarak indirmek istiyor musunuz?",
|
||||||
"doc": "Dokümantasyon",
|
"doc": "Dokümantasyon",
|
||||||
"dockerEditHost": "DOCKER_HOST'u düzenle",
|
"dockerEditHost": "DOCKER_HOST'u düzenle",
|
||||||
@@ -344,6 +343,4 @@
|
|||||||
"write": "Yaz",
|
"write": "Yaz",
|
||||||
"writeScriptFailTip": "Komut dosyasına yazma başarısız oldu, muhtemelen izin eksikliğinden veya dizin mevcut olmadığından kaynaklanıyor olabilir.",
|
"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."
|
"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": "生物认证",
|
"bioAuth": "生物认证",
|
||||||
"browser": "浏览器",
|
"browser": "浏览器",
|
||||||
"bulkImportServers": "批量导入服务器",
|
"bulkImportServers": "批量导入服务器",
|
||||||
"bulkImportServersTip": "可以在这里找到[格式]({url})",
|
|
||||||
"canPullRefresh": "可以下拉刷新",
|
"canPullRefresh": "可以下拉刷新",
|
||||||
"cancel": "取消",
|
"cancel": "取消",
|
||||||
"choose": "选择",
|
"choose": "选择",
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
"bioAuth": "生物認證",
|
"bioAuth": "生物認證",
|
||||||
"browser": "瀏覽器",
|
"browser": "瀏覽器",
|
||||||
"bulkImportServers": "批量導入伺服器",
|
"bulkImportServers": "批量導入伺服器",
|
||||||
"bulkImportServersTip": "您可以在此處找到[格式]({url})",
|
|
||||||
"canPullRefresh": "可以下拉更新",
|
"canPullRefresh": "可以下拉更新",
|
||||||
"cancel": "取消",
|
"cancel": "取消",
|
||||||
"choose": "選擇",
|
"choose": "選擇",
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import 'dart:io';
|
|||||||
import 'package:computer/computer.dart';
|
import 'package:computer/computer.dart';
|
||||||
import 'package:fl_lib/fl_lib.dart';
|
import 'package:fl_lib/fl_lib.dart';
|
||||||
import 'package:flutter/material.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/extension/context/locale.dart';
|
||||||
import 'package:server_box/core/utils/sync/icloud.dart';
|
import 'package:server_box/core/utils/sync/icloud.dart';
|
||||||
import 'package:server_box/core/utils/sync/webdav.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/model/server/server_private_info.dart';
|
||||||
import 'package:server_box/data/res/misc.dart';
|
import 'package:server_box/data/res/misc.dart';
|
||||||
import 'package:server_box/data/res/store.dart';
|
import 'package:server_box/data/res/store.dart';
|
||||||
import 'package:server_box/data/res/url.dart';
|
|
||||||
|
|
||||||
class BackupPage extends StatelessWidget {
|
class BackupPage extends StatelessWidget {
|
||||||
BackupPage({super.key});
|
BackupPage({super.key});
|
||||||
@@ -204,12 +202,6 @@ class BackupPage extends StatelessWidget {
|
|||||||
return CardX(
|
return CardX(
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
title: Text(l10n.bulkImportServers),
|
title: Text(l10n.bulkImportServers),
|
||||||
subtitle: SimpleMarkdown(
|
|
||||||
data: l10n.bulkImportServersTip(Urls.appWiki),
|
|
||||||
styleSheet: MarkdownStyleSheet(
|
|
||||||
p: UIs.textGrey,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
leading: const Icon(Icons.import_export),
|
leading: const Icon(Icons.import_export),
|
||||||
onTap: () => _onBulkImportServers(context),
|
onTap: () => _onBulkImportServers(context),
|
||||||
trailing: const Icon(Icons.keyboard_arrow_right),
|
trailing: const Icon(Icons.keyboard_arrow_right),
|
||||||
@@ -400,8 +392,12 @@ class BackupPage extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _onBulkImportServers(BuildContext context) async {
|
void _onBulkImportServers(BuildContext context) async {
|
||||||
final text = await Pfs.pickFileString();
|
final data = await context.showImportDialog(
|
||||||
if (text == null) return;
|
title: l10n.server,
|
||||||
|
modelDef: ServerPrivateInfo.example.toJson(),
|
||||||
|
);
|
||||||
|
if (data == null) return;
|
||||||
|
final text = String.fromCharCodes(data);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final (spis, err) = await context.showLoadingDialog(
|
final (spis, err) = await context.showLoadingDialog(
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:computer/computer.dart';
|
||||||
import 'package:fl_lib/fl_lib.dart';
|
import 'package:fl_lib/fl_lib.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||||
@@ -105,7 +106,7 @@ class _SnippetEditPageState extends State<SnippetEditPage>
|
|||||||
|
|
||||||
Widget _buildBody() {
|
Widget _buildBody() {
|
||||||
return ListView(
|
return ListView(
|
||||||
padding: const EdgeInsets.symmetric(horizontal:13),
|
padding: const EdgeInsets.symmetric(horizontal: 13),
|
||||||
children: [
|
children: [
|
||||||
_buildImport(),
|
_buildImport(),
|
||||||
Input(
|
Input(
|
||||||
@@ -198,8 +199,12 @@ class _SnippetEditPageState extends State<SnippetEditPage>
|
|||||||
);
|
);
|
||||||
if (data == null) return;
|
if (data == null) return;
|
||||||
final str = String.fromCharCodes(data);
|
final str = String.fromCharCodes(data);
|
||||||
final list = json.decode(str) as List;
|
final (list, _) = await context.showLoadingDialog(
|
||||||
if (list.isEmpty) return;
|
fn: () => Computer.shared.start((s) {
|
||||||
|
return json.decode(s) as List;
|
||||||
|
}, str),
|
||||||
|
);
|
||||||
|
if (list == null || list.isEmpty) return;
|
||||||
final snippets = <Snippet>[];
|
final snippets = <Snippet>[];
|
||||||
final errs = <String>[];
|
final errs = <String>[];
|
||||||
for (final item in list) {
|
for (final item in list) {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class _SnippetListPageState extends State<SnippetListPage> {
|
|||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
return ReorderableListView.builder(
|
return ReorderableListView.builder(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 13),
|
padding: const EdgeInsets.symmetric(horizontal: 11),
|
||||||
itemCount: filtered.length,
|
itemCount: filtered.length,
|
||||||
onReorder: (oldIdx, newIdx) => setState(() {
|
onReorder: (oldIdx, newIdx) => setState(() {
|
||||||
provider.snippets.moveByItem(
|
provider.snippets.moveByItem(
|
||||||
|
|||||||
Reference in New Issue
Block a user