fix: use url not value in JF2 photo objects for media_ids
This commit is contained in:
@@ -18,6 +18,7 @@ import express from "express";
|
||||
import { ObjectId } from "mongodb";
|
||||
import { serializeStatus } from "../entities/status.js";
|
||||
import { decodeCursor } from "../helpers/pagination.js";
|
||||
import { resolveReplyIds } from "../helpers/resolve-reply-ids.js";
|
||||
import {
|
||||
likePost, unlikePost,
|
||||
boostPost, unboostPost,
|
||||
@@ -43,11 +44,13 @@ router.get("/api/v1/statuses/:id", tokenRequired, scopeRequired("read", "read:st
|
||||
|
||||
// Load interaction state if authenticated
|
||||
const interactionState = await loadItemInteractions(collections, item);
|
||||
const replyIdMap = await resolveReplyIds(collections.ap_timeline, [item]);
|
||||
|
||||
const status = serializeStatus(item, {
|
||||
baseUrl,
|
||||
...interactionState,
|
||||
pinnedIds: new Set(),
|
||||
replyIdMap,
|
||||
});
|
||||
|
||||
res.json(status);
|
||||
@@ -122,7 +125,9 @@ router.get("/api/v1/statuses/:id/context", tokenRequired, scopeRequired("read",
|
||||
pinnedIds: new Set(),
|
||||
};
|
||||
|
||||
const serializeOpts = { baseUrl, ...emptyInteractions };
|
||||
const allItems = [...ancestors, ...descendants];
|
||||
const replyIdMap = await resolveReplyIds(collections.ap_timeline, allItems);
|
||||
const serializeOpts = { baseUrl, ...emptyInteractions, replyIdMap };
|
||||
|
||||
res.json({
|
||||
ancestors: ancestors.map((a) => serializeStatus(a, serializeOpts)),
|
||||
@@ -245,7 +250,7 @@ router.post("/api/v1/statuses", tokenRequired, scopeRequired("write", "write:sta
|
||||
for (const m of mediaUrls) {
|
||||
if (m.type?.startsWith("image/")) {
|
||||
if (!jf2.photo) jf2.photo = [];
|
||||
jf2.photo.push({ value: m.url, alt: m.alt });
|
||||
jf2.photo.push({ url: m.url, alt: m.alt });
|
||||
} else if (m.type?.startsWith("video/")) {
|
||||
if (!jf2.video) jf2.video = [];
|
||||
jf2.video.push(m.url);
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@rmdes/indiekit-endpoint-activitypub",
|
||||
"version": "3.11.4",
|
||||
"version": "3.11.5",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@rmdes/indiekit-endpoint-activitypub",
|
||||
"version": "3.11.4",
|
||||
"version": "3.11.5",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@fedify/debugger": "^2.1.0",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@rmdes/indiekit-endpoint-activitypub",
|
||||
"version": "3.11.4",
|
||||
"version": "3.11.5",
|
||||
"description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.",
|
||||
"keywords": [
|
||||
"indiekit",
|
||||
|
||||
Reference in New Issue
Block a user