Skip to content

Commit

Permalink
Merge pull request #213 from Muska-Ami/dev
Browse files Browse the repository at this point in the history
Update to GUI v0.2.4 with CLI 0.0.3+3
  • Loading branch information
Muska-Ami authored Nov 25, 2024
2 parents 82bf94e + 9e21c6c commit 02d116c
Show file tree
Hide file tree
Showing 46 changed files with 303 additions and 279 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-gui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: flutter-actions/setup-flutter@v3
with:
channel: 'stable'
version: 3.24.3
version: 3.24.5
cache-sdk: true

- name: Install Dependencies
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
uses: flutter-actions/setup-flutter@v3
with:
channel: 'stable'
version: 3.24.3
version: 3.24.5
cache-sdk: true

- name: Install Dependencies
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
uses: flutter-actions/setup-flutter@v3
with:
channel: 'stable'
version: 3.24.3
version: 3.24.5
cache-sdk: true

- name: Setup Node.js
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: flutter-actions/setup-flutter@v3
with:
channel: 'stable'
version: 3.24.3
version: 3.24.5
cache-sdk: true

- name: Install Dependencies
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
uses: flutter-actions/setup-flutter@v3
with:
channel: 'stable'
version: 3.24.3
version: 3.24.5
cache-sdk: true

- name: Install Dependencies
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
uses: flutter-actions/setup-flutter@v3
with:
channel: 'stable'
version: 3.24.3
version: 3.24.5
cache-sdk: true

- name: Install Dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: flutter-actions/setup-flutter@v3
with:
channel: 'stable'
version: 3.24.3
version: 3.24.5
cache-sdk: true

- name: Install Dependencies
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
uses: flutter-actions/setup-flutter@v3
with:
channel: 'stable'
version: 3.24.3
version: 3.24.5
cache-sdk: true

- name: Install Dependencies
Expand Down Expand Up @@ -136,7 +136,7 @@ jobs:
uses: flutter-actions/setup-flutter@v3
with:
channel: 'stable'
version: 3.24.3
version: 3.24.5
cache-sdk: true

- name: Setup Node.js
Expand Down
8 changes: 4 additions & 4 deletions RELEASE_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@

### GUI

-/-
- 新增 Monet 取色,重构了主题功能部分逻辑

### CLI

-/-
- 同步核心更改

### 其他

#### NyaLCF Core

- 修复 POST 请求数据提交
- 为配置文件添加 Fallback 赋值机制

## 版本信息

- nyalcf_gui: 0.2.3
- nyalcf_cli: 0.0.3
- nyalcf_env: 1.0.2
- nyalcf_core,nyalcf_inject: 1.2.3
- nyalcf_core,nyalcf_inject: 1.2.4

