Compare commits
25 Commits
6716456b04
...
v2.2.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
484e1eeee3 | ||
|
|
e2a2ae55ec | ||
|
|
558b780235 | ||
|
|
1cd3724805 | ||
|
|
7e3a63169e | ||
|
|
1298dba590 | ||
|
|
2005083d2e | ||
|
|
4e3f8a0df9 | ||
|
|
5698277301 | ||
|
|
02be737264 | ||
|
|
9558f3d235 | ||
|
|
14c3b1a965 | ||
|
|
b89de1414a | ||
|
|
9759caf9b8 | ||
|
|
c7824c920b | ||
|
|
817ad978e2 | ||
|
|
1d59128e47 | ||
|
|
62537f5814 | ||
|
|
5f91160d9a | ||
|
|
64ee8189b1 | ||
|
|
665a51f962 | ||
|
|
bd77beb60a | ||
|
|
578bb926fa | ||
|
|
2c64038fda | ||
|
|
9a27ae8e69 |
1
.gitignore
vendored
@@ -44,3 +44,4 @@ app.*.map.json
|
||||
/android/app/debug
|
||||
/android/app/profile
|
||||
/android/app/release
|
||||
.fvm/
|
||||
30
.metadata
@@ -1,10 +1,36 @@
|
||||
# This file tracks properties of this Flutter project.
|
||||
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
||||
#
|
||||
# This file should be version controlled and should not be manually edited.
|
||||
# This file should be version controlled.
|
||||
|
||||
version:
|
||||
revision: 77d935af4db863f6abd0b9c31c7e6df2a13de57b
|
||||
revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
|
||||
channel: stable
|
||||
|
||||
project_type: app
|
||||
|
||||
# Tracks metadata for the flutter migrate command
|
||||
migration:
|
||||
platforms:
|
||||
- platform: root
|
||||
create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
|
||||
base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
|
||||
- platform: linux
|
||||
create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
|
||||
base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
|
||||
- platform: macos
|
||||
create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
|
||||
base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
|
||||
- platform: windows
|
||||
create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
|
||||
base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
|
||||
|
||||
# User provided section
|
||||
|
||||
# List of Local paths (relative to this file) that should be
|
||||
# ignored by the migrate tool.
|
||||
#
|
||||
# Files that are not part of the templates will be ignored by default.
|
||||
unmanaged_files:
|
||||
- 'lib/main.dart'
|
||||
- 'ios/Runner.xcodeproj/project.pbxproj'
|
||||
|
||||
17
README.md
@@ -44,3 +44,20 @@ iOS端暂无上架打算,用户自行下载main分支源码编译安装
|
||||
### 不支持的功能
|
||||
>* 应用设置
|
||||
>* 通知设置
|
||||
|
||||
|
||||
版本更新通知 https://t.me/qinglongapp
|
||||
|
||||
用于生成app的图标
|
||||
|
||||
flutter pub run flutter_launcher_icons:main
|
||||
生成原生的启动页面
|
||||
|
||||
flutter pub run flutter_native_splash:create
|
||||
修改app名称
|
||||
|
||||
flutter pub run flutter_app_name
|
||||
|
||||
生成json.jc.dart文件
|
||||
flutter pub run build_runner build --delete-conflicting-outputs
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
||||
<application
|
||||
android:label="青龙"
|
||||
android:label="青龙客户端"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
<activity
|
||||
|
||||
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 29 KiB |
BIN
assets/images/add_btn_svip.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 19 KiB |
BIN
assets/images/dark.png
Normal file
|
After Width: | Height: | Size: 608 B |
BIN
assets/images/faceid.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
assets/images/figure.png
Normal file
|
After Width: | Height: | Size: 6.9 KiB |
BIN
assets/images/icon_a.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/images/icon_about.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
assets/images/icon_add_file.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
assets/images/icon_app_set.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
assets/images/icon_b.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
assets/images/icon_check.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
assets/images/icon_cron.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
assets/images/icon_cron_checked.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
assets/images/icon_d.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
assets/images/icon_default_user.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
assets/images/icon_disabled.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
assets/images/icon_enable.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
assets/images/icon_env.png
Normal file
|
After Width: | Height: | Size: 960 B |
BIN
assets/images/icon_env_checked.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
assets/images/icon_fail.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
assets/images/icon_file.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/images/icon_file_checked.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
assets/images/icon_history.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
assets/images/icon_idle.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
assets/images/icon_install_fail.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
assets/images/icon_install_success.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
assets/images/icon_login_icon.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
assets/images/icon_other.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
assets/images/icon_other_bg.png
Normal file
|
After Width: | Height: | Size: 400 KiB |
BIN
assets/images/icon_other_checked.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
assets/images/icon_right.png
Normal file
|
After Width: | Height: | Size: 491 B |
BIN
assets/images/icon_running.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
assets/images/icon_s.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
assets/images/icon_safety.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
assets/images/icon_search.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
assets/images/icon_setting.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
assets/images/icon_subsctibe.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
assets/images/icon_success.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
assets/images/icon_task_disable.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
assets/images/icon_task_log.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
assets/images/icon_uncheck.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
assets/images/icon_vip_bg.png
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
assets/images/icon_vip_bg_check.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
assets/images/js.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
assets/images/json.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 19 KiB |
BIN
assets/images/light.png
Normal file
|
After Width: | Height: | Size: 863 B |
BIN
assets/images/normal.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
assets/images/other.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
assets/images/py.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 115 KiB After Width: | Height: | Size: 16 KiB |
BIN
assets/images/ql_splash.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 16 KiB |
BIN
assets/images/shell.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
assets/images/svip.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
assets/images/svip_logo.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
assets/images/ts.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
assets/images/vip.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
assets/images/vip_logo.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 20 KiB |
@@ -1,65 +0,0 @@
|
||||
PODS:
|
||||
- Flutter (1.0.0)
|
||||
- flutter_native_splash (0.0.1):
|
||||
- Flutter
|
||||
- fluttertoast (0.0.2):
|
||||
- Flutter
|
||||
- Toast
|
||||
- move_to_background (0.0.1):
|
||||
- Flutter
|
||||
- package_info_plus (0.4.5):
|
||||
- Flutter
|
||||
- path_provider_ios (0.0.1):
|
||||
- Flutter
|
||||
- shared_preferences_ios (0.0.1):
|
||||
- Flutter
|
||||
- Toast (4.0.0)
|
||||
- url_launcher_ios (0.0.1):
|
||||
- Flutter
|
||||
|
||||
DEPENDENCIES:
|
||||
- Flutter (from `Flutter`)
|
||||
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
|
||||
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
|
||||
- move_to_background (from `.symlinks/plugins/move_to_background/ios`)
|
||||
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
|
||||
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
|
||||
- shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`)
|
||||
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
|
||||
|
||||
SPEC REPOS:
|
||||
trunk:
|
||||
- Toast
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
Flutter:
|
||||
:path: Flutter
|
||||
flutter_native_splash:
|
||||
:path: ".symlinks/plugins/flutter_native_splash/ios"
|
||||
fluttertoast:
|
||||
:path: ".symlinks/plugins/fluttertoast/ios"
|
||||
move_to_background:
|
||||
:path: ".symlinks/plugins/move_to_background/ios"
|
||||
package_info_plus:
|
||||
:path: ".symlinks/plugins/package_info_plus/ios"
|
||||
path_provider_ios:
|
||||
:path: ".symlinks/plugins/path_provider_ios/ios"
|
||||
shared_preferences_ios:
|
||||
:path: ".symlinks/plugins/shared_preferences_ios/ios"
|
||||
url_launcher_ios:
|
||||
:path: ".symlinks/plugins/url_launcher_ios/ios"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
|
||||
flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef
|
||||
fluttertoast: 16fbe6039d06a763f3533670197d01fc73459037
|
||||
move_to_background: 39a5b79b26d577b0372cbe8a8c55e7aa9fcd3a2d
|
||||
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
|
||||
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
|
||||
shared_preferences_ios: 548a61f8053b9b8a49ac19c1ffbc8b92c50d68ad
|
||||
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
|
||||
url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de
|
||||
|
||||
PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
|
||||
|
||||
COCOAPODS: 1.11.2
|
||||
|
Before Width: | Height: | Size: 647 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 9.7 KiB |
|
Before Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 35 KiB |
@@ -1,52 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "background.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"filename" : "darkbackground.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 68 B |
|
Before Width: | Height: | Size: 70 B |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 71 KiB |
@@ -24,12 +24,14 @@ class BaseStateWidget<T extends BaseViewModel> extends ConsumerStatefulWidget {
|
||||
_BaseStateWidgetState<T> createState() => _BaseStateWidgetState<T>();
|
||||
}
|
||||
|
||||
class _BaseStateWidgetState<T extends BaseViewModel> extends ConsumerState<BaseStateWidget<T>> with LazyLoadState<BaseStateWidget<T>> {
|
||||
class _BaseStateWidgetState<T extends BaseViewModel>
|
||||
extends ConsumerState<BaseStateWidget<T>>
|
||||
with LazyLoadState<BaseStateWidget<T>> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var viewModel = ref.watch<T>(widget.model);
|
||||
if (viewModel.failedToast != null) {
|
||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
(viewModel.failedToast ?? "").toast();
|
||||
viewModel.clearToast();
|
||||
});
|
||||
@@ -72,7 +74,7 @@ class _BaseStateWidgetState<T extends BaseViewModel> extends ConsumerState<BaseS
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
if (widget.onReady != null && !widget.lazyLoad) {
|
||||
widget.onReady!(ref.read<T>(widget.model));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import 'package:qinglong_app/base/http/http.dart';
|
||||
import 'package:qinglong_app/base/http/url.dart';
|
||||
import 'package:qinglong_app/main.dart';
|
||||
import 'package:qinglong_app/module/config/config_bean.dart';
|
||||
import 'package:qinglong_app/module/env/env_bean.dart';
|
||||
import 'package:qinglong_app/module/home/system_bean.dart';
|
||||
@@ -7,11 +9,10 @@ import 'package:qinglong_app/module/login/user_bean.dart';
|
||||
import 'package:qinglong_app/module/others/dependencies/dependency_bean.dart';
|
||||
import 'package:qinglong_app/module/others/login_log/login_log_bean.dart';
|
||||
import 'package:qinglong_app/module/others/scripts/script_bean.dart';
|
||||
import 'package:qinglong_app/module/others/subscription/subscription_bean.dart';
|
||||
import 'package:qinglong_app/module/others/task_log/task_log_bean.dart';
|
||||
import 'package:qinglong_app/module/task/task_bean.dart';
|
||||
|
||||
import '../../utils/utils.dart';
|
||||
import 'url.dart';
|
||||
import 'package:qinglong_app/utils/utils.dart';
|
||||
|
||||
class Api {
|
||||
static Future<HttpResponse<SystemBean>> system() async {
|
||||
@@ -89,24 +90,21 @@ class Api {
|
||||
);
|
||||
}
|
||||
|
||||
static Future<HttpResponse<NullResponse>> startTasks(
|
||||
List<String> crons) async {
|
||||
static Future<HttpResponse<NullResponse>> startTasks(List<String> crons) async {
|
||||
return await Http.put<NullResponse>(
|
||||
Url.runTasks,
|
||||
crons,
|
||||
);
|
||||
}
|
||||
|
||||
static Future<HttpResponse<NullResponse>> stopTasks(
|
||||
List<String> crons) async {
|
||||
static Future<HttpResponse<NullResponse>> stopTasks(List<String> crons) async {
|
||||
return await Http.put<NullResponse>(
|
||||
Url.stopTasks,
|
||||
crons,
|
||||
);
|
||||
}
|
||||
|
||||
static Future<HttpResponse<NullResponse>> updatePassword(
|
||||
String name, String password) async {
|
||||
static Future<HttpResponse<NullResponse>> updatePassword(String name, String password) async {
|
||||
return await Http.put<NullResponse>(
|
||||
Url.updatePassword,
|
||||
{
|
||||
@@ -124,15 +122,19 @@ class Api {
|
||||
}
|
||||
|
||||
static Future<HttpResponse<NullResponse>> addTask(
|
||||
String name, String command, String cron,
|
||||
{String? id}) async {
|
||||
var data = {"name": name, "command": command, "schedule": cron};
|
||||
String name,
|
||||
String command,
|
||||
String cron, {
|
||||
int? id,
|
||||
String? nId,
|
||||
}) async {
|
||||
var data = <String, dynamic>{"name": name, "command": command, "schedule": cron};
|
||||
|
||||
if (id != null || nId != null) {
|
||||
if (id != null) {
|
||||
if (Utils.isUpperVersion()) {
|
||||
data["id"] = id;
|
||||
} else {
|
||||
data["_id"] = id;
|
||||
} else if (nId != null) {
|
||||
data["_id"] = nId;
|
||||
}
|
||||
return await Http.put<NullResponse>(
|
||||
Url.addTask,
|
||||
@@ -194,8 +196,7 @@ class Api {
|
||||
);
|
||||
}
|
||||
|
||||
static Future<HttpResponse<NullResponse>> saveFile(
|
||||
String name, String content) async {
|
||||
static Future<HttpResponse<NullResponse>> saveFile(String name, String content) async {
|
||||
return await Http.post<NullResponse>(
|
||||
Url.saveFile,
|
||||
{"content": content, "name": name},
|
||||
@@ -231,21 +232,24 @@ class Api {
|
||||
}
|
||||
|
||||
static Future<HttpResponse<NullResponse>> addEnv(
|
||||
String name, String value, String remarks,
|
||||
{String? id}) async {
|
||||
var data = {
|
||||
String name,
|
||||
String value,
|
||||
String remarks, {
|
||||
int? id,
|
||||
String? nId,
|
||||
}) async {
|
||||
var data = <String, dynamic>{
|
||||
"value": value,
|
||||
"remarks": remarks,
|
||||
"name": name,
|
||||
};
|
||||
|
||||
if (id != null || nId != null) {
|
||||
if (id != null) {
|
||||
if (Utils.isUpperVersion()) {
|
||||
data["id"] = id;
|
||||
} else {
|
||||
data["_id"] = id;
|
||||
} else if (nId != null) {
|
||||
data["_id"] = nId;
|
||||
}
|
||||
|
||||
return await Http.put<NullResponse>(
|
||||
Url.addEnv,
|
||||
data,
|
||||
@@ -257,8 +261,7 @@ class Api {
|
||||
);
|
||||
}
|
||||
|
||||
static Future<HttpResponse<NullResponse>> moveEnv(
|
||||
String id, int fromIndex, int toIndex) async {
|
||||
static Future<HttpResponse<NullResponse>> moveEnv(String id, int fromIndex, int toIndex) async {
|
||||
return await Http.put<NullResponse>(
|
||||
Url.envMove(id),
|
||||
{"fromIndex": fromIndex, "toIndex": toIndex},
|
||||
@@ -273,26 +276,32 @@ class Api {
|
||||
}
|
||||
|
||||
static Future<HttpResponse<List<TaskLogBean>>> taskLog() async {
|
||||
return await Http.get<List<TaskLogBean>>(Url.taskLog, null,
|
||||
serializationName: "dirs");
|
||||
return await Http.get<List<TaskLogBean>>(Url.taskLog, null, serializationName: Utils.isUpperVersion2_12_2() ? "data" : "dirs");
|
||||
}
|
||||
|
||||
static Future<HttpResponse<String>> taskLogDetail(String name) async {
|
||||
static Future<HttpResponse<String>> taskLogDetail(String name, String path) async {
|
||||
if (Utils.isUpperVersion2_13_0()) {
|
||||
return await Http.get<String>(
|
||||
Url.taskLogDetail + name,
|
||||
Url.taskLogDetail + name + "?path=" + path,
|
||||
null,
|
||||
);
|
||||
} else {
|
||||
return await Http.get<String>(
|
||||
Url.taskLogDetail + path + "/" + name,
|
||||
null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
static Future<HttpResponse<List<ScriptBean>>> scripts() async {
|
||||
//2.12.2以及以上版本,脚本路径url做了修改
|
||||
return await Http.get<List<ScriptBean>>(
|
||||
Url.scripts,
|
||||
Utils.isUpperVersion2_13_0() ? Url.scripts2 : Url.scripts,
|
||||
null,
|
||||
);
|
||||
}
|
||||
|
||||
static Future<HttpResponse<NullResponse>> updateScript(
|
||||
String name, String path, String content) async {
|
||||
static Future<HttpResponse<NullResponse>> updateScript(String name, String path, String content) async {
|
||||
return await Http.put<NullResponse>(
|
||||
Url.scriptDetail,
|
||||
{
|
||||
@@ -303,8 +312,7 @@ class Api {
|
||||
);
|
||||
}
|
||||
|
||||
static Future<HttpResponse<NullResponse>> delScript(
|
||||
String name, String path) async {
|
||||
static Future<HttpResponse<NullResponse>> delScript(String name, String path) async {
|
||||
return await Http.delete<NullResponse>(
|
||||
Url.scriptDetail,
|
||||
{
|
||||
@@ -314,8 +322,7 @@ class Api {
|
||||
);
|
||||
}
|
||||
|
||||
static Future<HttpResponse<String>> scriptDetail(
|
||||
String name, String? path) async {
|
||||
static Future<HttpResponse<String>> scriptDetail(String name, String? path) async {
|
||||
return await Http.get<String>(
|
||||
Url.scriptDetail + name,
|
||||
{
|
||||
@@ -324,8 +331,7 @@ class Api {
|
||||
);
|
||||
}
|
||||
|
||||
static Future<HttpResponse<List<DependencyBean>>> dependencies(
|
||||
String type) async {
|
||||
static Future<HttpResponse<List<DependencyBean>>> dependencies(String type) async {
|
||||
return await Http.get<List<DependencyBean>>(
|
||||
Url.dependencies,
|
||||
{
|
||||
@@ -334,8 +340,7 @@ class Api {
|
||||
);
|
||||
}
|
||||
|
||||
static Future<HttpResponse<NullResponse>> dependencyReinstall(
|
||||
String id) async {
|
||||
static Future<HttpResponse<NullResponse>> dependencyReinstall(String id) async {
|
||||
return await Http.put<NullResponse>(
|
||||
Url.dependencies,
|
||||
[id],
|
||||
@@ -349,16 +354,21 @@ class Api {
|
||||
);
|
||||
}
|
||||
|
||||
static Future<HttpResponse<NullResponse>> addDependency(
|
||||
String name, int type) async {
|
||||
static Future<HttpResponse<NullResponse>> addDependency(List<Map<String, dynamic>> list) async {
|
||||
return await Http.post<NullResponse>(
|
||||
Url.dependencies,
|
||||
[
|
||||
{
|
||||
"name": name,
|
||||
"type": type,
|
||||
list,
|
||||
);
|
||||
}
|
||||
],
|
||||
|
||||
static Future<HttpResponse<NullResponse>> addScript(String name, String path, String content) async {
|
||||
return await Http.post<NullResponse>(
|
||||
Url.addScript,
|
||||
{
|
||||
"filename": name,
|
||||
"path": path,
|
||||
"content": content,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -368,4 +378,89 @@ class Api {
|
||||
[id],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// 获取订阅
|
||||
static Future<HttpResponse<List<Subscription>>> getSubscription()async{
|
||||
return await Http.get<List<Subscription>>(
|
||||
Url.subscriptions,
|
||||
{}
|
||||
);
|
||||
}
|
||||
|
||||
// 新增订阅
|
||||
static Future<HttpResponse<Subscription>> postSubscription(Subscription subscription)async{
|
||||
var data = subscription.toJson();
|
||||
data.remove("id");
|
||||
data.remove("status");
|
||||
data.remove("pid");
|
||||
data.remove("log_path");
|
||||
data.remove("is_disabled");
|
||||
data.remove("createdAt");
|
||||
data.remove("updatedAt");
|
||||
data.remove("pullType");
|
||||
data.remove("pullOption");
|
||||
return await Http.post<Subscription>(
|
||||
Url.subscriptions,
|
||||
data
|
||||
);
|
||||
}
|
||||
|
||||
// 修改订阅
|
||||
static Future<HttpResponse<Subscription>> putSubscription(Subscription subscription)async{
|
||||
return await Http.put<Subscription>(
|
||||
Url.subscriptions,
|
||||
subscription.toJson()
|
||||
);
|
||||
}
|
||||
|
||||
// 删除订阅 参数未一个id数组
|
||||
static Future<HttpResponse<NullResponse>> deleteSubscription(List<int> ids)async{
|
||||
return await Http.delete<NullResponse>(
|
||||
Url.subscriptions,
|
||||
ids
|
||||
);
|
||||
}
|
||||
|
||||
// 删除订阅 参数未一个id数组
|
||||
static Future<HttpResponse<NullResponse>> disableSubscription(List<int> ids)async{
|
||||
return await Http.put<NullResponse>(
|
||||
Url.disableSubscriptions,
|
||||
ids
|
||||
);
|
||||
}
|
||||
|
||||
// 删除订阅 参数未一个id数组
|
||||
static Future<HttpResponse<NullResponse>> enableSubscription(List<int> ids)async{
|
||||
return await Http.put<NullResponse>(
|
||||
Url.enableSubscriptions,
|
||||
ids
|
||||
);
|
||||
}
|
||||
|
||||
// 开始执行订阅
|
||||
static Future<HttpResponse<NullResponse>> startSubscription(
|
||||
List<int> subscriptions) async {
|
||||
return await Http.put<NullResponse>(
|
||||
Url.runSubscriptions,
|
||||
subscriptions,
|
||||
);
|
||||
}
|
||||
|
||||
// 暂停订阅执行
|
||||
static Future<HttpResponse<NullResponse>> stopSubscription(
|
||||
List<int> subscriptions) async {
|
||||
return await Http.put<NullResponse>(
|
||||
Url.stopSubscriptions,
|
||||
subscriptions,
|
||||
);
|
||||
}
|
||||
|
||||
// 获取订阅的日志
|
||||
static Future<HttpResponse<String>> subTimeLog(int subId) async {
|
||||
return await Http.get<String>(
|
||||
Url.subtimeLog(subId),
|
||||
null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,8 @@ class Http {
|
||||
if (!pushedLoginPage) {
|
||||
"身份已过期,请重新登录".toast();
|
||||
pushedLoginPage = true;
|
||||
navigatorState.currentState?.pushNamedAndRemoveUntil(Routes.routeLogin, (route) => false);
|
||||
navigatorState.currentState
|
||||
?.pushNamedAndRemoveUntil(Routes.routeLogin, (route) => false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,9 +137,15 @@ class Http {
|
||||
}
|
||||
|
||||
if (e.response != null && e.response!.data != null) {
|
||||
return HttpResponse(success: false, message: e.response?.data["message"] ?? e.message, code: e.response?.data["code"] ?? 0);
|
||||
return HttpResponse(
|
||||
success: false,
|
||||
message: e.response?.data["message"] ?? e.message,
|
||||
code: e.response?.data["code"] ?? 0);
|
||||
} else {
|
||||
return HttpResponse(success: false, message: e.message, code: e.response?.statusCode ?? 0);
|
||||
return HttpResponse(
|
||||
success: false,
|
||||
message: e.message,
|
||||
code: e.response?.statusCode ?? 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,7 +230,8 @@ class HttpResponse<T> {
|
||||
late int code;
|
||||
T? bean;
|
||||
|
||||
HttpResponse({required this.success, this.message, required this.code, this.bean});
|
||||
HttpResponse(
|
||||
{required this.success, this.message, required this.code, this.bean});
|
||||
}
|
||||
|
||||
class DeserializeAction<T> {
|
||||
|
||||