mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-13 03:43:41 +00:00
feat: docker support (#43)
This commit is contained in:
1 parent
e9442edd94
commit
95eb3a427c
9 files changed
+85
-18
No files matched your search
@@ -3,6 +3,7 @@ import 'dart:io';
|
||||
|
||||
import 'package:dio/adapter.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:gopeed/util/util.dart';
|
||||
import 'model/create_task.dart';
|
||||
import 'model/request.dart';
|
||||
import 'model/resource.dart';
|
||||
@@ -26,7 +27,9 @@ class _Client {
|
||||
final isUnixSocket = LibgopeedBoot.instance.config.network == 'unix';
|
||||
dio.options.baseUrl = isUnixSocket
|
||||
? 'http://127.0.0.1'
|
||||
: 'http://${LibgopeedBoot.instance.config.address}';
|
||||
: (Util.isWeb()
|
||||
? ""
|
||||
: 'http://${LibgopeedBoot.instance.config.address}');
|
||||
_instance!.dio = dio;
|
||||
if (isUnixSocket) {
|
||||
(_instance!.dio.httpClientAdapter as DefaultHttpClientAdapter)
|
||||
|
||||
@@ -9,7 +9,7 @@ class LibgopeedConfig {
|
||||
|
||||
LibgopeedConfig({
|
||||
this.network = "tcp",
|
||||
this.address = "127.0.0.1:9999",
|
||||
this.address = "127.0.0.1:0",
|
||||
this.refreshInterval = 500,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:gopeed/i18n/messages.dart';
|
||||
import 'package:gopeed/util/util.dart';
|
||||
import '../../setting/setting.dart';
|
||||
import '../../widget/directory_selector.dart';
|
||||
|
||||
@@ -69,7 +70,9 @@ class SettingView extends GetView<SettingController> {
|
||||
controller.setting.value.downloadDir) {
|
||||
controller.setting.value.downloadDir =
|
||||
downloadDirController.text;
|
||||
controller.clearTapStatus();
|
||||
if (Util.isDesktop()) {
|
||||
controller.clearTapStatus();
|
||||
}
|
||||
|
||||
await debounceSave();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:file_selector/file_selector.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:gopeed/util/util.dart';
|
||||
|
||||
import '../util/mac_secure_util.dart';
|
||||
|
||||
@@ -23,7 +24,7 @@ class _DirectorySelectorState extends State<DirectorySelector> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextFormField(
|
||||
readOnly: true,
|
||||
readOnly: Util.isWeb() ? false : true,
|
||||
controller: widget.controller,
|
||||
decoration: widget.showLabel
|
||||
? InputDecoration(
|
||||
@@ -34,18 +35,20 @@ class _DirectorySelectorState extends State<DirectorySelector> {
|
||||
return v!.trim().isNotEmpty ? null : 'setting.downloadDirValid'.tr;
|
||||
},
|
||||
)),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.folder_open),
|
||||
onPressed: () async {
|
||||
if (GetPlatform.isDesktop) {
|
||||
var dir = await getDirectoryPath();
|
||||
if (dir != null) {
|
||||
widget.controller.text = dir;
|
||||
MacSecureUtil.saveBookmark(dir);
|
||||
}
|
||||
}
|
||||
})
|
||||
],
|
||||
!Util.isDesktop()
|
||||
? null
|
||||
: IconButton(
|
||||
icon: const Icon(Icons.folder_open),
|
||||
onPressed: () async {
|
||||
if (GetPlatform.isDesktop) {
|
||||
var dir = await getDirectoryPath();
|
||||
if (dir != null) {
|
||||
widget.controller.text = dir;
|
||||
MacSecureUtil.saveBookmark(dir);
|
||||
}
|
||||
}
|
||||
})
|
||||
].where((e) => e != null).map((e) => e!).toList(),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user