mirror of
https://github.com/iptv-org/database.git
synced 2024-11-24 19:51:25 -05:00
Update channels.js
This commit is contained in:
parent
b50fe000f5
commit
f79a133170
1 changed files with 59 additions and 59 deletions
|
@ -2,63 +2,63 @@ const Joi = require('joi').extend(require('@joi/date'))
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
id: Joi.string()
|
id: Joi.string()
|
||||||
.regex(/^[A-Za-z0-9]+\.[a-z]{2}$/)
|
.regex(/^[A-Za-z0-9]+\.[a-z]{2}$/)
|
||||||
.required(),
|
.required(),
|
||||||
name: Joi.string()
|
name: Joi.string()
|
||||||
.regex(/^[a-z0-9-!:&.+'/»#%°$@?\s]+$/i)
|
.regex(/^[a-z0-9-!:&.+'/»#%°$@?\s]+$/i)
|
||||||
.required(),
|
.required(),
|
||||||
alt_names: Joi.array().items(
|
alt_names: Joi.array().items(
|
||||||
Joi.string()
|
Joi.string()
|
||||||
.regex(/^[^",]+$/)
|
.regex(/^[^",]+$/)
|
||||||
.invalid(Joi.ref('name'))
|
.invalid(Joi.ref('name'))
|
||||||
),
|
),
|
||||||
network: Joi.string()
|
network: Joi.string()
|
||||||
.regex(/^[^",]+$/)
|
.regex(/^[^",]+$/)
|
||||||
.allow(null),
|
.allow(null),
|
||||||
owners: Joi.array().items(Joi.string().regex(/^[^",]+$/)),
|
owners: Joi.array().items(Joi.string().regex(/^[^",]+$/)),
|
||||||
country: Joi.string()
|
country: Joi.string()
|
||||||
.regex(/^[A-Z]{2}$/)
|
.regex(/^[A-Z]{2}$/)
|
||||||
.required(),
|
.required(),
|
||||||
subdivision: Joi.string()
|
subdivision: Joi.string()
|
||||||
.regex(/^[A-Z]{2}-[A-Z0-9]{1,3}$/)
|
.regex(/^[A-Z]{2}-[A-Z0-9]{1,3}$/)
|
||||||
.allow(null),
|
.allow(null),
|
||||||
city: Joi.string()
|
city: Joi.string()
|
||||||
.regex(/^[\sa-zA-Z\u00C0-\u00FF0-9'-]+$/)
|
.regex(/^[^",]+$/)
|
||||||
.allow(null),
|
.allow(null),
|
||||||
broadcast_area: Joi.array().items(
|
broadcast_area: Joi.array().items(
|
||||||
Joi.string()
|
Joi.string()
|
||||||
.regex(/^(s\/[A-Z]{2}-[A-Z0-9]{1,3}|c\/[A-Z]{2}|r\/[A-Z0-9]{3,7})$/)
|
.regex(/^(s\/[A-Z]{2}-[A-Z0-9]{1,3}|c\/[A-Z]{2}|r\/[A-Z0-9]{3,7})$/)
|
||||||
.required()
|
.required()
|
||||||
),
|
),
|
||||||
languages: Joi.array().items(
|
languages: Joi.array().items(
|
||||||
Joi.string()
|
Joi.string()
|
||||||
.regex(/^[a-z]{3}$/)
|
.regex(/^[a-z]{3}$/)
|
||||||
.required()
|
.required()
|
||||||
),
|
),
|
||||||
categories: Joi.array().items(Joi.string().regex(/^[a-z]+$/)),
|
categories: Joi.array().items(Joi.string().regex(/^[a-z]+$/)),
|
||||||
is_nsfw: Joi.boolean().strict().required(),
|
is_nsfw: Joi.boolean().strict().required(),
|
||||||
launched: Joi.date().format('YYYY-MM-DD').raw().allow(null),
|
launched: Joi.date().format('YYYY-MM-DD').raw().allow(null),
|
||||||
closed: Joi.date().format('YYYY-MM-DD').raw().allow(null).greater(Joi.ref('launched')),
|
closed: Joi.date().format('YYYY-MM-DD').raw().allow(null).greater(Joi.ref('launched')),
|
||||||
replaced_by: Joi.string()
|
replaced_by: Joi.string()
|
||||||
.regex(/^[A-Za-z0-9]+\.[a-z]{2}$/)
|
.regex(/^[A-Za-z0-9]+\.[a-z]{2}$/)
|
||||||
.allow(null),
|
.allow(null),
|
||||||
website: Joi.string()
|
website: Joi.string()
|
||||||
.uri({
|
.uri({
|
||||||
scheme: ['http', 'https']
|
scheme: ['http', 'https']
|
||||||
})
|
})
|
||||||
.allow(null),
|
.allow(null),
|
||||||
logo: Joi.string()
|
logo: Joi.string()
|
||||||
.uri({
|
.uri({
|
||||||
scheme: ['https']
|
scheme: ['https']
|
||||||
})
|
})
|
||||||
.custom((value, helper) => {
|
.custom((value, helper) => {
|
||||||
const ext = path.extname(value)
|
const ext = path.extname(value)
|
||||||
if (!ext || /(\.png|\.jpeg|\.jpg)/i.test(ext)) {
|
if (!ext || /(\.png|\.jpeg|\.jpg)/i.test(ext)) {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
return helper.message(`"logo" has an invalid file extension "${ext}"`)
|
return helper.message(`"logo" has an invalid file extension "${ext}"`)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.required()
|
.required()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue