feat: aka without the at://
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
<router-link v-if="isLogged" :to="{ name: 'RepoList' }" class="btn"
|
<router-link v-if="isLogged" :to="{ name: 'RepoList' }" class="btn"
|
||||||
>Manage your repos</router-link
|
>Manage your repos</router-link
|
||||||
>
|
>
|
||||||
<router-link :to="{ name: 'PublicNoteList' }" class="btn"
|
<router-link :to="{ name: 'PublicNoteListView' }" class="btn"
|
||||||
>Public notes</router-link
|
>Public notes</router-link
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,11 +1,22 @@
|
|||||||
|
const correspondanceCache = new Map<string, string>()
|
||||||
|
|
||||||
export const getAka = async (dids: Set<string>) => {
|
export const getAka = async (dids: Set<string>) => {
|
||||||
const correspondance = await Promise.all(
|
const correspondance = await Promise.all(
|
||||||
[...dids].map(async (did) => {
|
[...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 response = await fetch(`https://plc.directory/${did}`)
|
||||||
const {
|
const {
|
||||||
alsoKnownAs: [aka],
|
alsoKnownAs: [aka],
|
||||||
} = await response.json()
|
} = await response.json()
|
||||||
return [did, aka] as [string, string]
|
|
||||||
|
const alias = aka.replace("at://", "")
|
||||||
|
|
||||||
|
correspondanceCache.set(did, alias)
|
||||||
|
|
||||||
|
return [did, alias] as [string, string]
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -8,11 +8,6 @@ const routes: Array<RouteRecordRaw> = [
|
|||||||
name: "RepoList",
|
name: "RepoList",
|
||||||
component: () => import("@/views/RepoList.vue"),
|
component: () => import("@/views/RepoList.vue"),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: "/notes",
|
|
||||||
name: "PublicNoteList",
|
|
||||||
component: () => import("@/views/PublicNoteList.vue"),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: "/:user/:repo",
|
path: "/:user/:repo",
|
||||||
name: "FluxNoteView",
|
name: "FluxNoteView",
|
||||||
@@ -21,13 +16,13 @@ const routes: Array<RouteRecordRaw> = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/notes",
|
path: "/notes",
|
||||||
name: "PublicNoteView",
|
name: "PublicNoteListView",
|
||||||
component: () => import("@/views/PublicNoteView.vue"),
|
component: () => import("@/views/PublicNoteListView.vue"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/tiboudenote",
|
path: "/tiboudenote",
|
||||||
name: "PublicNoteView",
|
name: "PublicNoteListView",
|
||||||
component: () => import("@/views/PublicNoteView.vue"),
|
component: () => import("@/views/PublicNoteListView.vue"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/:user/:repo/inbox",
|
path: "/:user/:repo/inbox",
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import { noteRouter } from "@/modules/post/data/client"
|
|
||||||
|
|
||||||
const { data: notes, isLoading } = noteRouter.noteLists.get.useQuery(["notes"])
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div class="public-note-view" v-if="isLoading">
|
|
||||||
<ul>
|
|
||||||
<li v-for="note in notes">{{ note.did }} / {{ note.rkey }}</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
.public-note-view {
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
Reference in New Issue
Block a user