Cleaned privacy policy. Added warning for 404, etc... instances for latency test #249

This commit is contained in:
ManeraKai 2022-05-16 23:21:22 +03:00
parent 754c52983a
commit b8618956fb
No known key found for this signature in database
GPG Key ID: 5ABC31FFD562E337
2 changed files with 21 additions and 15 deletions

View File

@ -5,14 +5,7 @@
OpenStreetMap (OSM) reverse geocoding, done via the [OSM Nomantim API](https://nominatim.org/release-docs/develop/api/Overview/), OpenStreetMap (OSM) reverse geocoding, done via the [OSM Nomantim API](https://nominatim.org/release-docs/develop/api/Overview/),
used as part of OSM redirects, which can be disabled by toggling the OSM redirects. used as part of OSM redirects, which can be disabled by toggling the OSM redirects.
* It also connects to [this url](https://raw.githubusercontent.com/libredirect/libredirect/master/src/instances/data.json) to update the Instances List. Though this only gets triggered when the user presses the `Update Instances` button. * It also connects to [this url](https://raw.githubusercontent.com/libredirect/libredirect/master/src/instances/data.json) to update the Instances List. Though this only gets triggered when the user presses the `Update Instances` button.
* For bibliogram instances. To set a cookie you should send an http request to the server as the server stores settings values itself and gives you a token to access them.
## Permissions
* `webRequest`, `webRequestBlocking`: To block http requests or redirect them. e.g redirect to YouTube => Invidious before it can reach YouTube's servers.
* `storage`: To save LibRedirect's settings permanently.
* `cookies`: To apply settings on multiple instances. Note that we use localStorage too. Those options are disabled by default though.
* `contextMenus`: For adding some buttons to the right click:\
![contextMenu](https://user-images.githubusercontent.com/40805353/160441937-dc0c71a9-bed1-4078-81a1-189f8ff21c0e.png)
* `<all_urls>`: LibRedirect is dynamic and customizable. The targets e.g `https://youtube.com`, `https://twitter.com` are written in [Regex](https://en.wikipedia.org/wiki/Regular_expression) and are much more complicated than to be hard-coded in the manifest. Ex: [search Regex](https://github.com/libredirect/libredirect/blob/master/src/assets/javascripts/helpers/search.js#L6=). Further more, we need to access the instances sites too to inject some localStorage variables. There's also an option to `Always Use Preferred instances` that is to even redirect of any other invidious instance to your selected instances. This has to be dynamic and you may even add a custom instance which can't at all be hard-coded.
## Future Changes ## Future Changes
If we decide to change our privacy policy, we will post those changes on this page. If we decide to change our privacy policy, we will post those changes on this page.

View File

@ -18,7 +18,7 @@ function getRandomInstance(instances) {
let cloudflareList = []; let cloudflareList = [];
async function initCloudflareList() { async function initCloudflareList() {
return new Promise(resolve => { return new Promise(resolve => {
fetch('/instances/blocklist').then(response => response.text()).then(data => { fetch('/instances/blocklist.json').then(response => response.text()).then(data => {
cloudflareList = JSON.parse(data); cloudflareList = JSON.parse(data);
resolve(); resolve();
}) })
@ -96,6 +96,7 @@ function protocolHost(url) {
} }
async function processDefaultCustomInstances(target, name, protocol, document) { async function processDefaultCustomInstances(target, name, protocol, document) {
function camelCase(str) { function camelCase(str) {
return str.charAt(0).toUpperCase() + str.slice(1); return str.charAt(0).toUpperCase() + str.slice(1);
} }
@ -109,6 +110,7 @@ async function processDefaultCustomInstances(target, name, protocol, document) {
await initCloudflareList(); await initCloudflareList();
let nameDefaultRedirects; let nameDefaultRedirects;
let redirectsChecks = `${name}${camelCase(protocol)}RedirectsChecks`; let redirectsChecks = `${name}${camelCase(protocol)}RedirectsChecks`;
@ -271,9 +273,13 @@ async function ping(href) {
let started = new Date().getTime(); let started = new Date().getTime();
http.onreadystatechange = () => { http.onreadystatechange = () => {
if (http.readyState == 2) { if (http.readyState == 2) {
let ended = new Date().getTime(); if (http.status == 200) {
http.abort(); let ended = new Date().getTime();
resolve(ended - started); http.abort();
resolve(ended - started);
}
else
resolve(5000 + http.status)
} }
}; };
http.ontimeout = () => resolve(5000) http.ontimeout = () => resolve(5000)
@ -292,9 +298,16 @@ async function testLatency(element, instances) {
for (const href of instances) await ping(href).then(m => { for (const href of instances) await ping(href).then(m => {
if (m) { if (m) {
myList[href] = m; myList[href] = m;
let color = m <= 1000 ? "green" : m <= 2000 ? "orange" : "red"; let color;
let text = m == 5000 ? '5000ms+' : m + 'ms'; if (m <= 1000) color = "green"
element.innerHTML = `${href}:&nbsp;'<span style="color:${color};">${text}</span>`; else if (m <= 2000) color = "orange"
else color = "red";
let text;
if (m == 5000) text = '5000ms+'
else if (m > 5000) text = m - 5000
else text = `${m}ms`;
element.innerHTML = `${href}:&nbsp;<span style="color:${color};">${text}</span>`;
} }
}) })
resolve(myList); resolve(myList);