mirror of
https://github.com/elder-plinius/G0DM0D3.git
synced 2026-11-16 07:02:25 +00:00
fix: remove stale encrypted OpenRouter key when cleared
When the user clears their OpenRouter key (switching to Venice-only), _flushSaveState now removes the g0dm0d3-apikey localStorage entry. Previously the encrypted key survived and was restored on reload, silently resuming OpenRouter requests. Also guards against a race where an older async encryptApiKey resolves after the key was already changed — only writes if state.apiKey still matches the value that was encrypted. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -12423,9 +12423,14 @@ Ignoring conversation history will cause you to LOSE the evaluation.`;
|
||||
|
||||
// Persist encrypted key separately (async, best-effort)
|
||||
if (apiKey) {
|
||||
encryptApiKey(apiKey).then(enc => {
|
||||
try { localStorage.setItem('g0dm0d3-apikey', enc); } catch (_) {}
|
||||
const keyAtFlush = apiKey;
|
||||
encryptApiKey(keyAtFlush).then(enc => {
|
||||
if (state.apiKey === keyAtFlush) {
|
||||
try { localStorage.setItem('g0dm0d3-apikey', enc); } catch (_) {}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
localStorage.removeItem('g0dm0d3-apikey');
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user