export type AppUrl = `${string}.${string}` | `localhost:${number}`; export enum App { Bluesky, Tangled, Pinksea, Blento, Popfeed, GreenGale, } export const appName = { [App.Bluesky]: "Bluesky", [App.Tangled]: "Tangled", [App.Pinksea]: "Pinksea", [App.Blento]: "Blento", [App.Popfeed]: "Popfeed", [App.GreenGale]: "GreenGale", }; export const appList: Record = { "localhost:19006": App.Bluesky, "blacksky.community": App.Bluesky, "bsky.app": App.Bluesky, "catsky.social": App.Bluesky, "deer.social": App.Bluesky, "deer-social-ayla.pages.dev": App.Bluesky, "deer.aylac.top": App.Bluesky, "main.bsky.dev": App.Bluesky, "witchsky.app": App.Bluesky, "tangled.org": App.Tangled, "pinksea.art": App.Pinksea, "blento.app": App.Blento, "popfeed.social": App.Popfeed, "greengale.app": App.GreenGale, }; export const appHandleLink: Record string> = { [App.Bluesky]: (path) => { const baseType = path[0]; const user = path[1]; if (baseType === "profile") { if (path[2]) { const type = path[2]; const rkey = path[3]; if (type === "post") { return `at://${user}/app.bsky.feed.post/${rkey}`; } else if (type === "lists") { return `at://${user}/app.bsky.graph.list/${rkey}`; } else if (type === "feed") { return `at://${user}/app.bsky.feed.generator/${rkey}`; } else if (type === "follows") { return `at://${user}/app.bsky.graph.follow/${rkey}`; } } else { return `at://${user}`; } } else if (baseType === "starter-pack") { return `at://${user}/app.bsky.graph.starterpack/${path[2]}`; } return `at://${user}`; }, [App.Tangled]: (path) => { if (path[0] === "strings") { return `at://${path[1]}/sh.tangled.string/${path[2]}`; } let query: string | undefined; if (path[path.length - 1].includes("?")) { const split = path[path.length - 1].split("?"); query = split[1]; path[path.length - 1] = split[0]; } const user = path[0].replace("@", ""); if (path.length === 1) { if (query === "tab=repos") { return `at://${user}/sh.tangled.repo`; } else if (query === "tab=starred") { return `at://${user}/sh.tangled.feed.star`; } else if (query === "tab=strings") { return `at://${user}/sh.tangled.string`; } } else if (path.length === 2) { // no way to convert the repo name to an rkey afaik // same reason why there's nothing related to issues in here return `at://${user}/sh.tangled.repo`; } return `at://${user}`; }, [App.Pinksea]: (path) => { if (path.length === 3) { return `at://${path[0]}/com.shinolabs.pinksea.oekaki/${path[2]}`; } return `at://${path[0]}`; }, [App.Blento]: (path) => { return `at://${path[0]}/app.blento.card`; }, [App.Popfeed]: (path) => { if (path[0] === "profile" && path[1]) { return `at://${path[1]}/social.popfeed.actor.profile/self`; } if ( (path[0] === "review" || path[0] === "list") && path[1] === "at:" && path[2] && path[3] && path[4] ) { return `at://${path[2]}/${path[3]}/${path[4]}`; } return `at://${path[1]}`; }, [App.GreenGale]: (path) => { return `at://${path[0]}/site.standard.document/${path[1]}`; }, };