atmosphere explorer pds.ls
tool typescript atproto
439
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v1.2.1 109 lines 3.1 kB view raw
1export type AppUrl = `${string}.${string}` | `localhost:${number}`; 2 3export enum App { 4 Bluesky, 5 Tangled, 6 Frontpage, 7 Pinksea, 8 Linkat, 9} 10 11export const appName = { 12 [App.Bluesky]: "Bluesky", 13 [App.Tangled]: "Tangled", 14 [App.Frontpage]: "Frontpage", 15 [App.Pinksea]: "Pinksea", 16 [App.Linkat]: "Linkat", 17}; 18 19export const appList: Record<AppUrl, App> = { 20 "localhost:19006": App.Bluesky, 21 "blacksky.community": App.Bluesky, 22 "bsky.app": App.Bluesky, 23 "catsky.social": App.Bluesky, 24 "deer.aylac.top": App.Bluesky, 25 "deer-social-ayla.pages.dev": App.Bluesky, 26 "deer.social": App.Bluesky, 27 "main.bsky.dev": App.Bluesky, 28 "social.daniela.lol": App.Bluesky, 29 "tangled.org": App.Tangled, 30 "frontpage.fyi": App.Frontpage, 31 "pinksea.art": App.Pinksea, 32 "linkat.blue": App.Linkat, 33}; 34 35export const appHandleLink: Record<App, (url: string[]) => string> = { 36 [App.Bluesky]: (path) => { 37 const baseType = path[0]; 38 const user = path[1]; 39 40 if (baseType === "profile") { 41 if (path[2]) { 42 const type = path[2]; 43 const rkey = path[3]; 44 45 if (type === "post") { 46 return `at://${user}/app.bsky.feed.post/${rkey}`; 47 } else if (type === "lists") { 48 return `at://${user}/app.bsky.graph.list/${rkey}`; 49 } else if (type === "feed") { 50 return `at://${user}/app.bsky.feed.generator/${rkey}`; 51 } else if (type === "follows") { 52 return `at://${user}/app.bsky.graph.follow/${rkey}`; 53 } 54 } else { 55 return `at://${user}`; 56 } 57 } else if (baseType === "starter-pack") { 58 return `at://${user}/app.bsky.graph.starterpack/${path[2]}`; 59 } 60 return `at://${user}`; 61 }, 62 [App.Tangled]: (path) => { 63 if (path[0] === "strings") { 64 return `at://${path[1]}/sh.tangled.string/${path[2]}`; 65 } 66 67 let query: string | undefined; 68 if (path[path.length - 1].includes("?")) { 69 const split = path[path.length - 1].split("?"); 70 query = split[1]; 71 path[path.length - 1] = split[0]; 72 } 73 74 const user = path[0].replace("@", ""); 75 76 if (path.length === 1) { 77 if (query === "tab=repos") { 78 return `at://${user}/sh.tangled.repo`; 79 } else if (query === "tab=starred") { 80 return `at://${user}/sh.tangled.feed.star`; 81 } else if (query === "tab=strings") { 82 return `at://${user}/sh.tangled.string`; 83 } 84 } else if (path.length === 2) { 85 // no way to convert the repo name to an rkey afaik 86 // same reason why there's nothing related to issues in here 87 return `at://${user}/sh.tangled.repo`; 88 } 89 90 return `at://${user}`; 91 }, 92 [App.Frontpage]: (path) => { 93 if (path.length === 3) { 94 return `at://${path[1]}/fyi.unravel.frontpage.post/${path[2]}`; 95 } else if (path.length === 5) { 96 return `at://${path[3]}/fyi.unravel.frontpage.comment/${path[4]}`; 97 } 98 99 return `at://${path[0]}`; 100 }, 101 [App.Pinksea]: (path) => { 102 if (path.length === 2) { 103 return `at://${path[0]}/com.shinolabs.pinksea.oekaki/${path[1]}`; 104 } 105 106 return `at://${path[0]}`; 107 }, 108 [App.Linkat]: (path) => `at://${path[0]}/blue.linkat.board/self`, 109};