This commit is contained in:
lollipopkit
2024-05-23 18:23:26 +08:00
parent cf5810d6ca
commit eb0100d432
28 changed files with 137 additions and 154 deletions

View File

@@ -95,6 +95,7 @@ class HomeWidget : AppWidgetProvider() {
appWidgetManager.updateAppWidget(appWidgetId, views) appWidgetManager.updateAppWidget(appWidgetId, views)
} }
} catch (e: Exception) { } catch (e: Exception) {
println("ServerBoxHomeWidget: ${e.localizedMessage}")
GlobalScope.launch(Dispatchers.Main) main@ { GlobalScope.launch(Dispatchers.Main) main@ {
views.setViewVisibility(R.id.widget_cpu_label, View.INVISIBLE) views.setViewVisibility(R.id.widget_cpu_label, View.INVISIBLE)
views.setViewVisibility(R.id.widget_mem_label, View.INVISIBLE) views.setViewVisibility(R.id.widget_mem_label, View.INVISIBLE)

View File

@@ -690,7 +690,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 908; CURRENT_PROJECT_VERSION = 909;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -700,7 +700,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.908; MARKETING_VERSION = 1.0.909;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -826,7 +826,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 908; CURRENT_PROJECT_VERSION = 909;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -836,7 +836,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.908; MARKETING_VERSION = 1.0.909;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -854,7 +854,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 908; CURRENT_PROJECT_VERSION = 909;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -864,7 +864,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.908; MARKETING_VERSION = 1.0.909;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -885,7 +885,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 908; CURRENT_PROJECT_VERSION = 909;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
GCC_C_LANGUAGE_STANDARD = gnu11; GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
@@ -898,7 +898,7 @@
"@executable_path/Frameworks", "@executable_path/Frameworks",
"@executable_path/../../Frameworks", "@executable_path/../../Frameworks",
); );
MARKETING_VERSION = 1.0.908; MARKETING_VERSION = 1.0.909;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
@@ -924,7 +924,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 908; CURRENT_PROJECT_VERSION = 909;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
GCC_C_LANGUAGE_STANDARD = gnu11; GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
@@ -937,7 +937,7 @@
"@executable_path/Frameworks", "@executable_path/Frameworks",
"@executable_path/../../Frameworks", "@executable_path/../../Frameworks",
); );
MARKETING_VERSION = 1.0.908; MARKETING_VERSION = 1.0.909;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
@@ -960,7 +960,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 908; CURRENT_PROJECT_VERSION = 909;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
GCC_C_LANGUAGE_STANDARD = gnu11; GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
@@ -973,7 +973,7 @@
"@executable_path/Frameworks", "@executable_path/Frameworks",
"@executable_path/../../Frameworks", "@executable_path/../../Frameworks",
); );
MARKETING_VERSION = 1.0.908; MARKETING_VERSION = 1.0.909;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
@@ -996,7 +996,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 908; CURRENT_PROJECT_VERSION = 909;
DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
@@ -1008,7 +1008,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.908; MARKETING_VERSION = 1.0.909;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
@@ -1037,7 +1037,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 908; CURRENT_PROJECT_VERSION = 909;
DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
@@ -1049,7 +1049,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.908; MARKETING_VERSION = 1.0.909;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
PRODUCT_NAME = ServerBox; PRODUCT_NAME = ServerBox;
@@ -1075,7 +1075,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 908; CURRENT_PROJECT_VERSION = 909;
DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
@@ -1087,7 +1087,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.908; MARKETING_VERSION = 1.0.909;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
PRODUCT_NAME = ServerBox; PRODUCT_NAME = ServerBox;

View File

@@ -3,6 +3,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:toolbox/data/model/server/private_key_info.dart'; import 'package:toolbox/data/model/server/private_key_info.dart';
import 'package:toolbox/data/model/server/server_private_info.dart'; import 'package:toolbox/data/model/server/server_private_info.dart';
import 'package:toolbox/data/res/build_data.dart';
import 'package:toolbox/data/res/provider.dart'; import 'package:toolbox/data/res/provider.dart';
import 'package:toolbox/data/res/store.dart'; import 'package:toolbox/data/res/store.dart';
import 'package:toolbox/view/page/backup.dart'; import 'package:toolbox/view/page/backup.dart';
@@ -154,8 +155,11 @@ class AppRoutes {
return AppRoutes( return AppRoutes(
DebugPage( DebugPage(
key: key, key: key,
args: DebugPageArgs(
notifier: Pros.debug.widgets, notifier: Pros.debug.widgets,
onClear: Pros.debug.clear, onClear: Pros.debug.clear,
title: 'Logs(${BuildData.build})',
),
), ),
'debug', 'debug',
); );

View File

@@ -130,12 +130,7 @@ final class PveLxc extends PveResIface implements PveCtrlIface {
@override @override
String get summary { String get summary {
if (available) { if (available) {
return uptime.secondsToDuration().toAgoStr( return uptime.secondsToDuration().toAgoStr;
day: l10n.day,
hour: l10n.hour,
minute: l10n.minute,
second: l10n.second,
);
} }
return l10n.stopped; return l10n.stopped;
} }
@@ -213,12 +208,7 @@ final class PveQemu extends PveResIface implements PveCtrlIface {
@override @override
String get summary { String get summary {
if (available) { if (available) {
return uptime.secondsToDuration().toAgoStr( return uptime.secondsToDuration().toAgoStr;
day: l10n.day,
hour: l10n.hour,
minute: l10n.minute,
second: l10n.second,
);
} }
return l10n.stopped; return l10n.stopped;
} }
@@ -268,12 +258,7 @@ final class PveNode extends PveResIface {
String get topRight { String get topRight {
if (isRunning) { if (isRunning) {
return uptime.secondsToDuration().toAgoStr( return uptime.secondsToDuration().toAgoStr;
day: l10n.day,
hour: l10n.hour,
minute: l10n.minute,
second: l10n.second,
);
} }
return l10n.stopped; return l10n.stopped;
} }

View File

@@ -39,7 +39,7 @@ final class WakeOnLanCfg {
return (err, valid); return (err, valid);
} }
Future<void> wake() async { Future<void> wake() {
if (!validate().$2) { if (!validate().$2) {
throw Exception('Invalid WakeOnLanCfg'); throw Exception('Invalid WakeOnLanCfg');
} }
@@ -48,7 +48,7 @@ final class WakeOnLanCfg {
final mac_ = MACAddress(mac); final mac_ = MACAddress(mac);
final pwd_ = pwd != null ? SecureONPassword(pwd!) : null; final pwd_ = pwd != null ? SecureONPassword(pwd!) : null;
final obj = WakeOnLAN(ip_, mac_, password: pwd_); final obj = WakeOnLAN(ip_, mac_, password: pwd_);
await obj.wake( return obj.wake(
repeat: 3, repeat: 3,
repeatDelay: const Duration(milliseconds: 500), repeatDelay: const Duration(milliseconds: 500),
); );

View File

@@ -283,7 +283,7 @@ class ServerProvider extends ChangeNotifier {
// message: 'Wake on lan failed: $e', // message: 'Wake on lan failed: $e',
// ); // );
// _setServerState(s, ServerConn.failed); // _setServerState(s, ServerConn.failed);
// Loggers.app.warning('Wake on lan failed', e); Loggers.app.warning('Wake on lan failed', e);
// return; // return;
} }
} }

View File

@@ -2,9 +2,9 @@
class BuildData { class BuildData {
static const String name = "ServerBox"; static const String name = "ServerBox";
static const int build = 908; static const int build = 909;
static const String engine = "3.22.0"; static const String engine = "3.22.0";
static const String buildAt = "2024-05-22 22:25:06"; static const String buildAt = "2024-05-23 00:45:04";
static const int modifications = 4; static const int modifications = 11;
static const int script = 48; static const int script = 48;
} }

View File

@@ -14,7 +14,6 @@ import 'package:toolbox/data/res/store.dart';
import '../../data/model/container/ps.dart'; import '../../data/model/container/ps.dart';
import '../../data/model/server/server_private_info.dart'; import '../../data/model/server/server_private_info.dart';
import '../../data/provider/container.dart'; import '../../data/provider/container.dart';
import '../widget/popup_menu.dart';
import '../widget/two_line_text.dart'; import '../widget/two_line_text.dart';
class ContainerPage extends StatefulWidget { class ContainerPage extends StatefulWidget {
@@ -260,8 +259,9 @@ class _ContainerPageState extends State<ContainerPage> {
Widget _buildMoreBtn(ContainerPs dItem) { Widget _buildMoreBtn(ContainerPs dItem) {
return PopupMenu( return PopupMenu(
items: ContainerMenu.items(dItem.running), items: ContainerMenu.items(dItem.running)
builder: (e) => PopMenu.build(e, e.icon, e.toStr), .map((e) => PopMenu.build(e, e.icon, e.toStr))
.toList(),
onSelected: (item) => _onTapMoreBtn(item, dItem), onSelected: (item) => _onTapMoreBtn(item, dItem),
); );
} }

View File

@@ -341,7 +341,6 @@ ${GithubIds.participants.map((e) => '[$e](${e.url})').join(' ')}
build: BuildData.build, build: BuildData.build,
url: '${Urls.cdnBase}/update.json', url: '${Urls.cdnBase}/update.json',
context: context, context: context,
updateL10n: l10n.update,
); );
} }
HomeWidgetMC.update(); HomeWidgetMC.update();

View File

@@ -77,7 +77,6 @@ final class _WearHomeState extends State<WearHome> with AfterLayoutMixin {
build: BuildData.build, build: BuildData.build,
url: '${Urls.cdnBase}/update.json', url: '${Urls.cdnBase}/update.json',
context: context, context: context,
updateL10n: l10n.update,
); );
} }
await Pros.server.load(); await Pros.server.load();

