mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-06-16 13:34:04 +08:00
* feat: WebDAV backup/restore - Add WebDAV test/backup/restore commands and settings\n- Fix ja i18n missing keys; decode PROPFIND href as UTF-8\n- Stabilize Windows prompt auto-import tests via CC_SWITCH_TEST_HOME * chore: format and minor cleanups * fix: update build config * feat(webdav): unify sync UX and hardening fixes * fix(webdav): harden sync flow and stabilize sync UX/tests * fix(webdav): add resource limits to skills.zip extraction Prevent zip bomb / resource exhaustion by enforcing: - MAX_EXTRACT_ENTRIES (10,000 files) - MAX_EXTRACT_BYTES (512 MB cumulative) * refactor(webdav): drop deviceId and display deviceName only --------- Co-authored-by: small-lovely-cat <77799160+small-lovely-cat@users.noreply.github.com> Co-authored-by: saladday <1203511142@qq.com>
55 lines
1.8 KiB
TypeScript
55 lines
1.8 KiB
TypeScript
import { z } from "zod";
|
|
|
|
const directorySchema = z
|
|
.string()
|
|
.trim()
|
|
.min(1, "路径不能为空")
|
|
.optional()
|
|
.or(z.literal(""));
|
|
|
|
export const settingsSchema = z.object({
|
|
// 设备级 UI 设置
|
|
showInTray: z.boolean(),
|
|
minimizeToTrayOnClose: z.boolean(),
|
|
enableClaudePluginIntegration: z.boolean().optional(),
|
|
skipClaudeOnboarding: z.boolean().optional(),
|
|
launchOnStartup: z.boolean().optional(),
|
|
language: z.enum(["en", "zh", "ja"]).optional(),
|
|
|
|
// 设备级目录覆盖
|
|
claudeConfigDir: directorySchema.nullable().optional(),
|
|
codexConfigDir: directorySchema.nullable().optional(),
|
|
geminiConfigDir: directorySchema.nullable().optional(),
|
|
|
|
// 当前供应商 ID(设备级)
|
|
currentProviderClaude: z.string().optional(),
|
|
currentProviderCodex: z.string().optional(),
|
|
currentProviderGemini: z.string().optional(),
|
|
|
|
// Skill 同步设置
|
|
skillSyncMethod: z.enum(["auto", "symlink", "copy"]).optional(),
|
|
|
|
// WebDAV v2 同步设置(通过专用命令保存,schema 仅用于读取)
|
|
webdavSync: z
|
|
.object({
|
|
enabled: z.boolean().optional(),
|
|
baseUrl: z.string().trim().optional().or(z.literal("")),
|
|
username: z.string().trim().optional().or(z.literal("")),
|
|
password: z.string().optional(),
|
|
remoteRoot: z.string().trim().optional().or(z.literal("")),
|
|
profile: z.string().trim().optional().or(z.literal("")),
|
|
status: z
|
|
.object({
|
|
lastSyncAt: z.number().nullable().optional(),
|
|
lastError: z.string().nullable().optional(),
|
|
lastRemoteEtag: z.string().nullable().optional(),
|
|
lastLocalManifestHash: z.string().nullable().optional(),
|
|
lastRemoteManifestHash: z.string().nullable().optional(),
|
|
})
|
|
.optional(),
|
|
})
|
|
.optional(),
|
|
});
|
|
|
|
export type SettingsFormData = z.infer<typeof settingsSchema>;
|