This commit is contained in:
Tijl 2022-12-25 17:58:17 +01:00
parent b4e68779e1
commit ea4b512429
5 changed files with 14 additions and 11 deletions

View File

@ -1,7 +1,8 @@
var config = {
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'.
customName: 'Redirect Extention',// Custom name for the extention
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

@ -17,6 +17,8 @@ function newRedirect () {
var responseData = JSON.parse(request.response);
shortUrlOut.value = `${config.shlinkOutUrl}/${responseData.shortCode}`;
shlinkAppBtnRdUrl = `${config.shlinkAppUrl}/short-code/${responseData.shortCode}/${config.shlinkAppOpenMode}`;
document.getElementById("newButton").style.display = 'none';
document.getElementById("cancelButton").style.display = 'block';
document.getElementById("p1qr-code").src = `${config.shlinkUrl}/${responseData.shortCode}/qr-code?size=160&format=png&margin=2&errorCorrection=L`;
}
});

View File

@ -4,5 +4,5 @@
.title {
font-size: 16px;
font-weight: bold;
padding: 12px;
padding: 8px 24px 2px;
}

View File

@ -2,11 +2,9 @@
<script src="popup-func.js"></script>
<div class="container">
<div>
<div class="title">Redirect Extention</div>
<button id="newButton">New</button>
<input id="output-shortUrl" type="text" disabled>
<button id="copyShortUrl-btn">Copy ShortUrl</button> <button id="openShlinkApp-btn">Open App</button>
<img id="p1qr-code" src="">
<p class="title" id="title">...</p>
<br><button id="newButton">New</button><button id="cancelButton" style="display: none;">Cancel</button> <input id="output-shortUrl" type="text" disabled> <button id="copyShortUrl-btn">Copy ShortUrl</button> <button id="openShlinkApp-btn">Open App</button><br>
<br><img id="p1qr-code" src="">
</div>
</div>
<script src="config.js"></script>

View File

@ -2,6 +2,8 @@ const searchButton = document.getElementById('searchButton');
var shlinkAppBtnRdUrl = `${config.shlinkAppUrl}`;
document.getElementById('title').innerHTML = config.customName
if (searchButton) {
searchButton.addEventListener('click', () => {
searchRedirect();