Skip to content

Commit

Permalink
Experimental: API v2.3 (GUI)
Browse files Browse the repository at this point in the history
  • Loading branch information
Muska-Ami committed Dec 12, 2024
1 parent f3cd0c2 commit cb3ce6a
Show file tree
Hide file tree
Showing 122 changed files with 2,381 additions and 2,493 deletions.
8 changes: 4 additions & 4 deletions RELEASE_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

## 版本信息

- nyalcf_gui: 0.2.4
- nyalcf_cli: 0.0.3
- nyalcf_env: 1.0.2
- nyalcf_core,nyalcf_inject: 1.2.6
- nyalcf_gui: 1.0.0
- nyalcf_cli: 1.0.0
- nyalcf_env: 2.0.0
- nyalcf_core,nyalcf_inject: 2.0.0

<!-- Some change log here -->
10 changes: 5 additions & 5 deletions nyalcf_cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

## 运行测试

| 打包类型 | 系统类型 | 编译架构 | 状态 | 已测试通过环境 |
|------------|---------|-------|----|------------------|
| EXE | Windows | x64 || Windows 11 (Pro) |
| 打包类型 | 系统类型 | 编译架构 | 状态 | 已测试通过环境 |
|------------|---------|-------|----|--------------------------------|
| EXE | Windows | x64 || Windows 11 (Pro) |
| EXECUTABLE | Linux | x64 || Kali Linux(With WSL, Linux5.9) |
| EXECUTABLE | MacOS | arm64 || - |
| EXECUTABLE | MacOS | x64 || MacOS 14 |
| EXECUTABLE | MacOS | arm64 || - |
| EXECUTABLE | MacOS | x64 || MacOS 14 |
6 changes: 3 additions & 3 deletions nyalcf_cli/lib/commands/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import 'package:nyalcf_core/storages/configurations/launcher_configuration_stora
import 'package:nyalcf_core/utils/logger.dart';

// Project imports:
import 'package:nyalcf/templates/command_implement.dart';
import 'package:nyalcf/utils/state.dart';
import 'package:nyalcf/templates/command.dart';
import 'package:nyalcf/state.dart';

