fix
This commit is contained in:
@@ -728,6 +728,56 @@ export async function getCardAdmin(did: string): Promise<CardAdminData | null> {
|
||||
return null
|
||||
}
|
||||
|
||||
// RSE admin data types
|
||||
export interface RseAdminItem {
|
||||
id: number
|
||||
name: string
|
||||
text: { ja: string; en: string }
|
||||
}
|
||||
|
||||
export interface RseAdminData {
|
||||
item: RseAdminItem[]
|
||||
ability: unknown[]
|
||||
character: unknown[]
|
||||
system: unknown[]
|
||||
collection: unknown[]
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
// Get RSE admin data (ai.syui.rse.admin)
|
||||
export async function getRseAdmin(did: string): Promise<RseAdminData | null> {
|
||||
const collection = 'ai.syui.rse.admin'
|
||||
|
||||
// Try local first
|
||||
try {
|
||||
const res = await fetch(`/content/${did}/${collection}/self.json`)
|
||||
if (res.ok && isJsonResponse(res)) {
|
||||
const record = await res.json()
|
||||
return record.value as RseAdminData
|
||||
}
|
||||
} catch {
|
||||
// Try remote
|
||||
}
|
||||
|
||||
// Remote fallback
|
||||
const pds = await getPds(did)
|
||||
if (!pds) return null
|
||||
|
||||
try {
|
||||
const host = pds.replace('https://', '')
|
||||
const url = `${xrpcUrl(host, comAtprotoRepo.getRecord)}?repo=${did}&collection=${collection}&rkey=self`
|
||||
const res = await fetch(url)
|
||||
if (res.ok) {
|
||||
const record = await res.json()
|
||||
return record.value as RseAdminData
|
||||
}
|
||||
} catch {
|
||||
// Failed
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
// Get user's links (ai.syui.at.link)
|
||||
export async function getLinks(did: string): Promise<LinkCollection | null> {
|
||||
const collection = 'ai.syui.at.link'
|
||||
|
||||
Reference in New Issue
Block a user