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

11
src/server/utils/WireGuard.ts

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

Loading…
Cancel
Save