- refactor(utils): extract Codex base_url parsing into shared helpers

- refactor(ProviderList): use shared base_url helpers
- refactor(App): reuse shared base_url helpers for VS Code sync
- fix(auto-sync): global shared VS Code auto-apply state (localStorage + event broadcast)
- feat(tray): auto-apply to VS Code on Codex provider-switched when enabled
- behavior: manual Apply enables auto-sync; manual Remove disables; official providers clear managed keys only
- chore(typecheck): pass pnpm typecheck
This commit is contained in:
Jason
2025-09-19 14:22:39 +08:00
parent 67db492330
commit 3ac3f122eb
7 changed files with 289 additions and 72 deletions

View File

@@ -11,6 +11,7 @@ import { getVersion } from "@tauri-apps/api/app";
import "../lib/tauri-api";
import { relaunchApp } from "../lib/updater";
import { useUpdate } from "../contexts/UpdateContext";
import { useVSCodeAutoSync } from "../hooks/useVSCodeAutoSync";
import type { Settings } from "../types";
interface SettingsModalProps {
@@ -28,6 +29,7 @@ export default function SettingsModal({ onClose }: SettingsModalProps) {
const [showUpToDate, setShowUpToDate] = useState(false);
const { hasUpdate, updateInfo, updateHandle, checkUpdate, resetDismiss } =
useUpdate();
const { isAutoSyncEnabled, toggleAutoSync } = useVSCodeAutoSync();
useEffect(() => {
loadSettings();
@@ -201,6 +203,29 @@ export default function SettingsModal({ onClose }: SettingsModalProps) {
</label>
</div> */}
{/* VS Code 自动同步设置 */}
<div>
<h3 className="text-sm font-medium text-gray-900 dark:text-gray-100 mb-3">
Codex
</h3>
<label className="flex items-center justify-between cursor-pointer">
<div className="flex-1">
<span className="text-sm text-gray-700 dark:text-gray-300">
VS Code
</span>
<p className="text-xs text-gray-500 dark:text-gray-400 mt-0.5">
Codex VS Code
</p>
</div>
<input
type="checkbox"
checked={isAutoSyncEnabled}
onChange={toggleAutoSync}
className="w-4 h-4 text-blue-500 rounded focus:ring-blue-500/20"
/>
</label>
</div>
{/* 配置文件位置 */}
<div>
<h3 className="text-sm font-medium text-gray-900 dark:text-gray-100 mb-3">