Support passing JWT secret key on worker restart

Added the ability to pass a JWT secret key when restarting the worker process by updating environment variable handling and message passing. Improved port retry logic in the backend to allow multiple attempts on the same port before incrementing. Also refactored process API to use getter for pid property.

Ensure Electron app is ready before creating process manager

Adds a check to await electron.app.whenReady() if the Electron app is not yet ready before instantiating the ElectronProcessManager. This prevents potential issues when accessing Electron APIs before the app is fully initialized.

Add mirror selection support for version updates

Introduces the ability to specify and select GitHub mirror sources for fetching tags, releases, and action artifacts throughout the backend and frontend. Updates API endpoints, internal helper functions, and UI components to allow users to choose a mirror for version queries and updates, improving reliability in regions with limited GitHub access. Also enhances version comparison logic and improves artifact metadata display.

Refactor artifact fetching to use HTML parsing only

Removed all GitHub API dependencies for fetching workflow runs and artifacts. Now, workflow runs are parsed directly from the HTML of the Actions page, and artifact URLs are constructed using nightly.link. Also added workflow title and mirror fields to ActionArtifact, and simplified mirror list without latency comments.
This commit is contained in:
手瓜一十雪
2026-01-18 10:13:35 +08:00
parent 96d70d07ca
commit a5a6f14cec
12 changed files with 440 additions and 376 deletions

View File

@@ -72,8 +72,9 @@ export default class WebUIManager {
pageSize?: number;
type?: 'release' | 'action' | 'all';
search?: string;
mirror?: string;
} = {}) {
const { page = 1, pageSize = 20, type = 'release', search = '' } = options;
const { page = 1, pageSize = 20, type = 'release', search = '', mirror } = options;
const { data } = await serverRequest.get<ServerResponse<{
versions: Array<{
tag: string;
@@ -94,15 +95,21 @@ export default class WebUIManager {
};
mirror?: string;
}>>('/base/getAllReleases', {
params: { page, pageSize, type, search },
params: { page, pageSize, type, search, mirror },
});
return data.data;
}
public static async UpdateNapCat () {
public static async getMirrors () {
const { data } =
await serverRequest.get<ServerResponse<{ mirrors: string[]; }>>('/base/getMirrors');
return data.data;
}
public static async UpdateNapCat (mirror?: string) {
const { data } = await serverRequest.post<ServerResponse<any>>(
'/UpdateNapCat/update',
{},
{ mirror },
{ timeout: 120000 } // 2分钟超时
);
return data;
@@ -112,11 +119,12 @@ export default class WebUIManager {
* 更新到指定版本
* @param targetVersion 目标版本 tag如 "v4.9.9" 或 "action-123456"
* @param force 是否强制更新(允许降级)
* @param mirror 指定使用的镜像
*/
public static async UpdateNapCatToVersion (targetVersion: string, force: boolean = false) {
public static async UpdateNapCatToVersion (targetVersion: string, force: boolean = false, mirror?: string) {
const { data } = await serverRequest.post<ServerResponse<any>>(
'/UpdateNapCat/update',
{ targetVersion, force },
{ targetVersion, force, mirror },
{ timeout: 120000 } // 2分钟超时
);
return data;
@@ -142,6 +150,16 @@ export default class WebUIManager {
return data.data;
}
public static async restart () {
const { data } = await serverRequest.post<ServerResponse<any>>('/Process/Restart');
return data.data;
}
public static async getAllUsers (): Promise<any> {
const { data } = await serverRequest.get<ServerResponse<any>>('/QQLogin/GetAllUsers');
return data.data;
}
public static async getLogList () {
const { data } =
await serverRequest.get<ServerResponse<string[]>>('/Log/GetLogList');