mirror of
https://github.com/CaramelFur/Picsur.git
synced 2026-05-07 03:27:26 +02:00
change regex names
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import { string, z } from 'zod';
|
||||
import { SemVer } from '../../util/common-regex';
|
||||
import { SemVerRegex } from '../../util/common-regex';
|
||||
import { createZodDto } from '../../util/create-zod-dto';
|
||||
import { IsStringList } from '../../validators/string-list.validator';
|
||||
|
||||
export const InfoResponseSchema = z.object({
|
||||
production: z.boolean(),
|
||||
demo: z.boolean(),
|
||||
version: string().regex(SemVer),
|
||||
version: string().regex(SemVerRegex),
|
||||
});
|
||||
export class InfoResponse extends createZodDto(InfoResponseSchema) {}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { z } from 'zod';
|
||||
import { SHA256 } from '../util/common-regex';
|
||||
import { SHA256Regex } from '../util/common-regex';
|
||||
import { IsEntityID } from '../validators/entity-id.validator';
|
||||
|
||||
export const EImageSchema = z.object({
|
||||
id: IsEntityID().optional(),
|
||||
hash: z.string().regex(SHA256),
|
||||
hash: z.string().regex(SHA256Regex),
|
||||
data: z.undefined(),
|
||||
mime: z.string(),
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
export const AlphaNumeric = /^[a-zA-Z0-9]+$/;
|
||||
export const SHA256 = /^[a-f0-9A-F]{64}$/;
|
||||
export const SemVer = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
|
||||
export const AlphaNumericRegex = /^[a-zA-Z0-9]+$/;
|
||||
export const SHA256Regex = /^[a-f0-9A-F]{64}$/;
|
||||
export const SemVerRegex = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
|
||||
export const URLRegex =
|
||||
/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?)/;
|
||||
export const UUIDRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod';
|
||||
import { AlphaNumeric } from '../util/common-regex';
|
||||
import { AlphaNumericRegex } from '../util/common-regex';
|
||||
|
||||
export const IsRoleName = () => z.string().min(4).max(32).regex(AlphaNumeric);
|
||||
export const IsRoleName = () => z.string().min(4).max(32).regex(AlphaNumericRegex);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { z } from 'zod';
|
||||
import { AlphaNumeric } from '../util/common-regex';
|
||||
import { AlphaNumericRegex } from '../util/common-regex';
|
||||
|
||||
// Match this with user validators in frontend
|
||||
// (Frontend is not security focused, but it tells the user what is wrong)
|
||||
|
||||
export const IsUsername = () => z.string().min(4).max(32).regex(AlphaNumeric);
|
||||
export const IsUsername = () => z.string().min(4).max(32).regex(AlphaNumericRegex);
|
||||
|
||||
export const IsPlainTextPwd = () => z.string().min(4).max(1024);
|
||||
|
||||
Reference in New Issue
Block a user