first commit
This commit is contained in:
commit
3c0479faf0
169 files changed
+27617
No files matched your search
@@ -0,0 +1,10 @@
|
||||
import vine from '@vinejs/vine'
|
||||
|
||||
export const loginValidator = vine.create({
|
||||
username: vine.string().trim().maxLength(64),
|
||||
password: vine.string().maxLength(256),
|
||||
code: vine
|
||||
.string()
|
||||
.trim()
|
||||
.regex(/^\d{6}$/),
|
||||
})
|
||||
@@ -0,0 +1,6 @@
|
||||
import vine from '@vinejs/vine'
|
||||
|
||||
export const updateCaddyfileValidator = vine.create({
|
||||
content: vine.string().minLength(1).maxLength(500_000),
|
||||
reason: vine.string().trim().maxLength(200).optional(),
|
||||
})
|
||||
@@ -0,0 +1,37 @@
|
||||
import vine from '@vinejs/vine'
|
||||
|
||||
const NAME = /^[a-z0-9][a-z0-9-]{0,40}$/
|
||||
const DOMAIN = /^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$/
|
||||
const GIT_URL = /^(https?:\/\/|ssh:\/\/|git@)[^\s]+$/
|
||||
|
||||
export const createProjectValidator = vine.create({
|
||||
type: vine.enum(['node', 'adonis', 'wordpress', 'static'] as const),
|
||||
name: vine.string().trim().toLowerCase().regex(NAME),
|
||||
category: vine.enum(['api', 'frontend', 'fullstack', 'wordpress'] as const),
|
||||
gitUrl: vine
|
||||
.string()
|
||||
.trim()
|
||||
.regex(GIT_URL)
|
||||
.optional()
|
||||
.requiredWhen('type', 'in', ['node', 'adonis']),
|
||||
port: vine
|
||||
.number()
|
||||
.withoutDecimals()
|
||||
.range([1, 65535])
|
||||
.optional()
|
||||
.requiredWhen('type', 'in', ['node', 'adonis']),
|
||||
command: vine.string().trim().maxLength(500).optional(),
|
||||
env: vine.string().maxLength(20_000).optional(),
|
||||
createDatabase: vine.boolean(),
|
||||
domain: vine.string().trim().toLowerCase().regex(DOMAIN),
|
||||
addCaddy: vine.boolean(),
|
||||
spa: vine.boolean(),
|
||||
})
|
||||
|
||||
export const projectActionValidator = vine.create({
|
||||
commit: vine
|
||||
.string()
|
||||
.trim()
|
||||
.regex(/^[0-9a-f]{7,40}$/)
|
||||
.optional(),
|
||||
})
|
||||
Reference in new issue
Block a user