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