Skip to content

Commit

Permalink
Merge pull request #234 from Muska-Ami/dev
Browse files Browse the repository at this point in the history
Ver. 1.0.2+1
  • Loading branch information
Muska-Ami authored Mar 2, 2025
2 parents 5d154f8 + 3a6d9a3 commit 442e415
Show file tree
Hide file tree
Showing 25 changed files with 62 additions and 45 deletions.
11 changes: 6 additions & 5 deletions RELEASE_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,24 @@

### GUI

-/-
- 修复了定时任务只执行两次的 BUG
- 修复了检查更新
- 修复异步导致的自启动隧道异常 #175 #225

### CLI

-/-

### Core

- 规范 UA
- 更新到 LoCyanFrp 0.51.3-9
- 修复了意外修改 `baseOptions` 的 BUG

## 版本信息

- nyalcf_gui: 1.0.1
- nyalcf_gui: 1.0.2
- nyalcf_cli: 1.0.1
- nyalcf_env: 2.0.0
- nyalcf_core: 2.0.3
- nyalcf_core: 2.0.4
- nyalcf_inject: 2.0.0

<!-- Some change log here -->
2 changes: 1 addition & 1 deletion nyalcf_cli/nyalcf_core_extend/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ packages:
path: "../../nyalcf_core"
relative: true
source: path
version: "2.0.2"
version: "2.0.4"
nyalcf_env:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion nyalcf_cli/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: 2.0.3
version: 2.0.4
homepage: https://nyalcf.1l1.icu
publish_to: none

