Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to GUI v0.2.2+1 #183

Merged
merged 1 commit into from
Sep 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions RELEASE_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,16 @@

### GUI

- 修改了 Frpc 下载的处理逻辑
- 打开终端默认自动滚动到底部
- 针对 `深度链接` 调用启动进行了优化,现在若隧道执行启动成功会自动进入 `仅 Frp Token 模式`

### CLI

-/-

### 其他

#### NyaLCF Core

- 修改了网络请求的返回数据类型
- 升级 Frpc 到 `LoCyanFrp-0.51.3-4 #2024082401` ([See here](https://github.com/LoCyan-Team/LoCyanFrpPureApp/releases/tag/v0.51.3-4))

## 版本信息

- nyalcf_gui: 0.2.1
- nyalcf_gui: 0.2.2
- nyalcf_cli: 0.0.2
- nyalcf_core,nyalcf_inject: 1.0.7
- nyalcf_core,nyalcf_inject: 1.0.8

<!-- Some change log here -->
15 changes: 12 additions & 3 deletions nyalcf_core/lib/storages/stores/user_info_storage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,21 @@ class UserInfoStorage {
}

/// 退出登录
static sigo(user, token) async {
final res = await LogoutAuth.requestLogout(user, token);
if (res.status) {
static Future<bool> sigo(user, token, {deleteSessionFileOnly = false}) async {
deleteFile() async {
await File('$_path/session.json').delete();
return true;
}
if (!deleteSessionFileOnly) {
final res = await LogoutAuth.requestLogout(user, token);
if (res.status) {
await deleteFile();
return true;
}
} else {
await deleteFile();
return true;
}
return false;
}
}
2 changes: 1 addition & 1 deletion nyalcf_core/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: nyalcf_core
description: 'Nya LoCyanFrp! core module.'
version: 1.0.7
version: 1.0.8
homepage: https://nyalcf.1l1.icu
publish_to: none
# repository: https://github.com/my_org/my_repo
Expand Down
27 changes: 24 additions & 3 deletions nyalcf_gui/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:app_links/app_links.dart';
import 'package:bitsdojo_window/bitsdojo_window.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:nyalcf_core_extend/storages/prefs/token_mode_prefs.dart';
import 'package:tray_manager/tray_manager.dart';
import 'package:window_manager/window_manager.dart';

Expand Down Expand Up @@ -31,6 +32,7 @@ import 'package:nyalcf_ui/views/tokenmode/panel.dart';
import 'package:nyalcf_ui/views/license.dart';

final _appLinks = AppLinks();
bool _appInit = false;

void main() async {
WidgetsFlutterBinding.ensureInitialized();
Expand Down Expand Up @@ -61,9 +63,26 @@ void main() async {

/// 注册并监听深度链接
if (Platform.isWindows) DeepLinkRegister.registerWindows('locyanfrp');
_appLinks.uriLinkStream.listen((uri) {
_appLinks.uriLinkStream.listen((uri) async {
Logger.debug('Received uri scheme: $uri');
DeepLinkExecutor(uri: uri.toString()).execute();
final res = await DeepLinkExecutor(uri: uri.toString()).execute();

Logger.debug(res);
if (res[0]) {
Logger.debug('Started as token-only mode as deeplink executed success');
await TokenModePrefs.setToken(res[1]);
await Future.doWhile(() async {
if (_appInit) {
Get.toNamed('/token_mode/panel');
return false; // 结束循环
}
Logger.debug('Waiting for app init...');
await Future.delayed(const Duration(milliseconds: 1000)); // 延迟检查
return true; // 继续循环
});
} else {
Logger.debug('Skip for enter token-only mode');
}
});

/// 启动定时任务
Expand All @@ -87,7 +106,7 @@ class _AppState extends State<App> with WindowListener, TrayListener {
Widget build(BuildContext context) {
ThemeData themeData = ThemeControl().getTheme();

return GetMaterialApp(
final app = GetMaterialApp(
logWriterCallback: Logger.getxLogWriter,
title: 'Nya LoCyanFrp!',
routes: {
Expand All @@ -105,6 +124,8 @@ class _AppState extends State<App> with WindowListener, TrayListener {
},
theme: themeData,
);
_appInit = true;
return app;
}

/// 组件初始化时操作
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class DeepLinkExecutor {

final String uri;

void execute() async {
Future<List<dynamic>> execute() async {
final content = uri.replaceFirst('locyanfrp://', '');
final data = content.split('/');
final frpToken = data[0], proxyId = int.parse(data[1]);
Expand All @@ -20,9 +20,11 @@ class DeepLinkExecutor {
proxyId: proxyId,
frpcPath: frpcPath,
);
return [true, frpToken];
} else {
Logger.error(
'Could not implement proxy fast startup, no frpc has installed!');
}
return [false];
}
}
2 changes: 1 addition & 1 deletion nyalcf_gui/nyalcf_core_extend/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: nyalcf_core_extend
description: "Nya LoCyanFrp! core extend module."
version: 1.0.7
version: 1.0.8
homepage: https://nyalcf.1l1.icu
publish_to: none

Expand Down
2 changes: 1 addition & 1 deletion nyalcf_gui/nyalcf_inject_extend/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: nyalcf_inject_extend
description: "Nya LoCyanFrp! communication injector extend module."
version: 1.0.7
version: 1.0.8
homepage: https://nyalcf.1l1.icu
publish_to: none

Expand Down
5 changes: 5 additions & 0 deletions nyalcf_gui/nyalcf_ui/lib/views/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ class HC extends GetxController {
// 跳转到面板首页
Get.toNamed('/panel/home');
} else {
UserInfoStorage.sigo(
userinfo.user,
userinfo.token,
deleteSessionFileOnly: true,
);
// 显示令牌校验失败的SnackBar
Get.snackbar(
'令牌校验失败',
Expand Down
2 changes: 1 addition & 1 deletion nyalcf_gui/nyalcf_ui/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: nyalcf_ui
description: "Nya LoCyanFrp! user interface module."
version: 1.0.7
version: 1.0.8
homepage: https://nyalcf.1l1.icu
publish_to: none

Expand Down
2 changes: 1 addition & 1 deletion nyalcf_gui/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: nyalcf
description: "[GUI]The next generation of LoCyanFrp launcher."
version: 0.2.2
version: 0.2.2+1
homepage: https://nyalcf.1l1.icu
publish_to: 'none'

Expand Down