Skip to content

Commit cb3ce6a

Browse files
committed
Experimental: API v2.3 (GUI)
1 parent f3cd0c2 commit cb3ce6a

File tree

122 files changed

+2381
-2493
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+2381
-2493
lines changed

Diff for: RELEASE_CHANGELOG.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818

1919
## 版本信息
2020

21-
- nyalcf_gui: 0.2.4
22-
- nyalcf_cli: 0.0.3
23-
- nyalcf_env: 1.0.2
24-
- nyalcf_core,nyalcf_inject: 1.2.6
21+
- nyalcf_gui: 1.0.0
22+
- nyalcf_cli: 1.0.0
23+
- nyalcf_env: 2.0.0
24+
- nyalcf_core,nyalcf_inject: 2.0.0
2525

2626
<!-- Some change log here -->

Diff for: nyalcf_cli/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
## 运行测试
1515

16-
| 打包类型 | 系统类型 | 编译架构 | 状态 | 已测试通过环境 |
17-
|------------|---------|-------|----|------------------|
18-
| EXE | Windows | x64 || Windows 11 (Pro) |
16+
| 打包类型 | 系统类型 | 编译架构 | 状态 | 已测试通过环境 |
17+
|------------|---------|-------|----|--------------------------------|
18+
| EXE | Windows | x64 || Windows 11 (Pro) |
1919
| EXECUTABLE | Linux | x64 || Kali Linux(With WSL, Linux5.9) |
20-
| EXECUTABLE | MacOS | arm64 || - |
21-
| EXECUTABLE | MacOS | x64 || MacOS 14 |
20+
| EXECUTABLE | MacOS | arm64 || - |
21+
| EXECUTABLE | MacOS | x64 || MacOS 14 |

Diff for: nyalcf_cli/lib/commands/config.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import 'package:nyalcf_core/storages/configurations/launcher_configuration_stora
33
import 'package:nyalcf_core/utils/logger.dart';
44

55
// Project imports:
6-
import 'package:nyalcf/templates/command_implement.dart';
7-
import 'package:nyalcf/utils/state.dart';
6+
import 'package:nyalcf/templates/command.dart';
7+
import 'package:nyalcf/state.dart';
88

9-
class Config implements CommandImplement {
9+
class Config implements Command {
1010
final _lcs = LauncherConfigurationStorage();
1111

1212
@override

Diff for: nyalcf_cli/lib/commands/download.dart

+13-8
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ import 'dart:io';
33

44
// Package imports:
55
import 'package:dio/dio.dart';
6-
import 'package:nyalcf_core/network/dio/frpc/download_frpc.dart';
76
import 'package:nyalcf_core/utils/cpu_arch.dart';
87
import 'package:nyalcf_core/utils/frpc/arch.dart';
98
import 'package:nyalcf_core/utils/frpc/archive.dart';
9+
import 'package:nyalcf_core/network/client/common/github/frp_client.dart';
1010
import 'package:nyalcf_core/utils/logger.dart';
1111

1212
// Project imports:
13-
import 'package:nyalcf/templates/command_implement.dart';
14-
import 'package:nyalcf/utils/state.dart';
13+
import 'package:nyalcf/templates/command.dart';
14+
import 'package:nyalcf/state.dart';
1515

16-
class Download implements CommandImplement {
16+
class Download implements Command {
1717
List<Map<String, String>> arch = [];
1818
late String platform;
1919

@@ -64,13 +64,14 @@ class Download implements CommandImplement {
6464
_cancelToken = CancelToken();
6565
Logger.info('Starting frpc download...');
6666

67-
await DownloadFrpc.download(
68-
arch: _selectedArch,
67+
await FrpClient().download(
68+
architecture: _selectedArch,
6969
platform: platform,
7070
version: '0.51.3-6',
71-
releaseName: 'LoCyanFrp-0.51.3-6 #2024100301',
72-
progressCallback: callback,
71+
name: 'LoCyanFrp-0.51.3-6 #2024100301',
7372
cancelToken: _cancelToken,
73+
onReceiveProgress: callback,
74+
onFailed: onFailed,
7475
useMirror: false,
7576
);
7677
stdout.write('\r${' ' * 30}');
@@ -107,4 +108,8 @@ class Download implements CommandImplement {
107108
stdout.write('\r${' ' * 30}');
108109
stdout.write('\rProgress: ${(downloaded / all * 100).toStringAsFixed(2)}%');
109110
}
111+
112+
void onFailed(Object e) {
113+
Logger.error('Download failed: $e, check your internet connection.');
114+
}
110115
}

Diff for: nyalcf_cli/lib/commands/login.dart

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
// Package imports:
2-
import 'package:nyalcf_core/models/response/response.dart';
32
import 'package:nyalcf_core/models/user_info_model.dart';
4-
import 'package:nyalcf_core/network/dio/auth/auth.dart';
3+
import 'package:nyalcf_core/network/client/api_client.dart';
54
import 'package:nyalcf_core/storages/stores/user_info_storage.dart';
65
import 'package:nyalcf_core/utils/logger.dart';
76

87
// Project imports:
9-
import 'package:nyalcf/templates/command_implement.dart';
10-
import 'package:nyalcf/utils/text_encrypt.dart';
8+
import 'package:nyalcf/templates/command.dart';
9+
import 'package:nyalcf_core_extend/utils/text_encrypt.dart';
1110

12-
class Login implements CommandImplement {
11+
class Login implements Command {
1312
@override
1413
Future<void> main(List<String> args) async {
1514
if (args.length == 2) {
15+
final ApiClient api = ApiClient(accessToken: );
1616
final res = await LoginAuth.requestLogin(args[0], args[1]);
1717
if (res.status) {
1818
res as LoginSuccessResponse;
1919
final UserInfoModel userInfo = res.userInfo;
2020
Logger.info('Login successfully.');
2121
Logger.info('Info:');
22-
Logger.info('- name: ${userInfo.user}');
22+
Logger.info('- name: ${userInfo.username}');
2323
Logger.info('- email: ${userInfo.email}');
2424
Logger.info('- login token: ${TextEncrypt.obscure(userInfo.token)}');
2525
Logger.info('- frp token: ${TextEncrypt.obscure(userInfo.frpToken)}');

Diff for: nyalcf_cli/lib/commands/logout.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import 'package:nyalcf_core/storages/stores/user_info_storage.dart';
55
import 'package:nyalcf_core/utils/logger.dart';
66

77
// Project imports:
8-
import 'package:nyalcf/templates/command_implement.dart';
8+
import 'package:nyalcf/templates/command.dart';
99

10-
class Logout implements CommandImplement {
10+
class Logout implements Command {
1111
@override
1212
Future<void> main(List<String> args) async {
1313
final userInfo = await UserInfoStorage.read();
14-
final res = await UserInfoStorage.sigo(userInfo?.user, userInfo?.token);
14+
final res = await UserInfoStorage.logout(userInfo?.username, userInfo?.token);
1515

1616
if (res) {
1717
Logger.info('Session data removed.');

Diff for: nyalcf_cli/lib/commands/start.dart

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import 'package:nyalcf_core/storages/stores/frpc_storage.dart';
77
import 'package:nyalcf_core/utils/logger.dart';
88

99
// Project imports:
10-
import 'package:nyalcf/templates/command_implement.dart';
11-
import 'package:nyalcf/utils/frpc/process_manager.dart';
12-
import 'package:nyalcf/utils/state.dart';
10+
import 'package:nyalcf/templates/command.dart';
11+
import 'package:nyalcf_core_extend/utils/frpc/process_manager.dart';
12+
import 'package:nyalcf/state.dart';
1313

14-
class Start implements CommandImplement {
14+
class Start implements Command {
1515
static final _fcs = FrpcConfigurationStorage();
1616

1717
@override
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
abstract class CommandImplement {
1+
abstract class Command {
22
/// 入口函数
33
void main(List<String> args);
44
}

Diff for: nyalcf_cli/nyalcf_core_extend/.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# https://dart.dev/guides/libraries/private-files
2+
# Created by `dart pub`
3+
.dart_tool/
4+
5+
# Avoid committing pubspec.lock for library packages; see
6+
# https://dart.dev/guides/libraries/private-files#pubspeclock.
7+
pubspec.lock

Diff for: nyalcf_cli/nyalcf_core_extend/.metadata

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This file tracks properties of this Flutter project.
2+
# Used by Flutter tool to assess capabilities and perform upgrades etc.
3+
#
4+
# This file should be version controlled and should not be manually edited.
5+
6+
version:
7+
revision: "761747bfc538b5af34aa0d3fac380f1bc331ec49"
8+
channel: "stable"
9+
10+
project_type: module

Diff for: nyalcf_cli/nyalcf_core_extend/LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Muska-Ami.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Diff for: nyalcf_cli/nyalcf_core_extend/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Nya LoCyanFrp! Core Extend
2+
3+
包含了 Nya LoCyanFrp! 的核心扩展,这些内容只在CLI版本中使用。
4+
5+
包含:
6+
- 存储

Diff for: nyalcf_cli/nyalcf_core_extend/analysis_options.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
include: package:flutter_lints/flutter.yaml
2+
3+
# Additional information about this file can be found at
4+
# https://dart.dev/guides/language/analysis-options
5+
analyzer:
6+
exclude:
7+
- 'lib/utils/highlight/ini_fix.dart'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import 'dart:io';
2+
3+
import 'package:nyalcf_core/storages/json_configuration.dart';
4+
5+
class TokenStorage extends JsonConfiguration {
6+
@override
7+
File get file => File('$path/frpc/proxies/autostart.json');
8+
9+
@override
10+
String get handle => 'TOKEN';
11+
12+
@override
13+
Map<String, dynamic> get defConfig => {
14+
'refresh_token': null,
15+
'access_token': null,
16+
'frp_token': null,
17+
};
18+
19+
}

0 commit comments

Comments
 (0)