Schedule posts to Bluesky with Cloudflare workers. skyscheduler.work
cf tool bsky-tool cloudflare bluesky schedule bsky service social-media cloudflare-workers

Readability of validator

authored by

SocksTheWolf and committed by
GitHub
da017f20 9a386792

+11 -4
+11 -4
src/validation/embedSchema.ts
··· 6 6 import isEmpty from "just-is-empty"; 7 7 8 8 export const AltTextSchema = z.object({ 9 - alt: z.string().trim().max(MAX_ALT_TEXT, "alt text is too long").prefault("") 9 + alt: z.string().trim() 10 + .max(MAX_ALT_TEXT, "alt text is too long") 11 + .prefault("") 10 12 }); 11 13 12 14 export const ImageEmbedSchema = z.object({ ··· 49 51 }), 50 52 type: z.literal(EmbedDataType.WebLink), 51 53 title: z.string().trim().default(""), 52 - /* uri is the link to the website */ 54 + /* NOTE: uri is the link to the website here, 55 + content is used as the thumbnail */ 53 56 uri: z.url({ 54 57 normalize: true, 55 58 protocol: /^https?$/, 56 59 hostname: z.regexes.domain, 57 60 error: "provided weblink is not in the correct form of an url" 58 - }).trim().nonoptional("link embeds require a url"), 61 + }).trim() 62 + .nonoptional("link embeds require a url"), 59 63 description: z.string().trim().default("") 60 64 }); 61 65 ··· 65 69 protocol: /^https?$/, 66 70 hostname: z.regexes.domain, 67 71 error: "post/feed/list/followgraph record url is invalid" 68 - }).trim().toLowerCase().regex(postRecordURI, "url is not a post/feed/list/followgraph record").nonoptional("post/feed/list/followgraph records require a url"), 72 + }).trim() 73 + .toLowerCase() 74 + .regex(postRecordURI, "url is not a post/feed/list/followgraph record") 75 + .nonoptional("post/feed/list/followgraph records require a url"), 69 76 type: z.literal(EmbedDataType.Record), 70 77 });