summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/api/endpoints')
-rw-r--r--src/server/api/endpoints/ap/show.ts28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/server/api/endpoints/ap/show.ts b/src/server/api/endpoints/ap/show.ts
index 1bb15117dd..9724a044b1 100644
--- a/src/server/api/endpoints/ap/show.ts
+++ b/src/server/api/endpoints/ap/show.ts
@@ -101,6 +101,32 @@ async function fetchAny(uri: string) {
// /@user のような正規id以外で取得できるURIが指定されていた場合、ここで初めて正規URIが確定する
// これはDBに存在する可能性があるため再度DB検索
if (uri !== object.id) {
+ if (object.id.startsWith(config.url + '/')) {
+ const parts = object.id.split('/');
+ const id = parts.pop();
+ const type = parts.pop();
+
+ if (type === 'notes') {
+ const note = await Notes.findOne(id);
+
+ if (note) {
+ return {
+ type: 'Note',
+ object: await Notes.pack(note, null, { detail: true })
+ };
+ }
+ } else if (type === 'users') {
+ const user = await Users.findOne(id);
+
+ if (user) {
+ return {
+ type: 'User',
+ object: await Users.pack(user, null, { detail: true })
+ };
+ }
+ }
+ }
+
const [user, note] = await Promise.all([
Users.findOne({ uri: object.id }),
Notes.findOne({ uri: object.id })
@@ -120,7 +146,7 @@ async function fetchAny(uri: string) {
}
if (['Note', 'Question', 'Article'].includes(object.type)) {
- const note = await createNote(object.id);
+ const note = await createNote(object.id, undefined, true);
return {
type: 'Note',
object: await Notes.pack(note!, null, { detail: true })