Add ATC thumbnail URL resolution for R2 storage
- Add resolveImgUrl() to prepend https://atc.tzzrdeck.me/ to relative paths - Update getImg() and getFullImg() to use the new resolver - Enables thumbnail display for attachments stored in R2 bucket Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -22,10 +22,21 @@ export function resolveGroupName(mrf: string | undefined, nameMap: Map<string, s
|
||||
return nameMap.get(mrf) || mrf.slice(0, 8);
|
||||
}
|
||||
|
||||
const ATC_BASE = 'https://atc.tzzrdeck.me';
|
||||
|
||||
function resolveImgUrl(url: string | undefined): string {
|
||||
if (!url) return '';
|
||||
// Relative paths (e.g., "thumbs/xxx.png") need ATC base
|
||||
if (url && !url.startsWith('http')) {
|
||||
return `${ATC_BASE}/${url}`;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
export function getImg(tag: Tag): string {
|
||||
return tag.img_thumb_url || '';
|
||||
return resolveImgUrl(tag.img_thumb_url);
|
||||
}
|
||||
|
||||
export function getFullImg(tag: Tag): string {
|
||||
return tag.img_url || tag.img_thumb_url || '';
|
||||
return resolveImgUrl(tag.img_url) || resolveImgUrl(tag.img_thumb_url);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user