From 58486a399772926e509339a8ca3fb811a370ddc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=8C=E8=90=8C=E5=93=92=E8=B5=AB=E8=90=9D?= Date: Wed, 12 Jul 2023 22:09:20 -0700 Subject: [PATCH] :bug: Fix: fix an issue related with yourls ISSUES CLOSED: #72 --- src/main/utils/common.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/utils/common.ts b/src/main/utils/common.ts index 99c1e06..67450e3 100644 --- a/src/main/utils/common.ts +++ b/src/main/utils/common.ts @@ -122,9 +122,12 @@ export const generateShortUrl = async (url: string) => { console.log(e) } } else if (server === 'yourls') { - const domain = db.get('settings.yourlsDomain') || '' + let domain = db.get('settings.yourlsDomain') || '' const signature = db.get('settings.yourlsSignature') || '' if (domain && signature) { + if (!/^https?:\/\//.test(domain)) { + domain = `http://${domain}` + } try { const res = await axios.get(`${domain}/yourls-api.php?signature=${signature}&action=shorturl&format=json&url=${url}`) if (res.data.shorturl) {