fedimbed: hopefully i didnt break things
This commit is contained in:
parent
30aef909df
commit
c7bd947b21
1 changed files with 15 additions and 5 deletions
|
@ -34,6 +34,7 @@ const PATH_REGEX = {
|
|||
pixelfed: /^\/p\/(.+?)\/(.+?)\/?/,
|
||||
//cohost: /^\/[A-Za-z0-9]+\/post\/\d+-[A-Za-z0-9-]+\/?/,
|
||||
bluesky: BSKY_POST_REGEX,
|
||||
twitter: /^\/[a-z0-9_]+\/status\/\d+\/?/,
|
||||
};
|
||||
|
||||
const PLATFORM_COLORS = {
|
||||
|
@ -51,7 +52,6 @@ const PLATFORM_COLORS = {
|
|||
//cohost: 0x83254f,
|
||||
bluesky: 0x0085ff,
|
||||
nitter: 0xff6c60,
|
||||
twitter: 0xff6c60, // Nitter accent color
|
||||
};
|
||||
|
||||
const BSKY_DOMAINS = [
|
||||
|
@ -67,8 +67,7 @@ const BSKY_DOMAINS = [
|
|||
"bsky.brid.gy",
|
||||
];
|
||||
|
||||
//eventually:tm:
|
||||
/*const TW_DOMAINS = [
|
||||
const TW_DOMAINS = [
|
||||
"tw.c7.pm",
|
||||
"tw.counter-strike.gay",
|
||||
"xcancel.com",
|
||||
|
@ -86,7 +85,7 @@ const BSKY_DOMAINS = [
|
|||
// these two are base64 encoded just because i dont want those words in my codebase
|
||||
Buffer.from("aGl0bGVyeC5jb20=", "base64").toString(),
|
||||
Buffer.from("bmlnZ2VyeC5jb20=", "base64").toString(),
|
||||
];*/
|
||||
];
|
||||
|
||||
const pageParser = new XMLParser({
|
||||
ignoreAttributes: false,
|
||||
|
@ -1016,7 +1015,7 @@ async function processUrl(msg, url, spoiler = false, command = false) {
|
|||
// some lemmy instances have old reddit frontend subdomains
|
||||
// but these frontends are just frontends and dont actually expose the API
|
||||
if (urlObj.hostname.startsWith("old.")) {
|
||||
urlObj.hostname = urlObj.hostname.replace("old.", "");
|
||||
urlObj.hostname = urlObj.hostname.replace(/^old\./, "");
|
||||
url = urlObj.href;
|
||||
}
|
||||
|
||||
|
@ -1024,6 +1023,17 @@ async function processUrl(msg, url, spoiler = false, command = false) {
|
|||
let color = PLATFORM_COLORS[platform];
|
||||
let platformName = normalizePlatform(platform);
|
||||
|
||||
if (PATH_REGEX.twitter.test(urlObj.pathname)) {
|
||||
const hostname = urlObj.hostname.replace(/^www\./, "");
|
||||
if (!TW_DOMAINS.includes(hostname)) logger.info("fedimbed", `Got new Twitter domain: ${urlObj.hostname}`);
|
||||
if (platform != "Nitter") return {};
|
||||
if (platform == "Nitter" && command === false) {
|
||||
if (hostname != "tw.c7.pm" && hostname != "tw.counter-strike.gay")
|
||||
logger.info("fedimbed", `Got new Nitter domain running fork: ${urlObj.hostname}`);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
const images = [];
|
||||
const videos = [];
|
||||
const audios = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue