feat: new ui (#1455)

This commit is contained in:
Levi authored and GitHub committed 2026-09-05 19:53:41 +08:00
1 parent 3be8db664c
commit 177c225f16
742 files changed
+59951 -5934

No files matched your search

@@ -0,0 +1,20 @@
import '../../database/database.dart';
import '../../util/util.dart';
class AppInitializer {
static Future<void>? _storageInitialization;
static Future<void>? _databaseInitialization;
static Future<void> ensureStorageInitialized() {
return _storageInitialization ??= Util.initStorageDir();
}
static Future<void> ensureDatabaseInitialized() {
return _databaseInitialization ??= _initializeDatabase();
}
static Future<void> _initializeDatabase() async {
await ensureStorageInitialized();
await Database.instance.init();
}
}
@@ -0,0 +1,22 @@
class AppStartupOptions {
const AppStartupOptions({required this.hidden});
factory AppStartupOptions.fromArgs(List<String> args) {
return AppStartupOptions(
hidden: args.contains('--hidden') || args.map(Uri.tryParse).whereType<Uri>().any(isSilentGopeedWakeUri),
);
}
final bool hidden;
AppStartupOptions withInitialUri(Uri? uri) {
return AppStartupOptions(hidden: hidden || (uri != null && isSilentGopeedWakeUri(uri)));
}
}
bool isSilentGopeedWakeUri(Uri uri) {
if (uri.scheme.toLowerCase() != 'gopeed' || uri.queryParameters['hidden'] != 'true') {
return false;
}
return uri.path.isEmpty || uri.path == '/';
}
@@ -9,9 +9,7 @@ LibgopeedBoot create() => LibgopeedBootBrowser();
class LibgopeedBootBrowser implements LibgopeedBoot {
// do nothing
@override
Future<int> start(StartConfig cfg) async {
return 0;
}
Future<int> start(StartConfig cfg) async => 0;
@override
Future<void> stop() async {}
@@ -38,8 +38,7 @@ class LibgopeedBootNative implements LibgopeedBoot {
cfg.storage = 'bolt';
cfg.storageDir = Util.getStorageDir();
cfg.refreshInterval = 0;
var port = await _libgopeed.start(cfg);
return port;
return _libgopeed.start(cfg);
}
@override