fix one time links (#1304)

Closes #1302
Co-authored-by: Bernd Storath <999999bst@gmail.com>
This commit is contained in:
Bernd Storath
2024-08-21 15:55:35 +02:00
committed by GitHub
parent 968d2b90a0
commit 86f968499a
8 changed files with 48 additions and 19 deletions
+2 -2
View File
@@ -256,7 +256,7 @@
{{!uiTrafficStats ? " · " : ""}}{{new Date(client.latestHandshakeAt) | timeago}}
</span>
</div>
<div v-if="uiShowLinks && client.oneTimeLink !== null && client.oneTimeLink !== ''" :ref="'client-' + client.id + '-link'" class="text-gray-400 text-xs">
<div v-if="enableOneTimeLinks && client.oneTimeLink !== null && client.oneTimeLink !== ''" :ref="'client-' + client.id + '-link'" class="text-gray-400 text-xs">
<a :href="'./cnf/' + client.oneTimeLink + ''">{{document.location.protocol}}//{{document.location.host}}/cnf/{{client.oneTimeLink}}</a>
</div>
<!-- Expire Date -->
@@ -385,7 +385,7 @@
</a>
<!-- Short OneTime Link -->
<button v-if="uiShowLinks" :disabled="!client.downloadableConfig"
<button v-if="enableOneTimeLinks" :disabled="!client.downloadableConfig"
class="align-middle inline-block bg-gray-100 dark:bg-neutral-600 dark:text-neutral-300 p-2 rounded transition"
:class="{
'hover:bg-red-800 dark:hover:bg-red-800 hover:text-white dark:hover:text-white': client.downloadableConfig,
+2 -2
View File
@@ -64,10 +64,10 @@ class API {
});
}
async getUIShowLinks() {
async getWGEnableOneTimeLinks() {
return this.call({
method: 'get',
path: '/ui-show-links',
path: '/wg-enable-one-time-links',
});
}
+4 -4
View File
@@ -92,7 +92,7 @@ new Vue({
uiTrafficStats: false,
uiChartType: 0,
uiShowLinks: false,
enableOneTimeLinks: false,
enableSortClient: false,
sortClient: true, // Sort clients by name, true = asc, false = desc
enableExpireTime: false,
@@ -441,12 +441,12 @@ new Vue({
this.uiChartType = 0;
});
this.api.getUIShowLinks()
this.api.getWGEnableOneTimeLinks()
.then((res) => {
this.uiShowLinks = res;
this.enableOneTimeLinks = res;
})
.catch(() => {
this.uiShowLinks = false;
this.enableOneTimeLinks = false;
});
this.api.getUiSortClients()