mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2026-02-14 12:14:26 +01:00
new: useCDN option
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 787;
|
||||
static const int build = 793;
|
||||
static const String engine = "3.19.2";
|
||||
static const String buildAt = "2024-03-06 16:28:08";
|
||||
static const int modifications = 3;
|
||||
static const String buildAt = "2024-03-08 15:18:32";
|
||||
static const int modifications = 2;
|
||||
static const int script = 40;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
abstract final class Urls {
|
||||
static const resBase = 'https://res.lolli.tech/serverbox';
|
||||
static const cdnBase = 'https://cdn.lolli.tech/serverbox';
|
||||
static const myGithub = 'https://github.com/lollipopkit';
|
||||
static const appHelp = '$myGithub/flutter_server_box#-help';
|
||||
static const appWiki = '$myGithub/flutter_server_box/wiki';
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:toolbox/data/res/store.dart';
|
||||
|
||||
import '../model/app/update.dart';
|
||||
import '../res/url.dart';
|
||||
|
||||
class AppService {
|
||||
Future<AppUpdate> getUpdate() async {
|
||||
final resp = await Dio().get('${Urls.resBase}/update.json');
|
||||
final useCDN = Stores.setting.useCdn.fetch() == 1;
|
||||
final resp =
|
||||
await Dio().get('${useCDN ? Urls.cdnBase : Urls.resBase}/update.json');
|
||||
return AppUpdate.fromJson(resp.data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,6 +250,11 @@ class SettingStore extends PersistentStore {
|
||||
/// when building traffic view on server tab
|
||||
late final ignoreLocalNet = property('ignoreLocalNetIface', true);
|
||||
|
||||
/// Use cdn
|
||||
/// It's recommended to use cdn for non-China users
|
||||
/// 0: unset, 1: use, 2: not use
|
||||
late final useCdn = property('useCdn', 0);
|
||||
|
||||
// Never show these settings for users
|
||||
//
|
||||
// ------BEGIN------
|
||||
|
||||
Reference in New Issue
Block a user