View File

@@ -255,9 +255,6 @@ class _ServerEditPageState extends State<ServerEditPage> {
onChanged: (p0) => _tags = p0, onChanged: (p0) => _tags = p0,
allTags: [...Pros.server.tags.value], allTags: [...Pros.server.tags.value],
onRenameTag: Pros.server.renameTag, onRenameTag: Pros.server.renameTag,
renameL10n: l10n.rename,
tagL10n: l10n.tag,
addL10n: l10n.add,
), ),
ListTile( ListTile(
title: Text(l10n.autoConnect), title: Text(l10n.autoConnect),

View File

@@ -214,7 +214,6 @@ class _ServerPageState extends State<ServerPage>
_tag = p0; _tag = p0;
}), }),
initTag: _tag, initTag: _tag,
allL10n: l10n.all,
); );
} }

View File

@@ -204,7 +204,6 @@ class _SettingPageState extends State<SettingPage> {
build: BuildData.build, build: BuildData.build,
url: Urls.updateCfg, url: Urls.updateCfg,
force: BuildMode.isDebug, force: BuildMode.isDebug,
updateL10n: l10n.update,
), ),
), ),
trailing: StoreSwitch(prop: _setting.autoCheckAppUpdate), trailing: StoreSwitch(prop: _setting.autoCheckAppUpdate),

View File

@@ -136,9 +136,6 @@ class _SnippetEditPageState extends State<SnippetEditPage>
onRenameTag: (old, n) => setState(() { onRenameTag: (old, n) => setState(() {
Pros.snippet.renameTag(old, n); Pros.snippet.renameTag(old, n);
}), }),
renameL10n: l10n.rename,
tagL10n: l10n.tag,
addL10n: l10n.add,
); );
}, },
), ),

View File

@@ -69,7 +69,6 @@ class _SnippetListPageState extends State<SnippetListPage> {
onTagChanged: (tag) => setState(() => _tag = tag), onTagChanged: (tag) => setState(() => _tag = tag),
initTag: _tag, initTag: _tag,
width: _media.size.width, width: _media.size.width,
allL10n: l10n.all,
), ),
footer: UIs.height77, footer: UIs.height77,
buildDefaultDragHandles: false, buildDefaultDragHandles: false,

View File

@@ -5,7 +5,6 @@ import 'package:dartssh2/dartssh2.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/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_background_service/flutter_background_service.dart'; import 'package:flutter_background_service/flutter_background_service.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:toolbox/core/extension/context/locale.dart'; import 'package:toolbox/core/extension/context/locale.dart';

View File

