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\/(.+?)\/(.+?)\/?/,
|
pixelfed: /^\/p\/(.+?)\/(.+?)\/?/,
|
||||||
//cohost: /^\/[A-Za-z0-9]+\/post\/\d+-[A-Za-z0-9-]+\/?/,
|
//cohost: /^\/[A-Za-z0-9]+\/post\/\d+-[A-Za-z0-9-]+\/?/,
|
||||||
bluesky: BSKY_POST_REGEX,
|
bluesky: BSKY_POST_REGEX,
|
||||||
|
twitter: /^\/[a-z0-9_]+\/status\/\d+\/?/,
|
||||||
};
|
};
|
||||||
|
|
||||||
const PLATFORM_COLORS = {
|
const PLATFORM_COLORS = {
|
||||||
|
@ -51,7 +52,6 @@ const PLATFORM_COLORS = {
|
||||||
//cohost: 0x83254f,
|
//cohost: 0x83254f,
|
||||||
bluesky: 0x0085ff,
|
bluesky: 0x0085ff,
|
||||||
nitter: 0xff6c60,
|
nitter: 0xff6c60,
|
||||||
twitter: 0xff6c60, // Nitter accent color
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const BSKY_DOMAINS = [
|
const BSKY_DOMAINS = [
|
||||||
|
@ -67,8 +67,7 @@ const BSKY_DOMAINS = [
|
||||||
"bsky.brid.gy",
|
"bsky.brid.gy",
|
||||||
];
|
];
|
||||||
|
|
||||||
//eventually:tm:
|
const TW_DOMAINS = [
|
||||||
/*const TW_DOMAINS = [
|
|
||||||
"tw.c7.pm",
|
"tw.c7.pm",
|
||||||
"tw.counter-strike.gay",
|
"tw.counter-strike.gay",
|
||||||
"xcancel.com",
|
"xcancel.com",
|
||||||
|
@ -86,7 +85,7 @@ const BSKY_DOMAINS = [
|
||||||
// these two are base64 encoded just because i dont want those words in my codebase
|
// these two are base64 encoded just because i dont want those words in my codebase
|
||||||
Buffer.from("aGl0bGVyeC5jb20=", "base64").toString(),
|
Buffer.from("aGl0bGVyeC5jb20=", "base64").toString(),
|
||||||
Buffer.from("bmlnZ2VyeC5jb20=", "base64").toString(),
|
Buffer.from("bmlnZ2VyeC5jb20=", "base64").toString(),
|
||||||
];*/
|
];
|
||||||
|
|
||||||
const pageParser = new XMLParser({
|
const pageParser = new XMLParser({
|
||||||
ignoreAttributes: false,
|
ignoreAttributes: false,
|
||||||
|
@ -1016,7 +1015,7 @@ async function processUrl(msg, url, spoiler = false, command = false) {
|
||||||
// some lemmy instances have old reddit frontend subdomains
|
// some lemmy instances have old reddit frontend subdomains
|
||||||
// but these frontends are just frontends and dont actually expose the API
|
// but these frontends are just frontends and dont actually expose the API
|
||||||
if (urlObj.hostname.startsWith("old.")) {
|
if (urlObj.hostname.startsWith("old.")) {
|
||||||
urlObj.hostname = urlObj.hostname.replace("old.", "");
|
urlObj.hostname = urlObj.hostname.replace(/^old\./, "");
|
||||||
url = urlObj.href;
|
url = urlObj.href;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1024,6 +1023,17 @@ async function processUrl(msg, url, spoiler = false, command = false) {
|
||||||
let color = PLATFORM_COLORS[platform];
|
let color = PLATFORM_COLORS[platform];
|
||||||
let platformName = normalizePlatform(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 images = [];
|
||||||
const videos = [];
|
const videos = [];
|
||||||
const audios = [];
|
const audios = [];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue