From 035f0eb9e3cd63e84110533ecd2a22a09612db86 Mon Sep 17 00:00:00 2001 From: whyour Date: Sun, 16 Jun 2024 00:28:45 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=80=E8=A8=80=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sample/notify.js | 3 +-- sample/notify.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/sample/notify.js b/sample/notify.js index 0379fba6..9a2ca41a 100644 --- a/sample/notify.js +++ b/sample/notify.js @@ -97,7 +97,6 @@ const push_config = { WEBHOOK_CONTENT_TYPE: '', // 自定义通知 content-type }; -// 首先读取 面板变量 或者 github action 运行变量 for (const key in push_config) { const v = process.env[key]; if (v) { @@ -1290,7 +1289,7 @@ async function sendNotify(text, desp, params = {}) { } } - if (push_config.HITOKOTO) { + if (push_config.HITOKOTO !== 'false') { desp += '\n\n' + (await one()); } diff --git a/sample/notify.py b/sample/notify.py index fe3bb53e..4c87cd9b 100644 --- a/sample/notify.py +++ b/sample/notify.py @@ -120,7 +120,6 @@ push_config = { } # fmt: on -# 首先读取 面板变量 或者 github action 运行变量 for k in push_config: if os.getenv(k): v = os.getenv(k) @@ -962,7 +961,7 @@ def send(title: str, content: str, ignore_default_config: bool = False, **kwargs return hitokoto = push_config.get("HITOKOTO") - content += "\n\n" + one() if hitokoto else "" + content += "\n\n" + one() if hitokoto != "false" else "" notify_function = add_notify_function() ts = [ From a45efbd69b3be20e0dbb66fc53bd398513935c31 Mon Sep 17 00:00:00 2001 From: whyour Date: Mon, 17 Jun 2024 23:04:47 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=9F=A5=E8=AF=A2=E4=B8=8D=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E7=9A=84=E8=AE=A2=E9=98=85=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/crontab/index.tsx | 12 +++++++++--- src/utils/http.ts | 37 ++++++++++++++++++++++++++++--------- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/src/pages/crontab/index.tsx b/src/pages/crontab/index.tsx index 4aa3ee02..c83ff1a2 100644 --- a/src/pages/crontab/index.tsx +++ b/src/pages/crontab/index.tsx @@ -57,6 +57,7 @@ import { useVT } from 'virtualizedtableforantd4'; import { ICrontab, OperationName, OperationPath, CrontabStatus } from './type'; import Name from '@/components/name'; import dayjs from 'dayjs'; +import { noop } from 'lodash'; const { Text, Paragraph, Link } = Typography; const { Search } = Input; @@ -76,7 +77,7 @@ const Crontab = () => { wordBreak: 'break-all', marginBottom: 0, color: '#1890ff', - cursor: 'pointer' + cursor: 'pointer', }} ellipsis={{ tooltip: text, rows: 2 }} onClick={() => { @@ -270,9 +271,14 @@ const Crontab = () => { record.sub_id ? ( - request.get(`${config.apiPrefix}subscriptions/${record.sub_id}`) + request.get(`${config.apiPrefix}subscriptions/${record.sub_id}`, { + onError: noop, + }) } - options={{ ready: record?.sub_id, cacheKey: record.sub_id }} + options={{ + ready: record?.sub_id, + cacheKey: record.sub_id, + }} /> ) : ( '-' diff --git a/src/utils/http.ts b/src/utils/http.ts index cee0fd00..e276ecdd 100644 --- a/src/utils/http.ts +++ b/src/utils/http.ts @@ -1,29 +1,44 @@ -import intl from 'react-intl-universal' +import intl from 'react-intl-universal'; import { message } from 'antd'; import config from './config'; import { history } from '@umijs/max'; -import axios, { AxiosError, AxiosInstance, AxiosRequestConfig } from 'axios'; +import axios, { + AxiosError, + AxiosInstance, + AxiosRequestConfig, + AxiosResponse, + InternalAxiosRequestConfig, +} from 'axios'; -interface IResponseData { +export interface IResponseData { code?: number; data?: any; message?: string; error?: any; } -type Override< +export type Override< T, K extends Partial<{ [P in keyof T]: any }> | string, > = K extends string ? Omit & { [P in keyof T]: T[P] | unknown } : Omit & K; +export interface ICustomConfig { + onError?: (res: AxiosResponse) => void; +} + message.config({ duration: 2, }); const time = Date.now(); -const errorHandler = function (error: AxiosError) { +const errorHandler = function ( + error: Override< + AxiosError, + { config: InternalAxiosRequestConfig & ICustomConfig } + >, +) { if (error.response) { const msg = error.response.data ? error.response.data.message || error.message || error.response.data @@ -38,6 +53,10 @@ const errorHandler = function (error: AxiosError) { history.push('/login'); } } else { + if (typeof error.config?.onError === 'function') { + return error.config?.onError(error.response); + } + message.error({ content: msg, style: { maxWidth: 500, margin: '0 auto' }, @@ -105,21 +124,21 @@ export const request = _request as Override< { get( url: string, - config?: AxiosRequestConfig, + config?: AxiosRequestConfig & ICustomConfig, ): Promise; delete( url: string, - config?: AxiosRequestConfig, + config?: AxiosRequestConfig & ICustomConfig, ): Promise; post( url: string, data?: D, - config?: AxiosRequestConfig, + config?: AxiosRequestConfig & ICustomConfig, ): Promise; put( url: string, data?: D, - config?: AxiosRequestConfig, + config?: AxiosRequestConfig & ICustomConfig, ): Promise; } >; From 0d492e94f4ca31ab89d53be290533c53dff48700 Mon Sep 17 00:00:00 2001 From: whyour Date: Sun, 23 Jun 2024 22:22:36 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9C=AA=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E9=80=9A=E7=9F=A5=E6=97=B6=E9=80=9A=E7=9F=A5=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/services/user.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/services/user.ts b/back/services/user.ts index 74a95c67..80408cc4 100644 --- a/back/services/user.ts +++ b/back/services/user.ts @@ -351,7 +351,7 @@ export default class UserService { public async getNotificationMode(): Promise { const doc = await this.getDb({ type: AuthDataType.notification }); - return doc.info as NotificationInfo; + return (doc.info || {}) as NotificationInfo; } private async updateAuthDb(payload: SystemInfo): Promise { From 1eb5c3ab537059f76e85ec667f3689add163a2c4 Mon Sep 17 00:00:00 2001 From: whyour Date: Sun, 23 Jun 2024 22:22:39 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC=20v2.1?= =?UTF-8?q?7.6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- version.yaml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/version.yaml b/version.yaml index fac0557c..e847b062 100644 --- a/version.yaml +++ b/version.yaml @@ -1,9 +1,7 @@ -version: 2.17.5 -changeLogLink: https://t.me/jiao_long/406 -publishTime: 2024-05-25 19:00 +version: 2.17.6 +changeLogLink: https://t.me/jiao_long/407 +publishTime: 2024-06-14 23:00 changeLog: | - 1. 修复有可能手动运行任务无日志 - 2. 重构 JavaScript 脚本通知文件 - 3. PushMe 通知支持自建服务 - 4. 增加微加机器人消息通道 - 5. 修复任务详情查看脚本错误 + 1. bark 推送改为 post 请求,防止请求头过大 + 2. 修复单文件订阅代理无效 + 3. 修复系统设置通知和依赖数据未初始化