mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-18 06:13:42 +00:00
feat: refactor browser extension communication to use IPC (#1130)
This commit is contained in:
17 files changed
+353
-116
No files matched your search
@@ -24,6 +24,8 @@ class Args {
|
||||
|
||||
bool hidden = false;
|
||||
|
||||
Args();
|
||||
|
||||
Args.parse(List<String> args) {
|
||||
final parser = ArgParser();
|
||||
parser.addFlag(flagHidden);
|
||||
@@ -33,7 +35,22 @@ class Args {
|
||||
}
|
||||
|
||||
void main(List<String> arguments) async {
|
||||
final args = Args.parse(arguments);
|
||||
Args args;
|
||||
// Parse url scheme arguments, e.g. gopeed:?hidden=true
|
||||
// TODO: macos open url handle
|
||||
// TODO: macos updater test
|
||||
if (arguments.firstOrNull?.startsWith("gopeed:") == true) {
|
||||
try {
|
||||
final uri = Uri.parse(arguments.first);
|
||||
args = Args()..hidden = uri.queryParameters["hidden"] == "true";
|
||||
} catch (e) {
|
||||
// ignore
|
||||
args = Args.parse([]);
|
||||
}
|
||||
} else {
|
||||
args = Args.parse(arguments);
|
||||
}
|
||||
|
||||
await init(args);
|
||||
onStart();
|
||||
|
||||
|
||||
Reference in new issue
Block a user