Skip to content

Commit

Permalink
Fixed thing in reddit. Fixed bug in incognito, Fixed localise module …
Browse files Browse the repository at this point in the history
…error. Bump => 2.1.0
  • Loading branch information
ManeraKai committed Jun 9, 2022
1 parent 22b6878 commit 64014cf
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
6 changes: 3 additions & 3 deletions chromium.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Linux
- Download the latest `.crx` file: [libredirect-2.0.0.crx](https://github.com/libredirect/libredirect/releases/download/v2.0.0/libredirect-2.0.0.crx)
- Download the latest `.crx` file: [libredirect-2.1.0.crx](https://github.com/libredirect/libredirect/releases/download/v2.1.0/libredirect-2.1.0.crx)
- Open `chrome://extensions`
- Enable `dev mode`
- Rerfesh the page
Expand All @@ -8,11 +8,11 @@
Updates are automatic

## Windows, MacOS
- Download the latest release [libredirect-2.0.0.zip](https://github.com/libredirect/libredirect/releases/download/v2.0.0/libredirect-2.0.0.zip)
- Download the latest release [libredirect-2.1.0.zip](https://github.com/libredirect/libredirect/releases/download/v2.1.0/libredirect-2.1.0.zip)
- Unzip it with `Auto detect subfolder`
- Open `chrome://extensions`
- Enable `dev mode`
- Click `Load unpacked`. Select and Open `libredirect-2.0.0/`
- Click `Load unpacked`. Select and Open `libredirect-2.1.0/`

https://user-images.githubusercontent.com/40805353/159987051-8be73cd3-3fdf-4dd0-99d4-8886674fbdb6.mp4

Expand Down
10 changes: 5 additions & 5 deletions src/assets/javascripts/reddit.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,34 +240,34 @@ function redirect(url, type, initiator) {
if (redditFrontend == 'teddit') {
if (tedditInstancesList.length === 0) return;
let tedditRandomInstance = utils.getRandomInstance(tedditInstancesList);
return `${tedditRandomInstance}/pics/w:null_${url.pathname.substring(1)}${url.reddit}`;
return `${tedditRandomInstance}/pics/w:null_${url.pathname.substring(1)}${url.search}`;
}
if (redditFrontend == 'libreddit') {
if (libredditInstancesList.length === 0) return;
let libredditRandomInstance = utils.getRandomInstance(libredditInstancesList);
return `${libredditRandomInstance}/img${url.pathname}${url.reddit}`
return `${libredditRandomInstance}/img${url.pathname}${url.search}`
}
}
else if (url.host === "redd.it") {
if (redditFrontend == 'libreddit' && !url.pathname.match(/^\/+[^\/]+\/+[^\/]/)) {
if (libredditInstancesList.length === 0) return;
let libredditRandomInstance = utils.getRandomInstance(libredditInstancesList);
// https://redd.it/foo => https://libredd.it/comments/foo
return `${libredditRandomInstance}/comments${url.pathname}${url.reddit}`;
return `${libredditRandomInstance}/comments${url.pathname}${url.search}`;
}
if (redditFrontend == 'teddit' && !url.pathname.match(/^\/+[^\/]+\/+[^\/]/)) {
if (tedditInstancesList.length === 0) return;
let tedditRandomInstance = utils.getRandomInstance(tedditInstancesList);
// https://redd.it/foo => https://teddit.net/comments/foo
return `${tedditRandomInstance}/comments${url.pathname}${url.reddit}`
return `${tedditRandomInstance}/comments${url.pathname}${url.search}`
}
}
else if (url.host === 'preview.redd.it') {
if (redditFrontend == 'teddit') return;
if (redditFrontend == 'libreddit') {
if (libredditInstancesList.length === 0) return;
const libredditRandomInstance = utils.getRandomInstance(libredditInstancesList);
return `${libredditRandomInstance}/preview/pre${url.pathname}${url.reddit}`;
return `${libredditRandomInstance}/preview/pre${url.pathname}${url.search}`;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/background/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ browser.tabs.onCreated.addListener(
tab => {
if (tab.incognito) {
incognitoList.push(tab.id);
if (incognitoList.length == 1) browser.tabs.create({ url: browser.runtime.getURL("/pages/background/incognito.html") });
if (incognitoList.length == 1) browser.tabs.create({ url: browser.runtime.getURL("/pages/background/incognito.html"), active: false });
}
}
);
Expand Down
9 changes: 4 additions & 5 deletions src/pages/errors/instance_offline.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@

<body>
<div>
<p id="message" data-localise="__MSG_instanceOffline__">This instance is offline, you'll be redirected after&nbsp;<span
id="number">2</span>&nbsp;<x data-localise="__MSG_sec__">seconds</x>
<p id="message" data-localise="__MSG_instanceOffline__">This instance is offline, you'll be redirected
after&nbsp;<span id="number">2</span>&nbsp;<x data-localise="__MSG_sec__">seconds</x>
</p>
<button id="cancel" data-localise="__MSG_cancel__">Cancel</button>
</div>

<script src="instance_offline.js"></script>
<script src="../../assets/javascripts/localise.js"></script>
<script src="instance_offline.js" type="module"></script>
</body>

</html>
</html>
5 changes: 5 additions & 0 deletions src/pages/errors/instance_offline.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import localise from "../../assets/javascripts/localise.js";


const params = new Proxy(
new URLSearchParams(window.location.search),
{ get: (searchParams, prop) => searchParams.get(prop) }
Expand All @@ -18,3 +21,5 @@ document.getElementById("cancel").addEventListener("click", () => {
isCanceled = true;
document.getElementById("message").innerHTML = browser.i18n.getMessage('redirectionCanceled');
})

localise.localisePage();
2 changes: 1 addition & 1 deletion src/updates/updates.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<app appid='oladmjdebphlnjjcnomfhhbfdldiimaf'>
<updatecheck codebase='https://github.com/libredirect/libredirect/releases/download/v2.0.0/libredirect-2.0.0.crx' version='2.0.0' />
<updatecheck codebase='https://github.com/libredirect/libredirect/releases/download/v2.1.0/libredirect-2.1.0.crx' version='2.1.0' />
</app>
</gupdate>

0 comments on commit 64014cf

Please sign in to comment.