📝 Added entire config directory for backup purposes
This commit is contained in:
parent
4b38e59bb6
commit
9b946e2d14
11091 changed files with 1440953 additions and 0 deletions
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2019 Simon Brazell
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#  Nitter Redirect
|
||||
|
||||
[](https://liberapay.com/SimonBrazell/donate) [](https://www.buymeacoffee.com/SimonBrazell)
|
||||
|
||||
[](https://addons.mozilla.org/en-US/firefox/addon/nitter-redirect/) [](https://chrome.google.com/webstore/detail/nitter-redirect/mohaicophfnifehkkkdbcejkflmgfkof)
|
||||
|
||||
A simple browser extension that redirects Twitter requests to [Nitter](https://github.com/zedeus/nitter) instead.
|
||||
|
||||
No unnecessary permissions required, only listens for and redirects requests made to `twitter.com`, `www.twitter.com`, `mobile.twitter.com`, `pbs.twimg.com` & `video.twimg.com`, nothing else.
|
||||
|
||||
Allows for setting custom [Nitter instances](https://github.com/zedeus/nitter/wiki/Instances) and toggling redirects on & off.
|
||||
|
||||
## Build
|
||||
|
||||
1. `npm install --global web-ext`
|
||||
2. `web-ext build`
|
||||
3. See `web-ext-artifacts/` for outputs.
|
||||
|
||||
## License
|
||||
|
||||
Code released under [the MIT license](LICENSE.txt).
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"file_hashes":[{"block_hashes":["fwlLtj8915ddq/G3eQYX2WPCu9ws3WRZw+YeVstrHIU="],"block_size":4096,"path":"LICENSE"},{"block_hashes":["ziBkxehED4MnZBeDLryR5C96/5WDC3RFXgO1Rg0VuMw="],"block_size":4096,"path":"README.md"},{"block_hashes":["IO+njdzO3bYPtlVokBaaeHyyLBBQm5V129ZlYGaGlqU="],"block_size":4096,"path":"background.js"},{"block_hashes":["XVqgEY5P39JJn4yQycu/2FH1fAbMfvXirD++k5SXgxc="],"block_size":4096,"path":"content-script.js"},{"block_hashes":["CrOQQ74r331DsoD2Yx3rN3VHWh3fQ/J4YsrncXyaQiA="],"block_size":4096,"path":"images/icon16.png"},{"block_hashes":["m7qbYv/UEh752bIIERoaIf7orDVoTzwyTht5TdYCNaM="],"block_size":4096,"path":"images/icon32.png"},{"block_hashes":["u7acrXLlnDyymQVZDede9Bc+iUUoahtYzhDMbPDrsWA="],"block_size":4096,"path":"pages/popup/popup.css"},{"block_hashes":["1abVKQCUzrJVzXesjhnNswAE3GT16XqtsBcPK+f+lkI="],"block_size":4096,"path":"pages/popup/popup.html"},{"block_hashes":["0dyUg0VcqQuswOM45KQlQDthmnz9B2HnVfhik8IcT6U="],"block_size":4096,"path":"pages/popup/popup.js"},{"block_hashes":["DFB7wU3OoxlrJvX1ylH/EF5jBbt6ppbdNzWKiwQy8i0="],"block_size":4096,"path":"web-ext-config.js"}],"version":2}
|
||||
|
|
@ -0,0 +1 @@
|
|||
[{"description":"treehash per file","signed_content":{"payload":"eyJjb250ZW50X2hh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"},{"header":{"kid":"webstore"},"protected":"eyJhbGciOiJSUzI1NiJ9","signature":"KV7We5V68uRNG_DRgMT1ZPfFboPtwkm5znLU0ZwclXW_Yl5tHN7Xm7F6rcAXjuHI7i7YQfUWFn0PgAIXVXhjUBeTVN6eVrBop5J5fb8VTcQEf4ujnccRY6P_L46lr-5Ic8N1yyLpMymdxirViuo0UBNCPLv3Vu4hptWI9icGDl4L-g3x9EwjvQV0Fi0nM2f3eN_vzD_LLDHXp5vqttJQx_jwyYmsYRNxNJ38jfEjf7qOUfcOhIOM-0KHRmd4dTWkxzZSgszxa1TqhJnSZCb9C4ccJT7edcBREf5HclagM81EBhEDoIfUQy-_sTHh0piPQNMDHiKalIL5UU3nMNdN9g"}]}}]
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
"use strict";
|
||||
|
||||
const nitterDefault = "https://nitter.net";
|
||||
|
||||
let instance;
|
||||
let nitterDisabled;
|
||||
|
||||
window.browser = window.browser || window.chrome;
|
||||
|
||||
browser.storage.sync.get(["nitterDisabled", "instance"], (result) => {
|
||||
nitterDisabled = result.nitterDisabled;
|
||||
instance = result.instance || nitterDefault;
|
||||
});
|
||||
|
||||
browser.storage.onChanged.addListener(function (changes) {
|
||||
if ("instance" in changes) {
|
||||
instance = changes.instance.newValue || nitterDefault;
|
||||
}
|
||||
if ("nitterDisabled" in changes) {
|
||||
nitterDisabled = changes.nitterDisabled.newValue;
|
||||
}
|
||||
});
|
||||
|
||||
function redirectTwitter(url) {
|
||||
if (nitterDisabled) {
|
||||
return null;
|
||||
}
|
||||
if (url.host.split(".")[0] === "pbs") {
|
||||
return `${instance}/pic/${encodeURIComponent(url.href)}`;
|
||||
} else if (url.host.split(".")[0] === "video") {
|
||||
return `${instance}/gif/${encodeURIComponent(url.href)}`;
|
||||
} else if (url.pathname.includes("tweets")) {
|
||||
return `${instance}${url.pathname.replace("/tweets", "")}${url.search}`;
|
||||
} else {
|
||||
return `${instance}${url.pathname}${url.search}`;
|
||||
}
|
||||
}
|
||||
|
||||
browser.webRequest.onBeforeRequest.addListener(
|
||||
(details) => {
|
||||
const url = new URL(details.url);
|
||||
let redirect;
|
||||
redirect = { redirectUrl: redirectTwitter(url) };
|
||||
if (redirect && redirect.redirectUrl) {
|
||||
console.info(
|
||||
"Redirecting",
|
||||
`"${url.href}"`,
|
||||
"=>",
|
||||
`"${redirect.redirectUrl}"`
|
||||
);
|
||||
console.info("Details", details);
|
||||
}
|
||||
return redirect;
|
||||
},
|
||||
{
|
||||
urls: [
|
||||
"*://twitter.com/*",
|
||||
"*://www.twitter.com/*",
|
||||
"*://mobile.twitter.com/*",
|
||||
"*://pbs.twimg.com/*",
|
||||
"*://video.twimg.com/*",
|
||||
],
|
||||
},
|
||||
["blocking"]
|
||||
);
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
"use strict";
|
||||
|
||||
const nitterDefault = "https://nitter.net";
|
||||
|
||||
let nitterDisabled;
|
||||
let instance;
|
||||
|
||||
window.browser = window.browser || window.chrome;
|
||||
|
||||
function redirectTwitter(url) {
|
||||
if (url.host.split(".")[0] === "pbs") {
|
||||
return `${instance}/pic/${encodeURIComponent(url.href)}`;
|
||||
} else if (url.host.split(".")[0] === "video") {
|
||||
return `${instance}/gif/${encodeURIComponent(url.href)}`;
|
||||
} else if (url.pathname.includes("tweets")) {
|
||||
return `${instance}${url.pathname.replace("/tweets", "")}${url.search}`;
|
||||
} else {
|
||||
return `${instance}${url.pathname}${url.search}`;
|
||||
}
|
||||
}
|
||||
|
||||
browser.storage.sync.get(["nitterDisabled", "instance"], (result) => {
|
||||
nitterDisabled = result.nitterDisabled;
|
||||
instance = result.instance || nitterDefault;
|
||||
navigator.serviceWorker.getRegistrations().then((registrations) => {
|
||||
for (let registration of registrations) {
|
||||
if (registration.scope === "https://twitter.com/") {
|
||||
registration.unregister();
|
||||
console.log("Unregistered Twitter SW", registration);
|
||||
}
|
||||
}
|
||||
});
|
||||
const url = new URL(window.location);
|
||||
if (!nitterDisabled && url.host !== instance) {
|
||||
const redirect = redirectTwitter(url);
|
||||
console.info("Redirecting", `"${url.href}"`, "=>", `"${redirect}"`);
|
||||
window.location = redirect;
|
||||
}
|
||||
});
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1 KiB |
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"background": {
|
||||
"persistent": true,
|
||||
"scripts": [ "background.js" ]
|
||||
},
|
||||
"browser_action": {
|
||||
"default_icon": {
|
||||
"128": "images/icon128.png",
|
||||
"48": "images/icon48.png"
|
||||
},
|
||||
"default_popup": "pages/popup/popup.html"
|
||||
},
|
||||
"browser_specific_settings": {
|
||||
"gecko": {
|
||||
"id": "{513646f8-fb87-4135-a41e-4cf1d1ccccf2}"
|
||||
}
|
||||
},
|
||||
"content_scripts": [ {
|
||||
"js": [ "content-script.js" ],
|
||||
"matches": [ "*://twitter.com/*", "*://www.twitter.com/*", "*://mobile.twitter.com/*", "*://pbs.twimg.com/*", "*://video.twimg.com/*" ],
|
||||
"run_at": "document_start"
|
||||
} ],
|
||||
"description": "Redirects Twitter requests to Nitter, the privacy friendly alternative.",
|
||||
"icons": {
|
||||
"128": "images/icon128.png",
|
||||
"48": "images/icon48.png"
|
||||
},
|
||||
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAgLsCbiJ7KY9niS6XzbVb0lBNryu6QMezjIgKsrj/F3giJQbxbAAaq2aNg5OfC6ZCRoxrhyUpSnn8/pYKYfCcAbX/wHe30aWVlZcXO6ufHJ+UUs6rji1X+sh+WQQnDZob903KvfCxQ61yUpGbL+UynWTe22T6kDSY65RI/+6ZML73U1iehqV9lRBrJyRkESVriiOjQPpTZnkpAVuuowBYtWBwSyRdQOvYPdOHk5SvgKKEyLsLN2kyBHUOzPfPqtpLqbDzyyIOPsZuRKmU4E3j0swfl8l8HcBgWwpygTSu9XdkGj+Uw13FIrXxLmaqQ9NDwRFy2UI4aF+UoEswtkNErwIDAQAB",
|
||||
"manifest_version": 2,
|
||||
"name": "Nitter Redirect",
|
||||
"permissions": [ "storage", "webRequest", "webRequestBlocking", "*://twitter.com/*", "*://www.twitter.com/*", "*://mobile.twitter.com/*", "*://pbs.twimg.com/*", "*://video.twimg.com/*" ],
|
||||
"update_url": "https://clients2.google.com/service/update2/crx",
|
||||
"version": "1.1.5"
|
||||
}
|
||||
|
|
@ -0,0 +1,153 @@
|
|||
:root {
|
||||
--text-main: #FFF;
|
||||
--dark: #3C4043;
|
||||
--darker: #1F1F1F;
|
||||
--active: #FF5B56;
|
||||
--space: 5px;
|
||||
--danger: #f04141;
|
||||
--danger-light: #F9D0D5;
|
||||
}
|
||||
|
||||
body {
|
||||
color: var(--text-main);
|
||||
margin: 0;
|
||||
max-width: 400px;
|
||||
min-width: 240px;
|
||||
background-color: var(--dark);
|
||||
}
|
||||
|
||||
header {
|
||||
background-color: var(--darker);
|
||||
color: var(--text-main);
|
||||
display: flex;
|
||||
padding: var(--space);
|
||||
}
|
||||
|
||||
header h1 {
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
header .logo-container {
|
||||
margin: var(--space);
|
||||
}
|
||||
|
||||
header .logo-container img {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
header small {
|
||||
display: block;
|
||||
font-size: .70em;
|
||||
font-weight: bold;
|
||||
margin: 1%;
|
||||
width: 100%;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 14px;
|
||||
margin: var(--space) auto
|
||||
}
|
||||
|
||||
h2 {
|
||||
clear: both;
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2 {
|
||||
color: var(--text-main);
|
||||
}
|
||||
|
||||
footer {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
footer a.button {
|
||||
margin: var(--space);
|
||||
}
|
||||
|
||||
/* Elements */
|
||||
|
||||
input[type=url] {
|
||||
width: 100%;
|
||||
margin-bottom: var(--space);
|
||||
}
|
||||
|
||||
input[type=checkbox] {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.checkbox-label {
|
||||
background: grey;
|
||||
border-radius: 25px;
|
||||
color: var(--text-main);
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
float: right;
|
||||
font-weight: bold;
|
||||
height: 30px;
|
||||
position: relative;
|
||||
text-indent: -400px;
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
.checkbox-label:after {
|
||||
background: #fff;
|
||||
border-radius: 90px;
|
||||
content: '';
|
||||
height: 20px;
|
||||
left: var(--space);
|
||||
position: absolute;
|
||||
top: var(--space);
|
||||
transition: 0.3s; /* Acts on transform below */
|
||||
width: 20px;
|
||||
}
|
||||
input:checked+label {
|
||||
background: var(--active);
|
||||
}
|
||||
/* position when active*/
|
||||
input:checked+label:after {
|
||||
left: calc(100% - var(--space));
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
|
||||
.settings_block {
|
||||
display: block;
|
||||
padding: var(--space) 1em 20px 1em;
|
||||
border-bottom: var(--dark) solid 1px;
|
||||
}
|
||||
|
||||
.settings_block h1 {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.button {
|
||||
border: var(--active) solid 1px;
|
||||
color: var(--text-main);
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
margin: var(--space) auto;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.button:hover {
|
||||
background-color: var(--active);
|
||||
color: #fff
|
||||
}
|
||||
|
||||
input[type="url"]:invalid {
|
||||
color: var(--danger);
|
||||
border-color: var(--danger);
|
||||
background-color: var(--danger-light);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title></title>
|
||||
<link href="./popup.css" rel="stylesheet" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header>
|
||||
<div class="logo-container">
|
||||
<img src="../../images/icon128.png" alt="Nitter Redirect logo" />
|
||||
</div>
|
||||
<small>
|
||||
<span>Version: <span id="version"></span></span>
|
||||
</small>
|
||||
</header>
|
||||
|
||||
<section class="options settings_block">
|
||||
<div class="onoffswitch switch" aria-label="Toggle Nitter redirects">
|
||||
<h1>Toggle Redirects</h1>
|
||||
<input
|
||||
aria-hidden="true"
|
||||
name="toggleNitter"
|
||||
id="toggle-nitter"
|
||||
type="checkbox"
|
||||
checked
|
||||
/>
|
||||
<label for="toggle-nitter" class="checkbox-label"> </label>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="options settings_block">
|
||||
<h1>Nitter Instance</h1>
|
||||
<input
|
||||
id="instance"
|
||||
list="instance-list"
|
||||
type="url"
|
||||
placeholder="https://nitter.net"
|
||||
/>
|
||||
<datalist id="instance-list">
|
||||
<option value="https://nitter.net"> </option>
|
||||
<option value="https://nitter.snopyta.org"> </option>
|
||||
<option value="https://nitter.42l.fr"> </option>
|
||||
<option value="https://nitter.nixnet.services"> </option>
|
||||
<option value="https://nitter.13ad.de"> </option>
|
||||
<option value="https://tw.openalgeria.org"> </option>
|
||||
<option value="https://nitter.pussthecat.org"> </option>
|
||||
<option value="https://nitter.mastodont.cat"> </option>
|
||||
<option value="https://nitter.dark.fail"> </option>
|
||||
<option value="https://nitter.tedomum.net"> </option>
|
||||
<option value="https://t.maisputain.ovh"> </option>
|
||||
<option value="https://nitter.cattube.org"> </option>
|
||||
<option value="https://nitter.fdn.fr"> </option>
|
||||
<option value="https://nitter.1d4.us"> </option>
|
||||
<option value="https://nitter.kavin.rocks"> </option>
|
||||
<option value="https://nitter.libre.cx"> </option>
|
||||
<option
|
||||
value="http://3nzoldnxplag42gqjs23xvghtzf6t6yzssrtytnntc6ppc7xxuoneoad.onion"
|
||||
>
|
||||
</option>
|
||||
<option
|
||||
value="http://nitter.l4qlywnpwqsluw65ts7md3khrivpirse744un3x7mlskqauz5pyuzgqd.onion"
|
||||
>
|
||||
</option>
|
||||
<option
|
||||
value="http://nitterlgj3n5fgwesu3vxc5h67ruku33nqaoeoocae2mvlzhsu6k7fqd.onion"
|
||||
></option>
|
||||
</datalist>
|
||||
</section>
|
||||
|
||||
<script src="./popup.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
'use strict';
|
||||
|
||||
let toggleNitter = document.querySelector('#toggle-nitter');
|
||||
let instance = document.querySelector('#instance');
|
||||
let version = document.querySelector('#version');
|
||||
|
||||
window.browser = window.browser || window.chrome;
|
||||
|
||||
browser.storage.sync.get(['nitterDisabled', 'instance'], (result) => {
|
||||
toggleNitter.checked = !result.nitterDisabled;
|
||||
instance.value = result.instance || '';
|
||||
});
|
||||
|
||||
version.textContent = browser.runtime.getManifest().version;
|
||||
|
||||
function debounce(func, wait, immediate) {
|
||||
let timeout;
|
||||
return function () {
|
||||
let context = this, args = arguments;
|
||||
let later = function () {
|
||||
timeout = null;
|
||||
if (!immediate) func.apply(context, args);
|
||||
};
|
||||
let callNow = immediate && !timeout;
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(later, wait);
|
||||
if (callNow) func.apply(context, args);
|
||||
};
|
||||
};
|
||||
|
||||
let instanceChange = debounce(() => {
|
||||
if (instance.checkValidity()) {
|
||||
browser.storage.sync.set({
|
||||
instance: instance.value ? new URL(instance.value).origin : ''
|
||||
});
|
||||
}
|
||||
}, 500);
|
||||
instance.addEventListener('input', instanceChange);
|
||||
|
||||
toggleNitter.addEventListener('change', (event) => {
|
||||
browser.storage.sync.set({ nitterDisabled: !event.target.checked });
|
||||
});
|
||||
|
||||
instance.addEventListener('input', instanceChange);
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
module.exports = {
|
||||
ignoreFiles: [
|
||||
"images/Screen Shot*.png",
|
||||
"images/buy-me-a-coffee.png",
|
||||
"images/badge-*.png",
|
||||
],
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue