fedimbed: nitter -> twitter cause people will complain :(
This commit is contained in:
parent
7557c8ae21
commit
76a5209577
1 changed files with 8 additions and 5 deletions
|
@ -49,7 +49,7 @@ const PLATFORM_COLORS = {
|
||||||
pixelfed: 0x10c5f8,
|
pixelfed: 0x10c5f8,
|
||||||
//cohost: 0x83254f,
|
//cohost: 0x83254f,
|
||||||
bluesky: 0x0085ff,
|
bluesky: 0x0085ff,
|
||||||
nitter: 0xff6c60,
|
nitter: 0x1da1f2,
|
||||||
};
|
};
|
||||||
|
|
||||||
const BSKY_DOMAINS = [
|
const BSKY_DOMAINS = [
|
||||||
|
@ -964,12 +964,15 @@ async function processUrl(msg, url, spoiler = false, command = false) {
|
||||||
|
|
||||||
let platform = (await resolvePlatform(url)) ?? "<no nodeinfo>";
|
let platform = (await resolvePlatform(url)) ?? "<no nodeinfo>";
|
||||||
|
|
||||||
|
let realUrl = url;
|
||||||
if (PATH_REGEX.twitter.test(urlObj.pathname)) {
|
if (PATH_REGEX.twitter.test(urlObj.pathname)) {
|
||||||
let hostname = urlObj.hostname.replace(/^www\./, "");
|
let hostname = urlObj.hostname.replace(/^www\./, "");
|
||||||
if (TW_DOMAINS.includes(hostname)) {
|
if (TW_DOMAINS.includes(hostname)) {
|
||||||
if (canTwitter === true) {
|
if (canTwitter === true) {
|
||||||
urlObj.hostname = "tw.c7.pm";
|
urlObj.hostname = "tw.c7.pm";
|
||||||
url = urlObj.toString();
|
url = urlObj.toString();
|
||||||
|
urlObj.hostName = "twitter.com";
|
||||||
|
realUrl = urlObj.toString();
|
||||||
hostname = "tw.c7.pm";
|
hostname = "tw.c7.pm";
|
||||||
platform = "Nitter";
|
platform = "Nitter";
|
||||||
}
|
}
|
||||||
|
@ -1318,7 +1321,7 @@ async function processUrl(msg, url, spoiler = false, command = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (platformName.includes("Nitter") && platformName.includes(" \u2022 ")) {
|
if (platformName.includes("Nitter") && platformName.includes(" \u2022 ")) {
|
||||||
const [nn, ns] = platformName.split(" \u2022 ");
|
const [_, ns] = platformName.split(" \u2022 ");
|
||||||
stats = ns
|
stats = ns
|
||||||
.replace("\u21a9", Icons.fedimbed.reply)
|
.replace("\u21a9", Icons.fedimbed.reply)
|
||||||
.replace("\ud83d\udd01", Icons.fedimbed.repost)
|
.replace("\ud83d\udd01", Icons.fedimbed.repost)
|
||||||
|
@ -1327,10 +1330,10 @@ async function processUrl(msg, url, spoiler = false, command = false) {
|
||||||
.replace("\ud83d\udd16", Icons.fedimbed.bookmark)
|
.replace("\ud83d\udd16", Icons.fedimbed.bookmark)
|
||||||
.replace("\ud83d\udc41", Icons.fedimbed.views)
|
.replace("\ud83d\udc41", Icons.fedimbed.views)
|
||||||
.replaceAll(/ <:i:/g, "\u3000<:i:");
|
.replaceAll(/ <:i:/g, "\u3000<:i:");
|
||||||
platformName = nn;
|
platformName = "Twitter";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (platformName == "Nitter") {
|
if (platformName == "Twitter") {
|
||||||
const newHandle = author.handle.split("@")[0];
|
const newHandle = author.handle.split("@")[0];
|
||||||
author.handle = "@" + newHandle;
|
author.handle = "@" + newHandle;
|
||||||
|
|
||||||
|
@ -1429,7 +1432,7 @@ async function processUrl(msg, url, spoiler = false, command = false) {
|
||||||
type: 2,
|
type: 2,
|
||||||
style: 5,
|
style: 5,
|
||||||
label: "View Post",
|
label: "View Post",
|
||||||
url,
|
url: realUrl,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
if (images.length > 0) {
|
if (images.length > 0) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue