new: delete scripts when delete server

This commit is contained in:
lollipopkit
2023-11-07 18:10:38 +08:00
parent e80f6d4cc2
commit 2133302397
17 changed files with 117 additions and 56 deletions

View File

@@ -368,6 +368,12 @@ abstract class S {
/// **'Delete'**
String get delete;
/// No description provided for @deleteScripts.
///
/// In en, this message translates to:
/// **'Delete scripts'**
String get deleteScripts;
/// No description provided for @deleteServers.
///
/// In en, this message translates to:

View File

@@ -141,6 +141,9 @@ class SDe extends S {
@override
String get delete => 'Löschen';
@override
String get deleteScripts => 'Skripte löschen';
@override
String get deleteServers => 'Batch-Löschung von Servern';

View File

@@ -141,6 +141,9 @@ class SEn extends S {
@override
String get delete => 'Delete';
@override
String get deleteScripts => 'Delete scripts';
@override
String get deleteServers => 'Batch delete servers';

View File

@@ -141,6 +141,9 @@ class SId extends S {
@override
String get delete => 'Menghapus';
@override
String get deleteScripts => 'Menghapus skrip';
@override
String get deleteServers => 'Penghapusan server secara batch';

View File

@@ -141,6 +141,9 @@ class SZh extends S {
@override
String get delete => '删除';
@override
String get deleteScripts => '同时删除服务器脚本';
@override
String get deleteServers => '批量删除服务器';
@@ -927,6 +930,9 @@ class SZhTw extends SZh {
@override
String get delete => '刪除';
@override
String get deleteScripts => '同時刪除服務器腳本';
@override
String get deleteServers => '批量刪除服務器';

View File

@@ -1,11 +1,13 @@
PODS:
- countly_flutter (23.8.1):
- countly_flutter (23.8.3):
- Flutter
- file_picker (0.0.1):
- Flutter
- Flutter (1.0.0)
- flutter_native_splash (0.0.1):
- Flutter
- flutter_secure_storage (6.0.0):
- Flutter
- icloud_storage (0.0.1):
- Flutter
- local_auth_ios (0.0.1):
@@ -32,6 +34,7 @@ DEPENDENCIES:
- file_picker (from `.symlinks/plugins/file_picker/ios`)
- Flutter (from `Flutter`)
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
- icloud_storage (from `.symlinks/plugins/icloud_storage/ios`)
- local_auth_ios (from `.symlinks/plugins/local_auth_ios/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
@@ -51,6 +54,8 @@ EXTERNAL SOURCES:
:path: Flutter
flutter_native_splash:
:path: ".symlinks/plugins/flutter_native_splash/ios"
flutter_secure_storage:
:path: ".symlinks/plugins/flutter_secure_storage/ios"
icloud_storage:
:path: ".symlinks/plugins/icloud_storage/ios"
local_auth_ios:
@@ -71,18 +76,19 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/watch_connectivity/ios"
SPEC CHECKSUMS:
countly_flutter: 9024d787ff03c4a2882bca3578edee80901b4289
countly_flutter: 5929a8a751abbd19a26e6a667d374eb7b8878636
file_picker: 1d63c4949e05e386da864365f8c13e1e64787675
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef
flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be
icloud_storage: d9ac7a33ced81df08ba7ea1bf3099cc0ee58f60a
local_auth_ios: c6cf091ded637a88f24f86a8875d8b0f526e2605
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
plain_notification_token: b36467dc91939a7b6754267c701bbaca14996ee1
r_upgrade: 44d715c61914cce3d01ea225abffe894fd51c114
share_plus: 599aa54e4ea31d4b4c0e9c911bcc26c55e791028
share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
url_launcher_ios: 68d46cc9766d0c41dbdc884310529557e3cd7a86
watch_connectivity: 715eb484685e05846eab74795348a44bb2809b82
PODFILE CHECKSUM: 7fb15c416f8685fca4966867a8da218ec592ec2e

View File

@@ -586,7 +586,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 630;
CURRENT_PROJECT_VERSION = 634;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -596,7 +596,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.630;
MARKETING_VERSION = 1.0.634;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -720,7 +720,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 630;
CURRENT_PROJECT_VERSION = 634;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -730,7 +730,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.630;
MARKETING_VERSION = 1.0.634;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -748,7 +748,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 630;
CURRENT_PROJECT_VERSION = 634;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -758,7 +758,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.630;
MARKETING_VERSION = 1.0.634;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -779,7 +779,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 630;
CURRENT_PROJECT_VERSION = 634;
DEVELOPMENT_TEAM = BA88US33G6;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
@@ -792,7 +792,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0.630;
MARKETING_VERSION = 1.0.634;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
@@ -818,7 +818,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 630;
CURRENT_PROJECT_VERSION = 634;
DEVELOPMENT_TEAM = BA88US33G6;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
@@ -831,7 +831,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0.630;
MARKETING_VERSION = 1.0.634;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -854,7 +854,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 630;
CURRENT_PROJECT_VERSION = 634;
DEVELOPMENT_TEAM = BA88US33G6;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
@@ -867,7 +867,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0.630;
MARKETING_VERSION = 1.0.634;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -890,7 +890,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 630;
CURRENT_PROJECT_VERSION = 634;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_PREVIEWS = YES;
@@ -902,7 +902,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.630;
MARKETING_VERSION = 1.0.634;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
@@ -931,7 +931,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 630;
CURRENT_PROJECT_VERSION = 634;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_PREVIEWS = YES;
@@ -943,7 +943,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.630;
MARKETING_VERSION = 1.0.634;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
PRODUCT_NAME = ServerBox;
@@ -969,7 +969,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 630;
CURRENT_PROJECT_VERSION = 634;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_PREVIEWS = YES;
@@ -981,7 +981,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.630;
MARKETING_VERSION = 1.0.634;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
PRODUCT_NAME = ServerBox;

View File

@@ -11,7 +11,7 @@ class SecureStore {
SecureStore._();
static const _secureStorage = FlutterSecureStorage();
static HiveAesCipher? _cipher;
static const _hiveKey = 'hive_key';

View File

@@ -16,8 +16,8 @@ enum ShellFunc {
suspend,
;
static const _serverBoxDir = '.config/server_box';
static const _scriptFileName = 'mobile_v${BuildData.script}.sh';
static const _srvBoxDir = '.config/server_box';
static const _scriptFile = 'mobile_v${BuildData.script}.sh';
/// Issue #159
///
@@ -26,15 +26,15 @@ enum ShellFunc {
/// So different version of app can run at the same time.
///
/// **Can't** use it in SFTP, because SFTP can't recognize `$HOME`
static String getShellPath(String home) =>
'$home/$_serverBoxDir/$_scriptFileName';
static String getShellPath(String home) => '$home/$_srvBoxDir/$_scriptFile';
static final _installShellPath = getShellPath(_homeVar);
static const srvBoxDir = '$_homeVar/$_srvBoxDir';
static const _installShellPath = '$_homeVar/$_srvBoxDir/$_scriptFile';
/// Issue #168
/// Use `sh` for compatibility
static final installShellCmd = """
mkdir -p $_homeVar/$_serverBoxDir
mkdir -p $_homeVar/$_srvBoxDir
cat << 'EOF' > $_installShellPath
${ShellFunc.allScript}
EOF

View File

@@ -2,9 +2,9 @@
class BuildData {
static const String name = "ServerBox";
static const int build = 630;
static const int build = 634;
static const String engine = "3.13.8";
static const String buildAt = "2023-11-02 13:45:05";
static const int modifications = 1;
static const String buildAt = "2023-11-03 22:14:11";
static const int modifications = 2;
static const int script = 25;
}

View File

@@ -45,6 +45,7 @@
"decode": "Decode",
"decompress": "Dekomprimieren",
"delete": "Löschen",
"deleteScripts": "Gleichzeitiges Löschen von Server-Skripten",
"deleteServers": "Batch-Löschung von Servern",
"dirEmpty": "Stelle sicher, dass der Ordner leer ist.",
"disabled": "Behinderte",

View File

@@ -45,6 +45,7 @@
"decode": "Decode",
"decompress": "Decompress",
"delete": "Delete",
"deleteScripts": "Delete server scripts at the same time",
"deleteServers": "Batch delete servers",
"dirEmpty": "Make sure dir is empty.",
"disabled": "Disabled",

View File

@@ -45,6 +45,7 @@
"decode": "Membaca sandi",
"decompress": "Dekompresi",
"delete": "Menghapus",
"deleteScripts": "Menghapus skrip server secara bersamaan",
"deleteServers": "Penghapusan server secara batch",
"dirEmpty": "Pastikan dir kosong.",
"disabled": "Dengan disabilitas",

View File

@@ -45,6 +45,7 @@
"decode": "解码",
"decompress": "解压缩",
"delete": "删除",
"deleteScripts": "同时删除服务器脚本",
"deleteServers": "批量删除服务器",
"dirEmpty": "请确保文件夹为空",
"disabled": "已禁用",

View File

@@ -45,6 +45,7 @@
"decode": "解碼",
"decompress": "解壓縮",
"delete": "刪除",
"deleteScripts": "同時刪除服務器腳本",
"deleteServers": "批量刪除服務器",
"dirEmpty": "請確保文件夾為空",
"disabled": "已禁用",

View File

@@ -96,7 +96,7 @@ class _HomePageState extends State<HomePage>
BgRunMC.moveToBg();
}
} else {
Pros.server.setDisconnected();
//Pros.server.setDisconnected();
Pros.server.stopAutoRefresh();
}
break;

View File

@@ -4,6 +4,7 @@ import 'package:toolbox/core/extension/context/common.dart';
import 'package:toolbox/core/extension/context/dialog.dart';
import 'package:toolbox/core/extension/context/locale.dart';
import 'package:toolbox/core/extension/context/snackbar.dart';
import 'package:toolbox/data/model/app/shell_func.dart';
import 'package:toolbox/data/res/provider.dart';
import 'package:toolbox/view/widget/expand_tile.dart';
@@ -107,31 +108,59 @@ class _ServerEditPageState extends State<ServerEditPage> {
}
PreferredSizeWidget _buildAppBar() {
final delBtn = IconButton(
onPressed: () {
context.showRoundDialog(
title: Text(l10n.attention),
child: Text(l10n.askContinue(
'${l10n.delete} ${l10n.server}(${widget.spi!.name})',
)),
actions: [
TextButton(
onPressed: () {
Pros.server.delServer(widget.spi!.id);
context.pop();
context.pop(true);
},
child: Text(l10n.ok, style: UIs.textRed),
),
],
);
},
icon: const Icon(Icons.delete),
);
final actions = widget.spi != null ? [delBtn] : null;
return CustomAppBar(
title: Text(l10n.edit, style: UIs.textSize18),
actions: actions,
actions: widget.spi != null
? [
IconButton(
onPressed: () {
var delScripts = false;
context.showRoundDialog(
title: Text(l10n.attention),
child: StatefulBuilder(builder: (ctx, setState) {
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(l10n.askContinue(
'${l10n.delete} ${l10n.server}(${widget.spi!.name})',
)),
UIs.height13,
Row(
children: [
Checkbox(
value: delScripts,
onChanged: (_) => setState(
() => delScripts = !delScripts,
),
),
Text(l10n.deleteScripts),
],
)
],
);
}),
actions: [
TextButton(
onPressed: () async {
if (delScripts) {
const cmd =
'rm ${ShellFunc.srvBoxDir}/mobile_v*.sh';
await widget.spi?.server?.client?.run(cmd);
}
Pros.server.delServer(widget.spi!.id);
context.pop();
context.pop(true);
},
child: Text(l10n.ok, style: UIs.textRed),
),
],
);
},
icon: const Icon(Icons.delete),
),
]
: null,
);
}