@@ -1636,7 +1636,7 @@
resultsContainer.innerHTML = `
`;
this.showNotification('❌ Maintenance failed', 'error');
@@ -1658,7 +1658,7 @@
html += `
`;
html += `
@@ -1680,29 +1680,29 @@
html += `
`;
html += `
`;
html += `${statusIcon} `;
- html += `${operation.replace(/_/g, ' ')} `;
+ html += `${escapeHtml(operation.replace(/_/g, ' '))} `;
html += `${statusText} `;
html += ` `;
if (result.message) {
- html += `
${result.message}
`;
+ html += `
${escapeHtml(result.message)}
`;
}
// Show specific details
if (result.removed_count !== undefined) {
- html += `
Items removed: ${result.removed_count}
`;
+ html += `
Items removed: ${escapeHtml(result.removed_count)}
`;
}
if (result.duplicate_hashes !== undefined) {
- html += `
Duplicate hash groups found: ${result.duplicate_hashes}
`;
+ html += `
Duplicate hash groups found: ${escapeHtml(result.duplicate_hashes)}
`;
}
if (result.issues_found !== undefined) {
- html += `
Issues found: ${result.issues_found}
`;
+ html += `
Issues found: ${escapeHtml(result.issues_found)}
`;
if (result.issues && result.issues.length > 0) {
html += `
`;
result.issues.forEach(issue => {
- html += `${issue} `;
+ html += `${escapeHtml(issue)} `;
});
html += ` `;
}
@@ -1710,14 +1710,14 @@
if (result.info) {
html += `
`;
- html += `
Total prompts: ${result.info.total_prompts || 'N/A'}
`;
- html += `
Database size: ${result.info.database_size_bytes ? this.formatFileSize(result.info.database_size_bytes) : 'N/A'}
`;
+ html += `
Total prompts: ${escapeHtml(result.info.total_prompts || 'N/A')}
`;
+ html += `
Database size: ${escapeHtml(result.info.database_size_bytes ? this.formatFileSize(result.info.database_size_bytes) : 'N/A')}
`;
html += `
`;
}
if (result.error) {
html += `
`;
- html += `Error: ${result.error}`;
+ html += `Error: ${escapeHtml(result.error)}`;
html += `
`;
}
@@ -1754,7 +1754,7 @@
content.innerHTML = `
❌ Diagnostics Failed
-
${error.message}
+
${escapeHtml(error.message)}
`;
}
@@ -1793,25 +1793,25 @@
html += `
${escapeHtml(category)} `;
if (result.message) {
- html += `
${result.message}
`;
+ html += `
${escapeHtml(result.message)}
`;
}
// Show specific details based on category
if (category === 'database' && result.status === 'ok') {
html += `
`;
- html += `
Prompts: ${result.prompt_count || 0}
`;
+ html += `
Prompts: ${escapeHtml(result.prompt_count || 0)}
`;
html += `
Images table: ${result.has_images_table ? 'Yes' : 'No'}
`;
html += `
`;
}
if (category === 'images_table' && result.status === 'ok') {
html += `
`;
- html += `
Images: ${result.image_count || 0}
`;
+ html += `
Images: ${escapeHtml(result.image_count || 0)}
`;
if (result.recent_images && result.recent_images.length > 0) {
html += `
Recent images:
`;
html += `
`;
result.recent_images.slice(0, 3).forEach(img => {
- html += `${img.filename} → Prompt ${img.prompt_id} `;
+ html += `${escapeHtml(img.filename)} → Prompt ${escapeHtml(img.prompt_id)} `;
});
html += ` `;
}
@@ -1823,7 +1823,7 @@
html += `
Output directories found:
`;
html += `
`;
result.output_dirs.forEach(dir => {
- html += `${dir} `;
+ html += `${escapeHtml(dir)} `;
});
html += ` `;
html += `
`;
@@ -2044,7 +2044,7 @@
Copy Prompt Text
Please manually copy the text below:
-
+
Close
@@ -2057,6 +2057,7 @@
// Auto-select the text in the textarea
const textarea = modal.querySelector('textarea');
+ textarea.value = text;
textarea.focus();
textarea.select();
@@ -3696,7 +3697,7 @@ Seed: ${this.currentMetadata.seed || 'Unknown'}`;
this.renderReviewTags();
} else {
document.getElementById('reviewTagsVisible').innerHTML =
- `Error: ${data.error}
`;
+ `Error: ${escapeHtml(data.error)}
`;
}
} catch (error) {
console.error('Error generating tags:', error);
diff --git a/web/js/gallery.js b/web/js/gallery.js
index bc926ac..c63b5ba 100644
--- a/web/js/gallery.js
+++ b/web/js/gallery.js
@@ -429,7 +429,7 @@
data-original="${escapeHtml(image.url)}"
data-thumbnail="${escapeHtml(image.thumbnail_url || '')}"
data-caption="${escapeHtml(this.formatImageCaption(image))}"
- data-media-type="${mediaType}"
+ data-media-type="${escapeHtml(mediaType)}"
data-is-video="${isVideo}"
onerror="this.style.display='none'; this.nextElementSibling.style.display='flex'">
@@ -488,7 +488,7 @@
data-original="${escapeHtml(image.url)}"
data-thumbnail="${escapeHtml(image.thumbnail_url || '')}"
data-caption="${escapeHtml(this.formatImageCaption(image))}"
- data-media-type="${mediaType}"
+ data-media-type="${escapeHtml(mediaType)}"
data-is-video="${isVideo}"
onerror="this.style.display='none'">
${hasThumb ? '
' : ''}
@@ -1018,7 +1018,7 @@
${escapeHtml(fileName)}
- Type: ${fileExt} Video
+ Type: ${escapeHtml(fileExt)} Video
@@ -1094,7 +1094,7 @@
container.innerHTML = `
❌ Video Info Error
-
${error.message}
+
${escapeHtml(error.message)}
`;
}
@@ -1188,7 +1188,7 @@
container.innerHTML = `
❌ Metadata Error
-
${error.message}
+
${escapeHtml(error.message)}
`;
}
@@ -2152,10 +2152,10 @@ Seed: ${this.currentMetadata.seed || 'Unknown'}`;
groupEl.innerHTML = `
- Duplicate Group ${groupIndex + 1} (${group.images.length} identical ${group.images[0].media_type}s)
+ Duplicate Group ${groupIndex + 1} (${group.images.length} identical ${escapeHtml(group.images[0].media_type)}s)
- Content Hash: ${group.hash.substring(0, 16)}...
+ Content Hash: ${escapeHtml(String(group.hash || '').substring(0, 16))}...
${group.images.map((image, imageIndex) => `