fedimbed: make iceshrimp fallback normal mastoapi api call, copypaste moment
This commit is contained in:
parent
134f417b91
commit
ac11f3a46b
1 changed files with 12 additions and 5 deletions
|
@ -661,10 +661,17 @@ async function fetchPost(url, platform, forceMastoAPI = false) {
|
||||||
noteId = noteId.split("#")[0];
|
noteId = noteId.split("#")[0];
|
||||||
}
|
}
|
||||||
logger.verbose("fedimbed", "Misskey post ID: " + noteId);
|
logger.verbose("fedimbed", "Misskey post ID: " + noteId);
|
||||||
redirUrl = urlObj.origin + "/api/notes/show/";
|
|
||||||
options.method = "POST";
|
// iceshrimp has an entire .NET rewrite and only supports MastoAPI it seems
|
||||||
options.body = JSON.stringify({noteId});
|
// *should* be fine for older iceshrimp-js instances
|
||||||
headers["Content-Type"] = "application/json";
|
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 {
|
} else {
|
||||||
logger.error("fedimbed", `Missing MastoAPI replacement for "${platform}"`);
|
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}`
|
replyData.account?.fqn ?? `${replyData.account?.username ?? replyData.user?.username}@${urlObj.hostname}`
|
||||||
})`;
|
})`;
|
||||||
} else {
|
} else {
|
||||||
const authorData = await signedFetch(postData.actor ?? postData.attributedTo, {
|
const authorData = await signedFetch(replyData.actor ?? replyData.attributedTo, {
|
||||||
headers: {
|
headers: {
|
||||||
"User-Agent": FRIENDLY_USERAGENT,
|
"User-Agent": FRIENDLY_USERAGENT,
|
||||||
Accept: "application/activity+json",
|
Accept: "application/activity+json",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue