Merge pull request #1910 from XianHain/fix/updage-joi-validation

modify validation to support bluesky
This commit is contained in:
Blake Campbell 2025-02-13 22:20:58 -05:00 committed by GitHub
commit 50adbdafe6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View file

@ -62,7 +62,7 @@ module.exports.Schema = Joi.object({
.required(),
twitter: Joi.string().pattern(new RegExp(/^@?(\w){1,15}$/)),
mastodon: Joi.string().pattern(new RegExp(/^@(\w){1,30}@(\w)+\.(.?\w)+$/)),
bluesky: Joi.string().pattern(new RegExp(/^@[\w-]+\.(?:[\w-]+\.)?[\w-]+$/)),
bluesky: Joi.string().pattern(new RegExp(/^[\w-]+\.(?:[\w-]+\.)?[\w-]+$/)),
emoji: Joi.string().allow(''),
computer: Joi.string().valid('apple', 'windows', 'linux', 'bsd'),
phone: Joi.string().valid('iphone', 'android', 'windowsphone', 'flipphone'),

View file

@ -166,7 +166,7 @@ Person.propTypes = {
}
},
bluesky(props, propName, componentName) {
if (!/^@(\w)+\.(\w)+\.(\w)+$/.test(props[propName])) {
if (!/^(\w)+\.(\w)+\.(\w)+$/.test(props[propName])) {
return new Error(
`Invalid prop \`${propName}\` supplied to` +
` \`${componentName}\`. This isn't a legit Bluesky handle.`

View file

@ -1,7 +1,7 @@
/**
* @typedef Person
* A single contributor with a /uses page.
* Data is validated against the following schema https://github.com/wesbos/awesome-uses/blob/master/scripts/utils.js#L53-L68
* Data is validated against the following schema https://github.com/wesbos/awesome-uses/blob/master/scripts/utils.js#L53-L70
* @property {string} name - contributor's name
* @property {string} description - tagline for contributor
* @property {string} url - link to contributor's /uses page
@ -18,7 +18,7 @@
/**
* List of all contributors with /uses pages.
* @type {Person[]}
* Data is validated against the following schema https://github.com/wesbos/awesome-uses/blob/master/scripts/utils.js#L53-L68
* Data is validated against the following schema https://github.com/wesbos/awesome-uses/blob/master/scripts/utils.js#L53-L70
*
* Keep this a commonjs export.
*/