@@ -17,15 +17,14 @@ class SSHTabPage extends StatefulWidget {
class _SSHTabPageState extends State<SSHTabPage> class _SSHTabPageState extends State<SSHTabPage>
with TickerProviderStateMixin, AutomaticKeepAliveClientMixin { with TickerProviderStateMixin, AutomaticKeepAliveClientMixin {
late final _tabIds = <String, Widget>{ late final _tabMap = <String, ({Widget page, FocusNode? focus})>{
l10n.add: _buildAddPage(), l10n.add: (page: _buildAddPage(), focus: null),
}; };
late var _tabController = TabController( late var _tabController = TabController(
length: _tabIds.length, length: _tabMap.length,
vsync: this, vsync: this,
); );
final _fabRN = ValueNotifier(0); final _fabRN = ValueNotifier(0);
final _focusMap = <String, FocusNode>{};
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -33,13 +32,14 @@ class _SSHTabPageState extends State<SSHTabPage>
return Scaffold( return Scaffold(
appBar: TabBar( appBar: TabBar(
controller: _tabController, controller: _tabController,
tabs: _tabIds.keys.map(_buildTabItem).toList(), tabs: _tabMap.keys.map(_buildTabItem).toList(),
isScrollable: true, isScrollable: true,
tabAlignment: TabAlignment.start, tabAlignment: TabAlignment.start,
dividerColor: Colors.transparent, dividerColor: Colors.transparent,
onTap: (value) { onTap: (value) {
_fabRN.value = value; _fabRN.value = value;
_focusMap[_tabIds.keys.elementAt(value)]?.requestFocus(); final mapKey = _tabMap.keys.elementAt(value);
_tabMap[mapKey]?.focus?.requestFocus();
}, },
), ),
body: _buildBody(), body: _buildBody(),
@@ -67,9 +67,9 @@ class _SSHTabPageState extends State<SSHTabPage>
children: [ children: [
Text(e), Text(e),
UIs.width7, UIs.width7,
IconButton( IconBtn(
icon: const Icon(Icons.close, size: 17), icon: Icons.close,
onPressed: () async { onTap: () async {
final confirm = await context.showRoundDialog<bool>( final confirm = await context.showRoundDialog<bool>(
title: l10n.attention, title: l10n.attention,
child: Text('${l10n.close} SSH ${l10n.conn}($e) ?'), child: Text('${l10n.close} SSH ${l10n.conn}($e) ?'),
@@ -87,7 +87,7 @@ class _SSHTabPageState extends State<SSHTabPage>
if (confirm != true) { if (confirm != true) {
return; return;
} }
_tabIds.remove(e); _tabMap.remove(e);
_refreshTabs(); _refreshTabs();
}, },
), ),
@@ -131,38 +131,39 @@ class _SSHTabPageState extends State<SSHTabPage>
return TabBarView( return TabBarView(
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
controller: _tabController, controller: _tabController,
children: _tabIds.values.toList(), children: _tabMap.values.map((e) => e.page).toList(),
); );
} }
void _onTapInitCard(ServerPrivateInfo spi) { void _onTapInitCard(ServerPrivateInfo spi) {
final name = () { final name = () {
if (_tabIds.containsKey(spi.name)) { if (_tabMap.containsKey(spi.name)) {
return '${spi.name}(${_tabIds.length + 1})'; return '${spi.name}(${_tabMap.length + 1})';
} }
return spi.name; return spi.name;
}(); }();
final focus = _focusMap.putIfAbsent(name, () => FocusNode()); final focus = FocusNode();
_tabIds[name] = SSHPage( _tabMap[name] = (
page: SSHPage(
spi: spi, spi: spi,
focus: focus, focus: focus,
notFromTab: false, notFromTab: false,
onSessionEnd: () { onSessionEnd: () {
// debugPrint("Session done received on page whose tabId = $name"); _tabMap.remove(name);
// debugPrint("key = $key");
_tabIds.remove(name);
_refreshTabs(); _refreshTabs();
}, },
),
focus: focus,
); );
_refreshTabs(); _refreshTabs();
final idx = _tabIds.length - 1; final idx = _tabMap.length - 1;
_tabController.animateTo(idx); _tabController.animateTo(idx);
_fabRN.value = idx; _fabRN.value = idx;
} }
void _refreshTabs() { void _refreshTabs() {
_tabController = TabController( _tabController = TabController(
length: _tabIds.length, length: _tabMap.length,
vsync: this, vsync: this,
); );
setState(() {}); setState(() {});

View File

@@ -677,7 +677,15 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
Loggers.app.warning('$op failed', e, s); Loggers.app.warning('$op failed', e, s);
return ctx.showRoundDialog( return ctx.showRoundDialog(
title: l10n.error, title: l10n.error,
child: Text(e.toString()), child: SingleChildScrollView(
child: Column(
children: [
Text(e.toString()),
const SizedBox(height: 7),
SimpleMarkdown(data: s.toString()),
],
),
),
actions: [ actions: [
TextButton( TextButton(
onPressed: () => ctx.pop(), onPressed: () => ctx.pop(),

View File

@@ -1,34 +0,0 @@
import 'package:fl_lib/fl_lib.dart';
import 'package:flutter/material.dart';
class PopupMenu<T> extends StatelessWidget {
final List<T> items;
final Widget Function(T) builder;
final void Function(T) onSelected;
final Widget child;
final EdgeInsetsGeometry padding;
final T? initialValue;
const PopupMenu({
super.key,
required this.items,
required this.builder,
required this.onSelected,
this.child = UIs.popMenuChild,
this.padding = const EdgeInsets.all(7),
this.initialValue,
});
@override
Widget build(BuildContext context) {
return PopupMenuButton<T>(
itemBuilder: (_) =>
items.map((e) => PopupMenuItem(value: e, child: builder(e))).toList(),
onSelected: onSelected,
initialValue: initialValue,
padding: padding,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
child: child,
);
}
}

View File

@@ -17,7 +17,6 @@ import '../../core/route.dart';
import '../../core/utils/server.dart'; import '../../core/utils/server.dart';
import '../../data/model/pkg/upgrade_info.dart'; import '../../data/model/pkg/upgrade_info.dart';
import '../../data/model/server/server_private_info.dart'; import '../../data/model/server/server_private_info.dart';
import 'popup_menu.dart';
class ServerFuncBtnsTopRight extends StatelessWidget { class ServerFuncBtnsTopRight extends StatelessWidget {
final ServerPrivateInfo spi; final ServerPrivateInfo spi;
@@ -30,8 +29,9 @@ class ServerFuncBtnsTopRight extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return PopupMenu<ServerFuncBtn>( return PopupMenu<ServerFuncBtn>(
items: ServerFuncBtn.values, items: ServerFuncBtn.values
builder: (e) => PopMenu.build(e, e.icon, e.toStr), .map((e) => PopMenu.build(e, e.icon, e.toStr))
.toList(),
padding: const EdgeInsets.symmetric(horizontal: 10), padding: const EdgeInsets.symmetric(horizontal: 10),
onSelected: (val) => _onTapMoreBtns(val, spi, context), onSelected: (val) => _onTapMoreBtns(val, spi, context),
); );

View File

@@ -7,6 +7,7 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <dynamic_color/dynamic_color_plugin.h> #include <dynamic_color/dynamic_color_plugin.h>
#include <gtk/gtk_plugin.h>
#include <screen_retriever/screen_retriever_plugin.h> #include <screen_retriever/screen_retriever_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h> #include <url_launcher_linux/url_launcher_plugin.h>
#include <window_manager/window_manager_plugin.h> #include <window_manager/window_manager_plugin.h>
@@ -15,6 +16,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) dynamic_color_registrar = g_autoptr(FlPluginRegistrar) dynamic_color_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin"); fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin");
dynamic_color_plugin_register_with_registrar(dynamic_color_registrar); dynamic_color_plugin_register_with_registrar(dynamic_color_registrar);
g_autoptr(FlPluginRegistrar) gtk_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "GtkPlugin");
gtk_plugin_register_with_registrar(gtk_registrar);
g_autoptr(FlPluginRegistrar) screen_retriever_registrar = g_autoptr(FlPluginRegistrar) screen_retriever_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverPlugin"); fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverPlugin");
screen_retriever_plugin_register_with_registrar(screen_retriever_registrar); screen_retriever_plugin_register_with_registrar(screen_retriever_registrar);

View File

@@ -4,6 +4,7 @@
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
dynamic_color dynamic_color
gtk
screen_retriever screen_retriever
url_launcher_linux url_launcher_linux
window_manager window_manager

View File

@@ -5,6 +5,7 @@
import FlutterMacOS import FlutterMacOS
import Foundation import Foundation
import app_links
import device_info_plus import device_info_plus
import dynamic_color import dynamic_color
import icloud_storage import icloud_storage
@@ -18,6 +19,7 @@ import wakelock_plus
import window_manager import window_manager
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
AppLinksMacosPlugin.register(with: registry.registrar(forPlugin: "AppLinksMacosPlugin"))
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin")) DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin"))
IcloudStoragePlugin.register(with: registry.registrar(forPlugin: "IcloudStoragePlugin")) IcloudStoragePlugin.register(with: registry.registrar(forPlugin: "IcloudStoragePlugin"))

View File

@@ -471,7 +471,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 908; CURRENT_PROJECT_VERSION = 909;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "Server Box"; INFOPLIST_KEY_CFBundleDisplayName = "Server Box";
@@ -481,7 +481,7 @@
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 10.15; MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 1.0.908; MARKETING_VERSION = 1.0.909;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "Server Box"; PRODUCT_NAME = "Server Box";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
@@ -608,7 +608,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 908; CURRENT_PROJECT_VERSION = 909;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "Server Box"; INFOPLIST_KEY_CFBundleDisplayName = "Server Box";
@@ -618,7 +618,7 @@
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 10.15; MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 1.0.908; MARKETING_VERSION = 1.0.909;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "Server Box"; PRODUCT_NAME = "Server Box";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
@@ -638,7 +638,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "3rd Party Mac Developer Application"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "3rd Party Mac Developer Application";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 908; CURRENT_PROJECT_VERSION = 909;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=macosx*]" = BA88US33G6; "DEVELOPMENT_TEAM[sdk=macosx*]" = BA88US33G6;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
@@ -649,7 +649,7 @@
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 10.15; MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 1.0.908; MARKETING_VERSION = 1.0.909;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "Server Box"; PRODUCT_NAME = "Server Box";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";

View File

@@ -33,6 +33,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.2" version: "2.0.2"
app_links:
dependency: transitive
description:
name: app_links
sha256: "96e677810b83707ff5e10fac11e4839daa0ea4e0123c35864c092699165eb3db"
url: "https://pub.dev"
source: hosted
version: "6.1.1"
archive: archive:
dependency: transitive dependency: transitive
description: description:
@@ -262,11 +270,9 @@ packages:
dartssh2: dartssh2:
dependency: "direct main" dependency: "direct main"
description: description:
path: "." path: "../dartssh2"
ref: dev relative: true
resolved-ref: d62d7e64c99de62a52495f3dedbf6b8983e4ce77 source: path
url: "https://github.com/lollipopkit/dartssh2"
source: git
version: "2.9.1-pre" version: "2.9.1-pre"
dbus: dbus:
dependency: transitive dependency: transitive
@@ -391,11 +397,9 @@ packages:
fl_lib: fl_lib:
dependency: "direct main" dependency: "direct main"
description: description:
path: "." path: "../fl_lib"
ref: main relative: true
resolved-ref: d6f282b4883615cc5a31b5f3a720b6a74d5285f4 source: path
url: "https://github.com/lollipopkit/fl_lib"
source: git
version: "0.0.1" version: "0.0.1"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
@@ -553,6 +557,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.3.1" version: "2.3.1"
gtk:
dependency: transitive
description:
name: gtk
sha256: e8ce9ca4b1df106e4d72dad201d345ea1a036cc12c360f1a7d5a758f78ffa42c
url: "https://pub.dev"
source: hosted
version: "2.1.0"
highlight: highlight:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -1145,6 +1157,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.4" version: "1.0.4"
shortid:
dependency: transitive
description:
name: shortid
sha256: d0b40e3dbb50497dad107e19c54ca7de0d1a274eb9b4404991e443dadb9ebedb
url: "https://pub.dev"
source: hosted
version: "0.1.2"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@@ -1468,10 +1488,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: window_manager name: window_manager
sha256: b3c895bdf936c77b83c5254bec2e6b3f066710c1f89c38b20b8acc382b525494 sha256: "8699323b30da4cdbe2aa2e7c9de567a6abd8a97d9a5c850a3c86dcd0b34bbfbf"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.3.8" version: "0.3.9"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:
@@ -1491,11 +1511,9 @@ packages:
xterm: xterm:
dependency: "direct main" dependency: "direct main"
description: description:
path: "." path: "../xterm.dart"
ref: a343bc2fdc11fbc7dbfc1f170692426a6fe01cb9 relative: true
resolved-ref: a343bc2fdc11fbc7dbfc1f170692426a6fe01cb9 source: path
url: "https://github.com/lollipopkit/xterm.dart"
source: git
version: "4.0.0" version: "4.0.0"
yaml: yaml:
dependency: transitive dependency: transitive
@@ -1514,5 +1532,5 @@ packages:
source: hosted source: hosted
version: "0.0.6" version: "0.0.6"
sdks: sdks:
dart: ">=3.3.3 <4.0.0" dart: ">=3.3.0 <4.0.0"
flutter: ">=3.19.0" flutter: ">=3.19.0"

View File

@@ -15,22 +15,17 @@ dependencies:
hive_flutter: ^1.1.0 hive_flutter: ^1.1.0
dio: ^5.2.1 dio: ^5.2.1
after_layout: ^1.1.0 after_layout: ^1.1.0
dartssh2: #^2.9.1-pre dartssh2:
# newer version has some issues
git: git:
ref: dev ref: dev
url: https://github.com/lollipopkit/dartssh2 url: https://github.com/lollipopkit/dartssh2
#path: ../dartssh2
circle_chart: circle_chart:
git: git:
url: https://github.com/lollipopkit/circle_chart url: https://github.com/lollipopkit/circle_chart
ref: main ref: main
# path: ../circle_chart
easy_isolate: ^1.3.0 easy_isolate: ^1.3.0
intl: ^0.19.0 intl: ^0.19.0
# xterm: ^3.5.0
xterm: xterm:
# path: ../xterm.dart
git: git:
ref: a343bc2fdc11fbc7dbfc1f170692426a6fe01cb9 ref: a343bc2fdc11fbc7dbfc1f170692426a6fe01cb9
url: https://github.com/lollipopkit/xterm.dart url: https://github.com/lollipopkit/xterm.dart
@@ -41,7 +36,6 @@ dependencies:
shared_preferences: ^2.1.1 shared_preferences: ^2.1.1
dynamic_color: ^1.6.6 dynamic_color: ^1.6.6
watch_connectivity: watch_connectivity:
#path: ../watch_connectivity
git: git:
ref: master ref: master
url: https://github.com/lollipopkit/watch_connectivity url: https://github.com/lollipopkit/watch_connectivity
@@ -64,7 +58,14 @@ dependencies:
url: https://github.com/lollipopkit/fl_lib url: https://github.com/lollipopkit/fl_lib
ref: main ref: main
device_info_plus: ^10.1.0 device_info_plus: ^10.1.0
# path: ../fl_lib
dependency_overrides:
dartssh2:
path: ../dartssh2
fl_lib:
path: ../fl_lib
xterm:
path: ../xterm.dart
dev_dependencies: dev_dependencies:
flutter_native_splash: ^2.1.6 flutter_native_splash: ^2.1.6

View File

@@ -6,6 +6,7 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <app_links/app_links_plugin_c_api.h>
#include <dynamic_color/dynamic_color_plugin_c_api.h> #include <dynamic_color/dynamic_color_plugin_c_api.h>
#include <local_auth_windows/local_auth_plugin.h> #include <local_auth_windows/local_auth_plugin.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h> #include <permission_handler_windows/permission_handler_windows_plugin.h>
@@ -15,6 +16,8 @@
#include <window_manager/window_manager_plugin.h> #include <window_manager/window_manager_plugin.h>
void RegisterPlugins(flutter::PluginRegistry* registry) { void RegisterPlugins(flutter::PluginRegistry* registry) {
AppLinksPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("AppLinksPluginCApi"));
DynamicColorPluginCApiRegisterWithRegistrar( DynamicColorPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("DynamicColorPluginCApi")); registry->GetRegistrarForPlugin("DynamicColorPluginCApi"));
LocalAuthPluginRegisterWithRegistrar( LocalAuthPluginRegisterWithRegistrar(

View File

@@ -3,6 +3,7 @@
# #
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
app_links
dynamic_color dynamic_color
local_auth_windows local_auth_windows
permission_handler_windows permission_handler_windows