mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 10:19:35 +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
|
@ -11,6 +11,25 @@ import * as pem from 'pem'
|
|||
import { URL } from 'url'
|
||||
import { truncate } from 'lodash'
|
||||
import { exec } from 'child_process'
|
||||
import { isArray } from './custom-validators/misc'
|
||||
|
||||
const objectConverter = (oldObject: any, keyConverter: (e: string) => string, valueConverter: (e: any) => any) => {
|
||||
if (!oldObject || typeof oldObject !== 'object') {
|
||||
return valueConverter(oldObject)
|
||||
}
|
||||
|
||||
if (isArray(oldObject)) {
|
||||
return oldObject.map(e => objectConverter(e, keyConverter, valueConverter))
|
||||
}
|
||||
|
||||
const newObject = {}
|
||||
Object.keys(oldObject).forEach(oldKey => {
|
||||
const newKey = keyConverter(oldKey)
|
||||
newObject[ newKey ] = objectConverter(oldObject[ oldKey ], keyConverter, valueConverter)
|
||||
})
|
||||
|
||||
return newObject
|
||||
}
|
||||
|
||||
const timeTable = {
|
||||
ms: 1,
|
||||
|
@ -235,6 +254,7 @@ export {
|
|||
isTestInstance,
|
||||
isProdInstance,
|
||||
|
||||
objectConverter,
|
||||
root,
|
||||
escapeHTML,
|
||||
pageToStartAndCount,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue