fedimbed: make iceshrimp fallback normal mastoapi api call, copypaste moment

This commit is contained in:
Cynthia Foxwell 2025-03-14 18:52:55 -06:00
parent 134f417b91
commit ac11f3a46b
Signed by: Cynosphere
SSH key fingerprint: SHA256:H3SM8ufP/uxqLwKSH7xY89TDnbR9uOHzjLoBr0tlajk

View file

@ -661,10 +661,17 @@ async function fetchPost(url, platform, forceMastoAPI = false) {
noteId = noteId.split("#")[0];
}
logger.verbose("fedimbed", "Misskey post ID: " + noteId);
redirUrl = urlObj.origin + "/api/notes/show/";
options.method = "POST";
options.body = JSON.stringify({noteId});
headers["Content-Type"] = "application/json";
// iceshrimp has an entire .NET rewrite and only supports MastoAPI it seems
// *should* be fine for older iceshrimp-js instances
if (platform == "iceshrimp") {
redirUrl = urlObj.origin + "/api/v1/statuses/" + noteId;
} else {
redirUrl = urlObj.origin + "/api/notes/show/";
options.method = "POST";
options.body = JSON.stringify({noteId});
headers["Content-Type"] = "application/json";
}
} else {
logger.error("fedimbed", `Missing MastoAPI replacement for "${platform}"`);
}
@ -951,7 +958,7 @@ async function processUrl(msg, url, spoiler = false, command = false) {
replyData.account?.fqn ?? `${replyData.account?.username ?? replyData.user?.username}@${urlObj.hostname}`
})`;
} else {
const authorData = await signedFetch(postData.actor ?? postData.attributedTo, {
const authorData = await signedFetch(replyData.actor ?? replyData.attributedTo, {
headers: {
"User-Agent": FRIENDLY_USERAGENT,
Accept: "application/activity+json",