diff --git a/src/components/WelcomeWorld.vue b/src/components/WelcomeWorld.vue index e065648..6f971af 100644 --- a/src/components/WelcomeWorld.vue +++ b/src/components/WelcomeWorld.vue @@ -19,7 +19,7 @@ Manage your repos - Public notes diff --git a/src/modules/atproto/getAka.ts b/src/modules/atproto/getAka.ts index 6480205..a1ef5bd 100644 --- a/src/modules/atproto/getAka.ts +++ b/src/modules/atproto/getAka.ts @@ -1,11 +1,22 @@ +const correspondanceCache = new Map() + export const getAka = async (dids: Set) => { const correspondance = await Promise.all( [...dids].map(async (did) => { + if (correspondanceCache.has(did)) { + return [did, correspondanceCache.get(did)!] as [string, string] + } + const response = await fetch(`https://plc.directory/${did}`) const { alsoKnownAs: [aka], } = await response.json() - return [did, aka] as [string, string] + + const alias = aka.replace("at://", "") + + correspondanceCache.set(did, alias) + + return [did, alias] as [string, string] }), ) diff --git a/src/router/router.ts b/src/router/router.ts index 36dc973..5ec12f4 100644 --- a/src/router/router.ts +++ b/src/router/router.ts @@ -8,11 +8,6 @@ const routes: Array = [ name: "RepoList", component: () => import("@/views/RepoList.vue"), }, - { - path: "/notes", - name: "PublicNoteList", - component: () => import("@/views/PublicNoteList.vue"), - }, { path: "/:user/:repo", name: "FluxNoteView", @@ -21,13 +16,13 @@ const routes: Array = [ }, { path: "/notes", - name: "PublicNoteView", - component: () => import("@/views/PublicNoteView.vue"), + name: "PublicNoteListView", + component: () => import("@/views/PublicNoteListView.vue"), }, { path: "/tiboudenote", - name: "PublicNoteView", - component: () => import("@/views/PublicNoteView.vue"), + name: "PublicNoteListView", + component: () => import("@/views/PublicNoteListView.vue"), }, { path: "/:user/:repo/inbox", diff --git a/src/views/PublicNoteList.vue b/src/views/PublicNoteList.vue deleted file mode 100644 index 82b74f0..0000000 --- a/src/views/PublicNoteList.vue +++ /dev/null @@ -1,18 +0,0 @@ - - - - - diff --git a/src/views/PublicNoteView.vue b/src/views/PublicNoteListView.vue similarity index 100% rename from src/views/PublicNoteView.vue rename to src/views/PublicNoteListView.vue