Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/settings/NetworkPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const NetworkPanel: React.FC<NetworkPanelProps> = ({ t }) => {
// --- RPC Download state ---
const [rpcForm, setRpcForm] = useState<RpcDownloadConfig>(rpcDownloadConfig);
const [showSecret, setShowSecret] = useState(false);
const [hasStoredSecret, setHasStoredSecret] = useState(false);
const [hasStoredSecret, setHasStoredSecret] = useState(() => !!rpcDownloadConfig.secret);
const [rpcTesting, setRpcTesting] = useState(false);
const [rpcTestResult, setRpcTestResult] = useState<{ success: boolean; error?: string; version?: string } | null>(null);
const [rpcSaving, setRpcSaving] = useState(false);
Expand Down
6 changes: 3 additions & 3 deletions src/store/useAppStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ const normalizePersistedState = (
enabled: typeof obj.enabled === 'boolean' ? obj.enabled : false,
host: typeof obj.host === 'string' ? obj.host : '',
port: typeof obj.port === 'number' && Number.isFinite(obj.port) ? obj.port : 6800,
// secret 不从持久化恢复,仅在内存中
secret: typeof obj.secret === 'string' ? obj.secret : undefined,
};
}
return { enabled: false, host: '', port: 6800 };
Expand Down Expand Up @@ -1539,12 +1539,12 @@ export const useAppStore = create<AppState & AppActions>()(
username: state.proxyConfig.username,
// password 不持久化,仅保留在内存中
},
// 持久化 RPC 下载配置,但排除密钥(安全考虑
// 持久化 RPC 下载配置(含密钥,确保重启后不丢失
rpcDownloadConfig: {
enabled: state.rpcDownloadConfig.enabled,
host: state.rpcDownloadConfig.host,
port: state.rpcDownloadConfig.port,
// secret 不持久化,仅保留在内存中
secret: state.rpcDownloadConfig.secret,
},
}),
migrate: (persistedState) => {
Expand Down
Loading