fedimbed: try 2

This commit is contained in:
Cynthia Foxwell 2022-12-31 13:05:57 -07:00
parent c9b248e23d
commit 705f9062e0

View file

@ -127,8 +127,15 @@ async function processUrl(msg, url) {
} else if (PATH_REGEX.mastodon2.test(urlObj.pathname)) { } else if (PATH_REGEX.mastodon2.test(urlObj.pathname)) {
redirUrl = url.replace(/^\/(.+?)\/statuses/, "/api/v1/statuses"); redirUrl = url.replace(/^\/(.+?)\/statuses/, "/api/v1/statuses");
} else if (PATH_REGEX.misskey.test(urlObj.pathname)) { } else if (PATH_REGEX.misskey.test(urlObj.pathname)) {
let noteId = url.split("/notes/")[0] let noteId = url.split("/notes/")[0];
noteId = noteId.split(noteId.indexOf("/") > -1 ? "/" : "?")[0]; if (noteId.indexOf("/") > -1) {
noteId = noteId.split("/")[0];
} else if (noteId.indexOf("?") > -1) {
noteId = noteId.split("?")[0];
} else if (noteId.indexOf("#") > -1) {
noteId = noteId.split("#")[0];
}
logger.debug("fedimbed", "Misskey post ID: " + noteId);
redirUrl = urlObj.origin + "/api/notes/show/"; redirUrl = urlObj.origin + "/api/notes/show/";
options.method = "POST"; options.method = "POST";
options.body = JSON.stringify({noteId}); options.body = JSON.stringify({noteId});