mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 02:09:37 +02:00
Implement contact form on server side
This commit is contained in:
parent
8d00889b60
commit
a4101923e6
32 changed files with 541 additions and 49 deletions
|
@ -3,6 +3,7 @@ import 'express-validator'
|
|||
|
||||
import { isArray, exists } from './misc'
|
||||
import { isTestInstance } from '../core-utils'
|
||||
import { CONSTRAINTS_FIELDS } from '../../initializers'
|
||||
|
||||
function isHostValid (host: string) {
|
||||
const isURLOptions = {
|
||||
|
@ -26,9 +27,19 @@ function isEachUniqueHostValid (hosts: string[]) {
|
|||
})
|
||||
}
|
||||
|
||||
function isValidContactBody (value: any) {
|
||||
return exists(value) && validator.isLength(value, CONSTRAINTS_FIELDS.CONTACT_FORM.BODY)
|
||||
}
|
||||
|
||||
function isValidContactFromName (value: any) {
|
||||
return exists(value) && validator.isLength(value, CONSTRAINTS_FIELDS.CONTACT_FORM.FROM_NAME)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export {
|
||||
isValidContactBody,
|
||||
isValidContactFromName,
|
||||
isEachUniqueHostValid,
|
||||
isHostValid
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue