From c147c2aeb3bbb0a1b9cee5c8d313b618a22b6910 Mon Sep 17 00:00:00 2001 From: Kopper Date: Fri, 6 Sep 2024 07:38:45 +0300 Subject: [PATCH] Accept full URLs for /api/v1/pleroma/emoji The frontend assumes these URLs will be relative to the target instance, which may not be the case due to object storage and such configurations. --- src/modules/instance.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/modules/instance.js b/src/modules/instance.js index 0c856352..ff59d1e6 100644 --- a/src/modules/instance.js +++ b/src/modules/instance.js @@ -182,10 +182,13 @@ const instance = { const result = await res.json() const values = Array.isArray(result) ? Object.assign({}, ...result) : result const emoji = Object.entries(values).map(([key, value]) => { - const imageUrl = value.image_url + let imageUrl = value.image_url + if (typeof imageUrl == 'string' && imageUrl.startsWith('/')) + imageUrl = state.server + imageUrl; + return { displayText: key, - imageUrl: imageUrl ? state.server + imageUrl : value, + imageUrl: imageUrl ? imageUrl : value, tags: imageUrl ? value.tags.sort((a, b) => a > b ? 1 : 0) : ['utf'], replacement: `:${key}: ` }