mirror of
https://github.com/wg-easy/wg-easy.git
synced 2025-09-26 19:51:15 +08:00
fix labels, date field, enable
This commit is contained in:
2
.github/ISSUE_TEMPLATE/01-bug-report.yml
vendored
2
.github/ISSUE_TEMPLATE/01-bug-report.yml
vendored
@@ -2,8 +2,6 @@
|
||||
name: 🐛 Bug Report
|
||||
description: Create a report to help us improve
|
||||
title: "[Bug]: "
|
||||
labels:
|
||||
- "type: bug"
|
||||
type: Bug
|
||||
|
||||
body:
|
||||
|
@@ -7,19 +7,38 @@
|
||||
<IconsInfo class="size-4" />
|
||||
</BaseTooltip>
|
||||
</div>
|
||||
<BaseInput :id="id" v-model="data" :name="id" type="date" />
|
||||
<BaseInput
|
||||
:id="id"
|
||||
:model-value="formattedDate"
|
||||
:name="id"
|
||||
type="date"
|
||||
max="9999-12-31"
|
||||
@update:model-value="updateDate"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
defineProps<{ id: string; label: string; description?: string }>();
|
||||
|
||||
const data = defineModel<string | null>({
|
||||
set(value) {
|
||||
const temp = value?.trim() ?? null;
|
||||
if (temp === '') {
|
||||
return null;
|
||||
}
|
||||
return temp;
|
||||
},
|
||||
const data = defineModel<string | null>();
|
||||
|
||||
const date = ref(data);
|
||||
|
||||
const formattedDate = computed(() => {
|
||||
return date.value ? date.value.split('T')[0] : '';
|
||||
});
|
||||
|
||||
const updateDate = (value: unknown) => {
|
||||
if (typeof value !== 'string' && value !== null) {
|
||||
return;
|
||||
}
|
||||
|
||||
const temp = value?.trim() ?? null;
|
||||
|
||||
if (temp === '' || temp === null) {
|
||||
date.value = null;
|
||||
} else {
|
||||
date.value = new Date(temp).toISOString();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@@ -12,7 +12,7 @@ export default definePermissionEventHandler(
|
||||
const client = await Database.clients.get(clientId);
|
||||
checkPermissions(client);
|
||||
|
||||
await Database.clients.toggle(clientId, false);
|
||||
await Database.clients.toggle(clientId, true);
|
||||
await WireGuard.saveConfig();
|
||||
return { success: true };
|
||||
}
|
||||
|
@@ -75,15 +75,6 @@ export class ClientService {
|
||||
const publicKey = await wg.getPublicKey(privateKey);
|
||||
const preSharedKey = await wg.generatePreSharedKey();
|
||||
|
||||
let parsedExpiresAt = expiresAt;
|
||||
if (parsedExpiresAt) {
|
||||
const expiresAtDate = new Date(parsedExpiresAt);
|
||||
expiresAtDate.setHours(23);
|
||||
expiresAtDate.setMinutes(59);
|
||||
expiresAtDate.setSeconds(59);
|
||||
parsedExpiresAt = expiresAtDate.toISOString();
|
||||
}
|
||||
|
||||
return this.#db.transaction(async (tx) => {
|
||||
const clients = await tx.query.client.findMany().execute();
|
||||
const clientInterface = await tx.query.wgInterface
|
||||
@@ -117,7 +108,7 @@ export class ClientService {
|
||||
name,
|
||||
// TODO: properly assign user id
|
||||
userId: 1,
|
||||
expiresAt: parsedExpiresAt,
|
||||
expiresAt,
|
||||
privateKey,
|
||||
publicKey,
|
||||
preSharedKey,
|
||||
|
@@ -22,6 +22,7 @@ const name = z
|
||||
.min(1, t('zod.client.name'))
|
||||
.pipe(safeStringRefine);
|
||||
|
||||
// TODO?: validate iso string
|
||||
const expiresAt = z
|
||||
.string({ message: t('zod.client.expiresAt') })
|
||||
.min(1, t('zod.client.expiresAt'))
|
||||
|
@@ -16,5 +16,3 @@ export const WG_ENV = {
|
||||
/** UI is hosted on HTTP instead of HTTPS */
|
||||
INSECURE: process.env.INSECURE === 'true',
|
||||
};
|
||||
|
||||
console.log(WG_ENV);
|
||||
|
Reference in New Issue
Block a user