fedimbed: ple

This commit is contained in:
Cynthia Foxwell 2025-06-23 18:26:15 -06:00
parent 8477a3bf87
commit fc809c41f0
Signed by: Cynosphere
SSH key fingerprint: SHA256:H3SM8ufP/uxqLwKSH7xY89TDnbR9uOHzjLoBr0tlajk

View file

@ -840,16 +840,16 @@ async function fetchPost(url, platform, forceMastoAPI = false) {
let redirUrl;
const options = {};
const headers = {};
if (PATH_REGEX.pleroma2.test(urlObj.pathname)) {
if (urlObj.hostname === "truthsocial.com") {
const postId = urlObj.pathname.match(PATH_REGEX.truthsocial)?.[2];
redirUrl = urlObj.origin + "/api/v1/statuses/" + postId;
} else if (PATH_REGEX.pleroma2.test(urlObj.pathname)) {
redirUrl = url.replace("notice", "api/v1/statuses");
} else if (PATH_REGEX.mastodon.test(urlObj.pathname)) {
const postId = urlObj.pathname.match(PATH_REGEX.mastodon)?.[2];
redirUrl = urlObj.origin + "/api/v1/statuses/" + postId;
} else if (PATH_REGEX.mastodon2.test(urlObj.pathname)) {
redirUrl = url.replace(/^\/(.+?)\/statuses/, "/api/v1/statuses");
} else if (urlObj.hostname === "truthsocial.com") {
const postId = urlObj.pathname.match(PATH_REGEX.truthsocial)?.[2];
redirUrl = urlObj.origin + "/api/v1/statuses/" + postId;
} else if (PATH_REGEX.misskey.test(urlObj.pathname)) {
let noteId = url.split("/notes/")[1];
if (noteId.indexOf("/") > -1) {