Ajouter une route JPEG ou Cover Cache

This commit is contained in:
2025-11-28 21:22:39 +01:00
parent b04a90818f
commit 4e979a2d79
7 changed files with 118 additions and 48 deletions

View File

@@ -122,6 +122,10 @@
<p v-else><strong>Source URL:</strong> Unknown</p>
<p><strong>Hits:</strong> {{ selectedImage.hits }}</p>
<p v-if="selectedImage.last_used"><strong>Last Used:</strong> {{ formatDate(selectedImage.last_used) }}</p>
<div class="links">
<p><strong>WebP:</strong> <a :href="getImageUrl(selectedImage.pk)" target="_blank">{{ getImageUrl(selectedImage.pk) }}</a></p>
<p><strong>JPEG:</strong> <a :href="getJpegUrl(selectedImage.pk)" target="_blank">{{ getJpegUrl(selectedImage.pk) }}</a></p>
</div>
<div class="modal-actions">
<button @click="copyImageUrl(selectedImage.pk)" class="btn-secondary">
📋 Copy URL
@@ -146,6 +150,7 @@ import {
purgeCache,
consolidateCache,
getImageUrl,
getJpegUrl,
getOriginUrl,
waitForDownload,
getDefaultImageUrl,
@@ -235,8 +240,10 @@ async function handleConsolidate(){
}
function copyImageUrl(pk:string){
navigator.clipboard.writeText(window.location.origin + getImageUrl(pk));
alert("✅ URL copied!");
const webpUrl = window.location.origin + getImageUrl(pk);
const jpegUrl = window.location.origin + getJpegUrl(pk);
navigator.clipboard.writeText(`${webpUrl}\n${jpegUrl}`);
alert("✅ URLs copied (WebP + JPEG)!");
}
function resolveOrigin(entry: CacheEntry | null): string | undefined {

View File

@@ -193,6 +193,13 @@ export function getImageUrl(pk: string, size?: number): string {
return `/covers/image/${pk}`;
}
export function getJpegUrl(pk: string, size?: number): string {
if (size) {
return `/covers/jpeg/${pk}/${size}`;
}
return `/covers/jpeg/${pk}`;
}
/**
* SVG par défaut pour les images qui ne se chargent pas
*/