diff options
-rw-r--r-- | .github/workflows/test.yml | 2 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | src/assets/javascripts/services.js | 25 | ||||
-rw-r--r-- | src/config.json | 32 | ||||
-rw-r--r-- | src/pages/stylesheets/styles.css | 2 |
5 files changed, 58 insertions, 5 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f31a693f..612e46a0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,5 @@ jobs: steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 - with: - node-version: "16" - run: npm install - run: npm test diff --git a/package.json b/package.json index d6051747..79147f4d 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ }, "scripts": { "start": "web-ext run", - "nightly": "web-ext run --firefox=/home/manerakai/software/firefox_nightly/firefox", + "nightly": "web-ext run --firefox=/home/esmail/software/firefox_nightly/firefox", "android": "web-ext run -t firefox-android --adb-device emulator-5554 --firefox-apk org.mozilla.fenix", "build": "web-ext build", "test": "web-ext lint", diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 245cb919..1a20dae5 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -460,6 +460,30 @@ function rewrite(url, frontend, randomInstance) { case "skyview": if (url.pathname == '/') return randomInstance return `${randomInstance}?url=${encodeURIComponent(url.href)}` + case "nitter": { + let search = new URLSearchParams(url.search) + + search.delete("ref_src") + search.delete("ref_url") + search.delete("s") // type of device that shared the link + search.delete("t") // some sort of tracking ID + + search = search.toString() + if (search !== "") search = `?${search}` + + if (url.host.split(".")[0] === "pbs" || url.host.split(".")[0] === "video") { + try { + const [, id, format, extra] = search.match(/(.*)\?format=(.*)&(.*)/) + const query = encodeURIComponent(`${id}.${format}?${extra}`) + return `${randomInstance}/pic${url.pathname}${query}` + } catch { + return `${randomInstance}/pic${url.pathname}${search}` + } + } + if (url.pathname.split("/").includes("tweets")) return `${randomInstance}${url.pathname.replace("/tweets", "")}${search}` + if (url.host == "t.co") return `${randomInstance}/t.co${url.pathname}` + return `${randomInstance}${url.pathname}${search}#m` + } case "priviblur": { if (url.hostname == "www.tumblr.com") return `${randomInstance}${url.pathname}${url.search}` if (url.hostname.startsWith("assets")) return `${randomInstance}/tblr/assets${url.pathname}${url.search}` @@ -719,6 +743,7 @@ const defaultInstances = { 'tekstoLibre': ['https://davilarek.github.io/TekstoLibre'], 'skyview': ['https://skyview.social'], 'priviblur': ['https://pb.bloat.cat'], + 'nitter': ['https://nitter.privacydev.net'], } function initDefaults() { diff --git a/src/config.json b/src/config.json index f0789a7b..19f85a12 100644 --- a/src/config.json +++ b/src/config.json @@ -173,6 +173,36 @@ "imageType": "png", "url": "https://music.youtube.com" }, + "twitter": { + "frontends": { + "nitter": { + "name": "Nitter", + "embeddable": true, + "instanceList": true, + "url": "https://github.com/zedeus/nitter", + "localhost": true + } + }, + "targets": [ + "^https?:\\/{2}(www\\.|mobile\\.)?twitter\\.com\\/", + "^https?:\\/{2}(www\\.|mobile\\.)?x\\.com\\/", + "^https?:\\/{2}(pbs\\.|video\\.)twimg\\.com\\/", + "^https?:\\/{2}platform\\.x\\.com/embed\\/", + "^https?:\\/{2}platform\\.twitter\\.com/embed\\/", + "^https?:\\/{2}t\\.co\\/" + ], + "name": "Twitter", + "options": { + "enabled": false, + "redirectType": "main_frame", + "unsupportedUrls": "bypass", + "frontend": "nitter", + "instance": "public" + }, + "imageType": "png", + "embeddable": true, + "url": "https://twitter.com" + }, "bluesky": { "frontends": { "skyview": { @@ -1079,4 +1109,4 @@ "url": "https://paste.libredirect.invalid" } } -} +} \ No newline at end of file diff --git a/src/pages/stylesheets/styles.css b/src/pages/stylesheets/styles.css index e3212a66..b220efdb 100644 --- a/src/pages/stylesheets/styles.css +++ b/src/pages/stylesheets/styles.css @@ -131,7 +131,7 @@ section.links { flex-wrap: wrap; flex-direction: column; width: 350px; - max-height: 970px; + max-height: 1030px; } section.links div { |