mirror of
https://github.com/whyour/qinglong.git
synced 2026-08-13 04:02:56 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f099bd8e05 | ||
|
|
6f7a54a614 | ||
|
|
6397415d7f | ||
|
|
8dc98a6c0e | ||
|
|
5c151f93c5 | ||
|
|
c61d1aa828 | ||
|
|
33fa3aca99 | ||
|
|
c772fc9527 |
@@ -164,7 +164,7 @@ jobs:
|
|||||||
flavor: |
|
flavor: |
|
||||||
latest=false
|
latest=false
|
||||||
tags: |
|
tags: |
|
||||||
type=ref,event=branch,enable=${{ github.ref != format('refs/heads/{0}', 'master') }}
|
type=ref,event=branch,enable=${{ github.ref == format('refs/heads/{0}', 'develop') }}
|
||||||
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
|
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
|
||||||
type=raw,value=${{ steps.version.outputs.version }},enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
|
type=raw,value=${{ steps.version.outputs.version }},enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
|
||||||
type=semver,pattern={{version}}
|
type=semver,pattern={{version}}
|
||||||
|
|||||||
+2
-1
@@ -130,7 +130,7 @@ export default (app: Router) => {
|
|||||||
originFilename: Joi.string().optional().allow(''),
|
originFilename: Joi.string().optional().allow(''),
|
||||||
directory: Joi.string().optional().allow(''),
|
directory: Joi.string().optional().allow(''),
|
||||||
file: Joi.string().optional().allow(''),
|
file: Joi.string().optional().allow(''),
|
||||||
}).unknown(true),
|
}),
|
||||||
}),
|
}),
|
||||||
async (req: Request, res: Response, next: NextFunction) => {
|
async (req: Request, res: Response, next: NextFunction) => {
|
||||||
try {
|
try {
|
||||||
@@ -176,6 +176,7 @@ export default (app: Router) => {
|
|||||||
path,
|
path,
|
||||||
`${originFilename.replace(/\//g, '')}`,
|
`${originFilename.replace(/\//g, '')}`,
|
||||||
);
|
);
|
||||||
|
await fs.mkdir(path, { recursive: true });
|
||||||
const filePath = join(path, `${filename.replace(/\//g, '')}`);
|
const filePath = join(path, `${filename.replace(/\//g, '')}`);
|
||||||
const fileExists = await fileExist(filePath);
|
const fileExists = await fileExist(filePath);
|
||||||
if (fileExists) {
|
if (fileExists) {
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ export default class DependenceService {
|
|||||||
query: any = {},
|
query: any = {},
|
||||||
): Promise<Dependence[]> {
|
): Promise<Dependence[]> {
|
||||||
let condition = query;
|
let condition = query;
|
||||||
if (DependenceTypes[type]) {
|
if (type && DependenceTypes[type] !== undefined) {
|
||||||
condition.type = DependenceTypes[type];
|
condition.type = DependenceTypes[type];
|
||||||
}
|
}
|
||||||
if (status) {
|
if (status) {
|
||||||
|
|||||||
+97
-17
@@ -218,28 +218,108 @@ export default class SystemService {
|
|||||||
...oDoc,
|
...oDoc,
|
||||||
info: { ...oDoc.info, ...info },
|
info: { ...oDoc.info, ...info },
|
||||||
});
|
});
|
||||||
let defaultDomain = 'https://dl-cdn.alpinelinux.org';
|
|
||||||
let targetDomain = 'https://dl-cdn.alpinelinux.org';
|
|
||||||
if (os.platform() !== 'linux') {
|
if (os.platform() !== 'linux') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const content = await fs.promises.readFile('/etc/apk/repositories', {
|
|
||||||
encoding: 'utf-8',
|
let command = '';
|
||||||
});
|
|
||||||
const domainMatch = content.match(/(http.*)\/alpine\/.*/);
|
// Check if this is a Debian-based system (including Armbian)
|
||||||
if (domainMatch) {
|
// Check for both sources.list and debian_version for more reliable detection
|
||||||
defaultDomain = domainMatch[1];
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (info.linuxMirror) {
|
|
||||||
targetDomain = info.linuxMirror;
|
if (!command) {
|
||||||
|
this.sockService.sendMessage({
|
||||||
|
type: 'updateLinuxMirror',
|
||||||
|
message: 'No supported package manager found or mirror not configured',
|
||||||
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
const command = `sed -i 's/${defaultDomain.replace(
|
|
||||||
/\//g,
|
|
||||||
'\\/',
|
|
||||||
)}/${targetDomain.replace(
|
|
||||||
/\//g,
|
|
||||||
'\\/',
|
|
||||||
)}/g' /etc/apk/repositories && apk update -f`;
|
|
||||||
|
|
||||||
this.scheduleService.runTask(
|
this.scheduleService.runTask(
|
||||||
command,
|
command,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const SaveModal = ({
|
|||||||
|
|
||||||
const handleOk = async (values: any) => {
|
const handleOk = async (values: any) => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const payload = { ...file, ...values, originFilename: file.title };
|
const payload = { ...values, originFilename: file.title, content: file.content };
|
||||||
request
|
request
|
||||||
.post(`${config.apiPrefix}scripts`, payload)
|
.post(`${config.apiPrefix}scripts`, payload)
|
||||||
.then(({ code, data }) => {
|
.then(({ code, data }) => {
|
||||||
|
|||||||
+46
-9
@@ -1,10 +1,47 @@
|
|||||||
version: 2.19.2
|
version: 2.20.0
|
||||||
changeLogLink: https://t.me/jiao_long/431
|
changeLogLink: https://t.me/jiao_long/432
|
||||||
publishTime: 2025-06-27 23:59
|
publishTime: 2025-12-10 01:05
|
||||||
changeLog: |
|
changeLog: |
|
||||||
1. 备份数据支持选择模块,支持清除依赖缓存
|
1. 定时任务(cron / task)相关的大量修复 & 增强
|
||||||
2. QLAPI 和 openapi 的 systemNotify 支持自定义通知类型和参数
|
|
||||||
3. ntfy 增加可选的认证与用户动作,感谢 https://github.com/liheji
|
修复 cron 解析错误(修复 parse cron / 升级 cron-parser)
|
||||||
4. 修复取消安装依赖
|
修复集群模式下定时任务可能不执行(race condition)
|
||||||
5. 修复环境变量过大解析报错
|
定时任务支持订阅筛选
|
||||||
6. 修改服务启动方式
|
定时任务支持排序调整
|
||||||
|
定时任务支持自定义日志文件或无日志
|
||||||
|
修复任务实例默认值
|
||||||
|
任务支持单实例 / 多实例模式
|
||||||
|
修复 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. 系统设置
|
||||||
|
|
||||||
|
新增多终端/多平台的并发登录会话支持
|
||||||
Reference in New Issue
Block a user