Compare commits

..

5 Commits

Author SHA1 Message Date
whyour 5afac3a3ac 更新版本 v2.17.7 2024-07-02 00:44:56 +08:00
whyour 71ba1534f2 增加自定写入 js 和 py 类型环境变量 2024-07-02 00:44:48 +08:00
whyour 791cf657b5 修复更新 linux 镜像源错误 2024-06-30 15:09:17 +08:00
whyour c1ef021009 更新 readme 2024-06-30 00:55:10 +08:00
whyour 90fe63211d 修复修改任务状态可能报错 2024-06-28 20:41:05 +08:00
10 changed files with 48 additions and 21 deletions
+3 -5
View File
@@ -48,7 +48,7 @@ docker pull whyour/qinglong:debian
### npm
The npm version supports `debian/ubuntu/centos/alpine` systems and requires `node/python3` to be installed.
The npm version supports `debian/ubuntu/alpine` systems and requires `node/npm/python3/pip3/pnpm` to be installed.
```bash
npm i @whyour/qinglong
@@ -105,15 +105,13 @@ podman run -dit \
docker.io/whyour/qinglong:latest
```
### Local
### Npm
It is recommended to use a pure system installation to avoid losing the original system data, you need to install node/npm/python3/pip3 yourself
It is recommended to use a pure system installation to avoid losing the original system data, you need to install node/npm/python3/pip3/pnpm yourself
```bash
# Debian/Ubuntu
curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash -
# Centos
curl --silent --location https://rpm.nodesource.com/setup_20.x | sudo bash
```
```bash
+3 -5
View File
@@ -50,7 +50,7 @@ docker pull whyour/qinglong:debian
### npm
npm 版本支持 `debian/ubuntu/centos/alpine` 系统,需要自行安装 `node/python3`
npm 版本支持 `debian/ubuntu/alpine` 系统,需要自行安装 `node/npm/python3/pip3/pnpm`
```bash
npm i @whyour/qinglong
@@ -107,15 +107,13 @@ podman run -dit \
docker.io/whyour/qinglong:latest
```
### 本机
### npm
建议使用纯净系统安装,避免系统原有数据丢失,需要自己安装 node/npm/python3/pip3
建议使用纯净系统安装,避免系统原有数据丢失,需要自己安装 node/npm/python3/pip3/pnpm
```bash
# Debian/Ubuntu
curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash -
# Centos
curl --silent --location https://rpm.nodesource.com/setup_20.x | sudo bash
```
```bash
+3
View File
@@ -51,6 +51,9 @@ export default (app: Router) => {
const logger: Logger = Container.get('logger');
try {
const envService = Container.get(EnvService);
if (!req.body?.length) {
return res.send({ code: 400, message: '参数不正确' });
}
const data = await envService.create(req.body);
return res.send({ code: 200, data });
} catch (e) {
+6
View File
@@ -38,6 +38,8 @@ const sshdPath = path.join(dataPath, 'ssh.d/');
const systemLogPath = path.join(dataPath, 'syslog/');
const envFile = path.join(configPath, 'env.sh');
const jsEnvFile = path.join(configPath, 'env.js');
const pyEnvFile = path.join(configPath, 'env.py');
const confFile = path.join(configPath, 'config.sh');
const crontabFile = path.join(configPath, 'crontab.list');
const authConfigFile = path.join(configPath, 'auth.json');
@@ -87,6 +89,8 @@ export default {
sampleFile,
confFile,
envFile,
jsEnvFile,
pyEnvFile,
dbPath,
uploadPath,
configPath,
@@ -99,6 +103,8 @@ export default {
'crontab.list',
'dependence-proxy.sh',
'env.sh',
'env.js',
'env.py',
'token.json',
],
writePathList: [configPath, scriptPath],
+7 -1
View File
@@ -114,7 +114,13 @@ export default class CronService {
}
for (const id of ids) {
const cron = await this.getDb({ id });
let cron;
try {
cron = await this.getDb({ id });
} catch (err) {}
if (!cron) {
continue;
}
if (status === CrontabStatus.idle && log_path !== cron.log_path) {
options = omit(options, ['status', 'log_path', 'pid']);
}
+11
View File
@@ -196,6 +196,8 @@ export default class EnvService {
});
const groups = groupBy(envs, 'name');
let env_string = '';
let js_env_string = '';
let py_env_string = 'import os\n';
for (const key in groups) {
if (Object.prototype.hasOwnProperty.call(groups, key)) {
const group = groups[key];
@@ -208,9 +210,18 @@ export default class EnvService {
.replace(/'/g, "'\\''")
.trim();
env_string += `export ${key}='${value}'\n`;
const _env_value = `'${group
.map((x) => x.value)
.join('&')
.replace(/\\/g, '\\\\')
.replace(/'/g, "\\'")}'`;
js_env_string += `process.env.${key}=${_env_value};\n`;
py_env_string += `os.environ['${key}']=${_env_value}\n`;
}
}
}
await fs.writeFile(config.envFile, env_string);
await fs.writeFile(config.jsEnvFile, js_env_string);
await fs.writeFile(config.pyEnvFile, py_env_string);
}
}
+2 -1
View File
@@ -1,6 +1,7 @@
import { Service, Inject } from 'typedi';
import winston from 'winston';
import {
createFile,
createRandomString,
fileExist,
getNetIp,
@@ -266,7 +267,7 @@ export default class UserService {
public async getUserInfo(): Promise<any> {
const authFileExist = await fileExist(config.authConfigFile);
if (!authFileExist) {
await fs.writeFile(
await createFile(
config.authConfigFile,
JSON.stringify({
username: 'admin',
+3 -1
View File
@@ -74,7 +74,9 @@ init_env() {
import_config() {
[[ -f $file_config_user ]] && . $file_config_user
[[ -f $file_env ]] && . $file_env
if [[ $LOAD_ENV != 'false' ]] && [[ -f $file_env ]]; then
. $file_env
fi
ql_base_url=${QlBaseUrl:-"/"}
ql_port=${QlPort:-"5700"}
+3 -2
View File
@@ -48,8 +48,9 @@ const Dependence = () => {
pick(systemConfig, dataMap[path]),
)
.then((res) => {})
.catch((error: any) => {
console.log(error);
.catch(() => {
setLoading(false);
setLog((p) => `${p}update mirror error`);
});
};
+7 -6
View File
@@ -1,7 +1,8 @@
version: 2.17.6
changeLogLink: https://t.me/jiao_long/407
publishTime: 2024-06-14 23:00
version: 2.17.7
changeLogLink: https://t.me/jiao_long/408
publishTime: 2024-06-30 16:00
changeLog: |
1. bark 推送改为 post 请求,防止请求头过大
2. 修复单文件订阅代理无效
3. 修复系统设置通知和依赖数据未初始化
1. 修复更新任务状态错误
2. 修复查询系统 health 状态错误
3. 修复更新 linux 镜像源错误
4. npm 包支持 alpine 和 debian、ubuntu,修复 linux 依赖安装命令