switches username and preferred_username
This commit is contained in:
@@ -36,7 +36,7 @@ export async function GET(event: RequestEvent) {
|
||||
outbox: id + '/outbox',
|
||||
summary: user.bio,
|
||||
name: actor.username,
|
||||
preferredUsername: user.username,
|
||||
preferredUsername: actor.preferred_username,
|
||||
followers: id + '/followers',
|
||||
following: id + '/following',
|
||||
url: `${env.ORIGIN}/profile/@${username}`,
|
||||
|
||||
@@ -41,15 +41,21 @@ export async function GET(event: RequestEvent) {
|
||||
remoteComments.items = remoteComments.items.filter(c => {
|
||||
const iriId = c.iri?.substring(c.iri.length - 15) ?? ""
|
||||
if (deduplicationMap[c.id!] != undefined) {
|
||||
deduplicationMap[c.id!] = {...c, author: deduplicationMap[c.id!].author}
|
||||
deduplicationMap[c.id!] = { ...c, author: deduplicationMap[c.id!].author }
|
||||
return false
|
||||
} else if (deduplicationMap[iriId] != undefined) {
|
||||
deduplicationMap[iriId] = {...c, author: deduplicationMap[iriId].author}
|
||||
deduplicationMap[iriId] = { ...c, author: deduplicationMap[iriId].author }
|
||||
return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
remoteComments.items.forEach(c => {
|
||||
if (!c.iri?.length) {
|
||||
c.iri = `${url}/${c.id}`
|
||||
}
|
||||
})
|
||||
|
||||
const allCommentItems = <ListResult<Comment>>{
|
||||
items: localComments.items.concat(remoteComments.items),
|
||||
page: localComments.page,
|
||||
|
||||
@@ -21,7 +21,7 @@ export async function POST(event: RequestEvent) {
|
||||
r = await event.locals.ms.index("lists").search(data.q, { ...data.options, filter: `author = ${actor.id}` });
|
||||
} else {
|
||||
const origin = new URL(actor.iri).origin
|
||||
const url = `${origin}/api/v1/profile/${actor.username}/lists?` + event.url.searchParams
|
||||
const url = `${origin}/api/v1/profile/${actor.preferred_username}/lists?` + event.url.searchParams
|
||||
const response = await event.fetch(url, { method: 'POST', body: JSON.stringify(data) })
|
||||
|
||||
if (!response.ok) {
|
||||
|
||||
@@ -22,7 +22,7 @@ export async function GET(event: RequestEvent) {
|
||||
.getList<SummitLog>(safeSearchParams.page, safeSearchParams.perPage, { ...safeSearchParams, filter: `author='${actor.id}'` })
|
||||
} else {
|
||||
const origin = new URL(actor.iri).origin
|
||||
const summitLogURL = `${origin}/api/v1/profile/${actor.username}/stats?` + event.url.searchParams
|
||||
const summitLogURL = `${origin}/api/v1/profile/${actor.preferred_username}/stats?` + event.url.searchParams
|
||||
const response = await event.fetch(summitLogURL, { method: 'GET' })
|
||||
if (!response.ok) {
|
||||
const errorResponse = await response.json()
|
||||
|
||||
@@ -23,7 +23,7 @@ export async function GET(event: RequestEvent) {
|
||||
.getList<TimelineItem>(safeSearchParams.page, safeSearchParams.perPage, { ...safeSearchParams, filter: `author='${actor.iri}'` })
|
||||
} else {
|
||||
const origin = new URL(actor.iri).origin
|
||||
const timelineURL = `${origin}/api/v1/profile/${actor.username}/timeline?` + event.url.searchParams
|
||||
const timelineURL = `${origin}/api/v1/profile/${actor.preferred_username}/timeline?` + event.url.searchParams
|
||||
|
||||
const response = await event.fetch(timelineURL, { method: 'GET' })
|
||||
if (!response.ok) {
|
||||
|
||||
@@ -20,7 +20,7 @@ export async function POST(event: RequestEvent) {
|
||||
r = await event.locals.ms.index("trails").search(data.q, { ...data.options, filter: `author = ${actor.id}` });
|
||||
} else {
|
||||
const origin = new URL(actor.iri).origin
|
||||
const url = `${origin}/api/v1/profile/${actor.username}/trails?` + event.url.searchParams
|
||||
const url = `${origin}/api/v1/profile/${actor.preferred_username}/trails?` + event.url.searchParams
|
||||
const response = await event.fetch(url, { method: 'POST', body: JSON.stringify(data) })
|
||||
|
||||
if (!response.ok) {
|
||||
|
||||
@@ -32,7 +32,8 @@ export async function GET(event: RequestEvent) {
|
||||
}
|
||||
t = {
|
||||
iri: iri,
|
||||
author: actor.id
|
||||
author: actor.id,
|
||||
like_count: 0
|
||||
} as Trail
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user