pixivflow 2.33.0 → 2.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.json +1 -1
- package/dist/version.js +1 -1
- package/dist/webui/package.json +1 -1
- package/dist/webui/routes/handlers/scheduler-handlers.d.ts +8 -0
- package/dist/webui/routes/handlers/scheduler-handlers.js +64 -0
- package/dist/webui/routes/scheduler.d.ts +3 -0
- package/dist/webui/routes/scheduler.js +8 -0
- package/dist/webui/server/server-routes.js +3 -0
- package/dist/webui/utils/error-codes.d.ts +1 -0
- package/dist/webui/utils/error-codes.js +2 -0
- package/package.json +1 -1
package/dist/package.json
CHANGED
package/dist/version.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BUILD = void 0;
|
|
4
4
|
// GENERATED by scripts/write-version.js — do not edit manually.
|
|
5
|
-
exports.BUILD = { version: '2.
|
|
5
|
+
exports.BUILD = { version: '2.34.0', commit: '578ff0efbc05' };
|
|
6
6
|
//# sourceMappingURL=version.js.map
|
package/dist/webui/package.json
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Request, Response } from 'express';
|
|
2
|
+
/**
|
|
3
|
+
* GET /api/scheduler — read-only recent slot occurrences (WebUI Control Center
|
|
4
|
+
* Phase 1: Scheduler panel). Deliberately no writes and no secrets: this is a
|
|
5
|
+
* projection of the existing Slot Ledger, not a second state system.
|
|
6
|
+
*/
|
|
7
|
+
export declare function listRecentSlots(req: Request, res: Response): Promise<void>;
|
|
8
|
+
//# sourceMappingURL=scheduler-handlers.d.ts.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listRecentSlots = listRecentSlots;
|
|
4
|
+
const Database_1 = require("../../../storage/Database");
|
|
5
|
+
const config_1 = require("../../../config");
|
|
6
|
+
const logger_1 = require("../../../logger");
|
|
7
|
+
const error_codes_1 = require("../../utils/error-codes");
|
|
8
|
+
/**
|
|
9
|
+
* GET /api/scheduler — read-only recent slot occurrences (WebUI Control Center
|
|
10
|
+
* Phase 1: Scheduler panel). Deliberately no writes and no secrets: this is a
|
|
11
|
+
* projection of the existing Slot Ledger, not a second state system.
|
|
12
|
+
*/
|
|
13
|
+
async function listRecentSlots(req, res) {
|
|
14
|
+
let database = null;
|
|
15
|
+
try {
|
|
16
|
+
const limit = Math.min(Math.max(Number(req.query.limit ?? 14) || 14, 1), 50);
|
|
17
|
+
const configPath = (0, config_1.getConfigPath)();
|
|
18
|
+
const config = (0, config_1.loadConfig)(configPath);
|
|
19
|
+
if (!config.storage?.databasePath) {
|
|
20
|
+
res.status(400).json({ errorCode: error_codes_1.ErrorCode.SCHEDULER_LIST_FAILED, message: 'database not configured' });
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
database = new Database_1.Database(config.storage.databasePath);
|
|
24
|
+
database.migrate();
|
|
25
|
+
const slots = database.slots.getRecentSlots(limit).map((slot) => ({
|
|
26
|
+
slotId: slot.id,
|
|
27
|
+
scheduleId: slot.scheduleId,
|
|
28
|
+
status: slot.status,
|
|
29
|
+
occurrenceAt: slot.occurrenceAt,
|
|
30
|
+
occurrenceDate: slot.occurrenceDate,
|
|
31
|
+
occurrenceLabel: slot.occurrenceLabel,
|
|
32
|
+
timezone: slot.timezone,
|
|
33
|
+
triggerSource: slot.triggerSource,
|
|
34
|
+
recoveryRequestId: slot.recoveryRequestId ?? null,
|
|
35
|
+
startedAt: slot.startedAt,
|
|
36
|
+
completedAt: slot.completedAt,
|
|
37
|
+
targets: database.slots.getCells(slot.id).map((cell) => ({
|
|
38
|
+
targetId: cell.targetId,
|
|
39
|
+
workType: cell.workType,
|
|
40
|
+
status: cell.status,
|
|
41
|
+
workId: cell.workId,
|
|
42
|
+
terminalReasonCode: cell.terminalReasonCode,
|
|
43
|
+
reason: cell.terminalReasonMessage ?? null,
|
|
44
|
+
})),
|
|
45
|
+
}));
|
|
46
|
+
database.close();
|
|
47
|
+
database = null;
|
|
48
|
+
res.json({ data: { slots } });
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
if (database) {
|
|
52
|
+
try {
|
|
53
|
+
database.close();
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
// ignore
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
60
|
+
logger_1.logger.error('Failed to list scheduler slots', { error: { message } });
|
|
61
|
+
res.status(500).json({ errorCode: error_codes_1.ErrorCode.SCHEDULER_LIST_FAILED });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=scheduler-handlers.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const express_1 = require("express");
|
|
4
|
+
const scheduler_handlers_1 = require("./handlers/scheduler-handlers");
|
|
5
|
+
const router = (0, express_1.Router)();
|
|
6
|
+
router.get('/', scheduler_handlers_1.listRecentSlots);
|
|
7
|
+
exports.default = router;
|
|
8
|
+
//# sourceMappingURL=scheduler.js.map
|
|
@@ -13,6 +13,7 @@ const logs_1 = __importDefault(require("../routes/logs"));
|
|
|
13
13
|
const admin_logs_1 = __importDefault(require("../routes/admin-logs"));
|
|
14
14
|
const system_errors_1 = __importDefault(require("../routes/system-errors"));
|
|
15
15
|
const files_1 = __importDefault(require("../routes/files"));
|
|
16
|
+
const scheduler_1 = __importDefault(require("../routes/scheduler"));
|
|
16
17
|
/**
|
|
17
18
|
* Setup API routes for Express app
|
|
18
19
|
*/
|
|
@@ -35,5 +36,7 @@ function setupRoutes(app) {
|
|
|
35
36
|
app.use('/admin/logs', admin_logs_1.default);
|
|
36
37
|
app.use('/admin/system-errors', system_errors_1.default);
|
|
37
38
|
app.use('/api/files', files_1.default);
|
|
39
|
+
// WebUI Control Center Phase 1: read-only scheduler projection.
|
|
40
|
+
app.use('/api/scheduler', scheduler_1.default);
|
|
38
41
|
}
|
|
39
42
|
//# sourceMappingURL=server-routes.js.map
|
|
@@ -62,6 +62,7 @@ export declare enum ErrorCode {
|
|
|
62
62
|
FILE_DELETE_SUCCESS = "FILE_DELETE_SUCCESS",
|
|
63
63
|
FILE_DELETE_FAILED = "FILE_DELETE_FAILED",
|
|
64
64
|
FILE_NORMALIZE_FAILED = "FILE_NORMALIZE_FAILED",
|
|
65
|
+
SCHEDULER_LIST_FAILED = "SCHEDULER_LIST_FAILED",
|
|
65
66
|
AUTH_STATUS_FAILED = "AUTH_STATUS_FAILED",
|
|
66
67
|
AUTH_USERNAME_PASSWORD_REQUIRED = "AUTH_USERNAME_PASSWORD_REQUIRED",
|
|
67
68
|
AUTH_LOGIN_SUCCESS = "AUTH_LOGIN_SUCCESS",
|
|
@@ -70,6 +70,8 @@ var ErrorCode;
|
|
|
70
70
|
ErrorCode["FILE_DELETE_SUCCESS"] = "FILE_DELETE_SUCCESS";
|
|
71
71
|
ErrorCode["FILE_DELETE_FAILED"] = "FILE_DELETE_FAILED";
|
|
72
72
|
ErrorCode["FILE_NORMALIZE_FAILED"] = "FILE_NORMALIZE_FAILED";
|
|
73
|
+
// Scheduler errors
|
|
74
|
+
ErrorCode["SCHEDULER_LIST_FAILED"] = "SCHEDULER_LIST_FAILED";
|
|
73
75
|
// Auth errors
|
|
74
76
|
ErrorCode["AUTH_STATUS_FAILED"] = "AUTH_STATUS_FAILED";
|
|
75
77
|
ErrorCode["AUTH_USERNAME_PASSWORD_REQUIRED"] = "AUTH_USERNAME_PASSWORD_REQUIRED";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pixivflow",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.34.0",
|
|
4
4
|
"description": "🎨 Pixiv 下载、筛选与自动收集工具 - 批量下载插画和小说、按标签/热度/日期筛选、定时任务与可靠 HTTP 交付 | Pixiv downloader and automation toolkit with filtering, scheduling and reliable HTTP delivery",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|