split known sources map out to an obj

so we can start adding more goodies

Changed files
+114 -40
atproto-notifications
lexicons
+1 -1
atproto-notifications/src/components/Notification.tsx
··· 42 42 let link = lex?.clients[0]?.notifications; 43 43 appName = lex?.name; 44 44 const sourceRemainder = source.slice(app.length + 1); 45 - title = lex?.known_sources[sourceRemainder] ?? source; 45 + title = lex?.known_sources[sourceRemainder]?.name ?? source; 46 46 47 47 let directLink; 48 48 if (subject.startsWith('did:')) {
+1 -1
atproto-notifications/src/pages/Feed.tsx
··· 123 123 const lex = lexicons[appPrefix]; 124 124 icon = lex?.clients[0]?.icon; 125 125 appName = lex?.name; 126 - title = lex?.known_sources[k.slice(app.length + 1)] ?? k; 126 + title = lex?.known_sources[k.slice(app.length + 1)]?.name ?? k; 127 127 128 128 } else if (secondary === 'group') { 129 129
+1 -1
atproto-notifications/src/service-worker.ts
··· 37 37 // TODO: user pref for alt client -> prefer that client's icon 38 38 const lex = lexicons[appPrefix]; 39 39 const icon = lex?.clients[0]?.icon; 40 - const title = lex?.known_sources[source.slice(app.length + 1)] ?? source; 40 + const title = lex?.known_sources[source.slice(app.length + 1)]?.name ?? source; 41 41 const body = `from @${handle} on ${lex?.name ?? app}`; 42 42 43 43 // const tag = 'simple-push-demo-notification-tag';
+111 -37
lexicons/defs.js
··· 47 47 }, 48 48 ], 49 49 known_sources: { 50 - 'graph.follow:subject': 'Follow', 51 - 'graph.verification:subject': 'Verification', 52 - 'feed.like:subject.uri': 'Like', 53 - 'feed.like:via.uri': 'Repost like', 54 - 'feed.post:reply.parent.uri': 'Reply', 55 - 'feed.post:reply.root.uri': 'Reply in thread', 56 - 'feed.post:embed.record.uri': 'Quote', 57 - 'feed.post:embed.record.record.uri': 'Quote', // with media 58 - 'feed.post:facets[app.bsky.richtext.facet].features[app.bsky.richtext.facet#mention].did': 'Mention', 59 - 'feed.repost:subject.uri': 'Repost', 60 - 'feed.repost:via.uri': 'Repost repost', 50 + 'graph.follow:subject': { 51 + name: 'Follow', 52 + }, 53 + 'graph.verification:subject': { 54 + name: 'Verification', 55 + }, 56 + 'feed.like:subject.uri': { 57 + name: 'Like', 58 + }, 59 + 'feed.like:via.uri': { 60 + name: 'Repost like', 61 + }, 62 + 'feed.post:reply.parent.uri': { 63 + name: 'Reply', 64 + }, 65 + 'feed.post:reply.root.uri': { 66 + name: 'Reply in thread', 67 + }, 68 + 'feed.post:embed.record.uri': { 69 + name: 'Quote', 70 + }, 71 + 'feed.post:embed.record.record.uri': { 72 + name: 'Quote', // with media 73 + }, 74 + 'feed.post:facets[app.bsky.richtext.facet].features[app.bsky.richtext.facet#mention].did': { 75 + name: 'Mention', 76 + }, 77 + 'feed.repost:subject.uri': { 78 + name: 'Repost', 79 + }, 80 + 'feed.repost:via.uri': { 81 + name: 'Repost repost', 82 + }, 61 83 }, 62 84 torment_sources: { 63 85 'graph.block:subject': null, ··· 81 103 } 82 104 ], 83 105 known_sources: { 84 - 'graph.subscription:publication': 'Subscription', 106 + 'graph.subscription:publication': { 107 + name: 'Subscription', 108 + }, 85 109 }, 86 110 }, 87 111 'sh.tangled': { ··· 98 122 } 99 123 ], 100 124 known_sources: { 101 - 'feed.star:subject': 'Star', 102 - 'feed.reaction:subject': 'Reaction', 103 - 'graph.follow:subject': 'Follow', 104 - 'actor.profile:pinnedRepositories[]': 'Pinned repo', 105 - 'repo.issue.comment:issue': 'Issue comment', 106 - 'repo.issue.comment:owner': 'Issue comment', 107 - 'repo.issue.comment:repo': 'Issue comment', 108 - 'repo.pull:targetRepo': 'Pull', 109 - 'repo.pull.comment:owner': 'Pull comment', 110 - 'repo.pull.comment:pull': 'Pull comment', 111 - 'repo.pull.comment:repo': 'Pull comment', 112 - 'knot.member:subject': 'Knot member', 113 - 'spindle.member:subject': 'Spindle member', 125 + 'feed.star:subject': { 126 + name: 'Star', 127 + }, 128 + 'feed.reaction:subject': { 129 + name: 'Reaction', 130 + }, 131 + 'graph.follow:subject': { 132 + name: 'Follow', 133 + }, 134 + 'actor.profile:pinnedRepositories[]': { 135 + name: 'Pinned repo', 136 + }, 137 + 'repo.issue.comment:issue': { 138 + name: 'Issue comment', 139 + }, 140 + 'repo.issue.comment:owner': { 141 + name: 'Issue comment', 142 + }, 143 + 'repo.issue.comment:repo': { 144 + name: 'Issue comment', 145 + }, 146 + 'repo.pull:targetRepo': { 147 + name: 'Pull', 148 + }, 149 + 'repo.pull.comment:owner': { 150 + name: 'Pull comment', 151 + }, 152 + 'repo.pull.comment:pull': { 153 + name: 'Pull comment', 154 + }, 155 + 'repo.pull.comment:repo': { 156 + name: 'Pull comment', 157 + }, 158 + 'knot.member:subject': { 159 + name: 'Knot member', 160 + }, 161 + 'spindle.member:subject': { 162 + name: 'Spindle member', 163 + }, 114 164 }, 115 165 }, 116 166 'com.shinolabs': { // TODO: this app isn't exactly tld+1 ··· 124 174 }, 125 175 ], 126 176 known_sources: { 127 - 'pinksea.oekaki:inResponseTo.uri': 'Response', 177 + 'pinksea.oekaki:inResponseTo.uri': { 178 + name: 'Response', 179 + }, 128 180 }, 129 181 }, 130 182 'place.stream': { ··· 138 190 }, 139 191 ], 140 192 known_sources: { 141 - 'chat.message:streamer': 'Message', 142 - 'key:signingKey': 'Signing key', 193 + 'chat.message:streamer': { 194 + name: 'Message', 195 + }, 196 + 'key:signingKey': { 197 + name: 'Signing key', 198 + }, 143 199 }, 144 200 }, 145 201 'so.sprk': { ··· 153 209 }, 154 210 ], 155 211 known_sources: { 156 - 'feed.like:subject.uri': 'Like', 212 + 'feed.like:subject.uri': { 213 + name: 'Like', 214 + }, 157 215 // it's not actually clear to me if *all* the bsky sources were copied for sprk posts or not 158 - 'feed.post:reply.parent.uri': 'Reply', 159 - 'feed.post:reply.root.uri': 'Reply in thread', 160 - 'feed.post:embed.record.uri': 'Quote', 161 - 'feed.post:embed.record.record.uri': 'Quote', // with media 162 - 'feed.post:facets[app.bsky.richtext.facet].features[app.bsky.richtext.facet#mention].did': 'Mention', 216 + 'feed.post:reply.parent.uri': { 217 + name: 'Reply', 218 + }, 219 + 'feed.post:reply.root.uri': { 220 + name: 'Reply in thread', 221 + }, 222 + 'feed.post:embed.record.uri': { 223 + name: 'Quote', 224 + }, 225 + 'feed.post:embed.record.record.uri': { 226 + name: 'Quote', // with media 227 + }, 228 + 'feed.post:facets[app.bsky.richtext.facet].features[app.bsky.richtext.facet#mention].did': { 229 + name: 'Mention', 230 + }, 163 231 }, 164 232 }, 165 233 'events.smokesignal': { ··· 173 241 }, 174 242 ], 175 243 known_sources: { 176 - 'calendar.rsvp:subject.uri': 'RSVP', 244 + 'calendar.rsvp:subject.uri': { 245 + name: 'RSVP', 246 + }, 177 247 }, 178 248 }, 179 249 'app.popsky': { ··· 187 257 }, 188 258 ], 189 259 known_sources: { 190 - 'like:subjectUri': 'Like', 191 - 'comment:subjectUri': 'Comment', 260 + 'like:subjectUri': { 261 + name: 'Like', 262 + }, 263 + 'comment:subjectUri': { 264 + name: 'Comment', 265 + }, 192 266 }, 193 267 }, 194 268 };