修复:通知页 SMTP 授权码提交格式
This commit is contained in:
1 parent
37e494ae76
commit
3710317011
12 files changed
+69
-46
No files matched your search
@@ -29,7 +29,7 @@ import { appendCardData,batchCreateCards,createCard,deleteCard,getCardDetails,ge
|
||||
import { getChatMessagePage,getChatMessages,getChatSessionPage,getChatSessions,markChatRead,sendChatImage,sendChatMessage } from './chat/api';
|
||||
import { getDashboardStats,getOrderAnalytics,getValidOrders } from './dashboard/api';
|
||||
import { cancelItemPublishBatch,createItem,deleteItem,deleteItemPublishBatch,getItemDetail,getItemPublishBatch,getItemPublishBatches,getItems,previewItemPublishBatch,publishItem,recommendPublishCategory,retryFailedItemPublishBatch,startItemPublishBatch,syncItemsFromAccount,updateItem } from './items/api';
|
||||
import { createNotificationChannel,deleteAccountNotifications,deleteMessageNotification,deleteNotificationChannel,getAccountBindings,getMessageNotifications,getNotificationChannels,setAccountBindings,setMessageNotification,testNotificationChannel,updateNotificationChannel } from './notifications/api';
|
||||
import { createNotificationChannel,deleteAccountNotifications,deleteMessageNotification,deleteNotificationChannel,getAccountBindings,getMessageNotifications,getNotificationChannels,setAccountBindings,setMessageNotification,testNotificationChannel,updateNotificationChannel,updateSystemSettings as updateNotificationSystemSettings } from './notifications/api';
|
||||
import { cancelOrderRefreshJob,deleteOrder,getAdminStats,getOrderDetail,getOrders,importOrders,manualShipOrder,syncOrders,syncSingleOrder,updateOrder } from './orders/api';
|
||||
import { clearDefaultReplyRecords,deleteDefaultReply,deleteReplyRule,deleteShippingRule,getAutomationIssues,getDefaultReplies,getDefaultReply,getReplyRules,getShippingRules,getShippingRulesPage,resolveAutomationRun,resolveDeferredAutomationTask,updateDefaultReply,updateReplyRule,updateShippingRule } from './rules/api';
|
||||
import { initializeAdmin,login,logout,verifySession } from './session/api';
|
||||
@@ -89,6 +89,18 @@ test('updateSystemSettings separates sensitive values into explicit commands', /
|
||||
});
|
||||
});
|
||||
|
||||
test('notification SMTP settings separate the authorization code into a secret command', /* 当前回调验证通知页不会把 SMTP 授权码写入普通设置。 */ async () => {
|
||||
// fetchMock 是通知页系统设置更新请求的 HTTP 替身。
|
||||
const fetchMock = vi.fn().mockResolvedValue(jsonResponse({ success: true }));
|
||||
stubContractFetch(fetchMock);
|
||||
await updateNotificationSystemSettings({ smtp_server: 'smtp.example.com', smtp_port: 465, smtp_user: 'sender@example.com', smtp_password: 'test-smtp-secret' });
|
||||
// payload 是通知页适配器分流后的普通设置和敏感命令。
|
||||
const payload = JSON.parse(fetchMock.mock.calls[0][1].body);
|
||||
expect(payload.values).toEqual({ smtp_server: 'smtp.example.com', smtp_port: 465, smtp_user: 'sender@example.com' });
|
||||
expect(payload.secrets).toEqual({ smtp_password: { action: 'replace', value: 'test-smtp-secret' } });
|
||||
expect(payload.values).not.toHaveProperty('smtp_password');
|
||||
});
|
||||
|
||||
test('health API exposes build metadata through the request boundary', async () => {
|
||||
// fetchMock 是健康检查 API 的请求替身。
|
||||
const fetchMock = vi.fn().mockResolvedValue(jsonResponse({ version: '1.2.3', commit: 'abc123' }));
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { MutationIDResponse,NotificationBinding,NotificationChannel,NotificationChannelResponse,NotificationEventType,OperationResponse,SystemSettings } from './models';
|
||||
import { normalizeSystemSettingsUpdate } from '../../../shared/api-contract/settings';
|
||||
import { type RequestControlOptions } from '../../../shared/http/client';
|
||||
import { contractClient, runContractRequest } from '../../../shared/api-contract/client';
|
||||
export type * from './models';
|
||||
@@ -128,4 +129,4 @@ export const getSystemSettings = async (options?: RequestControlOptions): Promis
|
||||
};
|
||||
|
||||
/** 保存通知 SMTP 编辑器提交的系统设置。 */
|
||||
export const updateSystemSettings = async (settings: Partial<SystemSettings>, options?: RequestControlOptions): Promise<OperationResponse> => runContractRequest(/* signal 控制系统设置更新请求的取消和超时。 */ signal => contractClient.PUT('/api/v1/settings/system', { body: settings as never, signal }), options);
|
||||
export const updateSystemSettings = async (settings: Partial<SystemSettings>, options?: RequestControlOptions): Promise<OperationResponse> => runContractRequest(/* signal 控制系统设置更新请求的取消和超时。 */ signal => contractClient.PUT('/api/v1/settings/system', { body: normalizeSystemSettingsUpdate(settings), signal }), options);
|
||||
@@ -1,7 +1,11 @@
|
||||
import type { OperationResponse,SystemSettings } from './models';
|
||||
import { contractClient, runContractRequest } from '../../../shared/api-contract/client';
|
||||
import { normalizeSystemSettingsUpdate,SENSITIVE_SYSTEM_SETTING_KEYS } from '../../../shared/api-contract/settings';
|
||||
import { type RequestControlOptions } from '../../../shared/http/client';
|
||||
import type { SystemSettingsUpdate } from '../../../shared/api-contract/settings';
|
||||
export type * from './models';
|
||||
export { normalizeSystemSettingsUpdate } from '../../../shared/api-contract/settings';
|
||||
export type { SensitiveSettingChange,SystemSettingsUpdate } from '../../../shared/api-contract/settings';
|
||||
|
||||
/** 设置页面使用的会话状态传输契约,避免跨 feature 依赖。 */
|
||||
export interface SettingsSessionStatusResponse {
|
||||
@@ -17,43 +21,6 @@ export interface SettingsSessionStatusResponse {
|
||||
is_admin?: boolean;
|
||||
}
|
||||
|
||||
/** 敏感系统设置的显式三态变更命令。 */
|
||||
export type SensitiveSettingChange = {
|
||||
/** 敏感值的保存策略。 */
|
||||
action: 'retain' | 'replace' | 'clear';
|
||||
/** replace 策略需要保存的新值,只存在于提交请求中。 */
|
||||
value?: string;
|
||||
};
|
||||
|
||||
/** 系统设置更新请求,将普通配置与敏感命令分开传输。 */
|
||||
export type SystemSettingsUpdate = {
|
||||
/** 非敏感配置字段。 */
|
||||
values?: Record<string, string | number | boolean>;
|
||||
/** 由服务端解释的敏感值变更命令。 */
|
||||
secrets?: Record<string, SensitiveSettingChange>;
|
||||
};
|
||||
|
||||
/** SENSITIVE_SYSTEM_SETTING_KEYS 标识不得写入普通 values 的秘密键。 */
|
||||
const SENSITIVE_SYSTEM_SETTING_KEYS = new Set(['ai_api_key', 'smtp_password', 'qq_reply_secret_key', 'captcha.remote_secret_key']);
|
||||
|
||||
/** 将历史设置草稿转换为服务端要求的普通值与敏感命令结构。 */
|
||||
const normalizeSystemSettingsUpdate = (settings: Partial<SystemSettings> | SystemSettingsUpdate): SystemSettingsUpdate => {
|
||||
if ('values' in settings || 'secrets' in settings) return settings as SystemSettingsUpdate;
|
||||
// values 保存普通设置,永不容纳秘密文本。
|
||||
const values: Record<string, string | number | boolean> = {};
|
||||
// secrets 保存服务端需要独立处理的敏感设置命令。
|
||||
const secrets: Record<string, SensitiveSettingChange> = {};
|
||||
for (const /* key、value 是当前待分流的设置键和值。 */ [key, value] of Object.entries(settings)) {
|
||||
if (value === undefined || value === null) continue;
|
||||
if (SENSITIVE_SYSTEM_SETTING_KEYS.has(key)) {
|
||||
secrets[key] = value === '' ? { action: 'clear' } : { action: 'replace', value: String(value) };
|
||||
continue;
|
||||
}
|
||||
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') values[key] = value;
|
||||
}
|
||||
return Object.keys(secrets).length > 0 ? { values, secrets } : values;
|
||||
};
|
||||
|
||||
/** 将服务端可兼容的字符串和数值设置归一为 UI 可消费的只读契约。 */
|
||||
const normalizeSettings = (settings: Record<string, unknown>): SystemSettings => {
|
||||
// result 是不修改原始响应的设置副本。
|
||||
|
||||
@@ -1,7 +1,49 @@
|
||||
// settings 只公开 OpenAPI 生成的设置传输类型;表单状态属于 settings feature。
|
||||
// settings 只公开 OpenAPI 生成的设置传输类型和跨 feature 共用的更新契约;表单状态属于各自 feature。
|
||||
import type { components } from './generated/schema';
|
||||
|
||||
/** SystemSettingsTransport 表示受约束动态键的设置响应。 */
|
||||
export type SystemSettingsTransport = components['schemas']['SystemSettingsResponse'];
|
||||
/** AIModelsTransport 表示生成的模型发现响应。 */
|
||||
export type AIModelsTransport = components['schemas']['AIModelsResponse'];
|
||||
|
||||
/** 敏感系统设置的显式三态变更命令。 */
|
||||
export type SensitiveSettingChange = {
|
||||
/** 敏感值的保存策略。 */
|
||||
action: 'retain' | 'replace' | 'clear';
|
||||
/** replace 策略需要保存的新值,只存在于提交请求中。 */
|
||||
value?: string;
|
||||
};
|
||||
|
||||
/** 系统设置更新请求,将普通配置与敏感命令分开传输。 */
|
||||
export type SystemSettingsUpdate = {
|
||||
/** 非敏感配置字段。 */
|
||||
values?: Record<string, string | number | boolean>;
|
||||
/** 由服务端解释的敏感值变更命令。 */
|
||||
secrets?: Record<string, SensitiveSettingChange>;
|
||||
};
|
||||
|
||||
/** SENSITIVE_SYSTEM_SETTING_KEYS 标识不得写入普通 values 的秘密键。 */
|
||||
export const SENSITIVE_SYSTEM_SETTING_KEYS = new Set([
|
||||
'ai_api_key',
|
||||
'smtp_password',
|
||||
'qq_reply_secret_key',
|
||||
'captcha.remote_secret_key',
|
||||
]);
|
||||
|
||||
/** 将各 feature 的设置草稿转换为服务端要求的普通值与敏感命令结构。 */
|
||||
export const normalizeSystemSettingsUpdate = (settings: Record<string, string | number | boolean | undefined> | SystemSettingsUpdate): SystemSettingsUpdate => {
|
||||
if ('values' in settings || 'secrets' in settings) return settings as SystemSettingsUpdate;
|
||||
// values 保存普通设置,永不容纳秘密文本。
|
||||
const values: Record<string, string | number | boolean> = {};
|
||||
// secrets 保存服务端需要独立处理的敏感设置命令。
|
||||
const secrets: Record<string, SensitiveSettingChange> = {};
|
||||
for (const /* key、value 是当前待分流的设置键和值。 */ [key, value] of Object.entries(settings)) {
|
||||
if (value === undefined || value === null) continue;
|
||||
if (SENSITIVE_SYSTEM_SETTING_KEYS.has(key)) {
|
||||
secrets[key] = value === '' ? { action: 'clear' } : { action: 'replace', value: String(value) };
|
||||
continue;
|
||||
}
|
||||
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') values[key] = value;
|
||||
}
|
||||
return Object.keys(secrets).length > 0 ? { values, secrets } : values;
|
||||
};
|
||||
+1
-1
@@ -1 +1 @@
|
||||
import{d as E,j as e,a}from"./react-vendor-Bf9ELcll.js";import{L as pe}from"./vendor-BE-_xUHH.js";import{B as me}from"./audio-codec-mjVr_wwJ.js";import{L as G,an as de,ao as ge,u as xe,ap as ue,aq as he,M as Q0,V as _e,R as be,ag as D0,m as fe,ar as je,x as J0,as as we,at as Ne,au as ye,av as Ce,S as W0,X as Oe}from"./icons-vendor-BSp7PTZg.js";import{a as U0,i as R,d as i0,e as V0,f as z0,m as Z0,h as ve,j as ke,k as q0,l as Se,s as Re,n as Ee,o as Ie,p as Me,g as Le,q as G0,u as $0,t as P0,C as De}from"./chat-metadata-74T0w35U.js";import{p as Ue,s as qe}from"./index-dO7JyNQY.js";const H0="ydisks:chat-audio-play",Pe=[6,10,15,8,17,12,7,16,11,6,14,9];function Te(u){const _=u.trim();if(typeof location>"u"||location.protocol!=="https:")return _;try{const n=new URL(_);return n.protocol==="http:"&&n.hostname.endsWith(".aliyuncs.com")&&(n.protocol="https:"),n.toString()}catch{return _}}function T0(u){const _=Number.isFinite(u)?Math.max(0,Math.floor(u)):0,n=Math.floor(_/60),l=_%60;return`${n}:${l.toString().padStart(2,"0")}`}function A0(u){window.dispatchEvent(new CustomEvent(H0,{detail:u}))}const Ae=({messageKey:u,src:_,outgoing:n,initialDuration:l=0})=>{const x=E.useRef(null),C=E.useRef(0),[o,I]=E.useState("idle"),[M,L]=E.useState(l),[V,T]=E.useState(0);E.useEffect(()=>(()=>{var d;C.current+=1,(d=x.current)==null||d.destroy(),x.current=null}),[_]),E.useEffect(()=>{L(Math.max(0,l))},[l]),E.useEffect(()=>{const d=f=>{const w=f.detail,N=x.current;w!==u&&(N!=null&&N.isPlaying())&&N.pause()};return window.addEventListener(H0,d),(()=>window.removeEventListener(H0,d))},[u]),E.useEffect(()=>{if(o!=="playing")return;const d=window.setInterval(()=>{const f=x.current;f&&T(f.getCurrentPosition())},100);return(()=>window.clearInterval(d))},[o]);const A=(d,f)=>{const w=()=>C.current===f&&x.current===d;d.onPlay(()=>{w()&&I("playing")}),d.onResume(()=>{w()&&I("playing")}),d.onPause(()=>{w()&&I("paused")}),d.onStop(()=>{w()&&(I("idle"),T(0))}),d.onEnded(()=>{w()&&(I("idle"),T(0))})},r0=async()=>{var w;const d=x.current;if(d!=null&&d.isPlaying()){d.pause();return}if(d!=null&&d.isPaused()){A0(u),d.resume();return}if(d!=null&&d.isInit()){A0(u),d.play();return}if(o==="loading")return;const f=C.current+1;C.current=f,I("loading"),T(0);try{const N=new me;if(x.current=N,A(N,f),await N.initWithUrl(Te(_)),C.current!==f||x.current!==N){N.destroy();return}L(N.getDuration()||Math.max(0,l)),A0(u),N.play()}catch{if(C.current!==f)return;(w=x.current)==null||w.destroy(),x.current=null,I("error"),T(0)}},H=o==="playing"||o==="paused"?V:M,$=M>0?o==="playing"||o==="paused"?`${T0(H)} / ${T0(M)}`:T0(M):"--:--",P=o==="loading"?"正在解码":o==="playing"?"正在播放":o==="paused"?"已暂停":o==="error"?"加载失败,点击重试":"语音消息",O=o==="playing"?"暂停语音消息":o==="paused"?"继续播放语音消息":o==="error"?"重新加载语音消息":o==="loading"?"正在加载语音消息":"播放语音消息";return e.jsxs("div",{className:`flex h-11 min-w-56 items-center gap-2 rounded-2xl border px-2 shadow-sm ${n?"rounded-br-md border-sky-400 bg-sky-500 text-white":"rounded-bl-md border-slate-200 bg-white text-slate-800"}`,children:[e.jsx("button",{type:"button","aria-label":O,title:O,disabled:o==="loading",onClick:(()=>void r0()),className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-full transition focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-wait ${n?"bg-white text-sky-600 hover:bg-sky-50 focus-visible:ring-white":"bg-sky-50 text-sky-600 hover:bg-sky-100 focus-visible:ring-sky-400"}`,children:o==="loading"?e.jsx(G,{className:"h-4 w-4 animate-spin"}):o==="playing"?e.jsx(de,{className:"h-4 w-4 fill-current"}):o==="error"?e.jsx(ge,{className:"h-4 w-4"}):e.jsx(xe,{className:"ml-px h-4 w-4 fill-current"})}),e.jsxs("div",{className:"min-w-0 flex flex-1 items-center gap-2",children:[e.jsx("div",{className:"flex h-5 flex-1 items-center gap-0.5","aria-hidden":"true",children:Pe.map((d,f)=>e.jsx("span",{className:`w-0.5 rounded-full ${o==="playing"?"animate-pulse":""} ${n?"bg-sky-100":o==="error"?"bg-red-300":"bg-sky-400"}`,style:{height:`${d}px`,animationDelay:`${f*45}ms`}},`${u}-${f}`))}),e.jsx("span",{className:`shrink-0 font-mono text-[11px] font-semibold tabular-nums ${n?"text-sky-100":o==="error"?"text-red-500":"text-slate-500"}`,children:$}),e.jsx("span",{className:"sr-only",children:P})]})]})},X0=[["尊嘟假嘟","https://img.alicdn.com/imgextra/i2/O1CN01hWzOgD1KcmFEIaGwE_!!6000000001185-2-tps-64-64.png_110x10000.jpg_.webp"],["鸡哔你","https://img.alicdn.com/imgextra/i1/O1CN01P9TVJl1JCqCZcQIdW_!!6000000000993-2-tps-64-64.png_110x10000.jpg_.webp"],["谁懂啊","https://img.alicdn.com/imgextra/i1/O1CN01r9qUnx1g3tcrtSmcs_!!6000000004087-2-tps-64-64.png_110x10000.jpg_.webp"],["吗喽","https://img.alicdn.com/imgextra/i4/O1CN01dTynZh1LnbIYTHI1D_!!6000000001344-2-tps-64-64.png_110x10000.jpg_.webp"],["功德+1","https://img.alicdn.com/imgextra/i1/O1CN01l1G5pS1IVn37pfQJi_!!6000000000899
Line truncated
|
||||
import{d as E,j as e,a}from"./react-vendor-Bf9ELcll.js";import{L as pe}from"./vendor-BE-_xUHH.js";import{B as me}from"./audio-codec-mjVr_wwJ.js";import{L as G,an as de,ao as ge,u as xe,ap as ue,aq as he,M as Q0,V as _e,R as be,ag as D0,m as fe,ar as je,x as J0,as as we,at as Ne,au as ye,av as Ce,S as W0,X as Oe}from"./icons-vendor-BSp7PTZg.js";import{a as U0,i as R,d as i0,e as V0,f as z0,m as Z0,h as ve,j as ke,k as q0,l as Se,s as Re,n as Ee,o as Ie,p as Me,g as Le,q as G0,u as $0,t as P0,C as De}from"./chat-metadata-74T0w35U.js";import{p as Ue,s as qe}from"./index-Q3nlx6gR.js";const H0="ydisks:chat-audio-play",Pe=[6,10,15,8,17,12,7,16,11,6,14,9];function Te(u){const _=u.trim();if(typeof location>"u"||location.protocol!=="https:")return _;try{const n=new URL(_);return n.protocol==="http:"&&n.hostname.endsWith(".aliyuncs.com")&&(n.protocol="https:"),n.toString()}catch{return _}}function T0(u){const _=Number.isFinite(u)?Math.max(0,Math.floor(u)):0,n=Math.floor(_/60),l=_%60;return`${n}:${l.toString().padStart(2,"0")}`}function A0(u){window.dispatchEvent(new CustomEvent(H0,{detail:u}))}const Ae=({messageKey:u,src:_,outgoing:n,initialDuration:l=0})=>{const x=E.useRef(null),C=E.useRef(0),[o,I]=E.useState("idle"),[M,L]=E.useState(l),[V,T]=E.useState(0);E.useEffect(()=>(()=>{var d;C.current+=1,(d=x.current)==null||d.destroy(),x.current=null}),[_]),E.useEffect(()=>{L(Math.max(0,l))},[l]),E.useEffect(()=>{const d=f=>{const w=f.detail,N=x.current;w!==u&&(N!=null&&N.isPlaying())&&N.pause()};return window.addEventListener(H0,d),(()=>window.removeEventListener(H0,d))},[u]),E.useEffect(()=>{if(o!=="playing")return;const d=window.setInterval(()=>{const f=x.current;f&&T(f.getCurrentPosition())},100);return(()=>window.clearInterval(d))},[o]);const A=(d,f)=>{const w=()=>C.current===f&&x.current===d;d.onPlay(()=>{w()&&I("playing")}),d.onResume(()=>{w()&&I("playing")}),d.onPause(()=>{w()&&I("paused")}),d.onStop(()=>{w()&&(I("idle"),T(0))}),d.onEnded(()=>{w()&&(I("idle"),T(0))})},r0=async()=>{var w;const d=x.current;if(d!=null&&d.isPlaying()){d.pause();return}if(d!=null&&d.isPaused()){A0(u),d.resume();return}if(d!=null&&d.isInit()){A0(u),d.play();return}if(o==="loading")return;const f=C.current+1;C.current=f,I("loading"),T(0);try{const N=new me;if(x.current=N,A(N,f),await N.initWithUrl(Te(_)),C.current!==f||x.current!==N){N.destroy();return}L(N.getDuration()||Math.max(0,l)),A0(u),N.play()}catch{if(C.current!==f)return;(w=x.current)==null||w.destroy(),x.current=null,I("error"),T(0)}},H=o==="playing"||o==="paused"?V:M,$=M>0?o==="playing"||o==="paused"?`${T0(H)} / ${T0(M)}`:T0(M):"--:--",P=o==="loading"?"正在解码":o==="playing"?"正在播放":o==="paused"?"已暂停":o==="error"?"加载失败,点击重试":"语音消息",O=o==="playing"?"暂停语音消息":o==="paused"?"继续播放语音消息":o==="error"?"重新加载语音消息":o==="loading"?"正在加载语音消息":"播放语音消息";return e.jsxs("div",{className:`flex h-11 min-w-56 items-center gap-2 rounded-2xl border px-2 shadow-sm ${n?"rounded-br-md border-sky-400 bg-sky-500 text-white":"rounded-bl-md border-slate-200 bg-white text-slate-800"}`,children:[e.jsx("button",{type:"button","aria-label":O,title:O,disabled:o==="loading",onClick:(()=>void r0()),className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-full transition focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-wait ${n?"bg-white text-sky-600 hover:bg-sky-50 focus-visible:ring-white":"bg-sky-50 text-sky-600 hover:bg-sky-100 focus-visible:ring-sky-400"}`,children:o==="loading"?e.jsx(G,{className:"h-4 w-4 animate-spin"}):o==="playing"?e.jsx(de,{className:"h-4 w-4 fill-current"}):o==="error"?e.jsx(ge,{className:"h-4 w-4"}):e.jsx(xe,{className:"ml-px h-4 w-4 fill-current"})}),e.jsxs("div",{className:"min-w-0 flex flex-1 items-center gap-2",children:[e.jsx("div",{className:"flex h-5 flex-1 items-center gap-0.5","aria-hidden":"true",children:Pe.map((d,f)=>e.jsx("span",{className:`w-0.5 rounded-full ${o==="playing"?"animate-pulse":""} ${n?"bg-sky-100":o==="error"?"bg-red-300":"bg-sky-400"}`,style:{height:`${d}px`,animationDelay:`${f*45}ms`}},`${u}-${f}`))}),e.jsx("span",{className:`shrink-0 font-mono text-[11px] font-semibold tabular-nums ${n?"text-sky-100":o==="error"?"text-red-500":"text-slate-500"}`,children:$}),e.jsx("span",{className:"sr-only",children:P})]})]})},X0=[["尊嘟假嘟","https://img.alicdn.com/imgextra/i2/O1CN01hWzOgD1KcmFEIaGwE_!!6000000001185-2-tps-64-64.png_110x10000.jpg_.webp"],["鸡哔你","https://img.alicdn.com/imgextra/i1/O1CN01P9TVJl1JCqCZcQIdW_!!6000000000993-2-tps-64-64.png_110x10000.jpg_.webp"],["谁懂啊","https://img.alicdn.com/imgextra/i1/O1CN01r9qUnx1g3tcrtSmcs_!!6000000004087-2-tps-64-64.png_110x10000.jpg_.webp"],["吗喽","https://img.alicdn.com/imgextra/i4/O1CN01dTynZh1LnbIYTHI1D_!!6000000001344-2-tps-64-64.png_110x10000.jpg_.webp"],["功德+1","https://img.alicdn.com/imgextra/i1/O1CN01l1G5pS1IVn37pfQJi_!!6000000000899
Line truncated
|
||||
@@ -1 +0,0 @@
|
||||
import{j as e,b as _e,a as d}from"./react-vendor-Bf9ELcll.js";import{al as te,S as ae,am as je,y as Q,g as I,L as J,H as Ne,T as ve,x as V,X as ne,J as re,N as le,s as ke,R as we,P as Se}from"./icons-vendor-BSp7PTZg.js";import{r as R,c as B}from"./chat-metadata-74T0w35U.js";import"./vendor-BE-_xUHH.js";const Y=["smtp_server","smtp_port","smtp_user","smtp_password","smtp_from_name","smtp_from_address","smtp_use_tls","smtp_use_ssl"],H=(s,t)=>{if(typeof s=="boolean")return s;if(typeof s=="string"){if(["true","1","yes","on"].includes(s.toLowerCase()))return!0;if(["false","0","no","off"].includes(s.toLowerCase()))return!1}return t},oe=s=>{const t=Object.prototype.hasOwnProperty.call(s,"use_custom_smtp"),a=Y.some(r=>String(s[r]??"").trim()!=="");return{...s,use_custom_smtp:t?H(s.use_custom_smtp,!1):a}},ie=(s,t)=>{const a={...s,use_custom_smtp:!0};for(const r of Y)String(a[r]??"").trim()===""&&t[r]!==void 0&&(a[r]=t[r]);return a.smtp_port||(a.smtp_port=587),a.smtp_from_address||(a.smtp_from_address=a.smtp_user||""),a.smtp_use_tls=H(a.smtp_use_tls,!0),a.smtp_use_ssl=H(a.smtp_use_ssl,!1),a},ce=s=>{const t=oe(s),a={to_email:String(t.to_email??"").trim(),use_custom_smtp:t.use_custom_smtp===!0};if(a.use_custom_smtp)for(const r of Y)a[r]=t[r];return a},$={bark:{label:"Bark",icon:I,fields:[{key:"server_url",label:"Bark 服务器",placeholder:"https://api.day.app",required:!0},{key:"device_key",label:"Device Key",placeholder:"你的 Bark 设备 Key",required:!0},{key:"title",label:"标题(可选)",placeholder:"Ydisks闲鱼助手"},{key:"sound",label:"铃声(可选)",placeholder:"default"},{key:"group",label:"分组(可选)",placeholder:"xianyu"}],guide:{steps:["App Store 搜索并安装 Bark(免费)","打开 Bark App,首页会显示一条测试 URL,形如 https://api.day.app/<key>/这是测试推送内容","URL 路径里 <key> 那一段就是 Device Key,复制填入","服务器地址默认 https://api.day.app,自建服务端则填自建域名"],urlFormat:"https://api.day.app/<你的key>/测试内容",note:"不需要 secret,Device Key 本身就是唯一凭证。"}},dingtalk:{label:"钉钉机器人",icon:Q,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://oapi.dingtalk.com/robot/send?access_token=...",required:!0},{key:"secret",label:"加签密钥",placeholder:"SEC...",help:"安全设置勾选「加签」后生成,SEC 开头"}],guide:{steps:["钉钉进入一个群(可建单人群)→ 右上角 群设置","机器人 → 添加机器人 → 选择「自定义机器人」","安全设置勾选「加签」","完成页同时展示 Webhook 地址和 SEC 开头的 Secret,两个都复制","Webhook URL 填上面,Secret 填加签密钥"],urlFormat:"https://oapi.dingtalk.com/robot/send?access_token=XXX",note:"加签密钥可选,但强烈建议启用,否则机器人可能被滥用。"}},feishu:{label:"飞书机器人",icon:Q,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",required:!0},{key:"secret",label:"签名校验密钥",placeholder:"sec-...",help:"安全设置选「签名校验」后生成"}],guide:{steps:["飞书进入目标群 → 右上角 更多 → 设置","群机器人 → 添加机器人 → 自定义机器人","安全设置选择「签名校验」,复制生成的秘钥","完成会给 Webhook 地址,复制","Webhook URL 填上面,秘钥填签名校验密钥"],urlFormat:"https://open.feishu.cn/open-apis/bot/v2/hook/xxx",note:"签名密钥可选,建议启用。频率限制:单机器人 100 次/分钟。"}},wechat:{label:"企业微信机器人",icon:Q,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=...",required:!0}],guide:{steps:["企业微信进入一个内部群 → 右上角 … → 群设置","找到「群机器人」(新版可能叫「消息推送」)","添加 → 选择自定义机器人","完成给 Webhook 地址(含 ?key=),复制填入"],urlFormat:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=XXX",note:"不需要 secret,URL 里的 key 就是唯一凭证,注意不要泄露。频率限制 20 条/分钟。"}},webhook:{label:"自定义 Webhook",icon:je,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://your-server/notify",required:!0}],guide:{steps:["仅适用于自己有服务器的用户:在你自己的机器上起一个 HTTP 接口收 JSON","系统会 POST 这个 URL,Content-Type: application/json","请求体固定为右侧 JSON 格式,按需解析 message 字段"],urlFormat:'{"message":"告警正文","timestamp":"2026-07-05 12:00:00","source":"xianyu-auto-reply"}',note:"若用 Server酱 / PushPlus 等第三方推送服务,格式不兼容,需写中间脚本转发,或改用对应专用渠道。"}},telegram:{label:"Telegram",icon:ae,fields:[{key:"bot_token",label:"Bot Token",placeholder:"123456:ABC-DEF...",required:!0},{key:"chat_id",label:"Chat ID",placeholder:"-1001234567890
Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
import{j as e,b as _e,a as d}from"./react-vendor-Bf9ELcll.js";import{al as te,S as ae,am as je,y as Q,g as I,L as J,H as Ne,T as ve,x as V,X as ne,J as re,N as le,s as ke,R as we,P as Se}from"./icons-vendor-BSp7PTZg.js";import{n as Ce}from"./settings-D-mx9vFJ.js";import{r as R,c as B}from"./chat-metadata-74T0w35U.js";import"./vendor-BE-_xUHH.js";const Y=["smtp_server","smtp_port","smtp_user","smtp_password","smtp_from_name","smtp_from_address","smtp_use_tls","smtp_use_ssl"],H=(s,t)=>{if(typeof s=="boolean")return s;if(typeof s=="string"){if(["true","1","yes","on"].includes(s.toLowerCase()))return!0;if(["false","0","no","off"].includes(s.toLowerCase()))return!1}return t},oe=s=>{const t=Object.prototype.hasOwnProperty.call(s,"use_custom_smtp"),a=Y.some(r=>String(s[r]??"").trim()!=="");return{...s,use_custom_smtp:t?H(s.use_custom_smtp,!1):a}},ie=(s,t)=>{const a={...s,use_custom_smtp:!0};for(const r of Y)String(a[r]??"").trim()===""&&t[r]!==void 0&&(a[r]=t[r]);return a.smtp_port||(a.smtp_port=587),a.smtp_from_address||(a.smtp_from_address=a.smtp_user||""),a.smtp_use_tls=H(a.smtp_use_tls,!0),a.smtp_use_ssl=H(a.smtp_use_ssl,!1),a},ce=s=>{const t=oe(s),a={to_email:String(t.to_email??"").trim(),use_custom_smtp:t.use_custom_smtp===!0};if(a.use_custom_smtp)for(const r of Y)a[r]=t[r];return a},$={bark:{label:"Bark",icon:I,fields:[{key:"server_url",label:"Bark 服务器",placeholder:"https://api.day.app",required:!0},{key:"device_key",label:"Device Key",placeholder:"你的 Bark 设备 Key",required:!0},{key:"title",label:"标题(可选)",placeholder:"Ydisks闲鱼助手"},{key:"sound",label:"铃声(可选)",placeholder:"default"},{key:"group",label:"分组(可选)",placeholder:"xianyu"}],guide:{steps:["App Store 搜索并安装 Bark(免费)","打开 Bark App,首页会显示一条测试 URL,形如 https://api.day.app/<key>/这是测试推送内容","URL 路径里 <key> 那一段就是 Device Key,复制填入","服务器地址默认 https://api.day.app,自建服务端则填自建域名"],urlFormat:"https://api.day.app/<你的key>/测试内容",note:"不需要 secret,Device Key 本身就是唯一凭证。"}},dingtalk:{label:"钉钉机器人",icon:Q,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://oapi.dingtalk.com/robot/send?access_token=...",required:!0},{key:"secret",label:"加签密钥",placeholder:"SEC...",help:"安全设置勾选「加签」后生成,SEC 开头"}],guide:{steps:["钉钉进入一个群(可建单人群)→ 右上角 群设置","机器人 → 添加机器人 → 选择「自定义机器人」","安全设置勾选「加签」","完成页同时展示 Webhook 地址和 SEC 开头的 Secret,两个都复制","Webhook URL 填上面,Secret 填加签密钥"],urlFormat:"https://oapi.dingtalk.com/robot/send?access_token=XXX",note:"加签密钥可选,但强烈建议启用,否则机器人可能被滥用。"}},feishu:{label:"飞书机器人",icon:Q,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",required:!0},{key:"secret",label:"签名校验密钥",placeholder:"sec-...",help:"安全设置选「签名校验」后生成"}],guide:{steps:["飞书进入目标群 → 右上角 更多 → 设置","群机器人 → 添加机器人 → 自定义机器人","安全设置选择「签名校验」,复制生成的秘钥","完成会给 Webhook 地址,复制","Webhook URL 填上面,秘钥填签名校验密钥"],urlFormat:"https://open.feishu.cn/open-apis/bot/v2/hook/xxx",note:"签名密钥可选,建议启用。频率限制:单机器人 100 次/分钟。"}},wechat:{label:"企业微信机器人",icon:Q,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=...",required:!0}],guide:{steps:["企业微信进入一个内部群 → 右上角 … → 群设置","找到「群机器人」(新版可能叫「消息推送」)","添加 → 选择自定义机器人","完成给 Webhook 地址(含 ?key=),复制填入"],urlFormat:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=XXX",note:"不需要 secret,URL 里的 key 就是唯一凭证,注意不要泄露。频率限制 20 条/分钟。"}},webhook:{label:"自定义 Webhook",icon:je,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://your-server/notify",required:!0}],guide:{steps:["仅适用于自己有服务器的用户:在你自己的机器上起一个 HTTP 接口收 JSON","系统会 POST 这个 URL,Content-Type: application/json","请求体固定为右侧 JSON 格式,按需解析 message 字段"],urlFormat:'{"message":"告警正文","timestamp":"2026-07-05 12:00:00","source":"xianyu-auto-reply"}',note:"若用 Server酱 / PushPlus 等第三方推送服务,格式不兼容,需写中间脚本转发,或改用对应专用渠道。"}},telegram:{label:"Telegram",icon:ae,fields:[{key:"bot_token",label:"Bot Token",placeholder:"123456:ABC-DEF...",required:!0},{key:"chat_id",laLine truncated
|
||||
@@ -1 +0,0 @@
|
||||
import{a as r,j as e}from"./react-vendor-Bf9ELcll.js";import{r as M,c as q}from"./chat-metadata-74T0w35U.js";import{h as xe,R as ae,ad as ue,v as pe,J as T,N as D,ae as me,x as he,b as re,af as le,ag as ge,s as ye}from"./icons-vendor-BSp7PTZg.js";import"./vendor-BE-_xUHH.js";const ne="https://dashscope.aliyuncs.com/compatible-mode/v1",fe=[{value:"debug",label:"Debug"},{value:"info",label:"Info"},{value:"warn",label:"Warn"},{value:"error",label:"Error"}],be=new Set(["ai_api_key_configured","smtp_password_configured","qq_reply_secret_key_configured","captcha.remote_secret_key_configured","smtp_server","smtp_port","smtp_user","smtp_password","smtp_from","smtp_from_name","smtp_from_address","registration_enabled","show_default_login_info","login_captcha_enabled","item_sync_enabled","item_sync_interval","item_sync_max_pages","default_reply"]),oe=new Set(["ai_api_key","smtp_password","qq_reply_secret_key","captcha.remote_secret_key"]),we=s=>{if("values"in s||"secrets"in s)return s;const a={},n={};for(const[d,x]of Object.entries(s))if(x!=null){if(oe.has(d)){n[d]=x===""?{action:"clear"}:{action:"replace",value:String(x)};continue}(typeof x=="string"||typeof x=="number"||typeof x=="boolean")&&(a[d]=x)}return Object.keys(n).length>0?{values:a,secrets:n}:a},je=s=>{const a={...s};for(const n of oe){const d=`${n}_configured`;d in a&&(a[d]=a[d]===!0||a[d]==="true")}if("renewal_log_retention_days"in a){const n=Number(a.renewal_log_retention_days);a.renewal_log_retention_days=Number.isFinite(n)?n:10}return a},ve=async(s,a)=>M(n=>q.PUT("/api/v1/session/credentials",{body:s,signal:n}),a),_e=async s=>{const a=await M(n=>q.GET("/api/v1/settings/system",{signal:n}),s);return je(a)},Ne=async(s,a)=>M(n=>q.PUT("/api/v1/settings/system",{body:we(s),signal:n}),a),Se=async(s,a="",n)=>{const d=await M(x=>q.POST("/api/v1/settings/ai-models",{body:{base_url:s,api_key:a},signal:x}),n);return Array.isArray(d.models)?d.models:[]},ke=async s=>M(a=>q.GET("/api/v1/session",{signal:a}),s),Ce=s=>Object.fromEntries(Object.entries(s).filter(([a,n])=>!be.has(a)&&n!==void 0&&n!==null)),Ee=s=>s.new_username.trim().length<3?"用户名至少需要 3 个字符":s.current_password?s.new_password&&s.new_password.length<8?"新密码至少需要 8 个字符":s.new_password!==s.confirm_password?"两次输入的新密码不一致":"":"请输入当前密码确认身份",f=(s,a,n)=>s===a&&!n.aborted,K=s=>s instanceof Error&&s.message==="请求已取消",U=(s,a)=>s instanceof Error?s.message:a,Ae=(s="")=>({new_username:s,current_password:"",new_password:"",confirm_password:""}),$=(s,a)=>({type:s,text:a}),Ie=()=>{const[s,a]=r.useState(null),[n,d]=r.useState(!1),[x,m]=r.useState(""),[S,A]=r.useState(!1),[R,k]=r.useState(""),[C,w]=r.useState([]),[j,I]=r.useState(!1),[P,u]=r.useState(""),[G,v]=r.useState(!1),[z,L]=r.useState(!1),[F,p]=r.useState(!1),[b,J]=r.useState(!1),[V,Y]=r.useState(!1),[W,_]=r.useState(!1),[O,y]=r.useState(null),[t,ee]=r.useState(()=>Ae()),[ce,B]=r.useState("idle"),se=r.useRef(null),te=r.useRef(null),h=r.useRef(0),H=r.useRef(null);te.current=s;const E=r.useCallback(()=>{var c;(c=H.current)==null||c.abort();const o=new AbortController;return H.current=o,h.current+=1,{controller:o,sequence:h.current}},[]),Q=r.useCallback(async(o,c=!1,l)=>{const i=o||te.current,g=(i==null?void 0:i.ai_api_url)||(i==null?void 0:i.ai_base_url)||ne;I(!0),u("");try{const N=await Se(g,(i==null?void 0:i.ai_api_key)||"",{signal:l});if(l!=null&&l.aborted)return;w(N),v(c&&N.length>0),!(i!=null&&i.ai_model)&&N.length>0&&a(Z=>Z&&{...Z,ai_model:N[0]})}catch(N){if(l!=null&&l.aborted||K(N))return;w([]),v(!1),u(U(N,"读取模型失败"))}finally{l!=null&&l.aborted||I(!1)}},[]),X=r.useCallback(()=>{const{controller:o,sequence:c}=E();d(!0),B("loading"),m(""),Promise.all([_e({signal:o.signal}),ke({signal:o.signal})]).then(([l,i])=>{f(h.current,c,o.signal)&&(a(l),i.username&&ee(g=>({...g,new_username:i.username||""})),Q(l,!1,o.signal),B("success"))}).catch(l=>{!f(h.current,c,o.signal)||K(l)||(a(null),m(U(l,"加载配置失败")),B("error"))}).finally(()=>{f(h.current,c,o.signal)&&d(!1)})},[E,Q]);r.useEffect(()=>(X(),(()=>{var o;return(o=H.current)==null?void 0:o.abort()})),[X]),r.useEffect(()=>{const o=c=>{var l;(l=se.current)!=null&&l.contains(c.target)||v(!1)};return document.addEventListener("mousedown",o),(()=>document.removeEventListener("mousedown",o))},[]);const ie=r.useCallback(async()=>{if(!s||S)return;const{controller:o,sequence:c}=E();A(!0),k("");try{if(await Ne(Ce(s),{signal:o.signal}),!f(h.current,c,o.signal))return;window.alert("系统配置已保存")}catch(l){if(!f(h.current,c,o.signal)||K(l))return;k(U(l,"保存配置失败"))}finally{f(h.current,c,o.signal)&&A(!1)}},[E,S,s]),de=r.useCallback(async o=>{o.preventDefault(),y(null);const c=Ee(t);if(c){y($("error",c));return}const{controller:l,sequence:i}=E();_(!0);try{const g=await ve({current_password:t.current_password,new_username:t.new_username.trim(),new_password:t.new_password||void 0},{signal:l.signal});if(!f(hLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
import{a as r,j as e}from"./react-vendor-Bf9ELcll.js";import{r as M,c as R}from"./chat-metadata-74T0w35U.js";import{n as de,S as xe}from"./settings-D-mx9vFJ.js";import{h as ue,R as ae,ad as pe,v as me,J as D,N as O,ae as he,x as ge,b as re,af as le,ag as ye,s as fe}from"./icons-vendor-BSp7PTZg.js";import"./vendor-BE-_xUHH.js";const ne="https://dashscope.aliyuncs.com/compatible-mode/v1",be=[{value:"debug",label:"Debug"},{value:"info",label:"Info"},{value:"warn",label:"Warn"},{value:"error",label:"Error"}],we=new Set(["ai_api_key_configured","smtp_password_configured","qq_reply_secret_key_configured","captcha.remote_secret_key_configured","smtp_server","smtp_port","smtp_user","smtp_password","smtp_from","smtp_from_name","smtp_from_address","registration_enabled","show_default_login_info","login_captcha_enabled","item_sync_enabled","item_sync_interval","item_sync_max_pages","default_reply"]),je=s=>{const a={...s};for(const o of xe){const d=`${o}_configured`;d in a&&(a[d]=a[d]===!0||a[d]==="true")}if("renewal_log_retention_days"in a){const o=Number(a.renewal_log_retention_days);a.renewal_log_retention_days=Number.isFinite(o)?o:10}return a},ve=async(s,a)=>M(o=>R.PUT("/api/v1/session/credentials",{body:s,signal:o}),a),Ne=async s=>{const a=await M(o=>R.GET("/api/v1/settings/system",{signal:o}),s);return je(a)},_e=async(s,a)=>M(o=>R.PUT("/api/v1/settings/system",{body:de(s),signal:o}),a),Se=async(s,a="",o)=>{const d=await M(_=>R.POST("/api/v1/settings/ai-models",{body:{base_url:s,api_key:a},signal:_}),o);return Array.isArray(d.models)?d.models:[]},Ce=async s=>M(a=>R.GET("/api/v1/session",{signal:a}),s),ke=s=>Object.fromEntries(Object.entries(s).filter(([a,o])=>!we.has(a)&&o!==void 0&&o!==null)),Ee=s=>s.new_username.trim().length<3?"用户名至少需要 3 个字符":s.current_password?s.new_password&&s.new_password.length<8?"新密码至少需要 8 个字符":s.new_password!==s.confirm_password?"两次输入的新密码不一致":"":"请输入当前密码确认身份",y=(s,a,o)=>s===a&&!o.aborted,K=s=>s instanceof Error&&s.message==="请求已取消",U=(s,a)=>s instanceof Error?s.message:a,Ae=(s="")=>({new_username:s,current_password:"",new_password:"",confirm_password:""}),$=(s,a)=>({type:s,text:a}),Ie=()=>{const[s,a]=r.useState(null),[o,d]=r.useState(!1),[_,p]=r.useState(""),[S,A]=r.useState(!1),[L,C]=r.useState(""),[k,b]=r.useState([]),[w,I]=r.useState(!1),[P,x]=r.useState(""),[G,j]=r.useState(!1),[z,T]=r.useState(!1),[F,u]=r.useState(!1),[f,J]=r.useState(!1),[V,Y]=r.useState(!1),[W,v]=r.useState(!1),[q,g]=r.useState(null),[t,ee]=r.useState(()=>Ae()),[oe,B]=r.useState("idle"),se=r.useRef(null),te=r.useRef(null),m=r.useRef(0),H=r.useRef(null);te.current=s;const E=r.useCallback(()=>{var c;(c=H.current)==null||c.abort();const n=new AbortController;return H.current=n,m.current+=1,{controller:n,sequence:m.current}},[]),Q=r.useCallback(async(n,c=!1,l)=>{const i=n||te.current,h=(i==null?void 0:i.ai_api_url)||(i==null?void 0:i.ai_base_url)||ne;I(!0),x("");try{const N=await Se(h,(i==null?void 0:i.ai_api_key)||"",{signal:l});if(l!=null&&l.aborted)return;b(N),j(c&&N.length>0),!(i!=null&&i.ai_model)&&N.length>0&&a(Z=>Z&&{...Z,ai_model:N[0]})}catch(N){if(l!=null&&l.aborted||K(N))return;b([]),j(!1),x(U(N,"读取模型失败"))}finally{l!=null&&l.aborted||I(!1)}},[]),X=r.useCallback(()=>{const{controller:n,sequence:c}=E();d(!0),B("loading"),p(""),Promise.all([Ne({signal:n.signal}),Ce({signal:n.signal})]).then(([l,i])=>{y(m.current,c,n.signal)&&(a(l),i.username&&ee(h=>({...h,new_username:i.username||""})),Q(l,!1,n.signal),B("success"))}).catch(l=>{!y(m.current,c,n.signal)||K(l)||(a(null),p(U(l,"加载配置失败")),B("error"))}).finally(()=>{y(m.current,c,n.signal)&&d(!1)})},[E,Q]);r.useEffect(()=>(X(),(()=>{var n;return(n=H.current)==null?void 0:n.abort()})),[X]),r.useEffect(()=>{const n=c=>{var l;(l=se.current)!=null&&l.contains(c.target)||j(!1)};return document.addEventListener("mousedown",n),(()=>document.removeEventListener("mousedown",n))},[]);const ce=r.useCallback(async()=>{if(!s||S)return;const{controller:n,sequence:c}=E();A(!0),C("");try{if(await _e(ke(s),{signal:n.signal}),!y(m.current,c,n.signal))return;window.alert("系统配置已保存")}catch(l){if(!y(m.current,c,n.signal)||K(l))return;C(U(l,"保存配置失败"))}finally{y(m.current,c,n.signal)&&A(!1)}},[E,S,s]),ie=r.useCallback(async n=>{n.preventDefault(),g(null);const c=Ee(t);if(c){g($("error",c));return}const{controller:l,sequence:i}=E();v(!0);try{const h=await ve({current_password:t.current_password,new_username:t.new_username.trim(),new_password:t.new_password||void 0},{signal:l.signal});if(!y(m.current,i,l.signal))return;if(!h.success){g($("error",h.message||"登录凭据更新失败"));return}g($("success",h.message||"登录凭据已更新")),window.setTimeout(()=>window.location.reload(),1400)}catch(h){if(!y(m.current,i,l.signal)||K(h))return;g($("error",U(h,"登录凭据更新失败")))}finally{y(m.current,i,l.signal)&&v(!1)}},[E,t]);return{settingsLine truncated
|
||||
+2
-2
@@ -1,2 +1,2 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-DBUkwLYQ.js","assets/react-vendor-Bf9ELcll.js","assets/dateTime-DDi7rqpW.js","assets/icons-vendor-BSp7PTZg.js","assets/charts-vendor-DBu_rVrn.js","assets/vendor-BE-_xUHH.js","assets/vendor-DUblxfbA.css","assets/chat-metadata-74T0w35U.js","assets/contract-COFcZjyb.js","assets/AccountList-D1PDvKjr.js","assets/OrderList-CKY0um79.js","assets/CardList-BG11KU7H.js","assets/ItemList-D-9IbEjX.js","assets/Settings-BMAitcQx.js","assets/Rules-DCuiI2LD.js","assets/Notifications-BepLRaYn.js","assets/Chat-8cCRP4iO.js","assets/audio-codec-mjVr_wwJ.js"])))=>i.map(i=>d[i]);
|
||||
import{d as P,j as e,a as i,e as H}from"./react-vendor-Bf9ELcll.js";import{r as j,c as L,g as Z,a as Y}from"./chat-metadata-74T0w35U.js";import{L as D,a as A,b as K,U as W,A as J,c as Q,d as X,M as ee,e as te,B as se,f as ne,Z as ae,g as re,h as oe,G as I,i as ie,j as le,k as ce}from"./icons-vendor-BSp7PTZg.js";import"./vendor-BE-_xUHH.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))m(r);new MutationObserver(r=>{for(const l of r)if(l.type==="childList")for(const o of l.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&m(o)}).observe(document,{childList:!0,subtree:!0});function n(r){const l={};return r.integrity&&(l.integrity=r.integrity),r.referrerPolicy&&(l.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?l.credentials="include":r.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function m(r){if(r.ep)return;r.ep=!0;const l=n(r);fetch(r.href,l)}})();class de extends P.Component{constructor(){super(...arguments),this.state={hasError:!1},this.handleReload=()=>{window.location.reload()}}static getDerivedStateFromError(){return{hasError:!0}}render(){const{hasError:s}=this.state,{children:n}=this.props;return s?e.jsx("main",{className:"flex min-h-screen items-center justify-center bg-canvas p-6 text-ink",children:e.jsxs("section",{className:"max-w-md text-center",children:[e.jsx("h1",{className:"text-xl font-semibold",children:"页面暂时无法显示"}),e.jsx("button",{className:"ios-btn-primary mt-6 px-4 py-2",type:"button",onClick:this.handleReload,children:"重新加载"})]})}):n}}const ue=async t=>{const s=await j(n=>L.POST("/api/v1/session/login",{body:t,signal:n}),{skipAuthLogout:!0});return{...s,token:s.token??void 0}},he=async t=>{const s=await j(n=>L.POST("/api/v1/session/initialize",{body:{password:t},signal:n}),{skipAuthLogout:!0});return{...s,token:s.token??void 0}},me=async t=>j(s=>L.GET("/api/v1/session",{signal:s}),t),fe=async()=>({success:!0,message:(await j(s=>L.POST("/api/v1/session/logout",{body:{},signal:s}))).message}),$=i.createContext(void 0),xe=({children:t})=>{const[s,n]=i.useState(!1),[m,r]=i.useState(!1),[l,o]=i.useState(!0),[a,d]=i.useState(!1),c=()=>{n(!1),r(!1)};i.useEffect(()=>{const p=new AbortController;let x=!0;me({signal:p.signal}).then(b=>{if(x){if((b==null?void 0:b.initialized)===!1){d(!0),c();return}d(!1),b!=null&&b.authenticated?(n(!0),r(b.is_admin===!0)):c()}}).catch(b=>{!x||b instanceof DOMException&&b.name==="AbortError"||(d(!1),c())}).finally(()=>{x&&o(!1)});const u=()=>c();return window.addEventListener("auth:logout",u),(()=>{x=!1,p.abort(),window.removeEventListener("auth:logout",u)})},[]);const h=async p=>{const x=await ue(p);return x.success&&(d(!1),n(!0),r(x.is_admin===!0)),x},g=async p=>{const x=await he(p);return x.success&&(d(!1),n(!0),r(x.is_admin===!0)),x},f=async()=>{try{await fe()}finally{c()}};return e.jsx($.Provider,{value:{checkingAuth:l,isLoggedIn:s,isAdmin:m,needsInit:a,signIn:h,initialize:g,signOut:f},children:t})},M=()=>{const t=i.useContext($);if(!t)throw new Error("useSession 必须在 SessionProvider 内使用");return t},z="ydisks.sidebar.v1",pe=()=>{try{return window.localStorage.getItem(z)==="collapsed"}catch{return!1}},ge=t=>{try{window.localStorage.setItem(z,t?"collapsed":"expanded")}catch{}},be=({className:t="w-full h-full text-white"})=>e.jsx("svg",{className:t,viewBox:"0 0 256 256","aria-hidden":"true",children:e.jsx("g",{stroke:"none",fill:"none",fillRule:"evenodd",children:e.jsx("path",{d:"M121.73,57.0003 C138.901,57.0003 154.897,65.5053 164.52,79.7493 C166.029,81.9823 165.441,85.0143 163.209,86.5233 C160.976,88.0323 157.944,87.4433 156.436,85.2113 C148.629,73.6553 135.655,66.7563 121.73,66.7563 C104.076789,66.7563 88.6201962,77.6596007 82.5581814,93.8184545 C83.9120803,93.7133631 85.2800264,93.66 86.6602,93.66 C111.537727,93.66 132.442611,110.997575 137.926382,134.224255 L162.5425,92.109 L162.615557,91.9879406 L162.756884,91.77367 L162.911804,91.5639102 L162.98657,91.4716759 C163.351845,91.025169 163.786059,90.6571744 164.264191,90.3738733 L164.550153,90.2178351 L164.729252,90.1315693 L164.989203,90.021723 L165.230265,89.9354653 L165.542393,89.8445739 C165.666021,89.8126706 165.790834,89.7857324 165.916565,89.7637431 L166.116517,89.7342499 C166.29505,89.7098142 166.475001,89.6957386 166.655596,89.6918808 L166.7539,89.693 C196.8909,89.693 221.4079,114.21 221.4079,144.347 C221.4079,174.482 196.8909,199 166.7539,199 L125.0869,199 C122.3919,199 120.2079,196.815 120.2079,194.122 C120.2079,191.429 122.3919,189.244 125.0869,189.244 L166.7539,189.244 C191.5109,189.244 211.6519,169.104 211.6519,144.347 C211.6519,120.513406 192.985349,100.957891 169.504046,99.5322548 L112.7745,196.584 C111.8995,198.08 110.2965,199 108.5635,199 L86.6602,199 C57.6182,199 33.9902,175.373 33.9902,146.33 C33.9902,122.475163 49.9316132,102.273061 71.7206298,95.817503 L71.9446339,9Line truncated
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-DBUkwLYQ.js","assets/react-vendor-Bf9ELcll.js","assets/dateTime-DDi7rqpW.js","assets/icons-vendor-BSp7PTZg.js","assets/charts-vendor-DBu_rVrn.js","assets/vendor-BE-_xUHH.js","assets/vendor-DUblxfbA.css","assets/chat-metadata-74T0w35U.js","assets/contract-COFcZjyb.js","assets/AccountList-D1PDvKjr.js","assets/OrderList-CKY0um79.js","assets/CardList-BG11KU7H.js","assets/ItemList-D-9IbEjX.js","assets/Settings-CbgtqNcx.js","assets/settings-D-mx9vFJ.js","assets/Rules-DCuiI2LD.js","assets/Notifications-xaqRCmgU.js","assets/Chat-Di7cjGAh.js","assets/audio-codec-mjVr_wwJ.js"])))=>i.map(i=>d[i]);
|
||||
import{d as P,j as e,a as i,e as H}from"./react-vendor-Bf9ELcll.js";import{r as j,c as L,g as Z,a as Y}from"./chat-metadata-74T0w35U.js";import{L as D,a as A,b as K,U as W,A as J,c as Q,d as X,M as ee,e as te,B as se,f as ne,Z as ae,g as re,h as oe,G as I,i as ie,j as le,k as ce}from"./icons-vendor-BSp7PTZg.js";import"./vendor-BE-_xUHH.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))m(r);new MutationObserver(r=>{for(const l of r)if(l.type==="childList")for(const o of l.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&m(o)}).observe(document,{childList:!0,subtree:!0});function n(r){const l={};return r.integrity&&(l.integrity=r.integrity),r.referrerPolicy&&(l.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?l.credentials="include":r.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function m(r){if(r.ep)return;r.ep=!0;const l=n(r);fetch(r.href,l)}})();class de extends P.Component{constructor(){super(...arguments),this.state={hasError:!1},this.handleReload=()=>{window.location.reload()}}static getDerivedStateFromError(){return{hasError:!0}}render(){const{hasError:s}=this.state,{children:n}=this.props;return s?e.jsx("main",{className:"flex min-h-screen items-center justify-center bg-canvas p-6 text-ink",children:e.jsxs("section",{className:"max-w-md text-center",children:[e.jsx("h1",{className:"text-xl font-semibold",children:"页面暂时无法显示"}),e.jsx("button",{className:"ios-btn-primary mt-6 px-4 py-2",type:"button",onClick:this.handleReload,children:"重新加载"})]})}):n}}const ue=async t=>{const s=await j(n=>L.POST("/api/v1/session/login",{body:t,signal:n}),{skipAuthLogout:!0});return{...s,token:s.token??void 0}},he=async t=>{const s=await j(n=>L.POST("/api/v1/session/initialize",{body:{password:t},signal:n}),{skipAuthLogout:!0});return{...s,token:s.token??void 0}},me=async t=>j(s=>L.GET("/api/v1/session",{signal:s}),t),fe=async()=>({success:!0,message:(await j(s=>L.POST("/api/v1/session/logout",{body:{},signal:s}))).message}),$=i.createContext(void 0),xe=({children:t})=>{const[s,n]=i.useState(!1),[m,r]=i.useState(!1),[l,o]=i.useState(!0),[a,d]=i.useState(!1),c=()=>{n(!1),r(!1)};i.useEffect(()=>{const p=new AbortController;let x=!0;me({signal:p.signal}).then(b=>{if(x){if((b==null?void 0:b.initialized)===!1){d(!0),c();return}d(!1),b!=null&&b.authenticated?(n(!0),r(b.is_admin===!0)):c()}}).catch(b=>{!x||b instanceof DOMException&&b.name==="AbortError"||(d(!1),c())}).finally(()=>{x&&o(!1)});const u=()=>c();return window.addEventListener("auth:logout",u),(()=>{x=!1,p.abort(),window.removeEventListener("auth:logout",u)})},[]);const h=async p=>{const x=await ue(p);return x.success&&(d(!1),n(!0),r(x.is_admin===!0)),x},g=async p=>{const x=await he(p);return x.success&&(d(!1),n(!0),r(x.is_admin===!0)),x},f=async()=>{try{await fe()}finally{c()}};return e.jsx($.Provider,{value:{checkingAuth:l,isLoggedIn:s,isAdmin:m,needsInit:a,signIn:h,initialize:g,signOut:f},children:t})},M=()=>{const t=i.useContext($);if(!t)throw new Error("useSession 必须在 SessionProvider 内使用");return t},z="ydisks.sidebar.v1",pe=()=>{try{return window.localStorage.getItem(z)==="collapsed"}catch{return!1}},ge=t=>{try{window.localStorage.setItem(z,t?"collapsed":"expanded")}catch{}},be=({className:t="w-full h-full text-white"})=>e.jsx("svg",{className:t,viewBox:"0 0 256 256","aria-hidden":"true",children:e.jsx("g",{stroke:"none",fill:"none",fillRule:"evenodd",children:e.jsx("path",{d:"M121.73,57.0003 C138.901,57.0003 154.897,65.5053 164.52,79.7493 C166.029,81.9823 165.441,85.0143 163.209,86.5233 C160.976,88.0323 157.944,87.4433 156.436,85.2113 C148.629,73.6553 135.655,66.7563 121.73,66.7563 C104.076789,66.7563 88.6201962,77.6596007 82.5581814,93.8184545 C83.9120803,93.7133631 85.2800264,93.66 86.6602,93.66 C111.537727,93.66 132.442611,110.997575 137.926382,134.224255 L162.5425,92.109 L162.615557,91.9879406 L162.756884,91.77367 L162.911804,91.5639102 L162.98657,91.4716759 C163.351845,91.025169 163.786059,90.6571744 164.264191,90.3738733 L164.550153,90.2178351 L164.729252,90.1315693 L164.989203,90.021723 L165.230265,89.9354653 L165.542393,89.8445739 C165.666021,89.8126706 165.790834,89.7857324 165.916565,89.7637431 L166.116517,89.7342499 C166.29505,89.7098142 166.475001,89.6957386 166.655596,89.6918808 L166.7539,89.693 C196.8909,89.693 221.4079,114.21 221.4079,144.347 C221.4079,174.482 196.8909,199 166.7539,199 L125.0869,199 C122.3919,199 120.2079,196.815 120.2079,194.122 C120.2079,191.429 122.3919,189.244 125.0869,189.244 L166.7539,189.244 C191.5109,189.244 211.6519,169.104 211.6519,144.347 C211.6519,120.513406 192.985349,100.957891 169.504046,99.5322548 L112.7745,196.584 C111.8995,198.08 110.2965,199 108.5635,199 L86.6602,199 C57.6182,199 33.9902,175.373 33.9902,146.33 C33.9902,122.475163 49.9316132,102.273061 71.7206298,95.817503 L71.9446339,9Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
const a=new Set(["ai_api_key","smtp_password","qq_reply_secret_key","captcha.remote_secret_key"]),c=t=>{if("values"in t||"secrets"in t)return t;const n={},o={};for(const[r,e]of Object.entries(t))if(e!=null){if(a.has(r)){o[r]=e===""?{action:"clear"}:{action:"replace",value:String(e)};continue}(typeof e=="string"||typeof e=="number"||typeof e=="boolean")&&(n[r]=e)}return Object.keys(o).length>0?{values:n,secrets:o}:n};export{a as S,c as n};
|
||||
@@ -6,7 +6,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Ydisks闲鱼助手 - 自动发货与管家系统</title>
|
||||
<meta name="description" content="Ydisks闲鱼助手 - 自动回复、自动发货、订单管理、AI智能议价一体化解决方案" />
|
||||
<script type="module" crossorigin src="/static/assets/index-dO7JyNQY.js"></script>
|
||||
<script type="module" crossorigin src="/static/assets/index-Q3nlx6gR.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="/static/assets/react-vendor-Bf9ELcll.js">
|
||||
<link rel="modulepreload" crossorigin href="/static/assets/vendor-BE-_xUHH.js">
|
||||
<link rel="modulepreload" crossorigin href="/static/assets/icons-vendor-BSp7PTZg.js">
|
||||
|
||||
Reference in new issue
Block a user