Browse Source

revert some code

pull/1719/head
Bernd Storath 5 months ago
parent
commit
84be4e9cd8
  1. 7
      src/app/components/ClientCard/OneTimeLink.vue
  2. 11
      src/server/utils/WireGuard.ts

7
src/app/components/ClientCard/OneTimeLink.vue

@ -1,6 +1,6 @@
<template>
<div v-if="props.client.oneTimeLink" class="text-xs text-gray-400">
<a :href="'./cnf/' + props.client.oneTimeLink.oneTimeLink">{{ path }}</a>
<div v-if="client.oneTimeLink !== null" class="text-xs text-gray-400">
<a :href="'./cnf/' + client.oneTimeLink.oneTimeLink">{{ path }}</a>
</div>
</template>
@ -8,14 +8,13 @@
const props = defineProps<{ client: LocalClient }>();
const path = ref('Loading...');
const timer = ref<NodeJS.Timeout | null>(null);
const { localeProperties } = useI18n();
onMounted(() => {
timer.value = setIntervalImmediately(() => {
if (!props.client.oneTimeLink) {
if (props.client.oneTimeLink === null) {
return;
}

11
src/server/utils/WireGuard.ts

@ -208,11 +208,12 @@ class WireGuard {
}
// One Time Link Feature
for (const client of clients) {
if (client.oneTimeLink !== null) {
if (new Date() > new Date(client.oneTimeLink.expiresAt)) {
WG_DEBUG(`OneTimeLink for Client ${client.id} expired.`);
await Database.oneTimeLinks.delete(client.id);
}
if (
client.oneTimeLink !== null &&
new Date() > new Date(client.oneTimeLink.expiresAt)
) {
WG_DEBUG(`OneTimeLink for Client ${client.id} expired.`);
await Database.oneTimeLinks.delete(client.id);
}
}

Loading…
Cancel
Save