class Config implements CommandImplement {
class Config implements Command {
final _lcs = LauncherConfigurationStorage();

@override
Expand Down
21 changes: 13 additions & 8 deletions nyalcf_cli/lib/commands/download.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import 'dart:io';

// Package imports:
import 'package:dio/dio.dart';
import 'package:nyalcf_core/network/dio/frpc/download_frpc.dart';
import 'package:nyalcf_core/utils/cpu_arch.dart';
import 'package:nyalcf_core/utils/frpc/arch.dart';
import 'package:nyalcf_core/utils/frpc/archive.dart';
import 'package:nyalcf_core/network/client/common/github/frp_client.dart';
import 'package:nyalcf_core/utils/logger.dart';

// Project imports:
import 'package:nyalcf/templates/command_implement.dart';
import 'package:nyalcf/utils/state.dart';
import 'package:nyalcf/templates/command.dart';
import 'package:nyalcf/state.dart';

class Download implements CommandImplement {
class Download implements Command {
List<Map<String, String>> arch = [];
late String platform;

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

await DownloadFrpc.download(
arch: _selectedArch,
await FrpClient().download(
architecture: _selectedArch,
platform: platform,
version: '0.51.3-6',
releaseName: 'LoCyanFrp-0.51.3-6 #2024100301',
progressCallback: callback,
name: 'LoCyanFrp-0.51.3-6 #2024100301',
cancelToken: _cancelToken,
onReceiveProgress: callback,
onFailed: onFailed,
useMirror: false,
);
stdout.write('\r${' ' * 30}');
Expand Down Expand Up @@ -107,4 +108,8 @@ class Download implements CommandImplement {
stdout.write('\r${' ' * 30}');
stdout.write('\rProgress: ${(downloaded / all * 100).toStringAsFixed(2)}%');
}

void onFailed(Object e) {
Logger.error('Download failed: $e, check your internet connection.');
}
}
12 changes: 6 additions & 6 deletions nyalcf_cli/lib/commands/login.dart
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
// Package imports:
import 'package:nyalcf_core/models/response/response.dart';
import 'package:nyalcf_core/models/user_info_model.dart';
import 'package:nyalcf_core/network/dio/auth/auth.dart';
import 'package:nyalcf_core/network/client/api_client.dart';
import 'package:nyalcf_core/storages/stores/user_info_storage.dart';
import 'package:nyalcf_core/utils/logger.dart';

// Project imports:
import 'package:nyalcf/templates/command_implement.dart';
import 'package:nyalcf/utils/text_encrypt.dart';
import 'package:nyalcf/templates/command.dart';
import 'package:nyalcf_core_extend/utils/text_encrypt.dart';

class Login implements CommandImplement {
class Login implements Command {
@override
Future<void> main(List<String> args) async {
if (args.length == 2) {
final ApiClient api = ApiClient(accessToken: );
final res = await LoginAuth.requestLogin(args[0], args[1]);
if (res.status) {
res as LoginSuccessResponse;
final UserInfoModel userInfo = res.userInfo;
Logger.info('Login successfully.');
Logger.info('Info:');
Logger.info('- name: ${userInfo.user}');
Logger.info('- name: ${userInfo.username}');
Logger.info('- email: ${userInfo.email}');
Logger.info('- login token: ${TextEncrypt.obscure(userInfo.token)}');
Logger.info('- frp token: ${TextEncrypt.obscure(userInfo.frpToken)}');
Expand Down
6 changes: 3 additions & 3 deletions nyalcf_cli/lib/commands/logout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import 'package:nyalcf_core/storages/stores/user_info_storage.dart';
import 'package:nyalcf_core/utils/logger.dart';

// Project imports:
import 'package:nyalcf/templates/command_implement.dart';
import 'package:nyalcf/templates/command.dart';

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

if (res) {
Logger.info('Session data removed.');
Expand Down
8 changes: 4 additions & 4 deletions nyalcf_cli/lib/commands/start.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import 'package:nyalcf_core/storages/stores/frpc_storage.dart';
import 'package:nyalcf_core/utils/logger.dart';

// Project imports:
import 'package:nyalcf/templates/command_implement.dart';
import 'package:nyalcf/utils/frpc/process_manager.dart';
import 'package:nyalcf/utils/state.dart';
import 'package:nyalcf/templates/command.dart';
import 'package:nyalcf_core_extend/utils/frpc/process_manager.dart';
import 'package:nyalcf/state.dart';

class Start implements CommandImplement {
class Start implements Command {
static final _fcs = FrpcConfigurationStorage();

@override
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
abstract class CommandImplement {
abstract class Command {
/// 入口函数
void main(List<String> args);
}
7 changes: 7 additions & 0 deletions nyalcf_cli/nyalcf_core_extend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# https://dart.dev/guides/libraries/private-files
# Created by `dart pub`
.dart_tool/

# Avoid committing pubspec.lock for library packages; see
# https://dart.dev/guides/libraries/private-files#pubspeclock.
pubspec.lock
10 changes: 10 additions & 0 deletions nyalcf_cli/nyalcf_core_extend/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: "761747bfc538b5af34aa0d3fac380f1bc331ec49"
channel: "stable"

project_type: module
21 changes: 21 additions & 0 deletions nyalcf_cli/nyalcf_core_extend/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Muska-Ami.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
6 changes: 6 additions & 0 deletions nyalcf_cli/nyalcf_core_extend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Nya LoCyanFrp! Core Extend

包含了 Nya LoCyanFrp! 的核心扩展,这些内容只在CLI版本中使用。

包含:
- 存储
7 changes: 7 additions & 0 deletions nyalcf_cli/nyalcf_core_extend/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include: package:flutter_lints/flutter.yaml

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
analyzer:
exclude:
- 'lib/utils/highlight/ini_fix.dart'
19 changes: 19 additions & 0 deletions nyalcf_cli/nyalcf_core_extend/lib/storages/token_storage.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import 'dart:io';

import 'package:nyalcf_core/storages/json_configuration.dart';

class TokenStorage extends JsonConfiguration {
@override
File get file => File('$path/frpc/proxies/autostart.json');

@override
String get handle => 'TOKEN';

@override
Map<String, dynamic> get defConfig => {
'refresh_token': null,
'access_token': null,
'frp_token': null,
};

}
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit cb3ce6a

Please sign in to comment.