<!-- Some change log here -->
2 changes: 1 addition & 1 deletion nyalcf_cli/lib/commands/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Config implements CommandImplement {
if (args.length == 3) {
switch (args[0]) {
case 'launcher':
final originValue = _lcs.cfg.get(args[1]);
final originValue = _lcs.cfg.get(args[1], null);
final convertedValue = _convert(originValue, args[2]);
if (convertedValue != null) {
_lcs.cfg.set(args[1], convertedValue);
Expand Down
2 changes: 2 additions & 0 deletions nyalcf_cli/lib/commands/logout.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Package imports:

// Package imports:
import 'package:nyalcf_core/storages/stores/user_info_storage.dart';
import 'package:nyalcf_core/utils/logger.dart';
Expand Down
6 changes: 3 additions & 3 deletions nyalcf_cli/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -252,21 +252,21 @@ packages:
path: "../nyalcf_core"
relative: true
source: path
version: "1.2.2"
version: "1.2.4"
nyalcf_env:
dependency: "direct main"
description:
path: "../nyalcf_env"
relative: true
source: path
version: "1.0.1"
version: "1.0.2"
nyalcf_inject:
dependency: "direct main"
description:
path: "../nyalcf_inject"
relative: true
source: path
version: "1.2.2"
version: "1.2.4"
package_config:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion nyalcf_cli/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: nyalcf
description: "[CLI]The next generation of LoCyanFrp launcher."
version: 0.0.3+2
version: 0.0.3+3
homepage: https://nyalcf.1l1.icu
publish_to: none
# repository: https://github.com/my_org/my_repo
Expand Down
7 changes: 3 additions & 4 deletions nyalcf_core/lib/models/response/response.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
library response;

export 'template/response_type.dart';
export 'template/error_model.dart';

export 'auth/login_auth_model.dart';
export 'auth/logout_auth_model.dart';
export 'auth/user_auth_model.dart';
export 'frpc/version_frpc_model.dart';
export 'frpc/download_frpc_model.dart';
export 'frpc/version_frpc_model.dart';
export 'launcher/update_launcher_model.dart';
export 'other/notice_other_model.dart';
export 'other/sign_other_model.dart';
export 'proxies/get_proxies_model.dart';
export 'proxies/status_proxies_model.dart';
export 'template/error_model.dart';
export 'template/response_type.dart';
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ class AutostartProxiesStorage extends JsonConfiguration {
String get handle => 'PROXIES_AUTOSTART';

@override
Future<Map<String, dynamic>> get defConfig async => {
Map<String, dynamic> get defConfig => {
'list': [],
};

/// 获取自带启动隧道列表
List getList() => cfg.getList('list');
List getList() => cfg.getList('list', defConfig['list']);

/// 添加自动启动隧道
/// [proxyId] 隧道 ID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class FrpcConfigurationStorage extends JsonConfiguration {
String get handle => 'FRPC';

@override
Future<Map<String, dynamic>> get defConfig async => {
Map<String, dynamic> get defConfig => {
'settings': {
'frpc_version': '0.51.3-6',
'frpc_download_mirror': true,
Expand All @@ -38,7 +38,7 @@ class FrpcConfigurationStorage extends JsonConfiguration {
};

/// 获取使用的 Frpc 版本
String getSettingsFrpcVersion() => cfg.getString('settings.frpc_version');
String getSettingsFrpcVersion() => cfg.getString('settings.frpc_version', defConfig['settings']['frpc_version']);

/// 设置使用的 Frpc 版本
/// [value] Frpc 版本
Expand All @@ -47,7 +47,7 @@ class FrpcConfigurationStorage extends JsonConfiguration {

/// 获取是否使用镜像源
bool getSettingsFrpcDownloadMirror() =>
cfg.getBool('settings.frpc_download_mirror');
cfg.getBool('settings.frpc_download_mirror', defConfig['settings']['frpc_download_mirror']);

/// 设置设置使用镜像源
/// [value] 是否使用镜像源
Expand All @@ -56,7 +56,7 @@ class FrpcConfigurationStorage extends JsonConfiguration {

/// 获取使用的镜像源 ID
String getSettingsFrpcDownloadMirrorId() =>
cfg.getString('settings.frpc_download_mirror_id');
cfg.getString('settings.frpc_download_mirror_id', defConfig['settings']['frpc_download_mirror_id']);

/// 设置使用的镜像源 ID
void setSettingsFrpcDownloadMirrorId(String value) =>
Expand Down Expand Up @@ -86,7 +86,7 @@ class FrpcConfigurationStorage extends JsonConfiguration {
List<Map<String, dynamic>> getDownloadMirrors() {
// 无法 cast,使用 for 转换一下类型
final list = <Map<String, dynamic>>[];
for (var single in cfg.getList('lists.frpc_download_mirrors')) {
for (var single in cfg.getList('lists.frpc_download_mirrors', defConfig['lists']['frpc_download_mirrors'])) {
list.add(single);
}
return list;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ class LauncherConfigurationStorage extends JsonConfiguration {
String get handle => 'LAUNCHER';

@override
Future<Map<String, dynamic>> get defConfig async => {
Map<String, dynamic> get defConfig => {
'debug': false,
'theme': {
'auto': true,
'monet': true,
'dark': {
'enable': false,
},
Expand All @@ -33,45 +34,50 @@ class LauncherConfigurationStorage extends JsonConfiguration {
};

/// 获取是否开启 DEBUG
bool getDebug() => ENV_UNIVERSAL_DEBUG ?? cfg.getBool('debug');
bool getDebug() => ENV_UNIVERSAL_DEBUG ?? cfg.getBool('debug', defConfig['debug']);

/// 设置是否开启 DEBUG
/// [value] 是否开启 DEBUG
void setDebug(bool value) => cfg.setBool('debug', value);

/// 获取是否自动设置主题
bool getThemeAuto() => cfg.getBool('theme.auto');
bool getThemeAuto() => cfg.getBool('theme.auto', defConfig['theme']['auto']);

/// 设置自动设置主题
/// [value] 是否自动设置主题
void setThemeAuto(bool value) => cfg.setBool('theme.auto', value);

/// 设置 Monet 取色
/// [value] 是否 Monet 取色
bool getThemeMonet() => cfg.getBool('theme.monet', defConfig['theme']['monet']);

void setThemeMonet(bool value) => cfg.setBool('theme.monet', value);

/// 获取是否启用暗色模式
bool getThemeDarkEnable() => cfg.getBool('theme.dark.enable');
bool getThemeDarkEnable() => cfg.getBool('theme.dark.enable', defConfig['theme']['dark']['enable']);

/// 设置是否启用暗色模式
/// [value] 是否启用暗色模式
void setThemeDarkEnable(bool value) =>
cfg.setBool('theme.dark.enable', value);

/// 获取是否浅色模式自定义主题色
bool getThemeLightSeedEnable() => cfg.getBool('theme.light.seed.enable');
bool getThemeLightSeedEnable() => cfg.getBool('theme.light.seed.enable', defConfig['theme']['light']['seed']['enable']);

/// 设置浅色模式自定义主题色
/// [value] 是否使用自定义主题色
void setThemeLightSeedEnable(bool value) =>
cfg.setBool('theme.light.seed.enable', value);
void setThemeLightSeedEnable(bool value) => cfg.setBool('theme.light.seed.enable', value);

/// 获取浅色模式主题色种子
String getThemeLightSeedValue() => cfg.getString('theme.light.seed.value');
String getThemeLightSeedValue() => cfg.getString('theme.light.seed.value', defConfig['theme']['light']['seed']['value']);

/// 设置浅色模式主题色种子
/// [value] 16 进制颜色代码
void setThemeLightSeedValue(String value) =>
cfg.setString('theme.light.seed.value', value);

/// 获取是否启用自动签到
bool getAutoSign() => cfg.getBool('auto_sign');
bool getAutoSign() => cfg.getBool('auto_sign', defConfig['auto_sign']);

/// 设置是否启用自动签到
/// [value] 是否启用自动签到
Expand Down
4 changes: 2 additions & 2 deletions nyalcf_core/lib/storages/json_configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ abstract class JsonConfiguration {
String get handle;

/// 配置文件默认内容
Future<Map<String, dynamic>> get defConfig async => {};
Map<String, dynamic> get defConfig => {};

/// 附加 Init 方法
void init() => {};
Expand Down Expand Up @@ -47,7 +47,7 @@ abstract class JsonConfiguration {
if (await file?.exists() == true) {
cfg.fromString(await file!.readAsString());
} else {
cfg.fromMap(await defConfig);
cfg.fromMap(defConfig);
cfg.save();
}
init();
Expand Down
21 changes: 13 additions & 8 deletions nyalcf_core/lib/utils/file_configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,37 +28,37 @@ class FileConfiguration {
/// String
void setString(String node, String value) => set(node, value);

String getString(String node) => get(node);
String getString(String node, String? defaultValue) => get(node, defaultValue);

void setStringList(String node, List<String> value) => setList(node, value);

List<String> getStringList(String node) =>
getList(node).map((item) => item as String).toList();
getList(node, []).map((item) => item as String).toList();

/// int
void setInt(String node, int value) => set(node, value);

int getInt(String node) => get(node);
int getInt(String node, int? defaultValue) => get(node, defaultValue);

/// double
void setDouble(String node, double value) => set(node, value);

double getDouble(String node) => get(node);
double getDouble(String node, double? defaultValue) => get(node, defaultValue);

/// bool
void setBool(String node, bool value) => set(node, value);

bool getBool(String node) => get(node);
bool getBool(String node, bool? defaultValue) => get(node, defaultValue);

/// Symbol
void setSymbol(String node, Symbol value) => set(node, value);

Symbol getSymbol(String node) => get(node);
Symbol getSymbol(String node, Symbol? defaultValue) => get(node, defaultValue);

/// List
void setList(String node, List value) => set(node, value);

List getList(String node) => get(node);
List getList(String node, List? defaultValue) => get(node, defaultValue);

/// 设置值
void set(String node, dynamic value) {
Expand All @@ -79,7 +79,7 @@ class FileConfiguration {
}

/// 获取值
dynamic get(String node) {
dynamic get(String node, dynamic defaultValue) {
List<String> nl = _parseNode(node);
dynamic last;
String? n;
Expand All @@ -96,6 +96,11 @@ class FileConfiguration {
//Logger.debug('读取迭代LAST: $last');
}
}

if (last == null && defaultValue != null) {
set(node, defaultValue);
return defaultValue;
}
//Logger.debug('最终值(${n}): ${last}');
return last;
}
Expand Down
Loading

0 comments on commit 02d116c

Please sign in to comment.