mirror of
https://mirror.ghproxy.com/https://github.com/StarCitizenToolBox/app.git
synced 2024-12-23 01:53:41 +08:00
拆分 AppConf
This commit is contained in:
parent
a290062304
commit
3f7c399234
@ -1,6 +1,6 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:starcitizen_doctor/common/conf.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
|
||||
import 'package:starcitizen_doctor/common/utils/base_utils.dart';
|
||||
|
||||
class AnalyticsApi {
|
||||
@ -11,7 +11,7 @@ class AnalyticsApi {
|
||||
if (kDebugMode) return;
|
||||
dPrint("AnalyticsApi.touch === $key start");
|
||||
try {
|
||||
await _dio.post("${AppConf.xkeycApiUrl}/analytics/$key");
|
||||
await _dio.post("${URLConf.xkeycApiUrl}/analytics/$key");
|
||||
dPrint("AnalyticsApi.touch === $key over");
|
||||
} catch (e) {
|
||||
dPrint("AnalyticsApi.touch === $key Error:$e");
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:starcitizen_doctor/common/conf.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
|
||||
import 'package:starcitizen_doctor/data/app_placard_data.dart';
|
||||
import 'package:starcitizen_doctor/data/app_version_data.dart';
|
||||
import 'package:starcitizen_doctor/data/countdown_festival_item_data.dart';
|
||||
@ -37,7 +37,7 @@ class Api {
|
||||
static Future<Map<String, dynamic>> getAppReleaseDataByVersionName(
|
||||
String version) async {
|
||||
final r = await dio
|
||||
.get("${AppConf.gitlabApiPath}/repos/SCToolBox/Release/releases/tags/$version");
|
||||
.get("${URLConf.gitlabApiPath}/repos/SCToolBox/Release/releases/tags/$version");
|
||||
return r.data;
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ class Api {
|
||||
}
|
||||
|
||||
static Future getRepoData(String dir, String name) async {
|
||||
final r = await dio.get("${AppConf.apiRepoPath}/$dir/$name");
|
||||
final r = await dio.get("${URLConf.apiRepoPath}/$dir/$name");
|
||||
return r.data;
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import 'dart:io';
|
||||
|
||||
import 'package:dart_rss/dart_rss.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:starcitizen_doctor/common/conf.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
|
||||
|
||||
class RSSApi {
|
||||
static final _dio = Dio(BaseOptions(
|
||||
@ -10,15 +10,15 @@ class RSSApi {
|
||||
responseType: ResponseType.plain));
|
||||
|
||||
static Future<List<RssItem>> getRssVideo() async {
|
||||
final r = await _dio.get(AppConf.rssVideoUrl);
|
||||
final r = await _dio.get(URLConf.rssVideoUrl);
|
||||
final f = RssFeed.parse(r.data);
|
||||
return f.items.sublist(0, 8);
|
||||
}
|
||||
|
||||
static Future<List<RssItem>> getRssText() async {
|
||||
final r1 = await _dio.get(AppConf.rssTextUrl1);
|
||||
final r1 = await _dio.get(URLConf.rssTextUrl1);
|
||||
final r1f = RssFeed.parse(r1.data);
|
||||
final r2 = await _dio.get(AppConf.rssTextUrl2);
|
||||
final r2 = await _dio.get(URLConf.rssTextUrl2);
|
||||
final r2f = RssFeed.parse(r2.data);
|
||||
final items = r1f.items..addAll(r2f.items);
|
||||
items.sort((a, b) {
|
||||
|
@ -14,37 +14,13 @@ import 'package:starcitizen_doctor/global_ui_model.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
|
||||
import '../base/ui.dart';
|
||||
import '../../base/ui.dart';
|
||||
|
||||
class AppConf {
|
||||
static const String appVersion = "2.11.0 Beta";
|
||||
static const int appVersionCode = 36;
|
||||
static const String appVersionDate = "2024-01-07";
|
||||
|
||||
static const String giteaAttachmentsUrl =
|
||||
"https://git.sctoolbox.sccsgo.com/SCToolBox/Release";
|
||||
static const String gitlabLocalizationUrl =
|
||||
"https://git.sctoolbox.sccsgo.com/SCToolBox/LocalizationData";
|
||||
static const String apiRepoPath =
|
||||
"https://git.sctoolbox.sccsgo.com/SCToolBox/api/raw/branch/main/";
|
||||
|
||||
static const String gitlabApiPath =
|
||||
"https://git.sctoolbox.sccsgo.com/api/v1/";
|
||||
|
||||
static const String webTranslateHomeUrl =
|
||||
"https://git.sctoolbox.sccsgo.com/SCToolBox/ScWeb_Chinese_Translate/raw/branch/main/json/locales";
|
||||
|
||||
static const String xkeycApiUrl = "https://sctoolbox.xkeyc.com";
|
||||
|
||||
static const _rssHomeUrl = "https://rss.sctoolbox.sccsgo.com";
|
||||
|
||||
static const rssVideoUrl =
|
||||
"$_rssHomeUrl/bilibili/user/channel/27976358/290653";
|
||||
|
||||
static const rssTextUrl1 = "$_rssHomeUrl/bilibili/user/article/40102960";
|
||||
static const rssTextUrl2 =
|
||||
"$_rssHomeUrl/baidu/tieba/user/%E7%81%AC%E7%81%ACG%E7%81%AC%E7%81%AC&";
|
||||
|
||||
static const gameChannels = ["LIVE", "PTU", "EPTU"];
|
||||
|
||||
static String deviceUUID = "";
|
25
lib/common/conf/url_conf.dart
Normal file
25
lib/common/conf/url_conf.dart
Normal file
@ -0,0 +1,25 @@
|
||||
class URLConf {
|
||||
static const String giteaAttachmentsUrl =
|
||||
"https://git.sctoolbox.sccsgo.com/SCToolBox/Release";
|
||||
static const String gitlabLocalizationUrl =
|
||||
"https://git.sctoolbox.sccsgo.com/SCToolBox/LocalizationData";
|
||||
static const String apiRepoPath =
|
||||
"https://git.sctoolbox.sccsgo.com/SCToolBox/api/raw/branch/main/";
|
||||
|
||||
static const String gitlabApiPath =
|
||||
"https://git.sctoolbox.sccsgo.com/api/v1/";
|
||||
|
||||
static const String webTranslateHomeUrl =
|
||||
"https://git.sctoolbox.sccsgo.com/SCToolBox/ScWeb_Chinese_Translate/raw/branch/main/json/locales";
|
||||
|
||||
static const String xkeycApiUrl = "https://sctoolbox.xkeyc.com";
|
||||
|
||||
static const _rssHomeUrl = "https://rss.sctoolbox.sccsgo.com";
|
||||
|
||||
static const rssVideoUrl =
|
||||
"$_rssHomeUrl/bilibili/user/channel/27976358/290653";
|
||||
|
||||
static const rssTextUrl1 = "$_rssHomeUrl/bilibili/user/article/40102960";
|
||||
static const rssTextUrl2 =
|
||||
"$_rssHomeUrl/baidu/tieba/user/%E7%81%AC%E7%81%ACG%E7%81%AC%E7%81%AC&";
|
||||
}
|
@ -6,7 +6,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:hexcolor/hexcolor.dart';
|
||||
|
||||
import 'base/ui_model.dart';
|
||||
import 'common/conf.dart';
|
||||
import 'common/conf/app_conf.dart';
|
||||
import 'ui/settings/upgrade_dialog_ui.dart';
|
||||
import 'ui/settings/upgrade_dialog_ui_model.dart';
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'package:desktop_webview_window/desktop_webview_window.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:starcitizen_doctor/base/ui_model.dart';
|
||||
import 'package:starcitizen_doctor/common/conf.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/app_conf.dart';
|
||||
import 'package:starcitizen_doctor/ui/index_ui_model.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:starcitizen_doctor/base/ui.dart';
|
||||
import 'package:starcitizen_doctor/common/conf.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/app_conf.dart';
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
|
||||
import 'about_ui_model.dart';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import 'package:starcitizen_doctor/base/ui_model.dart';
|
||||
import 'package:starcitizen_doctor/common/conf.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/app_conf.dart';
|
||||
import 'package:starcitizen_doctor/global_ui_model.dart';
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
|
||||
|
@ -10,7 +10,8 @@ import 'package:starcitizen_doctor/api/analytics.dart';
|
||||
import 'package:starcitizen_doctor/api/api.dart';
|
||||
import 'package:starcitizen_doctor/api/rss.dart';
|
||||
import 'package:starcitizen_doctor/base/ui_model.dart';
|
||||
import 'package:starcitizen_doctor/common/conf.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/app_conf.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
|
||||
import 'package:starcitizen_doctor/common/helper/log_helper.dart';
|
||||
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
|
||||
import 'package:starcitizen_doctor/data/app_placard_data.dart';
|
||||
@ -107,7 +108,7 @@ class HomeUIModel extends BaseUIModel {
|
||||
notifyListeners();
|
||||
appWebLocalizationVersionsData = AppWebLocalizationVersionsData.fromJson(
|
||||
json.decode((await Api.dio.get(
|
||||
"${AppConf.webTranslateHomeUrl}/versions.json",
|
||||
"${URLConf.webTranslateHomeUrl}/versions.json",
|
||||
options: Options(responseType: ResponseType.plain)))
|
||||
.data));
|
||||
countdownFestivalListData = await Api.getFestivalCountdownList();
|
||||
|
@ -7,7 +7,8 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:starcitizen_doctor/api/analytics.dart';
|
||||
import 'package:starcitizen_doctor/api/api.dart';
|
||||
import 'package:starcitizen_doctor/base/ui_model.dart';
|
||||
import 'package:starcitizen_doctor/common/conf.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/app_conf.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
|
||||
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
|
||||
import 'package:starcitizen_doctor/data/sc_localization_data.dart';
|
||||
|
||||
@ -134,7 +135,7 @@ class LocalizationUIModel extends BaseUIModel {
|
||||
return () async {
|
||||
AnalyticsApi.touch("install_localization");
|
||||
final downloadUrl =
|
||||
"${AppConf.gitlabLocalizationUrl}/archive/${value.versionName}.tar.gz";
|
||||
"${URLConf.gitlabLocalizationUrl}/archive/${value.versionName}.tar.gz";
|
||||
final savePath =
|
||||
File("${downloadDir.absolute.path}\\${value.versionName}.sclang");
|
||||
try {
|
||||
|
@ -9,7 +9,8 @@ import 'package:dio/dio.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:local_auth/local_auth.dart';
|
||||
import 'package:starcitizen_doctor/common/conf.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/app_conf.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
|
||||
import 'package:starcitizen_doctor/common/win32/credentials.dart';
|
||||
import 'package:starcitizen_doctor/data/app_web_localization_versions_data.dart';
|
||||
|
||||
@ -181,7 +182,7 @@ class WebViewModel {
|
||||
|
||||
/// https://github.com/CxJuice/Uex_Chinese_Translate
|
||||
// get versions
|
||||
const hostUrl = AppConf.webTranslateHomeUrl;
|
||||
const hostUrl = URLConf.webTranslateHomeUrl;
|
||||
dPrint("AppWebLocalizationVersionsData === ${v.toJson()}");
|
||||
|
||||
localizationResource["zh-CN"] = await _getJson("$hostUrl/zh-CN-rsi.json",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import 'package:starcitizen_doctor/base/ui_model.dart';
|
||||
import 'package:starcitizen_doctor/common/conf.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/app_conf.dart';
|
||||
import 'package:starcitizen_doctor/main.dart';
|
||||
import 'package:starcitizen_doctor/ui/about/about_ui.dart';
|
||||
import 'package:starcitizen_doctor/ui/about/about_ui_model.dart';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import 'package:starcitizen_doctor/base/ui_model.dart';
|
||||
import 'package:starcitizen_doctor/common/conf.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/app_conf.dart';
|
||||
import 'package:starcitizen_doctor/common/grpc/party_room_server.dart';
|
||||
import 'package:starcitizen_doctor/generated/grpc/party_room_server/index.pb.dart';
|
||||
import 'package:starcitizen_doctor/global_ui_model.dart';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'package:grpc/grpc.dart';
|
||||
import 'package:starcitizen_doctor/base/ui_model.dart';
|
||||
import 'package:starcitizen_doctor/common/conf.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/app_conf.dart';
|
||||
import 'package:starcitizen_doctor/common/grpc/party_room_server.dart';
|
||||
import 'package:starcitizen_doctor/generated/grpc/party_room_server/index.pb.dart';
|
||||
import 'package:starcitizen_doctor/global_ui_model.dart';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:starcitizen_doctor/base/ui.dart';
|
||||
import 'package:starcitizen_doctor/common/conf.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/app_conf.dart';
|
||||
import 'package:starcitizen_doctor/ui/settings/settings_ui_model.dart';
|
||||
|
||||
class SettingUI extends BaseUI<SettingUIModel> {
|
||||
|
@ -5,7 +5,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:local_auth/local_auth.dart';
|
||||
import 'package:starcitizen_doctor/base/ui_model.dart';
|
||||
import 'package:starcitizen_doctor/common/conf.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/app_conf.dart';
|
||||
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
|
||||
import 'package:starcitizen_doctor/common/win32/credentials.dart';
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart' show Material;
|
||||
import 'package:starcitizen_doctor/base/ui_model.dart';
|
||||
import 'package:starcitizen_doctor/common/conf.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/app_conf.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
|
||||
|
||||
import 'upgrade_dialog_ui_model.dart';
|
||||
|
||||
@ -35,7 +36,7 @@ class UpgradeDialogUI extends BaseUI<UpgradeDialogUIModel> {
|
||||
)
|
||||
] else
|
||||
...makeMarkdownView(model.description!,
|
||||
attachmentsUrl: AppConf.giteaAttachmentsUrl),
|
||||
attachmentsUrl: URLConf.giteaAttachmentsUrl),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -3,7 +3,7 @@ import 'dart:io';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:starcitizen_doctor/api/api.dart';
|
||||
import 'package:starcitizen_doctor/base/ui_model.dart';
|
||||
import 'package:starcitizen_doctor/common/conf.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/app_conf.dart';
|
||||
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
|
||||
|
@ -6,7 +6,7 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:starcitizen_doctor/api/analytics.dart';
|
||||
import 'package:starcitizen_doctor/base/ui_model.dart';
|
||||
import 'package:starcitizen_doctor/common/conf.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/app_conf.dart';
|
||||
import 'package:starcitizen_doctor/common/helper/log_helper.dart';
|
||||
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
|
||||
import 'package:starcitizen_doctor/ui/tools/downloader/downloader_dialog_ui_model.dart';
|
||||
|
Loading…
Reference in New Issue
Block a user