|
|
@@ -47,19 +47,9 @@ export default function SharedImagePage() {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- // Fetch the share link data to get the image_short_code using SDK
|
|
|
- const linkDataRes = await client
|
|
|
- .from<{ image_short_code: string }>('share_links')
|
|
|
- .select('image_short_code')
|
|
|
- .eq('link_code', shareId)
|
|
|
- .limit(1)
|
|
|
- .get();
|
|
|
-
|
|
|
- if (!linkDataRes.error && linkDataRes.data && linkDataRes.data.length > 0) {
|
|
|
- const imageShortCode = linkDataRes.data[0].image_short_code;
|
|
|
- // Use direct storage path with short code
|
|
|
- setImageUrl(`/i/${imageShortCode}`);
|
|
|
- }
|
|
|
+ // Use the dedicated share-image endpoint which handles auth and serves the image
|
|
|
+ // This endpoint validates the share link and serves images from private buckets
|
|
|
+ setImageUrl(`/api/share-image/${shareId}`);
|
|
|
|
|
|
// Increment view count using SDK (fire and forget)
|
|
|
incrementViewCount(client, shareId).catch(console.warn);
|