Skip to content

Commit fe09748

Browse files
authored
Merge pull request #222 from Muska-Ami/dev
Upgrade to v1.0.0+2
2 parents 60aa5d8 + 5c898b7 commit fe09748

File tree

6 files changed

+25
-58
lines changed

6 files changed

+25
-58
lines changed

Diff for: RELEASE_CHANGELOG.md

+2-9
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,11 @@
44

55
### GUI
66

7-
- 一些逻辑改动和界面优化
7+
- 修改回调地址
88

99
### CLI
1010

11-
- 移除了 `login` 指令参数
12-
- 添加 `authorize` 指令参数
13-
14-
### 其他
15-
16-
#### NyaLCF Core
17-
18-
- 适配 API v2.2.0
11+
- 添加回调提示
1912

2013
## 版本信息
2114

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

+16-7
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,19 @@ import 'dart:io';
44

55
// Package imports:
66
import 'package:crypto/crypto.dart';
7+
// Project imports:
8+
import 'package:nyalcf/templates/command.dart';
79
import 'package:nyalcf_core/models/user_info_model.dart';
810
import 'package:nyalcf_core/network/client/api/auth/oauth/access_token.dart';
11+
import 'package:nyalcf_core/network/client/api/user/frp/token.dart'
12+
as user_frp_token;
913
import 'package:nyalcf_core/network/client/api/user/info.dart' as user_info;
1014
import 'package:nyalcf_core/network/client/api_client.dart';
1115
import 'package:nyalcf_core/network/server/oauth.dart';
1216
import 'package:nyalcf_core/storages/stores/user_info_storage.dart';
1317
import 'package:nyalcf_core/utils/logger.dart';
1418
import 'package:nyalcf_core_extend/storages/token_storage.dart';
1519

