mirror of
https://github.com/lumina-rocks/lumina.git
synced 2026-06-04 17:51:16 +02:00
Feature: Image Proxy (#122)
* feat: Implement image proxying functionality in KIND20Card and QuickViewKind20NoteCard components * fix: Enhance image error handling in KIND20Card and QuickViewKind20NoteCard components * feat: Add imgproxy configuration instructions to README for image proxying support --------- Co-authored-by: highperfocused <highperfocused@pm.me>
This commit is contained in:
@@ -54,4 +54,19 @@ export async function signEvent(loginType: string | null, event: NostrEvent): Pr
|
||||
}
|
||||
console.log(eventSigned);
|
||||
return eventSigned;
|
||||
}
|
||||
|
||||
// Create proxied image URL
|
||||
export const getProxiedImageUrl = (url: string, width: number, height: number) => {
|
||||
if (!url.startsWith("http")) return url;
|
||||
try {
|
||||
// Encode the URL to be used in the proxy
|
||||
const encodedUrl = encodeURIComponent(url);
|
||||
const imgproxyEnv = process.env.NEXT_PUBLIC_IMGPROXY_URL;
|
||||
const imgproxyUrl = new URL(imgproxyEnv || "https://imgproxy.example.com");
|
||||
return `${imgproxyUrl}_/resize:fit:${width}:${height}/plain/${encodedUrl}`;
|
||||
} catch (error) {
|
||||
console.error("Error creating proxied image URL:", error);
|
||||
return url;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user