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}); }); }