From e7ef818701e029538ab64eaf9f6c0445b882205b Mon Sep 17 00:00:00 2001 From: Tijl <85572877+xTTLegend@users.noreply.github.com> Date: Sun, 25 Dec 2022 14:25:24 +0100 Subject: [PATCH] fixes --- assets/my-icon.png.example | 1 + config.js.example | 9 +++++---- popup-func.js | 2 +- popup.js | 5 +++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/assets/my-icon.png.example b/assets/my-icon.png.example index e69de29..219198a 100644 --- a/assets/my-icon.png.example +++ b/assets/my-icon.png.example @@ -0,0 +1 @@ +You can put your own icon in here! \ No newline at end of file diff --git a/config.js.example b/config.js.example index 1234f43..9c73866 100644 --- a/config.js.example +++ b/config.js.example @@ -1,6 +1,7 @@ var config = { - shlinkUrl: 'https://example.com', - shlinkOutUrl : 'https://example.com', - shlinkAppUrl : 'https://app.shlink.io/server/xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' - shlinkApiKey: 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' + shlinkUrl: 'https://example.com', // Base url of your shlink server + shlinkOutUrl: 'https://example.com', // The most cases this is the same as shlinkUrl + shlinkAppUrl: 'https://app.shlink.io/server/xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', // Base url for shlink app. See example. Selfhosted or app.shlink.io + shlinkApiKey: 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', // Shlink API Key + shlinkAppOpenMode: 'edit' // Changes the use of the Open App button to the shortUrl settings (edit) or visits info. Choose 'visits' or 'edit'. } \ No newline at end of file diff --git a/popup-func.js b/popup-func.js index 037c0fb..219624b 100644 --- a/popup-func.js +++ b/popup-func.js @@ -16,7 +16,7 @@ function newRedirect () { var shortUrlOut = document.getElementById("output-shortUrl") var responseData = JSON.parse(request.response); shortUrlOut.value = `${config.shlinkOutUrl}/${responseData.shortCode}`; - var shlinkAppBtnRdUrl = `${config.shlinkAppUrl}/short-code/${responseData.shortCode}/visits`; + shlinkAppBtnRdUrl = `${config.shlinkAppUrl}/short-code/${responseData.shortCode}/${config.shlinkAppOpenMode}`; document.getElementById("p1qr-code").src = `${config.shlinkUrl}/${responseData.shortCode}/qr-code?size=160&format=png&margin=2&errorCorrection=L`; } }); diff --git a/popup.js b/popup.js index 16acac1..47134cf 100644 --- a/popup.js +++ b/popup.js @@ -1,6 +1,7 @@ +const searchButton = document.getElementById('searchButton'); + var shlinkAppBtnRdUrl = `${config.shlinkAppUrl}`; -const searchButton = document.getElementById('searchButton'); if (searchButton) { searchButton.addEventListener('click', () => { searchRedirect(); @@ -23,7 +24,7 @@ if (copyShortUrlBtn) { const openShlinkAppBtn = document.getElementById('openShlinkApp-btn'); if (openShlinkAppBtn) { - copyShortUrlBtn.addEventListener('click', () => { + openShlinkAppBtn.addEventListener('click', () => { chrome.tabs.create({url:shlinkAppBtnRdUrl}); }); }