feat: auto-detect preview image format (jpg/png/webp/gif)

This commit is contained in:
2026-07-27 11:32:26 +08:00
parent 64bf6d9603
commit 958482e5e6
2 changed files with 12 additions and 2 deletions
+3 -2
View File
@@ -289,10 +289,11 @@ const PageDashboard = {
const isAll = supported === 'all';
const compatLabel = isAll ? '全' : '限';
const compatClass = isAll ? 'badge-info' : 'badge-warning';
const preview = `/dashboard/${theme.id}/preview.jpg`;
const preview = theme.preview_ext ? `/dashboard/${theme.id}/preview.${theme.preview_ext}` : '';
const bgStyle = preview ? `background-image:url(${preview});background-size:cover;background-position:center` : '';
return `
<div class="glass-card theme-card" data-theme-id="${theme.id}">
<div class="theme-card-preview" style="background-image:url(${preview});background-size:cover;background-position:center">${icon}</div>
<div class="theme-card-preview" style="${bgStyle}">${preview?'':icon}</div>
<div class="theme-card-info">
<div class="theme-card-name">${theme.name || 'Unnamed'}</div>
<div class="theme-card-meta">