diff options
| author | ilotterytea <iltsu@alright.party> | 2025-12-12 01:27:12 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-12-12 01:27:12 +0500 |
| commit | 878bbab27a541433ef35e4aaa4616c2975f20d24 (patch) | |
| tree | 9d995899c12561dd7fbba602abc18853b796453d /extension.js | |
| parent | 95893a324a761de671260b526143bd878feaaa53 (diff) | |
fix: check if url starts with https or http
Diffstat (limited to 'extension.js')
| -rw-r--r-- | extension.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/extension.js b/extension.js index dd7d229..4771baa 100644 --- a/extension.js +++ b/extension.js @@ -12,17 +12,21 @@ const start = async () => { const emotes = {}; // fetching instances - const instances = ["https://alright.party"]; + const instances = ["alright.party"]; for (const instanceUrl of instances) { - const data = await getTinyEmotesUserByName(instanceUrl, channelName); + let url = instanceUrl; + if (!url.startsWith("https://") && !url.startsWith("http://")) { + url = "https://" + url; + } + const data = await getTinyEmotesUserByName(url, channelName); const user = data.data; // adding emotes const emote_set = user.emote_sets.find((x) => x.id === user.active_emote_set_id); for (const emote of emote_set.emotes) { emotes[emote.code] = { - miniatureurl: `${instanceUrl}/static/userdata/emotes/${emote.id}/1x.${emote.ext}`, - fullurl: `${instanceUrl}/static/userdata/emotes/${emote.id}/3x.${emote.ext}`, + miniatureurl: `${url}/static/userdata/emotes/${emote.id}/1x.${emote.ext}`, + fullurl: `${url}/static/userdata/emotes/${emote.id}/3x.${emote.ext}`, uploader: emote.uploaded_by ? emote.uploaded_by.username : "Anonymous*", instance: instanceUrl }; |
