This commit is contained in:
Tijl 2022-12-25 14:25:24 +01:00
parent e611604385
commit e7ef818701
4 changed files with 10 additions and 7 deletions

View File

@ -0,0 +1 @@
You can put your own icon in here!

View File

@ -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'.
}

View File

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

View File

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