mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-01-05 21:03:24 -05:00
fix(api-server): add x.com to valid twitter domains (#55582)
This commit is contained in:
@@ -254,7 +254,7 @@ const updatePrivacyTerms = (req, res, next) => {
|
||||
const allowedSocialsAndDomains = {
|
||||
githubProfile: 'github.com',
|
||||
linkedin: 'linkedin.com',
|
||||
twitter: 'twitter.com',
|
||||
twitter: ['twitter.com', 'x.com'],
|
||||
website: ''
|
||||
};
|
||||
|
||||
@@ -280,7 +280,9 @@ export function updateMySocials(...args) {
|
||||
const url = new URL(val);
|
||||
const topDomain = url.hostname.split('.').slice(-2);
|
||||
if (topDomain.length === 2) {
|
||||
return topDomain.join('.') === domain;
|
||||
return Array.isArray(domain)
|
||||
? domain.some(d => topDomain.join('.') === d)
|
||||
: topDomain.join('.') === domain;
|
||||
}
|
||||
return false;
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user