mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-18 14:23:42 +00:00
feat: torrent scheme deep link and file associations (#866)
This commit is contained in:
30 files changed
+464
-79
No files matched your search
@@ -363,7 +363,14 @@ func (f *Fetcher) addTorrent(req *base.Request, fromUpload bool) (err error) {
|
|||||||
f.torrent, err = client.AddMagnet(req.URL)
|
f.torrent, err = client.AddMagnet(req.URL)
|
||||||
} else {
|
} else {
|
||||||
var reader io.Reader
|
var reader io.Reader
|
||||||
if schema == "DATA" {
|
if schema == "FILE" {
|
||||||
|
fileUrl, _ := url.Parse(req.URL)
|
||||||
|
filePath := fileUrl.Path[1:]
|
||||||
|
reader, err = os.Open(filePath)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else if schema == "DATA" {
|
||||||
_, data := util.ParseDataUri(req.URL)
|
_, data := util.ParseDataUri(req.URL)
|
||||||
reader = bytes.NewBuffer(data)
|
reader = bytes.NewBuffer(data)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
gohttp "net/http"
|
gohttp "net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
@@ -149,6 +150,16 @@ func doResolve(t *testing.T, fetcher fetcher.Fetcher) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
t.Run("Resolve file scheme Torrent", func(t *testing.T) {
|
||||||
|
file, _ := filepath.Abs("./testdata/test.unclean.torrent")
|
||||||
|
uri := "file:///" + file
|
||||||
|
err := fetcher.Resolve(&base.Request{
|
||||||
|
URL: uri,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Resolve file scheme Torrent Resolve() got = %v, want nil", err)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFetcherManager_ParseName(t *testing.T) {
|
func TestFetcherManager_ParseName(t *testing.T) {
|
||||||
|
|||||||
@@ -107,9 +107,9 @@ func (f *Fetcher) Resolve(req *base.Request) error {
|
|||||||
if base.HttpCodePartialContent == httpResp.StatusCode || (base.HttpCodeOK == httpResp.StatusCode && httpResp.Header.Get(base.HttpHeaderAcceptRanges) == base.HttpHeaderBytes && strings.HasPrefix(httpResp.Header.Get(base.HttpHeaderContentRange), base.HttpHeaderBytes)) {
|
if base.HttpCodePartialContent == httpResp.StatusCode || (base.HttpCodeOK == httpResp.StatusCode && httpResp.Header.Get(base.HttpHeaderAcceptRanges) == base.HttpHeaderBytes && strings.HasPrefix(httpResp.Header.Get(base.HttpHeaderContentRange), base.HttpHeaderBytes)) {
|
||||||
// response 206 status code, support breakpoint continuation
|
// response 206 status code, support breakpoint continuation
|
||||||
res.Range = true
|
res.Range = true
|
||||||
// parse content length from Content-Range header, eg: bytes 0-1000/1001
|
// parse content length from Content-Range header, eg: bytes 0-1000/1001 or bytes 0-0/*
|
||||||
contentTotal := path.Base(httpResp.Header.Get(base.HttpHeaderContentRange))
|
contentTotal := path.Base(httpResp.Header.Get(base.HttpHeaderContentRange))
|
||||||
if contentTotal != "" {
|
if contentTotal != "" && contentTotal != "*" {
|
||||||
parse, err := strconv.ParseInt(contentTotal, 10, 64)
|
parse, err := strconv.ParseInt(contentTotal, 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import (
|
|||||||
|
|
||||||
func ParseSchema(url string) string {
|
func ParseSchema(url string) string {
|
||||||
index := strings.Index(url, ":")
|
index := strings.Index(url, ":")
|
||||||
// if no schema or windows path like C:\a.txt, return FILE
|
|
||||||
if index == -1 || index == 1 {
|
if index == -1 || index == 1 {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ class ExtraConfig {
|
|||||||
String locale;
|
String locale;
|
||||||
bool lastDeleteTaskKeep;
|
bool lastDeleteTaskKeep;
|
||||||
bool defaultDirectDownload;
|
bool defaultDirectDownload;
|
||||||
|
bool defaultBtClient;
|
||||||
|
|
||||||
ExtraConfigBt bt = ExtraConfigBt();
|
ExtraConfigBt bt = ExtraConfigBt();
|
||||||
|
|
||||||
@@ -88,6 +89,7 @@ class ExtraConfig {
|
|||||||
this.locale = '',
|
this.locale = '',
|
||||||
this.lastDeleteTaskKeep = false,
|
this.lastDeleteTaskKeep = false,
|
||||||
this.defaultDirectDownload = false,
|
this.defaultDirectDownload = false,
|
||||||
|
this.defaultBtClient = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory ExtraConfig.fromJson(Map<String, dynamic>? json) =>
|
factory ExtraConfig.fromJson(Map<String, dynamic>? json) =>
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import '../../../../util/log_util.dart';
|
|||||||
import '../../../../util/package_info.dart';
|
import '../../../../util/package_info.dart';
|
||||||
import '../../../../util/util.dart';
|
import '../../../../util/util.dart';
|
||||||
import '../../../routes/app_pages.dart';
|
import '../../../routes/app_pages.dart';
|
||||||
|
import '../../redirect/views/redirect_view.dart';
|
||||||
|
|
||||||
const unixSocketPath = 'gopeed.sock';
|
const unixSocketPath = 'gopeed.sock';
|
||||||
|
|
||||||
@@ -160,8 +161,7 @@ class AppController extends GetxController with WindowListener, TrayListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _initDeepLinks() async {
|
Future<void> _initDeepLinks() async {
|
||||||
// currently only support android
|
if (Util.isWeb()) {
|
||||||
if (!Util.isAndroid()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,13 +169,13 @@ class AppController extends GetxController with WindowListener, TrayListener {
|
|||||||
|
|
||||||
// Handle link when app is in warm state (front or background)
|
// Handle link when app is in warm state (front or background)
|
||||||
_linkSubscription = _appLinks.uriLinkStream.listen((uri) async {
|
_linkSubscription = _appLinks.uriLinkStream.listen((uri) async {
|
||||||
await _toCreate(uri);
|
await _handleDeepLink(uri);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Check initial link if app was in cold state (terminated)
|
// Check initial link if app was in cold state (terminated)
|
||||||
final uri = await _appLinks.getInitialLink();
|
final uri = await _appLinks.getInitialLink();
|
||||||
if (uri != null) {
|
if (uri != null) {
|
||||||
await _toCreate(uri);
|
await _handleDeepLink(uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,13 +304,25 @@ class AppController extends GetxController with WindowListener, TrayListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _toCreate(Uri uri) async {
|
Future<void> _handleDeepLink(Uri uri) async {
|
||||||
final path = (uri.scheme == "magnet" ||
|
// Wake up application only
|
||||||
uri.scheme == "http" ||
|
if (uri.scheme == "gopeed") {
|
||||||
uri.scheme == "https")
|
Get.rootDelegate.offAndToNamed(Routes.HOME);
|
||||||
? uri.toString()
|
return;
|
||||||
: (await toFile(uri.toString())).path;
|
}
|
||||||
await Get.rootDelegate.offAndToNamed(Routes.CREATE, arguments: path);
|
|
||||||
|
String path;
|
||||||
|
if (uri.scheme == "magnet" ||
|
||||||
|
uri.scheme == "http" ||
|
||||||
|
uri.scheme == "https") {
|
||||||
|
path = uri.toString();
|
||||||
|
} else if (uri.scheme == "file") {
|
||||||
|
path = Util.isWindows() ? uri.path.substring(1) : uri.path;
|
||||||
|
} else {
|
||||||
|
path = (await toFile(uri.toString())).path;
|
||||||
|
}
|
||||||
|
Get.rootDelegate.offAndToNamed(Routes.REDIRECT,
|
||||||
|
arguments: RedirectArgs(Routes.CREATE, arguments: path));
|
||||||
}
|
}
|
||||||
|
|
||||||
String runningAddress() {
|
String runningAddress() {
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import '../../app/controllers/app_controller.dart';
|
|||||||
|
|
||||||
class CreateController extends GetxController
|
class CreateController extends GetxController
|
||||||
with GetSingleTickerProviderStateMixin {
|
with GetSingleTickerProviderStateMixin {
|
||||||
// final files = [].obs;
|
|
||||||
final RxList fileInfos = [].obs;
|
final RxList fileInfos = [].obs;
|
||||||
final RxList openedFolders = [].obs;
|
final RxList openedFolders = [].obs;
|
||||||
final selectedIndexes = <int>[].obs;
|
final selectedIndexes = <int>[].obs;
|
||||||
|
|||||||
@@ -61,31 +61,29 @@ class CreateView extends GetView<CreateController> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final String? filePath = Get.rootDelegate.arguments();
|
final String? filePath = Get.rootDelegate.arguments();
|
||||||
if (_urlController.text.isEmpty) {
|
if (filePath?.isNotEmpty ?? false) {
|
||||||
if (filePath?.isNotEmpty ?? false) {
|
// get file path from route arguments
|
||||||
// get file path from route arguments
|
_urlController.text = filePath!;
|
||||||
_urlController.text = filePath!;
|
_urlController.selection = TextSelection.fromPosition(
|
||||||
_urlController.selection = TextSelection.fromPosition(
|
TextPosition(offset: _urlController.text.length));
|
||||||
TextPosition(offset: _urlController.text.length));
|
} else if (_urlController.text.isEmpty) {
|
||||||
} else {
|
// read clipboard
|
||||||
// read clipboard
|
Clipboard.getData('text/plain').then((value) {
|
||||||
Clipboard.getData('text/plain').then((value) {
|
if (value?.text?.isNotEmpty ?? false) {
|
||||||
if (value?.text?.isNotEmpty ?? false) {
|
if (_availableSchemes
|
||||||
if (_availableSchemes
|
.where((e) =>
|
||||||
.where((e) =>
|
value!.text!.startsWith(e) ||
|
||||||
value!.text!.startsWith(e) ||
|
value.text!.startsWith(e.toUpperCase()))
|
||||||
value.text!.startsWith(e.toUpperCase()))
|
.isNotEmpty) {
|
||||||
.isNotEmpty) {
|
_urlController.text = value!.text!;
|
||||||
_urlController.text = value!.text!;
|
_urlController.selection = TextSelection.fromPosition(
|
||||||
_urlController.selection = TextSelection.fromPosition(
|
TextPosition(offset: _urlController.text.length));
|
||||||
TextPosition(offset: _urlController.text.length));
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
recognizeMagnetUri(value!.text!);
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
recognizeMagnetUri(value!.text!);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../controllers/redirect_controller.dart';
|
||||||
|
|
||||||
|
class RedirectBinding extends Bindings {
|
||||||
|
@override
|
||||||
|
void dependencies() {
|
||||||
|
Get.lazyPut<RedirectController>(
|
||||||
|
() => RedirectController(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
class RedirectController extends GetxController {}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../controllers/redirect_controller.dart';
|
||||||
|
|
||||||
|
class RedirectArgs {
|
||||||
|
final String page;
|
||||||
|
final dynamic arguments;
|
||||||
|
|
||||||
|
RedirectArgs(this.page, {this.arguments});
|
||||||
|
}
|
||||||
|
|
||||||
|
class RedirectView extends GetView<RedirectController> {
|
||||||
|
const RedirectView({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final redirectArgs = Get.rootDelegate.arguments() as RedirectArgs;
|
||||||
|
Get.rootDelegate
|
||||||
|
.offAndToNamed(redirectArgs.page, arguments: redirectArgs.arguments);
|
||||||
|
return const SizedBox();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,6 +17,7 @@ import '../../../../util/locale_manager.dart';
|
|||||||
import '../../../../util/log_util.dart';
|
import '../../../../util/log_util.dart';
|
||||||
import '../../../../util/message.dart';
|
import '../../../../util/message.dart';
|
||||||
import '../../../../util/package_info.dart';
|
import '../../../../util/package_info.dart';
|
||||||
|
import '../../../../util/scheme_register/scheme_register.dart';
|
||||||
import '../../../../util/util.dart';
|
import '../../../../util/util.dart';
|
||||||
import '../../../views/check_list_view.dart';
|
import '../../../views/check_list_view.dart';
|
||||||
import '../../../views/directory_selector.dart';
|
import '../../../views/directory_selector.dart';
|
||||||
@@ -111,7 +112,7 @@ class SettingView extends GetView<SettingController> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
final buildDefaultDirectDownload =
|
final buildDefaultDirectDownload =
|
||||||
_buildConfigItem('defaultDirectDownload'.tr, () {
|
_buildConfigItem('defaultDirectDownload', () {
|
||||||
return appController.downloaderConfig.value.extra.defaultDirectDownload
|
return appController.downloaderConfig.value.extra.defaultDirectDownload
|
||||||
? 'on'.tr
|
? 'on'.tr
|
||||||
: 'off'.tr;
|
: 'off'.tr;
|
||||||
@@ -161,7 +162,7 @@ class SettingView extends GetView<SettingController> {
|
|||||||
// Currently auto startup only support Windows and Linux
|
// Currently auto startup only support Windows and Linux
|
||||||
final buildAutoStartup = !Util.isWindows() && !Util.isLinux()
|
final buildAutoStartup = !Util.isWindows() && !Util.isLinux()
|
||||||
? () => null
|
? () => null
|
||||||
: _buildConfigItem('launchAtStartup'.tr, () {
|
: _buildConfigItem('launchAtStartup', () {
|
||||||
return appController.autoStartup.value ? 'on'.tr : 'off'.tr;
|
return appController.autoStartup.value ? 'on'.tr : 'off'.tr;
|
||||||
}, (Key key) {
|
}, (Key key) {
|
||||||
return Container(
|
return Container(
|
||||||
@@ -229,8 +230,9 @@ class SettingView extends GetView<SettingController> {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
final buildHttpUseServerCtime = _buildConfigItem('useServerCtime'.tr,
|
final buildHttpUseServerCtime = _buildConfigItem(
|
||||||
() => httpConfig.useServerCtime ? 'on'.tr : 'off'.tr, (Key key) {
|
'useServerCtime', () => httpConfig.useServerCtime ? 'on'.tr : 'off'.tr,
|
||||||
|
(Key key) {
|
||||||
return Container(
|
return Container(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: Switch(
|
child: Switch(
|
||||||
@@ -420,6 +422,37 @@ class SettingView extends GetView<SettingController> {
|
|||||||
].where((e) => e != null).map((e) => e!).toList(),
|
].where((e) => e != null).map((e) => e!).toList(),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
final buildBtDefaultClientConfig = !Util.isWindows()
|
||||||
|
? () => null
|
||||||
|
: _buildConfigItem('setAsDefaultBtClient', () {
|
||||||
|
return appController.downloaderConfig.value.extra.defaultBtClient
|
||||||
|
? 'on'.tr
|
||||||
|
: 'off'.tr;
|
||||||
|
}, (Key key) {
|
||||||
|
return Container(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: Switch(
|
||||||
|
value:
|
||||||
|
appController.downloaderConfig.value.extra.defaultBtClient,
|
||||||
|
onChanged: (bool value) async {
|
||||||
|
try {
|
||||||
|
if (value) {
|
||||||
|
registerDefaultTorrentClient();
|
||||||
|
} else {
|
||||||
|
unregisterDefaultTorrentClient();
|
||||||
|
}
|
||||||
|
appController.downloaderConfig.update((val) {
|
||||||
|
val!.extra.defaultBtClient = value;
|
||||||
|
});
|
||||||
|
await debounceSave();
|
||||||
|
} catch (e) {
|
||||||
|
showErrorMessage(e);
|
||||||
|
logger.e('register default torrent client fail', e);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
// ui config items start
|
// ui config items start
|
||||||
final buildTheme = _buildConfigItem(
|
final buildTheme = _buildConfigItem(
|
||||||
@@ -947,6 +980,7 @@ class SettingView extends GetView<SettingController> {
|
|||||||
buildBtTrackerSubscribeUrls(),
|
buildBtTrackerSubscribeUrls(),
|
||||||
buildBtTrackers(),
|
buildBtTrackers(),
|
||||||
buildBtSeedConfig(),
|
buildBtSeedConfig(),
|
||||||
|
buildBtDefaultClientConfig(),
|
||||||
]),
|
]),
|
||||||
)),
|
)),
|
||||||
Text('ui'.tr),
|
Text('ui'.tr),
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:gopeed/app/modules/task/views/task_files_view.dart';
|
|
||||||
import 'package:gopeed/app/modules/task/views/task_view.dart';
|
|
||||||
|
|
||||||
import '../modules/create/bindings/create_binding.dart';
|
import '../modules/create/bindings/create_binding.dart';
|
||||||
import '../modules/create/views/create_view.dart';
|
import '../modules/create/views/create_view.dart';
|
||||||
@@ -8,12 +6,16 @@ import '../modules/extension/bindings/extension_binding.dart';
|
|||||||
import '../modules/extension/views/extension_view.dart';
|
import '../modules/extension/views/extension_view.dart';
|
||||||
import '../modules/home/bindings/home_binding.dart';
|
import '../modules/home/bindings/home_binding.dart';
|
||||||
import '../modules/home/views/home_view.dart';
|
import '../modules/home/views/home_view.dart';
|
||||||
|
import '../modules/redirect/bindings/redirect_binding.dart';
|
||||||
|
import '../modules/redirect/views/redirect_view.dart';
|
||||||
import '../modules/root/bindings/root_binding.dart';
|
import '../modules/root/bindings/root_binding.dart';
|
||||||
import '../modules/root/views/root_view.dart';
|
import '../modules/root/views/root_view.dart';
|
||||||
import '../modules/setting/bindings/setting_binding.dart';
|
import '../modules/setting/bindings/setting_binding.dart';
|
||||||
import '../modules/setting/views/setting_view.dart';
|
import '../modules/setting/views/setting_view.dart';
|
||||||
import '../modules/task/bindings/task_binding.dart';
|
import '../modules/task/bindings/task_binding.dart';
|
||||||
import '../modules/task/bindings/task_files_binding.dart';
|
import '../modules/task/bindings/task_files_binding.dart';
|
||||||
|
import '../modules/task/views/task_files_view.dart';
|
||||||
|
import '../modules/task/views/task_view.dart';
|
||||||
|
|
||||||
part 'app_routes.dart';
|
part 'app_routes.dart';
|
||||||
|
|
||||||
@@ -68,6 +70,11 @@ class AppPages {
|
|||||||
page: () => CreateView(),
|
page: () => CreateView(),
|
||||||
binding: CreateBinding(),
|
binding: CreateBinding(),
|
||||||
),
|
),
|
||||||
|
GetPage(
|
||||||
|
name: _Paths.REDIRECT,
|
||||||
|
page: () => const RedirectView(),
|
||||||
|
binding: RedirectBinding(),
|
||||||
|
),
|
||||||
]),
|
]),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@ part of 'app_pages.dart';
|
|||||||
|
|
||||||
abstract class Routes {
|
abstract class Routes {
|
||||||
Routes._();
|
Routes._();
|
||||||
|
|
||||||
static const ROOT = _Paths.ROOT;
|
static const ROOT = _Paths.ROOT;
|
||||||
static const HOME = _Paths.HOME;
|
static const HOME = _Paths.HOME;
|
||||||
static const CREATE = _Paths.CREATE;
|
static const CREATE = _Paths.CREATE;
|
||||||
@@ -10,10 +11,12 @@ abstract class Routes {
|
|||||||
static const TASK_FILES = TASK + _Paths.TASK_FILES;
|
static const TASK_FILES = TASK + _Paths.TASK_FILES;
|
||||||
static const EXTENSION = _Paths.HOME + _Paths.EXTENSION;
|
static const EXTENSION = _Paths.HOME + _Paths.EXTENSION;
|
||||||
static const SETTING = _Paths.HOME + _Paths.SETTING;
|
static const SETTING = _Paths.HOME + _Paths.SETTING;
|
||||||
|
static const REDIRECT = _Paths.REDIRECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class _Paths {
|
abstract class _Paths {
|
||||||
_Paths._();
|
_Paths._();
|
||||||
|
|
||||||
static const ROOT = '/';
|
static const ROOT = '/';
|
||||||
static const HOME = '/home';
|
static const HOME = '/home';
|
||||||
static const CREATE = '/create';
|
static const CREATE = '/create';
|
||||||
@@ -21,4 +24,5 @@ abstract class _Paths {
|
|||||||
static const TASK_FILES = '/files';
|
static const TASK_FILES = '/files';
|
||||||
static const EXTENSION = '/extension';
|
static const EXTENSION = '/extension';
|
||||||
static const SETTING = '/setting';
|
static const SETTING = '/setting';
|
||||||
|
static const REDIRECT = '/redirect';
|
||||||
}
|
}
|
||||||
@@ -105,6 +105,7 @@ const enUS = {
|
|||||||
'seedKeep': 'Keep seeding until manually stopped',
|
'seedKeep': 'Keep seeding until manually stopped',
|
||||||
'seedRatio': 'Seed ratio',
|
'seedRatio': 'Seed ratio',
|
||||||
'seedTime': 'Seed time (minutes)',
|
'seedTime': 'Seed time (minutes)',
|
||||||
|
'setAsDefaultBtClient': 'Set as the default BT client',
|
||||||
'taskDetail': 'Task Detail',
|
'taskDetail': 'Task Detail',
|
||||||
'taskName': 'Task Name',
|
'taskName': 'Task Name',
|
||||||
'taskUrl': 'Task URL',
|
'taskUrl': 'Task URL',
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ const zhCN = {
|
|||||||
'seedKeep': '持续做种直到手动停止',
|
'seedKeep': '持续做种直到手动停止',
|
||||||
'seedRatio': '做种分享率',
|
'seedRatio': '做种分享率',
|
||||||
'seedTime': '做种时间(分钟)',
|
'seedTime': '做种时间(分钟)',
|
||||||
|
'setAsDefaultBtClient': '设为系统默认 BT 客户端',
|
||||||
'taskDetail': '任务详情',
|
'taskDetail': '任务详情',
|
||||||
'taskName': '任务名称',
|
'taskName': '任务名称',
|
||||||
'taskUrl': '任务链接',
|
'taskUrl': '任务链接',
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ const zhTW = {
|
|||||||
'seedKeep': '持續做種直到手動停止',
|
'seedKeep': '持續做種直到手動停止',
|
||||||
'seedRatio': '做種分享率',
|
'seedRatio': '做種分享率',
|
||||||
'seedTime': '做種時間(分鐘)',
|
'seedTime': '做種時間(分鐘)',
|
||||||
|
'setAsDefaultBtClient': '設為系統預設 BT 客戶端',
|
||||||
'taskDetail': '任務詳情',
|
'taskDetail': '任務詳情',
|
||||||
'taskName': '任務名稱',
|
'taskName': '任務名稱',
|
||||||
'taskUrl': '任務連結',
|
'taskUrl': '任務連結',
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import 'util/locale_manager.dart';
|
|||||||
import 'util/log_util.dart';
|
import 'util/log_util.dart';
|
||||||
import 'util/mac_secure_util.dart';
|
import 'util/mac_secure_util.dart';
|
||||||
import 'util/package_info.dart';
|
import 'util/package_info.dart';
|
||||||
|
import 'util/scheme_register/scheme_register.dart';
|
||||||
import 'util/util.dart';
|
import 'util/util.dart';
|
||||||
|
|
||||||
class Args {
|
class Args {
|
||||||
@@ -81,6 +82,15 @@ Future<void> init(Args args) async {
|
|||||||
logger.e("libgopeed init fail", e);
|
logger.e("libgopeed init fail", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
registerUrlScheme("gopeed");
|
||||||
|
if (controller.downloaderConfig.value.extra.defaultBtClient) {
|
||||||
|
registerDefaultTorrentClient();
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
logger.e("register scheme fail", e);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await controller.loadDownloaderConfig();
|
await controller.loadDownloaderConfig();
|
||||||
MacSecureUtil.loadBookmark();
|
MacSecureUtil.loadBookmark();
|
||||||
|
|||||||
@@ -0,0 +1,92 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:gopeed/util/util.dart';
|
||||||
|
import 'package:win32_registry/win32_registry.dart';
|
||||||
|
|
||||||
|
doRegisterUrlScheme(String scheme) {
|
||||||
|
if (Util.isWindows()) {
|
||||||
|
final schemeKey = 'Software\\Classes\\$scheme';
|
||||||
|
final appPath = Platform.resolvedExecutable;
|
||||||
|
|
||||||
|
_upsertRegistry(
|
||||||
|
schemeKey,
|
||||||
|
'URL Protocol',
|
||||||
|
'',
|
||||||
|
);
|
||||||
|
_upsertRegistry(
|
||||||
|
'$schemeKey\\shell\\open\\command',
|
||||||
|
'',
|
||||||
|
'"$appPath" "%1"',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
doUnregisterUrlScheme(String scheme) {
|
||||||
|
if (Util.isWindows()) {
|
||||||
|
Registry.currentUser
|
||||||
|
.deleteKey('Software\\Classes\\$scheme', recursive: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const _torrentRegKey = 'Software\\Classes\\.torrent';
|
||||||
|
const _torrentRegValue = 'Gopeed_torrent';
|
||||||
|
const _torrentAppRegKey = 'Software\\Classes\\$_torrentRegValue';
|
||||||
|
|
||||||
|
/// Register as the system's default torrent client
|
||||||
|
/// 1. Register the scheme "magnet"
|
||||||
|
/// 2. Register the file type ".torrent"
|
||||||
|
doRegisterDefaultTorrentClient() {
|
||||||
|
if (Util.isWindows()) {
|
||||||
|
doRegisterUrlScheme("magnet");
|
||||||
|
|
||||||
|
final appPath = Platform.resolvedExecutable;
|
||||||
|
final iconPath =
|
||||||
|
'${File(appPath).parent.path}\\data\\flutter_assets\\assets\\tray_icon\\icon.ico';
|
||||||
|
_upsertRegistry(
|
||||||
|
_torrentRegKey,
|
||||||
|
'',
|
||||||
|
_torrentRegValue,
|
||||||
|
);
|
||||||
|
_upsertRegistry(
|
||||||
|
_torrentAppRegKey,
|
||||||
|
'',
|
||||||
|
'Torrent file',
|
||||||
|
);
|
||||||
|
_upsertRegistry(
|
||||||
|
'$_torrentAppRegKey\\DefaultIcon',
|
||||||
|
'',
|
||||||
|
iconPath,
|
||||||
|
);
|
||||||
|
_upsertRegistry(
|
||||||
|
'$_torrentAppRegKey\\shell\\open\\command',
|
||||||
|
'',
|
||||||
|
'"$appPath" "file:///%1"',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
doUnregisterDefaultTorrentClient() {
|
||||||
|
if (Util.isWindows()) {
|
||||||
|
doUnregisterUrlScheme("magnet");
|
||||||
|
|
||||||
|
Registry.currentUser.deleteKey(_torrentRegKey, recursive: true);
|
||||||
|
Registry.currentUser.deleteKey(_torrentAppRegKey, recursive: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add Windows registry key and value if not exists
|
||||||
|
_upsertRegistry(String keyPath, String valueName, String value) {
|
||||||
|
RegistryKey regKey;
|
||||||
|
try {
|
||||||
|
regKey = Registry.openPath(RegistryHive.currentUser,
|
||||||
|
path: keyPath, desiredAccessRights: AccessRights.allAccess);
|
||||||
|
} catch (e) {
|
||||||
|
regKey = Registry.currentUser.createKey(keyPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (regKey.getValueAsString(valueName) != value) {
|
||||||
|
regKey
|
||||||
|
.createValue(RegistryValue(valueName, RegistryValueType.string, value));
|
||||||
|
}
|
||||||
|
regKey.close();
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import 'scheme_register_stub.dart'
|
||||||
|
if (dart.library.io) 'entry/scheme_register_native.dart';
|
||||||
|
|
||||||
|
registerUrlScheme(String scheme) => doRegisterUrlScheme(scheme);
|
||||||
|
|
||||||
|
unregisterUrlScheme(String scheme) => doUnregisterUrlScheme(scheme);
|
||||||
|
|
||||||
|
registerDefaultTorrentClient() => doRegisterDefaultTorrentClient();
|
||||||
|
|
||||||
|
unregisterDefaultTorrentClient() => doUnregisterDefaultTorrentClient();
|
||||||
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
doRegisterUrlScheme(String scheme) => throw UnimplementedError();
|
||||||
|
|
||||||
|
doUnregisterUrlScheme(String scheme) => throw UnimplementedError();
|
||||||
|
|
||||||
|
doRegisterDefaultTorrentClient() => throw UnimplementedError();
|
||||||
|
|
||||||
|
doUnregisterDefaultTorrentClient() => throw UnimplementedError();
|
||||||
@@ -11,4 +11,5 @@ Exec=gopeed
|
|||||||
Icon=com.gopeed.Gopeed
|
Icon=com.gopeed.Gopeed
|
||||||
Type=Application
|
Type=Application
|
||||||
Categories=Utility;Internet
|
Categories=Utility;Internet
|
||||||
Keywords=Bittorrent;Downloader;
|
Keywords=Bittorrent;Downloader;
|
||||||
|
MimeType=x-scheme-handler/gopeed;x-scheme-handler/magnet;application/x-bittorrent;
|
||||||
@@ -17,6 +17,13 @@ G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
|
|||||||
// Implements GApplication::activate.
|
// Implements GApplication::activate.
|
||||||
static void my_application_activate(GApplication* application) {
|
static void my_application_activate(GApplication* application) {
|
||||||
MyApplication* self = MY_APPLICATION(application);
|
MyApplication* self = MY_APPLICATION(application);
|
||||||
|
|
||||||
|
GList* windows = gtk_application_get_windows(GTK_APPLICATION(application));
|
||||||
|
if (windows) {
|
||||||
|
gtk_window_present(GTK_WINDOW(windows->data));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
GtkWindow* window =
|
GtkWindow* window =
|
||||||
GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
|
GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
|
||||||
|
|
||||||
@@ -79,7 +86,7 @@ static gboolean my_application_local_command_line(GApplication* application, gch
|
|||||||
g_application_activate(application);
|
g_application_activate(application);
|
||||||
*exit_status = 0;
|
*exit_status = 0;
|
||||||
|
|
||||||
return TRUE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implements GObject::dispose.
|
// Implements GObject::dispose.
|
||||||
@@ -100,6 +107,6 @@ static void my_application_init(MyApplication* self) {}
|
|||||||
MyApplication* my_application_new() {
|
MyApplication* my_application_new() {
|
||||||
return MY_APPLICATION(g_object_new(my_application_get_type(),
|
return MY_APPLICATION(g_object_new(my_application_get_type(),
|
||||||
"application-id", APPLICATION_ID,
|
"application-id", APPLICATION_ID,
|
||||||
"flags", G_APPLICATION_NON_UNIQUE,
|
"flags", G_APPLICATION_HANDLES_COMMAND_LINE | G_APPLICATION_HANDLES_OPEN,
|
||||||
nullptr));
|
nullptr));
|
||||||
}
|
}
|
||||||
@@ -14,4 +14,9 @@ categories:
|
|||||||
- Network
|
- Network
|
||||||
- Utility
|
- Utility
|
||||||
|
|
||||||
|
supported_mime_type:
|
||||||
|
- x-scheme-handler/gopeed
|
||||||
|
- x-scheme-handler/magnet
|
||||||
|
- application/x-bittorrent
|
||||||
|
|
||||||
startup_notify: true
|
startup_notify: true
|
||||||
@@ -28,4 +28,9 @@ categories:
|
|||||||
- Network
|
- Network
|
||||||
- Utility
|
- Utility
|
||||||
|
|
||||||
|
supported_mime_type:
|
||||||
|
- x-scheme-handler/gopeed
|
||||||
|
- x-scheme-handler/magnet
|
||||||
|
- application/x-bittorrent
|
||||||
|
|
||||||
startup_notify: true
|
startup_notify: true
|
||||||
@@ -1,8 +1,22 @@
|
|||||||
import Cocoa
|
import Cocoa
|
||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
|
import app_links
|
||||||
|
|
||||||
@main
|
@main
|
||||||
class AppDelegate: FlutterAppDelegate {
|
class AppDelegate: FlutterAppDelegate {
|
||||||
|
public override func application(_ application: NSApplication,
|
||||||
|
continue userActivity: NSUserActivity,
|
||||||
|
restorationHandler: @escaping ([any NSUserActivityRestoring]) -> Void) -> Bool {
|
||||||
|
|
||||||
|
guard let url = AppLinks.shared.getUniversalLink(userActivity) else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
AppLinks.shared.handleLink(link: url.absoluteString)
|
||||||
|
|
||||||
|
return false // Returning true will stop the propagation to other packages
|
||||||
|
}
|
||||||
|
|
||||||
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
|
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -19,4 +33,18 @@ class AppDelegate: FlutterAppDelegate {
|
|||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func application(_ sender: NSApplication, openFile filename: String) -> Bool {
|
||||||
|
let url = URL(fileURLWithPath: filename)
|
||||||
|
AppLinks.shared.handleLink(link: url.absoluteString)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
override func application(_ application: NSApplication, open urls: [URL]) {
|
||||||
|
// Only handle the first file
|
||||||
|
if(urls.isEmpty) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
AppLinks.shared.handleLink(link: urls.first!.absoluteString)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,32 +1,96 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>$(EXECUTABLE_NAME)</string>
|
<string>$(EXECUTABLE_NAME)</string>
|
||||||
<key>CFBundleIconFile</key>
|
<key>CFBundleIconFile</key>
|
||||||
<string></string>
|
<string></string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>6.0</string>
|
<string>6.0</string>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
<string>$(PRODUCT_NAME)</string>
|
<string>$(PRODUCT_NAME)</string>
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>$(FLUTTER_BUILD_NAME)</string>
|
<string>$(FLUTTER_BUILD_NAME)</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string>$(PRODUCT_COPYRIGHT)</string>
|
<string>$(PRODUCT_COPYRIGHT)</string>
|
||||||
<key>NSMainNibFile</key>
|
<key>NSMainNibFile</key>
|
||||||
<string>MainMenu</string>
|
<string>MainMenu</string>
|
||||||
<key>NSPrincipalClass</key>
|
<key>NSPrincipalClass</key>
|
||||||
<string>NSApplication</string>
|
<string>NSApplication</string>
|
||||||
</dict>
|
<key>CFBundleURLTypes</key>
|
||||||
</plist>
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleURLName</key>
|
||||||
|
<string>gopeed</string>
|
||||||
|
<key>CFBundleURLSchemes</key>
|
||||||
|
<array>
|
||||||
|
<string>gopeed</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleURLName</key>
|
||||||
|
<string>magnet</string>
|
||||||
|
<key>CFBundleURLSchemes</key>
|
||||||
|
<array>
|
||||||
|
<string>magnet</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleDocumentTypes</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>torrent</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeIconFile</key>
|
||||||
|
<string>icon</string>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>BitTorrent Document</string>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
<key>LSTypeIsPackage</key>
|
||||||
|
<false />
|
||||||
|
<key>LSHandlerRank</key>
|
||||||
|
<string>Owner</string>
|
||||||
|
<key>LSItemContentTypes</key>
|
||||||
|
<array>
|
||||||
|
<string>org.bittorrent.torrent</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
<key>UTExportedTypeDeclarations</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>UTTypeIdentifier</key>
|
||||||
|
<string>org.bittorrent.torrent</string>
|
||||||
|
<key>UTTypeDescription</key>
|
||||||
|
<string>Torrent File</string>
|
||||||
|
<key>UTTypeConformsTo</key>
|
||||||
|
<array>
|
||||||
|
<string>public.data</string>
|
||||||
|
</array>
|
||||||
|
<key>UTTypeTagSpecification</key>
|
||||||
|
<dict>
|
||||||
|
<key>public.filename-extension</key>
|
||||||
|
<array>
|
||||||
|
<string>torrent</string>
|
||||||
|
</array>
|
||||||
|
<key>public.mime-type</key>
|
||||||
|
<string>application/x-bittorrent</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@@ -1313,7 +1313,7 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "5.6.1"
|
version: "5.6.1"
|
||||||
win32_registry:
|
win32_registry:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: win32_registry
|
name: win32_registry
|
||||||
sha256: "21ec76dfc731550fd3e2ce7a33a9ea90b828fdf19a5c3bcf556fa992cfa99852"
|
sha256: "21ec76dfc731550fd3e2ce7a33a9ea90b828fdf19a5c3bcf556fa992cfa99852"
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ dependencies:
|
|||||||
device_info_plus: ^11.1.0
|
device_info_plus: ^11.1.0
|
||||||
checkable_treeview: ^1.3.1
|
checkable_treeview: ^1.3.1
|
||||||
contextmenu_plus: ^1.0.1
|
contextmenu_plus: ^1.0.1
|
||||||
|
win32_registry: ^1.1.5
|
||||||
dependency_overrides:
|
dependency_overrides:
|
||||||
permission_handler_windows:
|
permission_handler_windows:
|
||||||
git:
|
git:
|
||||||
|
|||||||
@@ -4,9 +4,49 @@
|
|||||||
|
|
||||||
#include "flutter_window.h"
|
#include "flutter_window.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "app_links/app_links_plugin_c_api.h"
|
||||||
|
|
||||||
|
bool SendAppLinkToInstance(const std::wstring& title) {
|
||||||
|
// Find our exact window
|
||||||
|
HWND hwnd = ::FindWindow(L"FLUTTER_RUNNER_WIN32_WINDOW", title.c_str());
|
||||||
|
|
||||||
|
if (hwnd) {
|
||||||
|
// Dispatch new link to current window
|
||||||
|
SendAppLink(hwnd);
|
||||||
|
|
||||||
|
// (Optional) Restore our window to front in same state
|
||||||
|
WINDOWPLACEMENT place = { sizeof(WINDOWPLACEMENT) };
|
||||||
|
GetWindowPlacement(hwnd, &place);
|
||||||
|
|
||||||
|
switch(place.showCmd) {
|
||||||
|
case SW_SHOWMAXIMIZED:
|
||||||
|
ShowWindow(hwnd, SW_SHOWMAXIMIZED);
|
||||||
|
break;
|
||||||
|
case SW_SHOWMINIMIZED:
|
||||||
|
ShowWindow(hwnd, SW_RESTORE);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ShowWindow(hwnd, SW_NORMAL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetWindowPos(0, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE);
|
||||||
|
SetForegroundWindow(hwnd);
|
||||||
|
// END (Optional) Restore
|
||||||
|
|
||||||
|
// Window has been found, don't create another one.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
|
int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
|
||||||
_In_ wchar_t *command_line, _In_ int show_command) {
|
_In_ wchar_t *command_line, _In_ int show_command) {
|
||||||
|
if (SendAppLinkToInstance(L"gopeed")) {
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
HWND hwnd = ::FindWindow(L"FLUTTER_RUNNER_WIN32_WINDOW", L"gopeed");
|
HWND hwnd = ::FindWindow(L"FLUTTER_RUNNER_WIN32_WINDOW", L"gopeed");
|
||||||
if (hwnd != NULL) {
|
if (hwnd != NULL) {
|
||||||
::ShowWindow(hwnd, SW_NORMAL);
|
::ShowWindow(hwnd, SW_NORMAL);
|
||||||
|
|||||||
Reference in new issue
Block a user