Browse Source

Fix lint

pull/1714/head
yanghuanglin 5 months ago
parent
commit
500a2deb89
  1. 2
      src/app/components/Base/Dialog.vue
  2. 12
      src/app/pages/clients/[id].vue
  3. 8
      src/server/database/repositories/client/schema.ts
  4. 12
      src/server/database/repositories/client/types.ts
  5. 8
      src/server/utils/wgHelper.ts

2
src/app/components/Base/Dialog.vue

@ -6,7 +6,7 @@
class="fixed inset-0 z-30 bg-gray-500 opacity-75 dark:bg-black dark:opacity-50"
/>
<DialogContent
class="fixed left-1/2 top-1/2 z-[100] max-h-[85vh] w-[90vw] max-w-md -translate-x-1/2 -translate-y-1/2 rounded-md p-6 shadow-2xl focus:outline-none bg-white dark:bg-neutral-700"
class="fixed left-1/2 top-1/2 z-[100] max-h-[85vh] w-[90vw] max-w-md -translate-x-1/2 -translate-y-1/2 rounded-md bg-white p-6 shadow-2xl focus:outline-none dark:bg-neutral-700"
>
<DialogTitle
class="m-0 text-lg font-semibold text-gray-900 dark:text-neutral-200"

12
src/app/pages/clients/[id].vue

@ -75,8 +75,16 @@
<FormHeading>{{ $t('form.hooks') }}</FormHeading>
<FormTextField id="PreUp" v-model="data.preUp" label="PreUp" />
<FormTextField id="PostUp" v-model="data.postUp" label="PostUp" />
<FormTextField id="PreDown" v-model="data.preDown" label="PreDown" />
<FormTextField id="PostDown" v-model="data.postDown" label="PostDown" />
<FormTextField
id="PreDown"
v-model="data.preDown"
label="PreDown"
/>
<FormTextField
id="PostDown"
v-model="data.postDown"
label="PostDown"
/>
</FormGroup>
<FormGroup>
<FormHeading>{{ $t('form.actions') }}</FormHeading>

8
src/server/database/repositories/client/schema.ts

@ -14,10 +14,10 @@ export const client = sqliteTable('clients_table', {
name: text().notNull(),
ipv4Address: text('ipv4_address').notNull().unique(),
ipv6Address: text('ipv6_address').notNull().unique(),
preUp: text('pre_up').default(''),
postUp: text('post_up').default(''),
preDown: text('pre_down').default(''),
postDown: text('post_down').default(''),
preUp: text('pre_up').default('').notNull(),
postUp: text('post_up').default('').notNull(),
preDown: text('pre_down').default('').notNull(),
postDown: text('post_down').default('').notNull(),
privateKey: text('private_key').notNull(),
publicKey: text('public_key').notNull(),
preSharedKey: text('pre_shared_key').notNull(),

12
src/server/database/repositories/client/types.ts

@ -41,23 +41,19 @@ const address6 = z
const preUp = z
.string({ message: t('zod.client.preUp') })
.pipe(safeStringRefine)
.nullable();
.pipe(safeStringRefine);
const postUp = z
.string({ message: t('zod.client.postUp') })
.pipe(safeStringRefine)
.nullable();
.pipe(safeStringRefine);
const preDown = z
.string({ message: t('zod.client.preDown') })
.pipe(safeStringRefine)
.nullable();
.pipe(safeStringRefine);
const postDown = z
.string({ message: t('zod.client.postDown') })
.pipe(safeStringRefine)
.nullable();
.pipe(safeStringRefine);
const serverAllowedIps = z.array(AddressSchema, {
message: t('zod.client.serverAllowedIps'),

8
src/server/utils/wgHelper.ts

@ -54,10 +54,10 @@ PrivateKey = ${client.privateKey}
Address = ${client.ipv4Address}/${cidr4Block}, ${client.ipv6Address}/${cidr6Block}
DNS = ${client.dns.join(', ')}
MTU = ${client.mtu}
${client.preUp ? `PreUp = ${client.preUp}\n` : ''
}${client.postUp ? `PostUp = ${client.postUp}\n` : ''
}${client.preDown ? `PreDown = ${client.preDown}\n` : ''
}${client.postDown ? `PostDown = ${client.postDown}\n` : ''
${client.preUp ? `PreUp = ${client.preUp}\n` : ''}${
client.postUp ? `PostUp = ${client.postUp}\n` : ''
}${client.preDown ? `PreDown = ${client.preDown}\n` : ''}${
client.postDown ? `PostDown = ${client.postDown}\n` : ''
}
[Peer]

Loading…
Cancel
Save