16-
// Project imports:
17-
import 'package:nyalcf/templates/command.dart';
18-
19-
import 'package:nyalcf_core/network/client/api/user/frp/token.dart'
20-
as user_frp_token;
21-
2220
class Authorize implements Command {
2321
static final _tokenStorage = TokenStorage();
2422

@@ -30,8 +28,19 @@ class Authorize implements Command {
3028
final ApiClient api = ApiClient();
3129

3230
await startHttpServer();
31+
Logger.info(
32+
'Please open this link to authorize: '
33+
'http://dashboard.locyanfrp.cn/auth/oauth/authorize'
34+
'?app_id=1'
35+
'&scopes=User,Proxy,Sign'
36+
'&redirect_url='
37+
'https%3A%2F%2Fdashboard.locyanfrp.cn%2Fcallback%2Fauth%2Foauth%2Flocalhost%3Fport%3D21131%26ssl%3Dfalse%26path%3D%2Foauth%2Fcallback',
38+
);
3339
Logger.write('Waiting callback...');
34-
while (!_callback) {}
40+
Future.doWhile(() async {
41+
await Future.delayed(const Duration(milliseconds: 1000)); // 延迟检查
42+
return !_callback;
43+
});
3544
if (_refreshToken == null) exit(1);
3645
final rs = await api.post(PostAccessToken(
3746
appId: 1,

Diff for: nyalcf_cli/pubspec.lock

-34
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,6 @@ packages:
5454
url: "https://pub.dev"
5555
source: hosted
5656
version: "2.1.2"
57-
characters:
58-
dependency: transitive
59-
description:
60-
name: characters
61-
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
62-
url: "https://pub.dev"
63-
source: hosted
64-
version: "1.3.0"
6557
collection:
6658
dependency: transitive
6759
description:
@@ -134,11 +126,6 @@ packages:
134126
url: "https://pub.dev"
135127
source: hosted
136128
version: "7.0.1"
137-
flutter:
138-
dependency: transitive
139-
description: flutter
140-
source: sdk
141-
version: "0.0.0"
142129
frontend_server_client:
143130
dependency: transitive
144131
description:
@@ -243,14 +230,6 @@ packages:
243230
url: "https://pub.dev"
244231
source: hosted
245232
version: "0.12.16+1"
246-
material_color_utilities:
247-
dependency: transitive
248-
description:
249-
name: material_color_utilities
250-
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
251-
url: "https://pub.dev"
252-
source: hosted
253-
version: "0.11.1"
254233
meta:
255234
dependency: transitive
256235
description:
@@ -375,11 +354,6 @@ packages:
375354
url: "https://pub.dev"
376355
source: hosted
377356
version: "2.0.1"
378-
sky_engine:
379-
dependency: transitive
380-
description: flutter
381-
source: sdk
382-
version: "0.0.99"
383357
source_map_stack_trace:
384358
dependency: transitive
385359
description:
@@ -476,14 +450,6 @@ packages:
476450
url: "https://pub.dev"
477451
source: hosted
478452
version: "1.4.0"
479-
vector_math:
480-
dependency: transitive
481-
description:
482-
name: vector_math
483-
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
484-
url: "https://pub.dev"
485-
source: hosted
486-
version: "2.1.4"
487453
vm_service:
488454
dependency: transitive
489455
description:

Diff for: nyalcf_cli/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: nyalcf
22
description: "[CLI]The next generation of LoCyanFrp launcher."
3-
version: 1.0.0+1
3+
version: 1.0.0+2
44
homepage: https://nyalcf.1l1.icu
55
publish_to: none
66
# repository: https://github.com/my_org/my_repo

Diff for: nyalcf_gui/nyalcf_ui/lib/views/auth/authorize.dart

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
// Dart imports:
22
import 'dart:convert';
33

4-
// Flutter imports:
5-
import 'package:flutter/material.dart';
6-
74
// Package imports:
85
import 'package:crypto/crypto.dart';
6+
// Flutter imports:
7+
import 'package:flutter/material.dart';
98
import 'package:get/get.dart';
109
import 'package:nyalcf_core/models/user_info_model.dart';
1110
import 'package:nyalcf_core/network/client/api/auth/oauth/access_token.dart';
@@ -15,12 +14,11 @@ import 'package:nyalcf_core/network/client/api_client.dart';
1514
import 'package:nyalcf_core/network/server/oauth.dart';
1615
import 'package:nyalcf_core_extend/storages/prefs/token_info_prefs.dart';
1716
import 'package:nyalcf_core_extend/storages/prefs/user_info_prefs.dart';
18-
import 'package:url_launcher/url_launcher.dart';
19-
2017
// Project imports:
2118
import 'package:nyalcf_ui/models/appbar_actions.dart';
2219
import 'package:nyalcf_ui/widgets/nya_loading_circle.dart';
2320
import 'package:nyalcf_ui/widgets/nya_scaffold.dart';
21+
import 'package:url_launcher/url_launcher.dart';
2422

2523
class AuthorizeUI extends StatefulWidget {
2624
const AuthorizeUI({super.key});
@@ -111,7 +109,8 @@ class _AuthorizeState extends State<AuthorizeUI> {
111109
const url = 'https://dashboard.locyanfrp.cn/auth/oauth/authorize'
112110
'?app_id=1'
113111
'&scopes=User,Proxy,Sign'
114-
'&redirect_url=http://localhost:21131/oauth/callback';
112+
'&redirect_url='
113+
'https%3A%2F%2Fdashboard.locyanfrp.cn%2Fcallback%2Fauth%2Foauth%2Flocalhost%3Fport%3D21131%26ssl%3Dfalse%26path%3D%2Foauth%2Fcallback';
115114
launchUrl(Uri.parse(url));
116115
OAuth.initRoute(
117116
response: OAuthResponseBody(success: '授权成功', error: '授权失败'),

Diff for: nyalcf_gui/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: nyalcf
22
description: "[GUI]The next generation of LoCyanFrp launcher."
3-
version: 1.0.0+1
3+
version: 1.0.0+2
44
homepage: https://nyalcf.1l1.icu
55
publish_to: 'none'
66

0 commit comments

Comments
 (0)