Add PreUp, PostUp, PreDown, PostDown for client (#1714)
* Fix create client popup background is not white * Fix no Add button when client Allowed Ips or Server Allowed Ips is empty * Add preUp preDown postUp postDown for client * Add description of hooks for client config * Move hooks's label text into 'hooks' in en.json --------- Co-authored-by: yanghuanglin <yanghuanglin@qq.com> Co-authored-by: Bernd Storath <999999bst@gmail.com>
This commit is contained in:
@@ -14,6 +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('').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(),
|
||||
|
||||
@@ -57,6 +57,10 @@ export const ClientUpdateSchema = schemaForType<UpdateClientType>()(
|
||||
expiresAt: expiresAt,
|
||||
ipv4Address: address4,
|
||||
ipv6Address: address6,
|
||||
preUp: HookSchema,
|
||||
postUp: HookSchema,
|
||||
preDown: HookSchema,
|
||||
postDown: HookSchema,
|
||||
allowedIps: AllowedIpsSchema,
|
||||
serverAllowedIps: serverAllowedIps,
|
||||
mtu: MtuSchema,
|
||||
|
||||
@@ -6,13 +6,11 @@ export type HooksType = InferSelectModel<typeof hooks>;
|
||||
|
||||
export type HooksUpdateType = Omit<HooksType, 'id' | 'createdAt' | 'updatedAt'>;
|
||||
|
||||
const hook = z.string({ message: t('zod.hook') }).pipe(safeStringRefine);
|
||||
|
||||
export const HooksUpdateSchema = schemaForType<HooksUpdateType>()(
|
||||
z.object({
|
||||
preUp: hook,
|
||||
postUp: hook,
|
||||
preDown: hook,
|
||||
postDown: hook,
|
||||
preUp: HookSchema,
|
||||
postUp: HookSchema,
|
||||
preDown: HookSchema,
|
||||
postDown: HookSchema,
|
||||
})
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user