Expand Down
4 changes: 2 additions & 2 deletions nyalcf_cli/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,14 @@ packages:
path: "../nyalcf_core"
relative: true
source: path
version: "2.0.2"
version: "2.0.4"
nyalcf_core_extend:
dependency: "direct main"
description:
path: nyalcf_core_extend
relative: true
source: path
version: "2.0.3"
version: "2.0.4"
nyalcf_env:
dependency: "direct main"
description:
Expand Down
2 changes: 1 addition & 1 deletion nyalcf_cli/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: nyalcf
description: "[CLI]The next generation of LoCyanFrp launcher."
version: 1.0.1+4
version: 1.0.2+1
homepage: https://nyalcf.1l1.icu
publish_to: none
# repository: https://github.com/my_org/my_repo
Expand Down
4 changes: 2 additions & 2 deletions nyalcf_core/lib/network/basic_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import 'package:nyalcf_inject/nyalcf_inject.dart';
BaseOptions baseOptions = BaseOptions(
headers: {
'User-Agent': 'Nya LoCyanFrp/$version'
'$appendInfo; '
'${Platform.operatingSystem}',
' ($appendInfo; '
'${Platform.operatingSystem})',
},
);
final apiV2Url = ENV_UNIVERSAL_API_URL ?? 'https://api.locyanfrp.cn/v2';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ class PostAccessToken extends ApiBaseModel {
'app_id': appId,
'refresh_token': refreshToken,
},
validateStatus: [200, 401],
);
}
13 changes: 7 additions & 6 deletions nyalcf_core/lib/network/client/api/user/info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import 'package:nyalcf_core/models/api_base_model.dart';
class GetInfo extends ApiBaseModel {
GetInfo({
required num userId,
}) : super(endpoint: '/user/info', params: {
'user_id': userId,
}, validateStatus: [
200,
401
]);
}) : super(
endpoint: '/user/info',
params: {
'user_id': userId,
},
validateStatus: [200, 401],
);
}
4 changes: 3 additions & 1 deletion nyalcf_core/lib/network/client/api_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ class ApiClient {

/// 获取对象
dio.Dio get _instance {
dio.BaseOptions options = baseOptions;
dio.BaseOptions options = dio.BaseOptions(
headers: baseOptions.headers
);
if (accessToken != null) {
options.headers.addAll({
'Authorization': 'Bearer $accessToken',
Expand Down
4 changes: 2 additions & 2 deletions nyalcf_core/lib/network/client/common/launcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Launcher {
try {
request = await _instance.get(
'$githubApiUrl'
'/repos/LoCyan-Team/LoCyanFrpPureApp/releases',
'/repos/Muska-Ami/NyaLCF/releases',
);
} catch (e, trace) {
Logger.error(e, t: trace);
Expand All @@ -33,7 +33,7 @@ class Launcher {
final List<String> verArr = version['tag_name'].split('+');

return UpdateInfoModel(
version: version['name'],
version: verArr[0],
tag: version['tag_name'],
buildNumber: verArr[1],
downloadUrl: version['assets'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class AutostartProxiesStorage extends JsonConfiguration {
'list': [],
};

/// 获取自带启动隧道列表
/// 获取自动启动隧道列表
List getList() => cfg.getList('list', defConfig['list']);

/// 添加自动启动隧道
Expand Down
10 changes: 9 additions & 1 deletion nyalcf_core/lib/storages/stores/proxies_storage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@ class ProxiesStorage {
}

/// 获取隧道列表
static List<ProxyInfoModel> get() => _proxies;
static List<ProxyInfoModel> getAll() => _proxies;

/// 获取单个隧道
static ProxyInfoModel? get(int i) {
for (ProxyInfoModel proxy in _proxies) {
if (proxy.id == i) return proxy;
}
return null;
}

/// 清除隧道列表
static void clear() {
Expand Down
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: 2.0.2
version: 2.0.4
homepage: https://nyalcf.1l1.icu
publish_to: none
# repository: https://github.com/my_org/my_repo
Expand Down
14 changes: 8 additions & 6 deletions nyalcf_gui/nyalcf_core_extend/lib/tasks/update_proxies_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,14 @@ class TaskUpdateProxiesList extends TaskBasic {
_removeNonExistsAutostart(List<ProxyInfoModel> proxies) async {
final aps = AutostartProxiesStorage();
final nowList = aps.getList();
for (ProxyInfoModel item in nowList) {
Logger.debug(
"${item.name} not exists again,"
" removing it from autostart.json",
);
if (!proxies.contains(item)) aps.removeFromList(item.id);
for (int id in nowList) {
final item = ProxiesStorage.get(id);
if (item == null) {
Logger.debug(
"$id not exists again, removing it from autostart.json",
);
if (!proxies.contains(item)) aps.removeFromList(id);
}
}
aps.save();
}
Expand Down
2 changes: 1 addition & 1 deletion nyalcf_gui/nyalcf_core_extend/lib/tasks/updater.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import 'package:nyalcf_core_extend/utils/universe.dart';
class TaskUpdater extends TaskBasic {
static UpdateInfoModel uIf = UpdateInfoModel(
version: Universe.appVersion,
tag: Universe.appVersion,
tag: '${Universe.appVersion}+${Universe.appBuildNumber}',
buildNumber: Universe.appBuildNumber,
downloadUrl: [],
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class FrpcProcessManager {
final FrpcController _fCtr = Get.find();
final ConsoleController _cCtr = Get.find();

void newProcess({
Future<void> newProcess({
required String frpToken,
required int proxyId,
required String frpcPath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class FrpcStartUpLoader {
if (execPath != null) {
for (var proxy in proxiesList) {
Logger.info('Starting proxy: $proxy');
pm.newProcess(
await pm.newProcess(
frpToken: uc.frpToken.value,
proxyId: proxy,
frpcPath: execPath,
Expand Down
11 changes: 7 additions & 4 deletions nyalcf_gui/nyalcf_core_extend/lib/utils/task_scheduler.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Package imports:
import 'package:nyalcf_core/storages/configurations/launcher_configuration_storage.dart';
import 'package:nyalcf_core/utils/logger.dart';
import 'package:nyalcf_env/nyalcf_env.dart';

// Project imports:
Expand All @@ -12,16 +13,18 @@ class TaskScheduler {
static final _lcs = LauncherConfigurationStorage();

static Future<void> start() async {
Logger.debug("Starting tasks schedule...");
if (ENV_GUI_DISABLE_AUTO_UPDATE_CHECK ?? false) _taskUpdater();
_taskAutoSign();
_taskUpdateProxiesList();
_taskRefreshAccessToken();
Logger.debug("Tasks started.");
}

static _taskUpdater() async {
TaskUpdater().startUp(
callback: () => Future.delayed(const Duration(hours: 1), () {
TaskUpdater().startUp();
_taskUpdater();
}),
);
}
Expand All @@ -30,7 +33,7 @@ class TaskScheduler {
if (_lcs.getAutoSign()) {
TaskAutoSign().startUp(
callback: () => Future.delayed(const Duration(hours: 12), () {
TaskAutoSign().startUp();
_taskAutoSign();
}),
);
}
Expand All @@ -39,7 +42,7 @@ class TaskScheduler {
static _taskRefreshAccessToken() async {
TaskRefreshAccessToken().startUp(
callback: () => Future.delayed(const Duration(minutes: 30), () {
TaskUpdater().startUp();
_taskRefreshAccessToken();
}),
);
}
Expand All @@ -48,7 +51,7 @@ class TaskScheduler {
if (_lcs.getAutoSign()) {
TaskUpdateProxiesList().startUp(
callback: () => Future.delayed(const Duration(minutes: 15), () {
TaskUpdateProxiesList().startUp();
_taskUpdateProxiesList();
}),
);
}
Expand Down
2 changes: 1 addition & 1 deletion nyalcf_gui/nyalcf_core_extend/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ packages:
path: "../../nyalcf_core"
relative: true
source: path
version: "2.0.2"
version: "2.0.4"
nyalcf_env:
dependency: "direct main"
description:
Expand Down
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: 2.0.3
version: 2.0.4
homepage: https://nyalcf.1l1.icu
publish_to: none

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ProxiesController extends GetxController {

/// 构建隧道列表
build() async {
var proxies = ProxiesStorage.get();
var proxies = ProxiesStorage.getAll();
proxiesWidgets.value = [
const NyaLoadingCircle(height: 22.0, width: 22.0),
];
Expand Down
1 change: 0 additions & 1 deletion nyalcf_gui/nyalcf_ui/lib/views/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ class HomeController extends GetxController {
);
}
TaskUpdateProxiesList().startUp();
TaskRefreshAccessToken().startUp();
FrpcStartUpLoader().onProgramStartUp();
// 显示自动登录的SnackBar
Get.snackbar(
Expand Down
2 changes: 1 addition & 1 deletion nyalcf_gui/nyalcf_ui/lib/views/panel/proxies.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class ProxiesPanelUI extends StatelessWidget {
),
),
afterLayout: (RenderAfterLayout ral) async {
if (ProxiesStorage.get().isEmpty) {
if (ProxiesStorage.getAll().isEmpty) {
pCtr.load(request: true);
} else {
pCtr.load();
Expand Down
4 changes: 2 additions & 2 deletions nyalcf_gui/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -470,14 +470,14 @@ packages:
path: "../nyalcf_core"
relative: true
source: path
version: "2.0.2"
version: "2.0.4"
nyalcf_core_extend:
dependency: "direct main"
description:
path: nyalcf_core_extend
relative: true
source: path
version: "2.0.3"
version: "2.0.4"
nyalcf_env:
dependency: "direct main"
description:
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: 1.0.1+4
version: 1.0.2+1
homepage: https://nyalcf.1l1.icu
publish_to: 'none'

Expand Down

0 comments on commit 442e415

Please sign in to comment.