Skip to content

Commit

Permalink
Merge pull request #178 from Muska-Ami/dev
Browse files Browse the repository at this point in the history
Update v0.2.1+1
  • Loading branch information
Muska-Ami authored Aug 23, 2024
2 parents c939082 + 6dfa961 commit 16ec091
Show file tree
Hide file tree
Showing 33 changed files with 149 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ body:
id: logs
attributes:
label: 运行日志
description: 请提供您的运行日志,以便分析原因。日志位于 `${SupportPath}/moe.xmcn.nyanana/nyanana/run.log`
description: 请提供您的运行日志,以便分析原因。日志位于 `${SupportPath}/moe.muska.ami/nyanana/logs/run.log`
render: sh
validations:
required: true
44 changes: 32 additions & 12 deletions RELEASE_CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,53 @@
使用方法请参考 NyaLCF Wiki 食用~ [Wiki](https://docs-nyalcf.1l1.icu)

应用户需求,Nya LoCyanFrp! 开始开发 CLI 版本,欢迎使用和反馈问题!
**Breaking changes: 本版本修改了启动器包名,需要手动迁移配置文件位置**
****

请参照 [如何重置启动器](https://docs-nyalcf.1l1.icu/gui/chang-jian-wen-ti-jie-da#q-ru-he-zhong-zhi-qi-dong-qi) 找到您的数据目录,并将 `moe.xmcn.nyanana` 文件夹改名为 `moe.muska.ami`,造成不便请谅解。

此外,要使用 LoCyan Mirrors 镜像源,请修改你的 `frpc.json` :

```json
{
// ...
"lists": {
// ...
"frpc_download_mirrors": [
// ...
{
"name": "LoCyan Mirrors",
"id": "locyan-mirror",
// 将这里的 github-releases 改成 github-release
// 请不要把注释粘进去
"format": "https://mirrors.locyan.cn/github-release/{owner}/{repo}/{release_name}/frp_LoCyanFrp-{version_pure}_{platform}_{arch}.{suffix}"
}
]
}
}

```

[//]: # (应用户需求,Nya LoCyanFrp! 开始开发 CLI 版本,欢迎使用和反馈问题!)

## 更新日志

### GUI

- 更新 Flutter
- 修改了欢迎语判定
- 下载 Frpc 添加了镜像选择
- 适配了核心登出会吊销 Token
- 更改了包名
- 修复写错了一个镜像信息

### CLI

- 添加 Frpc 下载功能
- 适配了核心登出会吊销 Token
-/-

### 其他

- 重写了下载 Frpc 核心逻辑
- 现在登出会调用请求吊销 Token
- 将网络请求方法改为静态方法
- Typo `install-dependecy.sh` -> `install-dependency.sh`
-/-

## 版本信息

- nyalcf_gui: 0.2.1
- nyalcf_cli: 0.0.1
- nyalcf_core,nyalcf_inject: 0.1.6

-/-
<!-- Some change log here -->
11 changes: 11 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This file configures the static analysis results for your project (errors,
# warnings, and lints).

analyzer:
exclude:
- 'tools/**'

linter:
rules:
prefer_single_quotes: true
always_use_package_imports: true
5 changes: 5 additions & 0 deletions nyalcf_core/lib/models/frpc_list_model.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
/// Frpc 版本列表模型
@deprecated
class FrpcListModel {
FrpcListModel({
required this.name,
required this.description,
required this.assets,
});

/// 版本名
final String name;
/// 版本介绍
final String description;
/// 资源列表
final List<Map<String, dynamic>> assets;
}
4 changes: 4 additions & 0 deletions nyalcf_core/lib/models/process_model.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import 'dart:io';

/// 进程模型
class ProcessModel {
ProcessModel({
required this.proxyId,
required this.process,
});

/// 隧道ID
final int proxyId;
/// 进程对象
final Process process;

@override
Expand Down
1 change: 1 addition & 0 deletions nyalcf_core/lib/models/proxy_info_model.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// 隧道信息模型
class ProxyInfoModel {
ProxyInfoModel({
required this.proxyName,
Expand Down
2 changes: 2 additions & 0 deletions nyalcf_core/lib/models/proxy_status_model.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/// 隧道状态模型
class ProxyStatusModel {
ProxyStatusModel({
required this.status,
});

/// 是否在线(Why String?)
final String? status;
}
5 changes: 5 additions & 0 deletions nyalcf_core/lib/models/update_info_model.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// 启动器更新信息模型
class UpdateInfoModel {
UpdateInfoModel({
required this.version,
Expand All @@ -6,8 +7,12 @@ class UpdateInfoModel {
required this.downloadUrl,
});

/// 版本号
final String version;
/// 版本标签
final String tag;
/// 版本构建号
final String buildNumber;
/// 资源列表
final List<dynamic> downloadUrl;
}
9 changes: 9 additions & 0 deletions nyalcf_core/lib/models/user_info_model.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// 用户信息模型
class UserInfoModel {
UserInfoModel({
required this.user,
Expand All @@ -10,13 +11,21 @@ class UserInfoModel {
required this.traffic,
});

/// 用户名
final String user;
/// 邮箱
final String email;
/// 登录令牌
final String token;
/// 头像链接
final String avatar;
/// 下行限速
final int inbound;
/// 上行限速
final int outbound;
/// Frp 令牌
final String frpToken;
/// 剩余流量
final num traffic;

UserInfoModel.fromJson(Map<String, dynamic> json)
Expand Down
3 changes: 3 additions & 0 deletions nyalcf_core/lib/network/dio/auth/login_auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import 'package:nyalcf_core/network/response_type.dart';
class LoginAuth {
static final instance = dio.Dio(options);

/// 发起登录请求
/// [user] 用户名
/// [password] 密码
static Future<Response> requestLogin(user, password) async {
dio.FormData data =
dio.FormData.fromMap({'username': user, 'password': password});
Expand Down
3 changes: 3 additions & 0 deletions nyalcf_core/lib/network/dio/auth/logout_auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import 'package:nyalcf_core/utils/logger.dart';
class LogoutAuth {
static final instance = dio.Dio(options);

/// 请求登出
/// [user] 用户名
/// [token] 登录令牌
static Future<Response> requestLogout(user, token) async {
Map<String, dynamic> paramsMap = {};
paramsMap['username'] = user;
Expand Down
7 changes: 7 additions & 0 deletions nyalcf_core/lib/network/dio/auth/register_auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ import 'package:nyalcf_core/network/response_type.dart';
class RegisterAuth {
static final instance = dio.Dio(options);

/// 请求注册
/// [user] 用户名
/// [password] 密码
/// [confirmPassword] 确认密码
/// [email] 邮箱
/// [verify] 邮件验证代码
/// [qq] QQ号
static Future<Response> requestRegister(
user, password, confirmPassword, email, verify, qq) async {
dio.FormData data = dio.FormData.fromMap({
Expand Down
2 changes: 2 additions & 0 deletions nyalcf_core/lib/network/dio/auth/user_auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import 'package:nyalcf_core/network/response_type.dart';
class UserAuth {
static final instance = dio.Dio(options);

/// 检查 Token 有效性
/// [token] 登录令牌
static Future<Response> checkToken(token) async {
try {
Logger.info('Check token if is valid');
Expand Down
10 changes: 9 additions & 1 deletion nyalcf_core/lib/network/dio/frpc/download_frpc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@ class DownloadFrpc {

static final _fcs = FrpcConfigurationStorage();

/// 下载Frpc
/// 下载 Frpc
/// [arch] 架构
/// [platform] 平台
/// [version] 版本
/// [releaseName] 发行名称
/// [progressCallback] 进度回调函数
/// [cancelToken] 取消下载令牌
/// [useMirror] 镜像源设置
/// [mirrorId] 镜像源位于配置中的ID
static Future<dynamic> download({
required String arch,
required String platform,
Expand Down
1 change: 1 addition & 0 deletions nyalcf_core/lib/network/dio/frpc/version_frpc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:nyalcf_core/network/response_type.dart';
class VersionFrpc {
static final instance = dio.Dio();

/// 获取最新 Frpc 版本信息
static Future<Response> getLatestVersion() async {
try {
final resData = await instance.get(
Expand Down
1 change: 1 addition & 0 deletions nyalcf_core/lib/network/dio/launcher/update_launcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:nyalcf_core/network/response_type.dart';
class UpdateLauncher {
static final instance = dio.Dio(options);

/// 获取启动器更新信息
static Future<Response> getUpdate() async {
try {
final res = await instance
Expand Down
2 changes: 2 additions & 0 deletions nyalcf_core/lib/network/dio/other/announcement_other.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:nyalcf_core/network/response_type.dart';
class OtherAnnouncement {
static final instance = dio.Dio(options);

/// 获取网站 Broadcast
static Future<Response> getBroadcast() async {
try {
Logger.info('Get broadcast announcement');
Expand All @@ -33,6 +34,7 @@ class OtherAnnouncement {
}
}

/// 获取网站 Ads
Future<Response> getAds() async {
try {
Logger.info('Get common announcement');
Expand Down
2 changes: 2 additions & 0 deletions nyalcf_core/lib/network/dio/other/sign_other.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class OtherSign {
static final instance = dio.Dio(options);

/// 检查签到状态
/// [username] 用户名
/// [token] 登录令牌
static Future<Response> checkSign(String username, String token) async {
// Logger.debug(token);
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import 'package:nyalcf_core/network/dio/basic_config.dart';
class ProxiesConfiguration {
static final dio = Dio(options);

/// 获取隧道启动配置
/// [frpToken] Frp 令牌
/// [proxyId] 隧道ID
static Future<dynamic> get(String frpToken, int proxyId) async {
try {
Map<String, dynamic> paramsMap = {};
Expand Down
3 changes: 3 additions & 0 deletions nyalcf_core/lib/network/dio/proxies/get_proxies.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import 'package:nyalcf_core/network/response_type.dart';
class ProxiesGet {
static final instance = dio.Dio(options);

/// 获取隧道列表
/// [username] 用户名
/// [token] 登录令牌
static Future<Response> get(username, token) async {
try {
Map<String, dynamic> paramsMap = {};
Expand Down
3 changes: 3 additions & 0 deletions nyalcf_core/lib/network/dio/proxies/status_proxies.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import 'package:nyalcf_core/network/response_type.dart';
class ProxiesStatus {
static final instance = dio.Dio(options);

/// 获取单个隧道状态
/// [proxy] 隧道ID
/// [token] 登录令牌
static Future<Response> getProxyStatus(
ProxyInfoModel proxy, String token) async {
Map<String, dynamic> paramsMap = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class FrpcConfigurationStorage extends JsonConfiguration {
'name': 'LoCyan Mirrors',
'id': 'locyan-mirror',
'format':
'https://mirrors.locyan.cn/github-releases/{owner}/{repo}/{release_name}/frp_LoCyanFrp-{version_pure}_{platform}_{arch}.{suffix}',
'https://mirrors.locyan.cn/github-release/{owner}/{repo}/{release_name}/frp_LoCyanFrp-{version_pure}_{platform}_{arch}.{suffix}',
},
],
},
Expand Down
4 changes: 2 additions & 2 deletions nyalcf_gui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
基于图形化的 Nya LoCyanFrp! Core 调用实现。

- nyalcf_ui 图形化主体模块
- nyalcf_core_ui 对 NyaLCF Core 的扩展模块
- nyalcf_inject_ui 对 NyaLCF Inject 的扩展模块
- nyalcf_core_extend 对 NyaLCF Core 的扩展模块
- nyalcf_inject_extend 对 NyaLCF Inject 的扩展模块

## 设计功能

Expand Down
5 changes: 0 additions & 5 deletions nyalcf_gui/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
analyzer:
exclude:
- 'tools/**'

linter:
# The lint rules applied to this project can be customized in the
Expand All @@ -24,8 +21,6 @@ linter:
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
always_use_package_imports: true
avoid_web_libraries_in_flutter: true
use_build_context_synchronously: false
annotate_overrides: true
Expand Down
11 changes: 11 additions & 0 deletions nyalcf_gui/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,20 @@ void main() async {

/// 初始化配置文件等
await PathProvider.loadSyncPath();

await StoragesInjector.init();
await Logger.init();

final appSupportParentPath = Directory(appSupportPath!).parent.parent.path;
if (Directory('$appSupportParentPath/moe.xmcn.nyanana').existsSync()) {
if (!Directory('$appSupportParentPath/moe.muska.ami').existsSync())
Directory('$appSupportParentPath/moe.muska.ami').createSync();
await moveDirectory(
Directory('$appSupportParentPath/moe.xmcn.nyanana/nyanana'),
Directory('$appSupportParentPath/moe.muska.ami/nyanana'),
);
}

Logger.debug('Append info has been set: $appendInfo');

/// 注册并监听深度链接
Expand Down
2 changes: 1 addition & 1 deletion nyalcf_gui/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ project(runner LANGUAGES CXX)
set(BINARY_NAME "nyanana")
# The unique GTK application identifier for this application. See:
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
set(APPLICATION_ID "moe.xmcn.nyanana")
set(APPLICATION_ID "moe.muska.ami")

# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
# versions of CMake.
Expand Down
2 changes: 1 addition & 1 deletion nyalcf_gui/linux/packaging/deb/make_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ icon: icon.png

postinstall_scripts: []
postuninstall_scripts:
- 'rm -rf ~/.share/moe.xmcn.nyanana'
- 'rm -rf ~/.share/moe.muska.ami'

keywords:
- NyaLCF
Expand Down
Loading

0 comments on commit 16ec091

Please sign in to comment.