29 lines
1,021 B
TypeScript
29 lines
1,021 B
TypeScript
// Module ID: 8999
|
|
// Function ID: 70835
|
|
// Name: validateHandle
|
|
// Dependencies: []
|
|
// Exports: getExampleHandle, validateHandle
|
|
|
|
// Module 8999 (validateHandle)
|
|
const PlatformTypes = require(dependencyMap[0]).PlatformTypes;
|
|
const _module = require(dependencyMap[1]);
|
|
const result = _module.fileFinishedImporting("modules/connections/FederatedSocialUtils.tsx");
|
|
|
|
export const validateHandle = function validateHandle(first, platformType) {
|
|
if (platformType === PlatformTypes.MASTODON) {
|
|
const isMatch = /^@?[a-z0-9_]+([.-]+[a-z0-9_]+)*@[^@]+\.[^.@]{2,}$/i.test(first);
|
|
const obj = /^@?[a-z0-9_]+([.-]+[a-z0-9_]+)*@[^@]+\.[^.@]{2,}$/i;
|
|
}
|
|
return /^.+\.[^.@]{2,}$/.test(first);
|
|
};
|
|
export const getExampleHandle = function getExampleHandle(platformType) {
|
|
let str = "@example@mastodon.social";
|
|
if (platformType !== PlatformTypes.MASTODON) {
|
|
let str2 = "clyde@example.com";
|
|
if (platformType === PlatformTypes.BLUESKY) {
|
|
str2 = "example.bsky.social";
|
|
}
|
|
str = str2;
|
|
}
|
|
return str;
|
|
};
|