mirror of
https://github.com/simon-ding/polaris.git
synced 2026-02-06 23:21:00 +08:00
feat: windows app update
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
//go:build !c
|
||||
//go:build !lib
|
||||
package ui
|
||||
|
||||
import "embed"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//go:build c
|
||||
//go:build lib
|
||||
package ui
|
||||
|
||||
import "embed"
|
||||
|
||||
@@ -5,7 +5,6 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:ui/providers/server_response.dart';
|
||||
import 'package:ui/widgets/utils.dart';
|
||||
|
||||
class APIs {
|
||||
static int port = 8096;
|
||||
@@ -32,7 +31,7 @@ class APIs {
|
||||
static final allDownloadClientsUrl = "$_baseUrl/api/v1/downloader";
|
||||
static final addDownloadClientUrl = "$_baseUrl/api/v1/downloader/add";
|
||||
static final delDownloadClientUrl = "$_baseUrl/api/v1/downloader/del/";
|
||||
static final storageUrl = "$_baseUrl/api/v1/storage/";
|
||||
static final storageUrl = "$_baseUrl/api/v1/storage";
|
||||
static final loginUrl = "$_baseUrl/api/login";
|
||||
static final logoutUrl = "$_baseUrl/api/v1/setting/logout";
|
||||
static final loginSettingUrl = "$_baseUrl/api/v1/setting/auth";
|
||||
@@ -46,12 +45,12 @@ class APIs {
|
||||
static final changeMonitoringUrl = "$_baseUrl/api/v1/setting/monitoring";
|
||||
static final addImportlistUrl = "$_baseUrl/api/v1/importlist/add";
|
||||
static final deleteImportlistUrl = "$_baseUrl/api/v1/importlist/delete";
|
||||
static final getAllImportlists = "$_baseUrl/api/v1/importlist/";
|
||||
static final getAllImportlists = "$_baseUrl/api/v1/importlist";
|
||||
static final prowlarrUrl = "$_baseUrl/api/v1/setting/prowlarr";
|
||||
|
||||
static final notifierAllUrl = "$_baseUrl/api/v1/notifier/all";
|
||||
static final notifierDeleteUrl = "$_baseUrl/api/v1/notifier/id/";
|
||||
static final notifierAddUrl = "$_baseUrl/api/v1/notifier/add/";
|
||||
static final notifierAddUrl = "$_baseUrl/api/v1/notifier/add";
|
||||
|
||||
static final tmdbImgBaseUrl = "$_baseUrl/api/v1/posters";
|
||||
|
||||
@@ -85,14 +84,21 @@ class APIs {
|
||||
var dio = Dio();
|
||||
dio.options.followRedirects = true;
|
||||
dio.interceptors.add(InterceptorsWrapper(
|
||||
onError: (error, handler) {
|
||||
onError: (error, handler) async {
|
||||
if (error.response?.statusCode != null &&
|
||||
error.response?.statusCode! == 403) {
|
||||
//not login
|
||||
final context = navigatorKey.currentContext;
|
||||
if (context != null) {
|
||||
context.go('/login');
|
||||
}
|
||||
}
|
||||
|
||||
if (error.response?.statusCode == 307) {
|
||||
final redirectUrl = error.response!.headers['Location']!.first;
|
||||
final newResponse = await dio.get(_baseUrl+redirectUrl);
|
||||
return handler.resolve(newResponse); // 返回修正后的响应
|
||||
}
|
||||
return handler.next(error);
|
||||
},
|
||||
));
|
||||
|
||||
@@ -111,8 +111,8 @@ class Activity {
|
||||
final String? saved;
|
||||
final int? progress;
|
||||
final int? size;
|
||||
final double? seedRatio;
|
||||
final double? uploadProgress;
|
||||
final num? seedRatio;
|
||||
final num? uploadProgress;
|
||||
|
||||
factory Activity.fromJson(Map<String, dynamic> json) {
|
||||
return Activity(
|
||||
|
||||
@@ -251,7 +251,7 @@ class MediaTorrentResource extends AutoDisposeFamilyAsyncNotifier<
|
||||
"season": arg.seasonNumber,
|
||||
"episode": arg.episodeNumber
|
||||
});
|
||||
final dio = await APIs.getDio();
|
||||
final dio = APIs.getDio();
|
||||
var resp = await dio.post(APIs.downloadTorrentUrl, data: data);
|
||||
var rsp = ServerResponse.fromJson(resp.data);
|
||||
if (rsp.code != 0) {
|
||||
|
||||
@@ -315,7 +315,7 @@ class StorageSettingData extends AutoDisposeAsyncNotifier<List<Storage>> {
|
||||
|
||||
Future<void> deleteStorage(int id) async {
|
||||
final dio = await APIs.getDio();
|
||||
var resp = await dio.delete("${APIs.storageUrl}$id");
|
||||
var resp = await dio.delete("${APIs.storageUrl}/$id");
|
||||
var sp = ServerResponse.fromJson(resp.data);
|
||||
if (sp.code != 0) {
|
||||
throw sp.message;
|
||||
|
||||
@@ -93,7 +93,7 @@ class _SystemPageState extends ConsumerState<SystemPage> {
|
||||
]),
|
||||
DataRow(cells: [
|
||||
const DataCell(Text("更新监控列表")),
|
||||
const DataCell(Text("每小时")),
|
||||
const DataCell(Text("每20分钟")),
|
||||
DataCell(IconButton(
|
||||
icon: const Icon(Icons.not_started),
|
||||
onPressed: () =>
|
||||
|
||||
Reference in New Issue
Block a user