decord/source/modules/connections/FederatedSocialUtils.tsx

32 lines
1 KiB
TypeScript
Raw Normal View History

// Module ID: 9353
// Function ID: 9354
// Name: FederatedSocialUtils
// Dependencies: [1074, 2]
2026-07-20 16:05:17 +00:00
// Exports: getExampleHandle, validateHandle
// Module 9353 (FederatedSocialUtils)
import Constants from "Constants" /* 1074 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
const PlatformTypes = Constants.PlatformTypes;
const result = size.fileFinishedImporting("modules/connections/FederatedSocialUtils.tsx");
2026-07-20 16:05:17 +00:00
export const validateHandle = function validateHandle(arg0, platformType) {
2026-07-20 16:05:17 +00:00
if (platformType === PlatformTypes.MASTODON) {
const isMatch = /^@?[a-z0-9_]+([.-]+[a-z0-9_]+)*@[^@]+\.[^.@]{2,}$/i.test(arg0);
2026-07-20 16:05:17 +00:00
const obj = /^@?[a-z0-9_]+([.-]+[a-z0-9_]+)*@[^@]+\.[^.@]{2,}$/i;
}
return /^.+\.[^.@]{2,}$/.test(arg0);
2026-07-20 16:05:17 +00:00
};
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;
};