From c1c9a37914cdf05bdc2846dd531b5e3d5ee7bc25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Thu, 24 Oct 2024 16:09:36 +0200 Subject: [PATCH] Fall back to plain profile picture if imagemagick is not installed --- models/profile.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/models/profile.ts b/models/profile.ts index e50759a..fcb9b8d 100644 --- a/models/profile.ts +++ b/models/profile.ts @@ -1,6 +1,9 @@ import { nip19, NostrEvent as NEvent } from "@nostr/tools"; +import { getImageMagickCommand } from "../utils.ts"; import config from "../config.ts"; +const magick = await getImageMagickCommand(); + export interface ProfileData { name?: string; display_name?: string; @@ -60,6 +63,10 @@ export default class Profile { } get ogImageUrl(): string { - return `${config.base_url}/assets/g/img/og-p-${this.event.id}.png`; + if (magick) { + return `${config.base_url}/assets/g/img/og-p-${this.event.id}.png`; + } else { + return this.picture || ""; + } } }