mirror of
https://github.com/whyour/qinglong.git
synced 2026-08-07 01:04:39 +08:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6a59bf7af3 | |||
| 6f185570d6 | |||
| 8b8336d9d0 | |||
| a1e1d6ed3f | |||
| df3e209534 | |||
| 851408860e | |||
| d92ea23b0e | |||
| d83641db92 | |||
| 48f262e1f3 | |||
| bc49a7db50 | |||
| 49975b461c | |||
| 3ccb635956 | |||
| 074a90e0ac | |||
| 526f927436 |
@@ -17,6 +17,32 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
to_gitlab:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: pixta-dev/repository-mirroring-action@v1
|
||||
with:
|
||||
target_repo_url:
|
||||
git@gitlab.com:whyour/qinglong.git
|
||||
ssh_private_key:
|
||||
${{ secrets.GITLAB_SSH_PK }}
|
||||
|
||||
to_gitee:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: pixta-dev/repository-mirroring-action@v1
|
||||
with:
|
||||
target_repo_url:
|
||||
git@gitee.com:whyour/qinglong.git
|
||||
ssh_private_key:
|
||||
${{ secrets.GITLAB_SSH_PK }}
|
||||
|
||||
build-static:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -34,6 +60,9 @@ jobs:
|
||||
env:
|
||||
GITHUB_REPO: github.com/${{ github.repository_owner }}/qinglong-static
|
||||
GITHUB_BRANCH: ${{ github.ref_name }}
|
||||
REPO_GITEE: git@gitee.com:whyour/qinglong-static.git
|
||||
REPO_GITLAB: git@gitlab.com:whyour/qinglong-static.git
|
||||
PRIVATE_KEY: ${{ secrets.GITLAB_SSH_PK }}
|
||||
run: |
|
||||
mkdir -p tmp
|
||||
cd ./tmp
|
||||
@@ -44,6 +73,16 @@ jobs:
|
||||
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}
|
||||
|
||||
mkdir -p ~/.ssh
|
||||
echo "${PRIVATE_KEY}" > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
|
||||
export GIT_SSH_COMMAND="ssh -v -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no -l git"
|
||||
git remote add gitee "${REPO_GITEE}"
|
||||
git remote add gitlab "${REPO_GITLAB}"
|
||||
git push --force --quiet gitee ${GITHUB_BRANCH}:${GITHUB_BRANCH}
|
||||
git push --force --quiet gitlab ${GITHUB_BRANCH}:${GITHUB_BRANCH}
|
||||
|
||||
build:
|
||||
needs: build-static
|
||||
|
||||
|
||||
+5
-2
@@ -8,6 +8,7 @@ import { celebrate, Joi } from 'celebrate';
|
||||
import UserService from '../services/user';
|
||||
import { EnvModel } from '../data/env';
|
||||
import { promiseExec } from '../config/util';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
const route = Router();
|
||||
|
||||
@@ -25,7 +26,9 @@ export default (app: Router) => {
|
||||
const currentVersionFile = fs.readFileSync(config.versionFile, 'utf8');
|
||||
const version = currentVersionFile.match(versionRegx)![1];
|
||||
const lastCommitTime = (
|
||||
await promiseExec(`cd ${config.rootPath} && git show -s --format=%ai | head -1`)
|
||||
await promiseExec(
|
||||
`cd ${config.rootPath} && git show -s --format=%ai | head -1`,
|
||||
)
|
||||
).replace('\n', '');
|
||||
const lastCommitId = (
|
||||
await promiseExec(`cd ${config.rootPath} && git rev-parse --short HEAD`)
|
||||
@@ -50,7 +53,7 @@ export default (app: Router) => {
|
||||
data: {
|
||||
isInitialized,
|
||||
version,
|
||||
lastCommitTime,
|
||||
lastCommitTime: dayjs(lastCommitTime).unix(),
|
||||
lastCommitId,
|
||||
branch,
|
||||
},
|
||||
|
||||
@@ -41,6 +41,7 @@ export class ServerChanNotification extends NotificationBaseInfo {
|
||||
|
||||
export class PushDeerNotification extends NotificationBaseInfo {
|
||||
public pushDeerKey = '';
|
||||
public pushDeerUrl = '';
|
||||
}
|
||||
|
||||
export class ChatNotification extends NotificationBaseInfo {
|
||||
|
||||
@@ -123,8 +123,8 @@ export default class NotificationService {
|
||||
}
|
||||
|
||||
private async pushDeer() {
|
||||
const { pushDeerKey } = this.params;
|
||||
const url = `https://api2.pushdeer.com/message/push`;
|
||||
const { pushDeerKey, pushDeerUrl } = this.params;
|
||||
const url = pushDeerUrl || `https://api2.pushdeer.com/message/push`;
|
||||
const res: any = await got
|
||||
.post(url, {
|
||||
...this.gotOption,
|
||||
|
||||
+1
-1
@@ -136,7 +136,7 @@
|
||||
"sockjs-client": "^1.6.0",
|
||||
"ts-node": "^10.6.0",
|
||||
"tslib": "^2.4.0",
|
||||
"typescript": "^4.6.2",
|
||||
"typescript": "4.8.4",
|
||||
"umi-request": "^1.4.0",
|
||||
"vh-check": "^2.0.5",
|
||||
"webpack": "^5.70.0",
|
||||
|
||||
+3
-1
@@ -38,6 +38,7 @@ let SCKEY = '';
|
||||
//此处填你申请的PushDeer KEY.
|
||||
//(环境变量名 DEER_KEY)
|
||||
let PUSHDEER_KEY = '';
|
||||
let PUSHDEER_URL = '';
|
||||
|
||||
// =======================================Synology Chat通知设置区域===========================================
|
||||
//此处填你申请的CHAT_URL与CHAT_TOKEN
|
||||
@@ -151,6 +152,7 @@ if (process.env.PUSH_KEY) {
|
||||
|
||||
if (process.env.DEER_KEY) {
|
||||
PUSHDEER_KEY = process.env.DEER_KEY;
|
||||
PUSHDEER_URL = process.env.DEER_URL;
|
||||
}
|
||||
|
||||
if (process.env.CHAT_URL) {
|
||||
@@ -413,7 +415,7 @@ function PushDeerNotify(text, desp) {
|
||||
// PushDeer 建议对消息内容进行 urlencode
|
||||
desp = encodeURI(desp);
|
||||
const options = {
|
||||
url: `https://api2.pushdeer.com/message/push`,
|
||||
url: PUSHDEER_URL || `https://api2.pushdeer.com/message/push`,
|
||||
body: `pushkey=${PUSHDEER_KEY}&text=${text}&desp=${desp}&type=markdown`,
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
|
||||
@@ -61,6 +61,7 @@ push_config = {
|
||||
'PUSH_KEY': '', # server 酱的 PUSH_KEY,兼容旧版与 Turbo 版
|
||||
|
||||
'DEER_KEY': '', # PushDeer 的 PUSHDEER_KEY
|
||||
'DEER_URL': '', # PushDeer 的 PUSHDEER_URL
|
||||
|
||||
'CHAT_URL': '', # synology chat url
|
||||
'CHAT_TOKEN': '', # synology chat token
|
||||
@@ -280,6 +281,9 @@ def pushdeer(title: str, content: str) -> None:
|
||||
print("PushDeer 服务启动")
|
||||
data = {"text": title, "desp": content, "type": "markdown", "pushkey": push_config.get("DEER_KEY")}
|
||||
url = 'https://api2.pushdeer.com/message/push'
|
||||
if push_config.get("DEER_URL"):
|
||||
url = push_config.get("DEER_URL")
|
||||
|
||||
response = requests.post(url, data=data).json()
|
||||
|
||||
if len(response.get("content").get("result")) > 0:
|
||||
|
||||
+7
-6
@@ -333,7 +333,6 @@ git_pull_scripts() {
|
||||
exit_status=$?
|
||||
git pull &>/dev/null
|
||||
unset_proxy
|
||||
reset_branch "$branch"
|
||||
|
||||
cd $dir_current
|
||||
}
|
||||
@@ -344,19 +343,21 @@ reset_romote_url() {
|
||||
local url=$2
|
||||
local branch="$3"
|
||||
|
||||
cd $dir_work
|
||||
if [[ -d "$dir_work/.git" ]]; then
|
||||
cd $dir_work
|
||||
[[ -f ".git/index.lock" ]] && rm -f .git/index.lock >/dev/null
|
||||
git remote set-url origin $url &>/dev/null
|
||||
|
||||
local part_cmd=""
|
||||
reset_branch "$branch"
|
||||
cd $dir_current
|
||||
else
|
||||
git init
|
||||
git remote add origin $url &>/dev/null
|
||||
fi
|
||||
reset_branch "$branch"
|
||||
cd $dir_current
|
||||
}
|
||||
|
||||
reset_branch() {
|
||||
local branch="$1"
|
||||
local part_cmd=""
|
||||
if [[ $branch ]]; then
|
||||
part_cmd="origin/${branch}"
|
||||
git checkout -B "$branch" &>/dev/null
|
||||
|
||||
+8
-2
@@ -247,6 +247,12 @@ usage() {
|
||||
update_qinglong() {
|
||||
patch_version &>/dev/null
|
||||
|
||||
local mirror="github"
|
||||
local githubStatus=$(curl -s -m 3 -IL "https://github.com" | grep 200)
|
||||
if [ "$githubStatus" == "" ]; then
|
||||
mirror="gitee"
|
||||
fi
|
||||
echo -e "\n使用 ${mirror} 源更新...\n"
|
||||
export isFirstStartServer=false
|
||||
|
||||
local all_branch=$(git branch -a)
|
||||
@@ -255,7 +261,7 @@ update_qinglong() {
|
||||
primary_branch="${current_branch}"
|
||||
fi
|
||||
[[ -f $dir_root/package.json ]] && ql_depend_old=$(cat $dir_root/package.json)
|
||||
reset_romote_url ${dir_root} "https://github.com/whyour/qinglong.git" ${primary_branch}
|
||||
reset_romote_url ${dir_root} "https://${mirror}.com/whyour/qinglong.git" ${primary_branch}
|
||||
git_pull_scripts $dir_root ${primary_branch}
|
||||
|
||||
if [[ $exit_status -eq 0 ]]; then
|
||||
@@ -276,7 +282,7 @@ update_qinglong() {
|
||||
update_qinglong_static() {
|
||||
local no_restart="$1"
|
||||
local primary_branch="$2"
|
||||
local url="https://github.com/whyour/qinglong-static.git"
|
||||
local url="https://${mirror}.com/whyour/qinglong-static.git"
|
||||
if [[ -d ${ql_static_repo}/.git ]]; then
|
||||
reset_romote_url ${ql_static_repo} ${url} ${primary_branch}
|
||||
git_pull_scripts ${ql_static_repo} ${primary_branch}
|
||||
|
||||
@@ -50,7 +50,7 @@ interface TSystemInfo {
|
||||
branch: 'develop' | 'master';
|
||||
isInitialized: boolean;
|
||||
lastCommitId: string;
|
||||
lastCommitTime: string;
|
||||
lastCommitTime: number;
|
||||
version: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,9 @@ const About = ({ systemInfo }: { systemInfo: SharedContext['systemInfo'] }) => {
|
||||
{TVersion[systemInfo.branch]} v{systemInfo.version}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="更新时间" span={3}>
|
||||
{dayjs(systemInfo.lastCommitTime).format('YYYY-MM-DD HH:mm:ss')}
|
||||
{dayjs(systemInfo.lastCommitTime * 1000).format(
|
||||
'YYYY-MM-DD HH:mm:ss',
|
||||
)}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="更新ID" span={3}>
|
||||
{systemInfo.lastCommitId}
|
||||
|
||||
@@ -31,7 +31,7 @@ import CheckUpdate from './checkUpdate';
|
||||
import About from './about';
|
||||
import { useOutletContext } from '@umijs/max';
|
||||
import { SharedContext } from '@/layouts';
|
||||
import './index.less'
|
||||
import './index.less';
|
||||
|
||||
const { Text } = Typography;
|
||||
const optionsWithDisabled = [
|
||||
@@ -80,10 +80,15 @@ const Setting = () => {
|
||||
dataIndex: 'scopes',
|
||||
key: 'scopes',
|
||||
align: 'center' as const,
|
||||
width: '40%',
|
||||
render: (text: string, record: any) => {
|
||||
return record.scopes.map((scope: any) => {
|
||||
return <Tag key={scope}>{(config.scopesMap as any)[scope]}</Tag>;
|
||||
});
|
||||
return (
|
||||
<div style={{ textAlign: 'left' }}>
|
||||
{record.scopes.map((scope: any) => {
|
||||
return <Tag key={scope}>{(config.scopesMap as any)[scope]}</Tag>;
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -137,6 +137,10 @@ export default {
|
||||
tip: 'PushDeer的Key,https://github.com/easychen/pushdeer',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: 'pushDeerUrl',
|
||||
tip: 'PushDeer的自架API endpoint,默认是 https://api2.pushdeer.com/message/push',
|
||||
},
|
||||
],
|
||||
bark: [
|
||||
{
|
||||
|
||||
+7
-10
@@ -1,11 +1,8 @@
|
||||
export const version = '2.15.0';
|
||||
export const changeLogLink = 'https://t.me/jiao_long/340';
|
||||
export const changeLog = `2.15.0 版本说明
|
||||
1. 任务视图筛选条件支持 且/或
|
||||
2. 订阅支持设置代理
|
||||
3. 修改日志管理列表默认排序
|
||||
4. 修复openapi token生成逻辑
|
||||
5. 修复日志管理搜索失效
|
||||
6. 修复系统最后commit时间获取
|
||||
7. 其他优化
|
||||
export const version = '2.15.1';
|
||||
export const changeLogLink = 'https://t.me/jiao_long/341';
|
||||
export const changeLog = `2.15.1 版本说明
|
||||
1. 系统更新增加 gitee 更新源
|
||||
2. pushDeer 通知增加自架版
|
||||
3. 修复移动端最后更新时间展示
|
||||
4. 其他优化
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user