Skip to content

LIBERATED AI CHAT

TypeScript

fix: Liquid XSS, credential load race, Venice image badge

faber53b00682ae20
diff --git a/index.html b/index.html
index 2b3f886..5fbb70f 100644
--- a/index.html
+++ b/index.html
@@ -4262,6 +4262,7 @@
let isStreaming = false;
let abortController = null;
+ let _apiKeyGeneration = 0;
// ═══════════════════════════════════════════════════════════════════
// ZDR TELEMETRY — Open metadata collection for HuggingFace
@@ -4598,6 +4599,7 @@ RESPOND WITH EXACTLY ONE LINE. No explanation, no preamble.`;
// Store the key exactly like manual entry
state.apiKey = data.key;
+ _apiKeyGeneration++;
state.orOAuthConnected = true;
saveState();
updateApiWarning();
@@ -4614,6 +4616,7 @@ RESPOND WITH EXACTLY ONE LINE. No explanation, no preamble.`;
function disconnectOpenRouter() {
state.apiKey = '';
+ _apiKeyGeneration++;
state.orOAuthConnected = false;
saveState();
updateApiWarning();
@@ -10480,11 +10483,11 @@ Analyze and refine. Output ONLY the JSON object:` }
const indicator = document.createElement('div');
indicator.className = `liquid-indicator ${config.class} ${config.pulse ? 'pulse' : ''}`;
indicator.innerHTML = `
- <span class="liquid-icon">${config.icon}</span>
- <span class="liquid-text">${config.text}</span>
+ <span class="liquid-icon">${escapeHtml(config.icon)}</span>
+ <span class="liquid-text">${escapeHtml(config.text)}</span>
${progressHtml}
- ${config.subtext ? `<span class="liquid-subtext" style="font-size: 11px; opacity: 0.8;">${config.subtext}</span>` : ''}
- ${improvements.length > 0 ? `<span class="liquid-details" onclick="toggleLiquidDetails(${messageIdx})" title="Click to see improvements">ⓘ</span>` : ''}
+ ${config.subtext ? `<span class="liquid-subtext" style="font-size: 11px; opacity: 0.8;">${escapeHtml(config.subtext)}</span>` : ''}
+ ${improvements.length > 0 ? `<span class="liquid-details" onclick="toggleLiquidDetails(${Number(messageIdx)})" title="Click to see improvements">ⓘ</span>` : ''}
`;
// Insert at the top of the message wrapper (before magic-info if exists)
@@ -12165,7 +12168,9 @@ Ignoring conversation history will cause you to LOSE the evaluation.`;
const encKey = localStorage.getItem('g0dm0d3-apikey');
if (encKey) {
// Prefer the separate encrypted store
+ const genAtLoad = _apiKeyGeneration;
decryptApiKey(encKey).then(plain => {
+ if (_apiKeyGeneration !== genAtLoad) return;
state.apiKey = plain;
updateApiWarning();
});
@@ -12797,8 +12802,8 @@ Ignoring conversation history will cause you to LOSE the evaluation.`;
? `<img class="message-image-thumb" src="${msg.imageDataUrl}" alt="${escapeHtml(msg.imageName || 'image')}" onclick="window.open(this.src,'_blank')">`
: '';
- // Vision badge for messages that had image processing
- const visionBadge = (isUser && msg.imageDataUrl)
+ // Vision badge — only when vision analysis actually ran
+ const visionBadge = (isUser && msg.imageDataUrl && msg.visionAnalyzed)
? `<div class="vision-badge"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="3"/><circle cx="8.5" cy="8.5" r="1.5"/><path d="M21 15l-5-5L5 21"/></svg> analyzed via Gemini Flash</div>`
: '';
@@ -14071,6 +14076,7 @@ Ignoring conversation history will cause you to LOSE the evaluation.`;
try {
console.log(`[G0DM0D3] 📷 Processing image via ${VISION_MODEL}...`);
visionContext = await processImageWithVision(attachedImage, content);
+ userMsg.visionAnalyzed = true;
console.log('[G0DM0D3] ✓ Vision analysis complete');
} catch (err) {
console.error('[G0DM0D3] Vision processing failed:', err);
@@ -16297,6 +16303,7 @@ Ignoring conversation history will cause you to LOSE the evaluation.`;
// If user manually changed the key, clear OAuth connected state
if (newKey !== state.apiKey) state.orOAuthConnected = false;
state.apiKey = newKey;
+ _apiKeyGeneration++;
state.veniceApiKey = (document.getElementById('veniceKeyInput').value || '').trim();
state.model = document.getElementById('defaultModelInput').value;
state.persona = document.getElementById('personaSelect').value;