Browse Source
fix regressions
fix missing expire date in client create dialog
fix wrong type rules
fix wrong api endpoint
pull/1349/head
Bernd Storath
10 months ago
No known key found for this signature in database
GPG Key ID: D6C85685A555540F
4 changed files with
24 additions and
7 deletions
-
src/components/Clients/CreateDialog.vue
-
src/server/utils/types.ts
-
src/stores/modal.ts
-
src/utils/api.ts
|
|
@ -71,6 +71,23 @@ |
|
|
|
/> |
|
|
|
</p> |
|
|
|
</div> |
|
|
|
<div v-show="globalStore.enableExpireTime" class="mt-2"> |
|
|
|
<p class="text-sm text-gray-500"> |
|
|
|
<label |
|
|
|
class="block text-gray-900 dark:text-neutral-200 text-sm font-bold mb-2" |
|
|
|
for="expireDate" |
|
|
|
> |
|
|
|
{{ $t('ExpireDate') }} |
|
|
|
</label> |
|
|
|
<input |
|
|
|
v-model.trim="modalStore.clientExpireDate" |
|
|
|
class="rounded p-2 border-2 dark:bg-neutral-700 dark:text-neutral-200 border-gray-100 dark:border-neutral-600 focus:border-gray-200 focus:dark:border-neutral-500 dark:placeholder:text-neutral-400 outline-none w-full" |
|
|
|
type="date" |
|
|
|
:placeholder="$t('ExpireDate')" |
|
|
|
name="expireDate" |
|
|
|
/> |
|
|
|
</p> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -110,4 +127,5 @@ |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
const modalStore = useModalStore(); |
|
|
|
const globalStore = useGlobalStore(); |
|
|
|
</script> |
|
|
|
|
|
@ -30,14 +30,13 @@ const password = z |
|
|
|
.string({ message: 'Password must be a valid string' }) |
|
|
|
.pipe(safeStringRefine); |
|
|
|
|
|
|
|
const remember = z |
|
|
|
.boolean({ message: 'Remember must be a valid boolean' }) |
|
|
|
.optional(); |
|
|
|
const remember = z.boolean({ message: 'Remember must be a valid boolean' }); |
|
|
|
|
|
|
|
const expireDate = z |
|
|
|
.string({ message: 'expiredDate must be a valid string' }) |
|
|
|
.min(1, 'expiredDate must be at least 1 Character') |
|
|
|
.pipe(safeStringRefine); |
|
|
|
.pipe(safeStringRefine) |
|
|
|
.nullable(); |
|
|
|
|
|
|
|
export const clientIdType = z.object( |
|
|
|
{ |
|
|
|
|
|
@ -5,12 +5,12 @@ export const useModalStore = defineStore('Modal', () => { |
|
|
|
const clientDelete = ref<null | WGClient>(null); |
|
|
|
const clientCreate = ref<null | boolean>(null); |
|
|
|
const clientCreateName = ref<string>(''); |
|
|
|
const clientExpireDate = ref<string | null>(null); |
|
|
|
const clientExpireDate = ref<string>(''); |
|
|
|
const qrcode = ref<null | string>(null); |
|
|
|
|
|
|
|
function createClient() { |
|
|
|
const name = clientCreateName.value; |
|
|
|
const expireDate = clientExpireDate.value; |
|
|
|
const expireDate = clientExpireDate.value || null; |
|
|
|
if (!name) return; |
|
|
|
|
|
|
|
api |
|
|
|
|
|
@ -93,7 +93,7 @@ class API { |
|
|
|
} |
|
|
|
|
|
|
|
async showOneTimeLink({ clientId }: { clientId: string }) { |
|
|
|
return $fetch(`/api/wireguard/${clientId}/:clientId/generateOneTimeLink`, { |
|
|
|
return $fetch(`/api/wireguard/client/${clientId}/generateOneTimeLink`, { |
|
|
|
method: 'post', |
|
|
|
}); |
|
|
|
} |
|
|
|