mirror of
https://github.com/whyour/qinglong.git
synced 2026-08-05 16:25:04 +08:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7d6dd3d42d | |||
| 8de5bff700 | |||
| bcf1cffb88 | |||
| d53437d169 | |||
| d526602d19 | |||
| 91b44914f6 | |||
| 4f6c93cc1c | |||
| e326d89571 | |||
| 5f0dafa010 | |||
| dc0b3f2eb2 | |||
| 3db716763d | |||
| fae226745e | |||
| 9330650163 | |||
| 073de76a4a |
@@ -9,15 +9,13 @@ on:
|
||||
- "develop"
|
||||
tags:
|
||||
- "v*"
|
||||
schedule:
|
||||
- cron: "00 20 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
code_gitlab:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: Yikun/hub-mirror-action@master
|
||||
@@ -32,7 +30,7 @@ jobs:
|
||||
code_gitee:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: Yikun/hub-mirror-action@master
|
||||
@@ -47,12 +45,12 @@ jobs:
|
||||
build-static:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v3
|
||||
- uses: actions/checkout@v6
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: "8.3.1"
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
cache: "pnpm"
|
||||
|
||||
@@ -78,12 +76,12 @@ jobs:
|
||||
git config --local user.email 'github-actions[bot]@users.noreply.github.com'
|
||||
git commit --allow-empty -m "copy static at $(date +'%Y-%m-%d %H:%M:%S')"
|
||||
git push --force --quiet "https://${{ secrets.API_TOKEN }}@${GITHUB_REPO}.git" ${GITHUB_BRANCH}:${GITHUB_BRANCH}
|
||||
|
||||
|
||||
static_gitlab:
|
||||
needs: build-static
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: Yikun/hub-mirror-action@master
|
||||
@@ -99,7 +97,7 @@ jobs:
|
||||
needs: build-static
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: Yikun/hub-mirror-action@master
|
||||
@@ -112,6 +110,7 @@ jobs:
|
||||
force_update: true
|
||||
|
||||
build:
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||
needs: build-static
|
||||
|
||||
runs-on: ubuntu-22.04
|
||||
@@ -121,11 +120,11 @@ jobs:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v3
|
||||
- uses: actions/checkout@v6
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: "8.3.1"
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
cache: "pnpm"
|
||||
|
||||
@@ -209,11 +208,11 @@ jobs:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v3
|
||||
- uses: actions/checkout@v6
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: "8.3.1"
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
cache: "pnpm"
|
||||
|
||||
|
||||
@@ -28,3 +28,7 @@ __pycache__
|
||||
/shell/preload/notify.*
|
||||
/shell/preload/*-notify.json
|
||||
/shell/preload/__ql_notify__.*
|
||||
|
||||
# Test files
|
||||
test-*.cjs
|
||||
test-*.mjs
|
||||
|
||||
@@ -16,7 +16,7 @@ export default (app: Router) => {
|
||||
searchValue: Joi.string().optional().allow(''),
|
||||
type: Joi.string().optional().allow(''),
|
||||
status: Joi.string().optional().allow(''),
|
||||
}),
|
||||
}).unknown(true),
|
||||
}),
|
||||
async (req: Request, res: Response, next: NextFunction) => {
|
||||
const logger: Logger = Container.get('logger');
|
||||
|
||||
+4
-4
@@ -29,7 +29,7 @@ export default (app: Router) => {
|
||||
celebrate({
|
||||
query: Joi.object({
|
||||
path: Joi.string().optional().allow(''),
|
||||
}),
|
||||
}).unknown(true),
|
||||
}),
|
||||
async (req: Request, res: Response, next: NextFunction) => {
|
||||
const logger: Logger = Container.get('logger');
|
||||
@@ -79,7 +79,7 @@ export default (app: Router) => {
|
||||
query: Joi.object({
|
||||
path: Joi.string().optional().allow(''),
|
||||
file: Joi.string().required(),
|
||||
}),
|
||||
}).unknown(true),
|
||||
}),
|
||||
async (req: Request, res: Response, next: NextFunction) => {
|
||||
try {
|
||||
@@ -103,7 +103,7 @@ export default (app: Router) => {
|
||||
}),
|
||||
query: Joi.object({
|
||||
path: Joi.string().optional().allow(''),
|
||||
}),
|
||||
}).unknown(true),
|
||||
}),
|
||||
async (req: Request, res: Response, next: NextFunction) => {
|
||||
try {
|
||||
@@ -130,7 +130,7 @@ export default (app: Router) => {
|
||||
originFilename: Joi.string().optional().allow(''),
|
||||
directory: Joi.string().optional().allow(''),
|
||||
file: Joi.string().optional().allow(''),
|
||||
}),
|
||||
}).unknown(true),
|
||||
}),
|
||||
async (req: Request, res: Response, next: NextFunction) => {
|
||||
try {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Container } from 'typedi';
|
||||
import { Logger } from 'winston';
|
||||
import SubscriptionService from '../services/subscription';
|
||||
import { celebrate, Joi } from 'celebrate';
|
||||
import { CronExpressionParser } from 'cron-parser';
|
||||
import CronExpressionParser from 'cron-parser';
|
||||
const route = Router();
|
||||
|
||||
export default (app: Router) => {
|
||||
|
||||
@@ -64,6 +64,19 @@ if (!process.env.QL_DIR) {
|
||||
|
||||
const lastVersionFile = `https://qn.whyour.cn/version.yaml`;
|
||||
|
||||
// Get and normalize QlBaseUrl
|
||||
let baseUrl = process.env.QlBaseUrl || '';
|
||||
if (baseUrl) {
|
||||
// Ensure it starts with /
|
||||
if (!baseUrl.startsWith('/')) {
|
||||
baseUrl = `/${baseUrl}`;
|
||||
}
|
||||
// Remove trailing slash for consistency in route definitions
|
||||
if (baseUrl.endsWith('/')) {
|
||||
baseUrl = baseUrl.slice(0, -1);
|
||||
}
|
||||
}
|
||||
|
||||
const rootPath = process.env.QL_DIR as string;
|
||||
const envFound = dotenv.config({ path: path.join(rootPath, '.env') });
|
||||
|
||||
@@ -116,6 +129,7 @@ if (envFound.error) {
|
||||
export default {
|
||||
...config,
|
||||
jwt: config.jwt,
|
||||
baseUrl,
|
||||
rootPath,
|
||||
tmpPath,
|
||||
dataPath,
|
||||
|
||||
@@ -15,6 +15,13 @@ import path from 'path';
|
||||
export default ({ app }: { app: Application }) => {
|
||||
app.set('trust proxy', 'loopback');
|
||||
app.use(cors());
|
||||
|
||||
// Rewrite URLs to strip baseUrl prefix if configured
|
||||
// This allows the rest of the app to work without baseUrl awareness
|
||||
if (config.baseUrl) {
|
||||
app.use(rewrite(`${config.baseUrl}/*`, '/$1'));
|
||||
}
|
||||
|
||||
app.get(`${config.api.prefix}/env.js`, serveEnv);
|
||||
app.use(`${config.api.prefix}/static`, express.static(config.uploadPath));
|
||||
|
||||
|
||||
@@ -5,9 +5,10 @@ import SockService from '../services/sock';
|
||||
import { getPlatform } from '../config/util';
|
||||
import { shareStore } from '../shared/store';
|
||||
import { isValidToken } from '../shared/auth';
|
||||
import config from '../config';
|
||||
|
||||
export default async ({ server }: { server: Server }) => {
|
||||
const echo = sockJs.createServer({ prefix: '/api/ws', log: () => {} });
|
||||
const echo = sockJs.createServer({ prefix: `${config.baseUrl}/api/ws`, log: () => { } });
|
||||
const sockService = Container.get(SockService);
|
||||
|
||||
echo.on('connection', async (conn) => {
|
||||
|
||||
@@ -231,6 +231,7 @@ message NotificationInfo {
|
||||
optional string webhookContentType = 57;
|
||||
|
||||
optional string larkKey = 58;
|
||||
optional string larkSecret = 69;
|
||||
|
||||
optional string ntfyUrl = 59;
|
||||
optional string ntfyTopic = 60;
|
||||
|
||||
+19
-1
@@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.6.1
|
||||
// protoc v3.17.3
|
||||
// protoc v3.21.12
|
||||
// source: back/protos/api.proto
|
||||
|
||||
/* eslint-disable */
|
||||
@@ -382,6 +382,7 @@ export interface NotificationInfo {
|
||||
webhookMethod?: string | undefined;
|
||||
webhookContentType?: string | undefined;
|
||||
larkKey?: string | undefined;
|
||||
larkSecret?: string | undefined;
|
||||
ntfyUrl?: string | undefined;
|
||||
ntfyTopic?: string | undefined;
|
||||
ntfyPriority?: string | undefined;
|
||||
@@ -2947,6 +2948,7 @@ function createBaseNotificationInfo(): NotificationInfo {
|
||||
webhookMethod: undefined,
|
||||
webhookContentType: undefined,
|
||||
larkKey: undefined,
|
||||
larkSecret: undefined,
|
||||
ntfyUrl: undefined,
|
||||
ntfyTopic: undefined,
|
||||
ntfyPriority: undefined,
|
||||
@@ -3136,6 +3138,9 @@ export const NotificationInfo: MessageFns<NotificationInfo> = {
|
||||
if (message.larkKey !== undefined) {
|
||||
writer.uint32(466).string(message.larkKey);
|
||||
}
|
||||
if (message.larkSecret !== undefined) {
|
||||
writer.uint32(554).string(message.larkSecret);
|
||||
}
|
||||
if (message.ntfyUrl !== undefined) {
|
||||
writer.uint32(474).string(message.ntfyUrl);
|
||||
}
|
||||
@@ -3640,6 +3645,14 @@ export const NotificationInfo: MessageFns<NotificationInfo> = {
|
||||
message.larkKey = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 69: {
|
||||
if (tag !== 554) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.larkSecret = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 59: {
|
||||
if (tag !== 474) {
|
||||
break;
|
||||
@@ -3797,6 +3810,7 @@ export const NotificationInfo: MessageFns<NotificationInfo> = {
|
||||
webhookMethod: isSet(object.webhookMethod) ? globalThis.String(object.webhookMethod) : undefined,
|
||||
webhookContentType: isSet(object.webhookContentType) ? globalThis.String(object.webhookContentType) : undefined,
|
||||
larkKey: isSet(object.larkKey) ? globalThis.String(object.larkKey) : undefined,
|
||||
larkSecret: isSet(object.larkSecret) ? globalThis.String(object.larkSecret) : undefined,
|
||||
ntfyUrl: isSet(object.ntfyUrl) ? globalThis.String(object.ntfyUrl) : undefined,
|
||||
ntfyTopic: isSet(object.ntfyTopic) ? globalThis.String(object.ntfyTopic) : undefined,
|
||||
ntfyPriority: isSet(object.ntfyPriority) ? globalThis.String(object.ntfyPriority) : undefined,
|
||||
@@ -3990,6 +4004,9 @@ export const NotificationInfo: MessageFns<NotificationInfo> = {
|
||||
if (message.larkKey !== undefined) {
|
||||
obj.larkKey = message.larkKey;
|
||||
}
|
||||
if (message.larkSecret !== undefined) {
|
||||
obj.larkSecret = message.larkSecret;
|
||||
}
|
||||
if (message.ntfyUrl !== undefined) {
|
||||
obj.ntfyUrl = message.ntfyUrl;
|
||||
}
|
||||
@@ -4086,6 +4103,7 @@ export const NotificationInfo: MessageFns<NotificationInfo> = {
|
||||
message.webhookMethod = object.webhookMethod ?? undefined;
|
||||
message.webhookContentType = object.webhookContentType ?? undefined;
|
||||
message.larkKey = object.larkKey ?? undefined;
|
||||
message.larkSecret = object.larkSecret ?? undefined;
|
||||
message.ntfyUrl = object.ntfyUrl ?? undefined;
|
||||
message.ntfyTopic = object.ntfyTopic ?? undefined;
|
||||
message.ntfyPriority = object.ntfyPriority ?? undefined;
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.6.1
|
||||
// protoc v3.17.3
|
||||
// protoc v3.21.12
|
||||
// source: back/protos/cron.proto
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.6.1
|
||||
// protoc v3.17.3
|
||||
// protoc v3.21.12
|
||||
// source: back/protos/health.proto
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
@@ -4,7 +4,7 @@ import config from '../config';
|
||||
import { Crontab, CrontabModel, CrontabStatus } from '../data/cron';
|
||||
import { exec, execSync } from 'child_process';
|
||||
import fs from 'fs/promises';
|
||||
import { CronExpressionParser } from 'cron-parser';
|
||||
import CronExpressionParser from 'cron-parser';
|
||||
import {
|
||||
getFileContentByName,
|
||||
fileExist,
|
||||
@@ -29,7 +29,7 @@ import { logStreamManager } from '../shared/logStreamManager';
|
||||
|
||||
@Service()
|
||||
export default class CronService {
|
||||
constructor(@Inject('logger') private logger: winston.Logger) {}
|
||||
constructor(@Inject('logger') private logger: winston.Logger) { }
|
||||
|
||||
private isNodeCron(cron: Crontab) {
|
||||
const { schedule, extra_schedules } = cron;
|
||||
@@ -165,7 +165,7 @@ export default class CronService {
|
||||
let cron;
|
||||
try {
|
||||
cron = await this.getDb({ id });
|
||||
} catch (err) {}
|
||||
} catch (err) { }
|
||||
if (!cron) {
|
||||
continue;
|
||||
}
|
||||
@@ -467,7 +467,10 @@ export default class CronService {
|
||||
for (const doc of docs) {
|
||||
// Kill all running instances of this task
|
||||
try {
|
||||
const command = this.makeCommand(doc);
|
||||
if (doc.pid) {
|
||||
await killTask(doc.pid);
|
||||
}
|
||||
const command = doc.command.replace(/\s+/g, ' ').trim();
|
||||
await killAllTasks(command);
|
||||
this.logger.info(
|
||||
`[panel][停止所有运行中的任务实例] 任务ID: ${doc.id}, 命令: ${command}`,
|
||||
|
||||
@@ -13,10 +13,11 @@ import {
|
||||
stepPosition,
|
||||
} from '../data/env';
|
||||
import { writeFileWithLock } from '../shared/utils';
|
||||
import { sequelize } from '../data';
|
||||
|
||||
@Service()
|
||||
export default class EnvService {
|
||||
constructor(@Inject('logger') private logger: winston.Logger) {}
|
||||
constructor(@Inject('logger') private logger: winston.Logger) { }
|
||||
|
||||
public async create(payloads: Env[]): Promise<Env[]> {
|
||||
const envs = await this.envs();
|
||||
@@ -146,7 +147,7 @@ export default class EnvService {
|
||||
}
|
||||
try {
|
||||
const result = await this.find(condition, [
|
||||
['isPinned', 'DESC'],
|
||||
[sequelize.literal('COALESCE(`isPinned`, 0)'), 'DESC'],
|
||||
['position', 'DESC'],
|
||||
['createdAt', 'ASC'],
|
||||
]);
|
||||
|
||||
+17
-97
@@ -218,108 +218,28 @@ export default class SystemService {
|
||||
...oDoc,
|
||||
info: { ...oDoc.info, ...info },
|
||||
});
|
||||
|
||||
let defaultDomain = 'https://dl-cdn.alpinelinux.org';
|
||||
let targetDomain = 'https://dl-cdn.alpinelinux.org';
|
||||
if (os.platform() !== 'linux') {
|
||||
return;
|
||||
}
|
||||
|
||||
let command = '';
|
||||
|
||||
// Check if this is a Debian-based system (including Armbian)
|
||||
// Check for both sources.list and debian_version for more reliable detection
|
||||
const hasAptSourcesList = await fs.promises.access('/etc/apt/sources.list')
|
||||
.then(() => true)
|
||||
.catch(() => false);
|
||||
const hasDebianVersion = await fs.promises.access('/etc/debian_version')
|
||||
.then(() => true)
|
||||
.catch(() => false);
|
||||
const isDebianBased = hasAptSourcesList || hasDebianVersion;
|
||||
|
||||
if (isDebianBased) {
|
||||
// Handle Debian/Ubuntu/Armbian systems
|
||||
let defaultDomain = '';
|
||||
let targetDomain = info.linuxMirror || '';
|
||||
|
||||
try {
|
||||
// Read the current sources.list
|
||||
const content = await fs.promises.readFile('/etc/apt/sources.list', {
|
||||
encoding: 'utf-8',
|
||||
});
|
||||
|
||||
// Match the first deb line to extract the current mirror
|
||||
// Note: This assumes all mirrors in sources.list use the same base URL
|
||||
// If multiple different mirrors are configured, only the first one will be replaced
|
||||
const debMatch = content.match(/^deb\s+(https?:\/\/[^\s]+)/m);
|
||||
if (debMatch) {
|
||||
defaultDomain = debMatch[1];
|
||||
}
|
||||
|
||||
if (defaultDomain && targetDomain) {
|
||||
// Sanitize and escape special characters for sed
|
||||
// Escape backslashes first, then other special characters
|
||||
const escapedDefault = defaultDomain
|
||||
.replace(/\\/g, '\\\\') // Escape backslashes first
|
||||
.replace(/\//g, '\\/') // Escape forward slashes
|
||||
.replace(/\./g, '\\.'); // Escape dots
|
||||
const escapedTarget = targetDomain
|
||||
.replace(/\\/g, '\\\\') // Escape backslashes first
|
||||
.replace(/\//g, '\\/'); // Escape forward slashes
|
||||
|
||||
// Replace mirror URL in main sources.list
|
||||
command = `sed -i 's/${escapedDefault}/${escapedTarget}/g' /etc/apt/sources.list`;
|
||||
|
||||
// Also update sources.list.d if it exists
|
||||
command += ` && if [ -d /etc/apt/sources.list.d ]; then find /etc/apt/sources.list.d -type f \\( -name "*.list" -o -name "*.sources" \\) -exec sed -i 's/${escapedDefault}/${escapedTarget}/g' {} \\;; fi`;
|
||||
|
||||
// Update package lists
|
||||
command += ` && apt-get update`;
|
||||
} else if (!defaultDomain && targetDomain) {
|
||||
// Cannot detect current mirror, log warning
|
||||
this.logger.warn('Unable to detect current mirror from /etc/apt/sources.list. Mirror update skipped.');
|
||||
this.sockService.sendMessage({
|
||||
type: 'updateLinuxMirror',
|
||||
message: 'Warning: Unable to detect current mirror. Please manually configure /etc/apt/sources.list',
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.error('Failed to read /etc/apt/sources.list', error);
|
||||
}
|
||||
} else {
|
||||
// Handle Alpine Linux systems
|
||||
let defaultDomain = 'https://dl-cdn.alpinelinux.org';
|
||||
let targetDomain = 'https://dl-cdn.alpinelinux.org';
|
||||
|
||||
try {
|
||||
const content = await fs.promises.readFile('/etc/apk/repositories', {
|
||||
encoding: 'utf-8',
|
||||
});
|
||||
const domainMatch = content.match(/(http.*)\/alpine\/.*/);
|
||||
if (domainMatch) {
|
||||
defaultDomain = domainMatch[1];
|
||||
}
|
||||
if (info.linuxMirror) {
|
||||
targetDomain = info.linuxMirror;
|
||||
}
|
||||
// Sanitize and escape special characters for sed
|
||||
// Escape backslashes first, then other special characters
|
||||
command = `sed -i 's/${defaultDomain
|
||||
.replace(/\\/g, '\\\\') // Escape backslashes first
|
||||
.replace(/\//g, '\\/') // Escape forward slashes
|
||||
.replace(/\./g, '\\.')}/${targetDomain
|
||||
.replace(/\\/g, '\\\\') // Escape backslashes first
|
||||
.replace(/\//g, '\\/')}/g' /etc/apk/repositories && apk update -f`;
|
||||
} catch (error) {
|
||||
this.logger.error('Failed to read /etc/apk/repositories', error);
|
||||
}
|
||||
const content = await fs.promises.readFile('/etc/apk/repositories', {
|
||||
encoding: 'utf-8',
|
||||
});
|
||||
const domainMatch = content.match(/(http.*)\/alpine\/.*/);
|
||||
if (domainMatch) {
|
||||
defaultDomain = domainMatch[1];
|
||||
}
|
||||
|
||||
if (!command) {
|
||||
this.sockService.sendMessage({
|
||||
type: 'updateLinuxMirror',
|
||||
message: 'No supported package manager found or mirror not configured',
|
||||
});
|
||||
return;
|
||||
if (info.linuxMirror) {
|
||||
targetDomain = info.linuxMirror;
|
||||
}
|
||||
const command = `sed -i 's/${defaultDomain.replace(
|
||||
/\//g,
|
||||
'\\/',
|
||||
)}/${targetDomain.replace(
|
||||
/\//g,
|
||||
'\\/',
|
||||
)}/g' /etc/apk/repositories && apk update -f`;
|
||||
|
||||
this.scheduleService.runTask(
|
||||
command,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Joi } from 'celebrate';
|
||||
import { CronExpressionParser } from 'cron-parser';
|
||||
import CronExpressionParser from 'cron-parser';
|
||||
import { ScheduleType } from '../interface/schedule';
|
||||
import path from 'path';
|
||||
import config from '../config';
|
||||
|
||||
+20
-4
@@ -482,9 +482,13 @@ function tgBotNotify(text, desp) {
|
||||
timeout,
|
||||
};
|
||||
if (TG_PROXY_HOST && TG_PROXY_PORT) {
|
||||
let proxyHost = TG_PROXY_HOST;
|
||||
if (TG_PROXY_AUTH && !TG_PROXY_HOST.includes('@')) {
|
||||
proxyHost = `${TG_PROXY_AUTH}@${TG_PROXY_HOST}`;
|
||||
}
|
||||
let agent;
|
||||
agent = new ProxyAgent({
|
||||
uri: `http://${TG_PROXY_AUTH}${TG_PROXY_HOST}:${TG_PROXY_PORT}`,
|
||||
uri: `http://${proxyHost}:${TG_PROXY_PORT}`,
|
||||
});
|
||||
options.dispatcher = agent;
|
||||
}
|
||||
@@ -992,7 +996,10 @@ function fsBotNotify(text, desp) {
|
||||
return new Promise((resolve) => {
|
||||
const { FSKEY, FSSECRET } = push_config;
|
||||
if (FSKEY) {
|
||||
const body = { msg_type: 'text', content: { text: `${text}\n\n${desp}` } };
|
||||
const body = {
|
||||
msg_type: 'text',
|
||||
content: { text: `${text}\n\n${desp}` },
|
||||
};
|
||||
|
||||
// Add signature if secret is provided
|
||||
// Note: Feishu's signature algorithm uses timestamp+"\n"+secret as the HMAC key
|
||||
@@ -1278,7 +1285,15 @@ function ntfyNotify(text, desp) {
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
const { NTFY_URL, NTFY_TOPIC, NTFY_PRIORITY, NTFY_TOKEN, NTFY_USERNAME, NTFY_PASSWORD, NTFY_ACTIONS } = push_config;
|
||||
const {
|
||||
NTFY_URL,
|
||||
NTFY_TOPIC,
|
||||
NTFY_PRIORITY,
|
||||
NTFY_TOKEN,
|
||||
NTFY_USERNAME,
|
||||
NTFY_PASSWORD,
|
||||
NTFY_ACTIONS,
|
||||
} = push_config;
|
||||
if (NTFY_TOPIC) {
|
||||
const options = {
|
||||
url: `${NTFY_URL || 'https://ntfy.sh'}/${NTFY_TOPIC}`,
|
||||
@@ -1293,7 +1308,8 @@ function ntfyNotify(text, desp) {
|
||||
if (NTFY_TOKEN) {
|
||||
options.headers['Authorization'] = `Bearer ${NTFY_TOKEN}`;
|
||||
} else if (NTFY_USERNAME && NTFY_PASSWORD) {
|
||||
options.headers['Authorization'] = `Basic ${Buffer.from(`${NTFY_USERNAME}:${NTFY_PASSWORD}`).toString('base64')}`;
|
||||
options.headers['Authorization'] =
|
||||
`Basic ${Buffer.from(`${NTFY_USERNAME}:${NTFY_PASSWORD}`).toString('base64')}`;
|
||||
}
|
||||
if (NTFY_ACTIONS) {
|
||||
options.headers['Actions'] = encodeRFC2047(NTFY_ACTIONS);
|
||||
|
||||
@@ -91,10 +91,14 @@ const CronModal = ({
|
||||
{ required: true },
|
||||
{
|
||||
validator: (_, value) => {
|
||||
if (!value || CronExpressionParser.parse(value).hasNext()) {
|
||||
return Promise.resolve();
|
||||
try {
|
||||
if (!value || CronExpressionParser.parse(value).hasNext()) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
return Promise.reject(intl.get('Cron表达式格式有误'));
|
||||
} catch (e) {
|
||||
return Promise.reject(intl.get('Cron表达式格式有误'));
|
||||
}
|
||||
return Promise.reject(intl.get('Cron表达式格式有误'));
|
||||
},
|
||||
},
|
||||
]}
|
||||
|
||||
@@ -378,13 +378,17 @@ const SubscriptionModal = ({
|
||||
{ required: true },
|
||||
{
|
||||
validator: (rule, value) => {
|
||||
if (
|
||||
scheduleType === 'interval' ||
|
||||
!value ||
|
||||
CronExpressionParser.parse(value).hasNext()
|
||||
) {
|
||||
return Promise.resolve();
|
||||
} else {
|
||||
try {
|
||||
if (
|
||||
scheduleType === 'interval' ||
|
||||
!value ||
|
||||
CronExpressionParser.parse(value).hasNext()
|
||||
) {
|
||||
return Promise.resolve();
|
||||
} else {
|
||||
return Promise.reject(intl.get('Subscription表达式格式有误'));
|
||||
}
|
||||
} catch (e) {
|
||||
return Promise.reject(intl.get('Subscription表达式格式有误'));
|
||||
}
|
||||
},
|
||||
|
||||
+6
-6
@@ -84,12 +84,12 @@ let _request = axios.create({
|
||||
});
|
||||
|
||||
const apiWhiteList = [
|
||||
'/api/user/login',
|
||||
'/open/auth/token',
|
||||
'/api/user/two-factor/login',
|
||||
'/api/system',
|
||||
'/api/user/init',
|
||||
'/api/user/notification/init',
|
||||
`${config.baseUrl}api/user/login`,
|
||||
`${config.baseUrl}open/auth/token`,
|
||||
`${config.baseUrl}api/user/two-factor/login`,
|
||||
`${config.baseUrl}api/system`,
|
||||
`${config.baseUrl}api/user/init`,
|
||||
`${config.baseUrl}api/user/notification/init`,
|
||||
];
|
||||
|
||||
_request.interceptors.request.use((_config) => {
|
||||
|
||||
+10
-46
@@ -1,47 +1,11 @@
|
||||
version: 2.20.0
|
||||
changeLogLink: https://t.me/jiao_long/432
|
||||
publishTime: 2025-12-10 01:05
|
||||
version: 2.20.1
|
||||
changeLogLink: https://t.me/jiao_long/433
|
||||
publishTime: 2025-12-26 22:00
|
||||
changeLog: |
|
||||
1. 定时任务(cron / task)相关的大量修复 & 增强
|
||||
|
||||
修复 cron 解析错误(修复 parse cron / 升级 cron-parser)
|
||||
修复集群模式下定时任务可能不执行(race condition)
|
||||
定时任务支持订阅筛选
|
||||
定时任务支持排序调整
|
||||
定时任务支持自定义日志文件或无日志
|
||||
修复任务实例默认值
|
||||
任务支持单实例 / 多实例模式
|
||||
修复 task 命令软链可能失败问题
|
||||
|
||||
2. 日志系统相关的大更新
|
||||
|
||||
修复日志目录逻辑
|
||||
修复 pm2 日志目录
|
||||
优化日志写入(stream pooling)
|
||||
|
||||
3. 环境变量(env)系统的改进与修复
|
||||
|
||||
修复环境变量复制到剪贴板时可能失败
|
||||
添加环境变量“置顶”功能
|
||||
修复 QlPort 与 QlGrpcPort 环境变量在 host network 模式下被忽略
|
||||
增加全局 SSH 私钥配置
|
||||
|
||||
4. Docker / 非 root 用户 / Alpine 兼容性增强
|
||||
|
||||
新增非 root Docker 用户支持,自动初始化命令
|
||||
修复 Alpine 容器 DNS 解析失败(设置 ndots:0)
|
||||
修复 PM2 在 ARM 路由器(Node.js 不兼容)上的启动失败
|
||||
移除 nginx(可能是考虑更轻量的镜像运行)
|
||||
|
||||
5. API 安全与校验增强
|
||||
|
||||
Dependencies GET endpoint 增加校验
|
||||
Script API routes 增加输入校验
|
||||
修复 JWT 认证问题
|
||||
Feishu 机器人通知增加签名校验
|
||||
QLAPI 增加 cron task 管理功能
|
||||
修复 URIError(错误 cookie 导致白屏)
|
||||
|
||||
6. 系统设置
|
||||
|
||||
新增多终端/多平台的并发登录会话支持
|
||||
1. 修复获取依赖管理列表
|
||||
2. notify.js 修复 TG_PROXY_AUTH 参数拼接
|
||||
3. QLAPI.notify larkSecret 参数
|
||||
4. 修复 cron parser 定时规则校验
|
||||
5. 修复设置 baseUrl 后无法访问
|
||||
6. 修复环境变量排序
|
||||
7. 修复定时任务无法停止
|
||||
Reference in New Issue
Block a user