about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/assets/javascripts/search.js93
-rw-r--r--src/pages/options/index.html106
-rw-r--r--src/pages/options/widgets/search.js101
-rw-r--r--src/pages/options/widgets/search.pug43
4 files changed, 304 insertions, 39 deletions
diff --git a/src/assets/javascripts/search.js b/src/assets/javascripts/search.js
index 5a91ff89..93bb10ae 100644
--- a/src/assets/javascripts/search.js
+++ b/src/assets/javascripts/search.js
@@ -5,8 +5,12 @@ import utils from './utils.js'
 const targets = [
   /^https?:\/{2}search\.libredirect\.invalid/,
 ];
+// Ill optimise all of assets/javascripts at a later date. For now, I'll just add librex and optimse options javascript
+const frontends = new Array("searx", "searxng", "whoogle", "librex")
+const protocols = new Array("normal", "tor", "i2p")
 
-let redirects = {
+const redirects = {}
+  /*
   "searx": {
     "normal": [],
     "tor": [],
@@ -22,7 +26,27 @@ let redirects = {
     "tor": [],
     "i2p": []
   }
-};
+  */
+//};
+
+//let tmp = "{"
+
+for (let i = 0; i < frontends.length; i++) {
+  //redirects.frontends[i] = {}
+  //redirects.push(frontends[i])
+  //tmp = frontends[i]
+  //tmp = tmp + '\n"' + frontends[i] + '": {'
+  redirects[frontends[i]] = {}
+  for (let x = 0; x < protocols.length; x++) {
+    //redirects.frontends[i].protocols = []
+    //tmp = tmp + '\n"' + protocols[x] + '": [],'
+    redirects[frontends[i]][protocols[x]] = []
+  }
+  //tmp = tmp + "\n},"
+}
+//tmp = tmp + "\n}"
+
+//const redirects = JSON.parse(tmp)
 
 function setRedirects(val) {
   browser.storage.local.get('cloudflareBlackList', r => {
@@ -30,6 +54,7 @@ function setRedirects(val) {
     searxNormalRedirectsChecks = [...redirects.searx.normal];
     searxngNormalRedirectsChecks = [...redirects.searxng.normal];
     whoogleNormalRedirectsChecks = [...redirects.whoogle.normal];
+    librexNormalRedirectsChecks = [...redirects.librex.normal];
     for (const instance of r.cloudflareBlackList) {
       const a = searxNormalRedirectsChecks.indexOf(instance);
       if (a > -1) searxNormalRedirectsChecks.splice(a, 1);
@@ -39,12 +64,16 @@ function setRedirects(val) {
 
       const c = whoogleNormalRedirectsChecks.indexOf(instance);
       if (c > -1) whoogleNormalRedirectsChecks.splice(c, 1);
+
+      const d = librexNormalRedirectsChecks.indexOf(instance);
+      if (c > -1) librexNormalRedirectsChecks.splice(d, 1);
     }
     browser.storage.local.set({
       searchRedirects: redirects,
       searxNormalRedirectsChecks,
       searxngNormalRedirectsChecks,
       whoogleNormalRedirectsChecks,
+      librexNormalRedirectsChecks,
     });
   })
 }
@@ -71,7 +100,13 @@ let
   searxngTorRedirectsChecks,
   searxngTorCustomRedirects,
   searxngI2pRedirectsChecks,
-  searxngI2pCustomRedirects;
+  searxngI2pCustomRedirects,
+  librexNormalRedirectsChecks,
+  librexNormalCustomRedirects,
+  librexTorRedirectsChecks,
+  librexTorCustomRedirects,
+  librexI2pRedirectsChecks,
+  librexI2pCustomRedirects;
 
 function init() {
   return new Promise(async resolve => {
@@ -99,6 +134,12 @@ function init() {
         "searxngTorCustomRedirects",
         "searxngI2pRedirectsChecks",
         "searxngI2pCustomRedirects",
+        "librexNormalRedirectsChecks",
+        "librexNormalCustomRedirects",
+        "librexTorRedirectsChecks",
+        "librexTorCustomRedirects",
+        "librexI2pRedirectsChecks",
+        "librexI2pCustomRedirects"
       ],
       r => {
         disableSearch = r.disableSearch;
@@ -123,6 +164,12 @@ function init() {
         searxngTorCustomRedirects = r.searxngTorCustomRedirects;
         searxngI2pRedirectsChecks = r.searxngI2pRedirectsChecks;
         searxngI2pCustomRedirects = r.searxngI2pCustomRedirects;
+        librexNormalRedirectsChecks = r.librexNormalRedirectsChecks;
+        librexNormalCustomRedirects = r.librexNormalCustomRedirects;
+        librexTorRedirectsChecks = r.librexTorRedirectsChecks;
+        librexTorCustomRedirects = r.librexTorCustomRedirects;
+        librexI2pRedirectsChecks = r.librexI2pRedirectsChecks;
+        librexI2pCustomRedirects = r.librexI2pCustomRedirects;
         resolve();
       }
     )
@@ -307,6 +354,14 @@ function redirect(url, disableOverride) {
     randomInstance = utils.getRandomInstance(instancesList)
     path = "/search";
   }
+  else if (searchFrontend == 'librex') {
+    let instancesList;
+    if (searchProtocol == 'normal') instancesList = [...librexNormalRedirectsChecks, ...librexNormalCustomRedirects];
+    if (searchProtocol == 'tor') instancesList = [...librexTorRedirectsChecks, ...librexTorCustomRedirects];
+    if (searchProtocol == 'i2p') instancesList = [...librexI2pRedirectsChecks, ...librexI2pCustomRedirects];
+    randomInstance = utils.getRandomInstance(instancesList)
+    path = "/search.php";
+  }
 
   if (
     ((url.hostname.includes('google') || url.hostname.includes('bing')) && !url.searchParams.has('q')) ||
@@ -345,6 +400,10 @@ function switchInstance(url, disableOverride) {
       ...searchRedirects.whoogle.tor,
       ...searchRedirects.whoogle.i2p,
 
+      ...searchRedirects.librex.normal,
+      ...searchRedirects.librex.tor,
+      ...searchRedirects.librex.i2p,
+
       ...searxNormalCustomRedirects,
       ...searxTorCustomRedirects,
       ...searxI2pCustomRedirects,
@@ -356,6 +415,10 @@ function switchInstance(url, disableOverride) {
       ...whoogleNormalCustomRedirects,
       ...whoogleTorCustomRedirects,
       ...whoogleI2pCustomRedirects,
+
+      ...librexNormalCustomRedirects,
+      ...librexTorCustomRedirects,
+      ...librexI2pCustomRedirects,
     ].includes(protocolHost)) { resolve(); return; }
 
     let instancesList;
@@ -363,16 +426,19 @@ function switchInstance(url, disableOverride) {
       if (searchFrontend == 'searx') instancesList = [...searxNormalRedirectsChecks, ...searxNormalCustomRedirects];
       else if (searchFrontend == 'searxng') instancesList = [...searxngNormalRedirectsChecks, ...searxngNormalCustomRedirects];
       else if (searchFrontend == 'whoogle') instancesList = [...whoogleNormalRedirectsChecks, ...whoogleNormalCustomRedirects];
+      else if (searchFrontend == 'librex') instancesList = [...librexNormalRedirectsChecks, ...librexNormalCustomRedirects];
     }
     else if (searchProtocol == 'tor') {
       if (searchFrontend == 'searx') instancesList = [...searxTorRedirectsChecks, ...searxTorCustomRedirects];
       else if (searchFrontend == 'searxng') instancesList = [...searxngTorRedirectsChecks, ...searxngTorCustomRedirects];
       else if (searchFrontend == 'whoogle') instancesList = [...whoogleTorRedirectsChecks, ...whoogleTorCustomRedirects];
+      else if (searchFrontend == 'librex') instancesList = [...librexTorRedirectsChecks, ...librexTorCustomRedirects];
     }
     else if (searchProtocol == 'i2p') {
       if (searchFrontend == 'searx') instancesList = [...searxI2pRedirectsChecks, ...searxI2pCustomRedirects];
       else if (searchFrontend == 'searxng') instancesList = [...searxngI2pRedirectsChecks, ...searxngI2pCustomRedirects];
       else if (searchFrontend == 'whoogle') instancesList = [...whoogleI2pRedirectsChecks, ...whoogleI2pCustomRedirects];
+      else if (searchFrontend == 'librex') instancesList = [...librexI2pRedirectsChecks, ...librexI2pCustomRedirects];
     }
 
     const i = instancesList.indexOf(protocolHost);
@@ -388,14 +454,20 @@ function initDefaults() {
   return new Promise(async resolve => {
     fetch('/instances/data.json').then(response => response.text()).then(async data => {
       let dataJson = JSON.parse(data);
+      /*
       redirects.searx = dataJson.searx;
       redirects.searxng = dataJson.searxng;
       redirects.whoogle = dataJson.whoogle;
+      */
+      for (let i = 0; i < frontends.length; i++) {
+        redirects[frontends[i]] = dataJson[frontends[i]]
+      }
 
       browser.storage.local.get('cloudflareBlackList', async r => {
         whoogleNormalRedirectsChecks = [...redirects.whoogle.normal];
         searxNormalRedirectsChecks = [...redirects.searx.normal];
         searxngNormalRedirectsChecks = [...redirects.searxng.normal];
+        librexNormalRedirectsChecks = [...redirects.librex.normal];
         for (const instance of r.cloudflareBlackList) {
           let i;
 
@@ -407,6 +479,9 @@ function initDefaults() {
 
           i = searxngNormalRedirectsChecks.indexOf(instance);
           if (i > -1) searxngNormalRedirectsChecks.splice(i, 1);
+
+          i = librexNormalRedirectsChecks.indexOf(instance);
+          if (i > -1) librexNormalRedirectsChecks.splice(i, 1)
         }
         browser.storage.local.set({
           disableSearch: false,
@@ -424,6 +499,7 @@ function initDefaults() {
           whoogleI2pRedirectsChecks: [...redirects.whoogle.i2p],
           whoogleI2pCustomRedirects: [],
 
+
           searxNormalRedirectsChecks: searxNormalRedirectsChecks,
           searxNormalCustomRedirects: [],
 
@@ -433,6 +509,7 @@ function initDefaults() {
           searxI2pRedirectsChecks: [...redirects.searx.i2p],
           searxI2pCustomRedirects: [],
 
+
           searxngNormalRedirectsChecks: searxngNormalRedirectsChecks,
           searxngNormalCustomRedirects: [],
 
@@ -441,6 +518,16 @@ function initDefaults() {
 
           searxngI2pRedirectsChecks: [...redirects.searxng.i2p],
           searxngI2pCustomRedirects: [],
+
+
+          librexNormalRedirectsChecks: librexNormalRedirectsChecks,
+          librexNormalCustomRedirects: [],
+
+          librexTorRedirectsChecks: librexTorRedirectsChecks,
+          librexTorCustomRedirects: [],
+
+          librexI2pRedirectsChecks: librexI2pRedirectsChecks,
+          librexI2pCustomRedirects: []
         }, () => resolve())
       })
     })
diff --git a/src/pages/options/index.html b/src/pages/options/index.html
index 241a20e7..80c2a039 100644
--- a/src/pages/options/index.html
+++ b/src/pages/options/index.html
@@ -1502,20 +1502,19 @@
             <option value="searxng">SearXNG</option>
             <option value="searx">SearX</option>
             <option value="whoogle">Whoogle</option>
+            <option value="librex">LibreX</option>
           </select>
         </div>
-        <div id="searx-whoogle">
-          <div class="some-block option-block">
-            <h4 data-localise="__MSG_protocol__">Protocol</h4>
-            <select id="search-protocol">
-              <option value="normal" data-localise="__MSG_normal__">Normal</option>
-              <option value="tor" data-localise="__MSG_tor__">Tor</option>
-              <option value="i2p" data-localise="__MSG_i2p__">I2P</option>
-            </select>
-          </div>
+        <div class="some-block option-block">
+          <h4 data-localise="__MSG_protocol__">Protocol</h4>
+          <select id="search-protocol">
+            <option value="normal" data-localise="__MSG_normal__">Normal</option>
+            <option value="tor" data-localise="__MSG_tor__">Tor</option>
+            <option value="i2p" data-localise="__MSG_i2p__">I2P</option>
+          </select>
         </div>
         <div class="some-block">
-          <h4 data-localise="__MSG_searchNote__">Note: To use Search to its full potential, make LibRedirect as the Default Search Engine</h4>
+          <h4 data-localise="__MSG_searchNote__">Note: To use Search, make LibRedirect the Default Search Engine</h4>
         </div>
         <div id="searx">
           <hr>
@@ -1560,7 +1559,7 @@
                         </div>
                         <form class="custom-instance-form">
                           <div class="some-block option-block">
-                            <input class="custom-instance" placeholder="https://searx.onion" type="url">
+                            <input class="custom-instance" placeholder="http://searx.onion" type="url">
                             <button class="add add-instance" type="submit">
                               <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor">
                                 <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path>
@@ -1581,7 +1580,7 @@
                         </div>
                         <form class="custom-instance-form">
                           <div class="some-block option-block">
-                            <input class="custom-instance" placeholder="https://searx.i2p" type="url">
+                            <input class="custom-instance" placeholder="http://searx.i2p" type="url">
                             <button class="add add-instance" type="submit">
                               <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor">
                                 <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path>
@@ -1635,7 +1634,7 @@
                         </div>
                         <form class="custom-instance-form">
                           <div class="some-block option-block">
-                            <input class="custom-instance" placeholder="https://searxng.onion" type="url">
+                            <input class="custom-instance" placeholder="http://searxng.onion" type="url">
                             <button class="add add-instance" type="submit">
                               <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor">
                                 <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path>
@@ -1656,7 +1655,7 @@
                         </div>
                         <form class="custom-instance-form">
                           <div class="some-block option-block">
-                            <input class="custom-instance" placeholder="https://searxng.i2p" type="url">
+                            <input class="custom-instance" placeholder="http://searxng.i2p" type="url">
                             <button class="add add-instance" type="submit">
                               <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor">
                                 <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path>
@@ -1710,7 +1709,82 @@
                         </div>
                         <form class="custom-instance-form">
                           <div class="some-block option-block">
-                            <input class="custom-instance" placeholder="https://whoogle.onion" type="url">
+                            <input class="custom-instance" placeholder="http://whoogle.onion" type="url">
+                            <button class="add add-instance" type="submit">
+                              <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor">
+                                <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path>
+                              </svg>
+                            </button>
+                          </div>
+                        </form>
+                        <div class="checklist custom-checklist"></div>
+          </div>
+          <div class="i2p">
+                        <div class="some-block option-block">
+                          <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4>
+                        </div>
+                        <div class="checklist"></div>
+                        <hr>
+                        <div class="some-block option-block">
+                          <h4 data-localise="__MSG_customInstances__">Custom Instances</h4>
+                        </div>
+                        <form class="custom-instance-form">
+                          <div class="some-block option-block">
+                            <input class="custom-instance" placeholder="http://whoogle.i2p" type="url">
+                            <button class="add add-instance" type="submit">
+                              <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor">
+                                <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path>
+                              </svg>
+                            </button>
+                          </div>
+                        </form>
+                        <div class="checklist custom-checklist"></div>
+          </div>
+        </div>
+        <div id="librex">
+          <hr>
+          <div class="normal">
+                        <div class="some-block option-block">
+                          <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4>
+                        </div>
+                        <div class="checklist"></div>
+                        <hr>
+                        <div class="some-block option-block">
+                          <h4 data-localise="__MSG_customInstances__">Custom Instances</h4>
+                        </div>
+                        <form class="custom-instance-form">
+                          <div class="some-block option-block">
+                            <input class="custom-instance" placeholder="https://librex.com" type="url">
+                            <button class="add add-instance" type="submit">
+                              <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor">
+                                <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path>
+                              </svg>
+                            </button>
+                          </div>
+                        </form>
+                        <div class="checklist custom-checklist"></div>
+                        <div class="buttons buttons-inline">
+                          <label class="button button-inline" id="latency-librex-label" for="latency-librex"> 
+                            <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
+                              <path d="M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"></path>
+                            </svg>&nbsp;
+                            <x data-localise="__MSG_testInstancesLatency__">Test Instances Latency</x>
+                          </label>
+                          <input class="button button-inline" id="latency-librex" style="display:none;">
+                        </div>
+          </div>
+          <div class="tor">
+                        <div class="some-block option-block">
+                          <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4>
+                        </div>
+                        <div class="checklist"></div>
+                        <hr>
+                        <div class="some-block option-block">
+                          <h4 data-localise="__MSG_customInstances__">Custom Instances</h4>
+                        </div>
+                        <form class="custom-instance-form">
+                          <div class="some-block option-block">
+                            <input class="custom-instance" placeholder="http://librex.onion" type="url">
                             <button class="add add-instance" type="submit">
                               <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor">
                                 <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path>
@@ -1731,7 +1805,7 @@
                         </div>
                         <form class="custom-instance-form">
                           <div class="some-block option-block">
-                            <input class="custom-instance" placeholder="https://whoogle.i2p" type="url">
+                            <input class="custom-instance" placeholder="http://librex.i2p" type="url">
                             <button class="add add-instance" type="submit">
                               <svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor">
                                 <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path>
diff --git a/src/pages/options/widgets/search.js b/src/pages/options/widgets/search.js
index 62b8bd78..0af37343 100644
--- a/src/pages/options/widgets/search.js
+++ b/src/pages/options/widgets/search.js
@@ -1,8 +1,39 @@
 import utils from "../../../assets/javascripts/utils.js";
 
+// GOAL: to never mention frontends/protocls outside these two arrays, so that adding a new frontend/protocol is as easy as adding it here.
+// This may be expanded across the whole project, where almost everything becomes a template, and the frontend/protocol parts just become a JSON file.
+
+// ONCE FINISHED: add librex and see if it works
+const frontends = new Array("searx", "searxng", "whoogle", "librex") // Add librex once /javascripts/search.js is made agnostic
+const protocols = new Array("normal", "tor", "i2p")
+//let frontendProtocols = (frontends.length)
+
+// I will leave comments of my privious attemps so that people can learn from my mistakes. :)
+
+/*
+for (let i = 0; i < frontends.length; i++) {
+  this.frontends[i] = frontends[i].getElementsByClassName(protocol)
+}
+*/
+    // There was a class here, but I deleted a bit of it
+    /*
+    this.searxDiv = searxDiv.getElementsByClassName(protocol)[0];
+    this.searxngDiv = searxngDiv.getElementsByClassName(protocol)[0];
+    this.librexDiv = librexDiv.getElementsByClassName(protocol)[0];
+    */
+
+/*
+  * Here I was trying to solve the issue by making a 2D array, but I later realised I was overcomplicating things
+for (var i = 0; i < frontends.length; i++) {
+  frontendProtocols[i] = new Array(protocols.length)
+}
+*/
+
+/*
 const searxDiv = document.getElementById("searx");
 const searxngDiv = document.getElementById("searxng");
 const whoogleDiv = document.getElementById("whoogle");
+*/
 
 const enable = document.getElementById("search-enable");
 const frontend = document.getElementById("search-frontend");
@@ -12,28 +43,69 @@ const search = document.getElementById('search_page');
 
 
 function changeFrontendsSettings() {
-  let SearxWhoogleElement = document.getElementById("searx-whoogle");
+  for (let i = 0; i < frontends.length; i++) {
+    const frontendDiv = document.getElementById(frontends[i])
+    if (frontends[i] == frontend.value) {
+      frontendDiv.style.display = 'block'
+    } else {
+      frontendDiv.style.display = 'none'
+    }
+  }
+
+
+  /*
   if (frontend.value == 'searx') {
     searxDiv.style.display = 'block';
     searxngDiv.style.display = 'none';
     whoogleDiv.style.display = 'none';
-    SearxWhoogleElement.style.display = 'block';
+    librexDiv.style.display = 'none';
   }
   else if (frontend.value == 'searxng') {
     searxDiv.style.display = 'none';
     searxngDiv.style.display = 'block';
     whoogleDiv.style.display = 'none';
-    SearxWhoogleElement.style.display = 'block';
+    librexDiv.style.display = 'none';
   }
   else if (frontend.value == 'whoogle') {
     searxDiv.style.display = 'none';
     searxngDiv.style.display = 'none';
     whoogleDiv.style.display = 'block';
-    SearxWhoogleElement.style.display = 'block';
+    librexDiv.style.display = 'none';
   }
+  else if (frontend.value == 'librex') {
+    searxDiv.style.display = 'none';
+    searxDiv.style.display = 'none';
+    searxngDiv.style.display = 'none';
+    librexDiv.style.display = 'block';
+  }
+  */
 }
 
+
+
 function changeProtocolSettings() {
+
+
+  for (let i = 0; i < frontends.length; i++) {
+    const frontendDiv = document.getElementById(frontends[i])
+    if (frontends[i] == frontend.value) {       // Here we are checking if the frontend matches the current one. This skips the protocol checking for that frontend, speeding things up.
+      for (let x = 0; x < protocols.length; x++) {
+        const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0]
+        if (protocols[x] == protocol.value) { //if the frontend value equals the selected one, it will show. Otherwise, it will be hidden
+          protocolDiv.style.display = 'block'
+        } else {
+          protocolDiv.style.display = 'none'
+        }
+      }
+    } else {
+      continue
+    }
+  }
+
+
+
+/*
+    * "Legacy" code
   const normalsearxDiv = searxDiv.getElementsByClassName("normal")[0];
   const torsearxDiv = searxDiv.getElementsByClassName("tor")[0];
   const i2psearxDiv = searxDiv.getElementsByClassName("i2p")[0];
@@ -42,10 +114,18 @@ function changeProtocolSettings() {
   const torsearxngDiv = searxngDiv.getElementsByClassName("tor")[0];
   const i2psearxngDiv = searxngDiv.getElementsByClassName("i2p")[0];
 
-  const normalwhoogleDiv = whoogleDiv.getElementsByClassName("normal")[0];
   const torwhoogleDiv = whoogleDiv.getElementsByClassName("tor")[0];
   const i2pwhoogleDiv = whoogleDiv.getElementsByClassName("i2p")[0];
+  const normalwhoogleDiv = whoogleDiv.getElementsByClassName("normal")[0];
+
+  
+  function protocolDisplay(proto) {
+    proto.searxngDiv = 'block'
+  }
 
+  protocolDisplay(protocol.value)
+  
+  
   if (protocol.value == 'normal') {
     normalsearxDiv.style.display = 'block';
     normalsearxngDiv.style.display = 'block';
@@ -85,6 +165,7 @@ function changeProtocolSettings() {
     i2psearxngDiv.style.display = 'block';
     i2pwhoogleDiv.style.display = 'block';
   }
+  */
 }
 
 browser.storage.local.get(
@@ -103,6 +184,13 @@ browser.storage.local.get(
   }
 );
 
+for (let i = 0; i < frontends.length; i++) {
+  for (let x = 0; x < protocols.length; x++){
+    utils.processDefaultCustomInstances('search', frontends[i], protocols[x], document)
+  }
+  utils.latency('search', frontends[i], document, location, true)
+}
+
 search.addEventListener("change", () => {
   browser.storage.local.set({
     disableSearch: !enable.checked,
@@ -113,6 +201,8 @@ search.addEventListener("change", () => {
   changeProtocolSettings(protocol.value);
 })
 
+/*
+  * more "legacy" code
 utils.processDefaultCustomInstances('search', 'searx', 'normal', document);
 utils.processDefaultCustomInstances('search', 'searx', 'tor', document);
 utils.processDefaultCustomInstances('search', 'searx', 'i2p', document);
@@ -126,3 +216,4 @@ utils.processDefaultCustomInstances('search', 'whoogle', 'i2p', document);
 utils.latency('search', 'searx', document, location, true)
 utils.latency('search', 'searxng', document, location, true)
 utils.latency('search', 'whoogle', document, location, true)
+*/
diff --git a/src/pages/options/widgets/search.pug b/src/pages/options/widgets/search.pug
index 7e16e74f..ec075f79 100644
--- a/src/pages/options/widgets/search.pug
+++ b/src/pages/options/widgets/search.pug
@@ -13,17 +13,17 @@ section#search_page.option-block
             option(value="searxng") SearXNG
             option(value="searx") SearX
             option(value="whoogle") Whoogle
+            option(value="librex") LibreX
 
-    #searx-whoogle
-        .some-block.option-block
-            h4(data-localise="__MSG_protocol__") Protocol
-            select#search-protocol
-                option(value="normal" data-localise="__MSG_normal__") Normal
-                option(value="tor" data-localise="__MSG_tor__") Tor
-                option(value="i2p" data-localise="__MSG_i2p__") I2P
+    .some-block.option-block
+        h4(data-localise="__MSG_protocol__") Protocol
+        select#search-protocol
+            option(value="normal" data-localise="__MSG_normal__") Normal
+            option(value="tor" data-localise="__MSG_tor__") Tor
+            option(value="i2p" data-localise="__MSG_i2p__") I2P
 
     .some-block
-        h4(data-localise="__MSG_searchNote__") Note: To use Search to its full potential, make LibRedirect as the Default Search Engine
+        h4(data-localise="__MSG_searchNote__") Note: To use Search, make LibRedirect the Default Search Engine
 
     #searx
         hr
@@ -34,10 +34,10 @@ section#search_page.option-block
             +latency('searx')
         .tor
             include ../../widgets/instances.pug
-            +instances('https://searx.onion')
+            +instances('http://searx.onion')
         .i2p
             include ../../widgets/instances.pug
-            +instances('https://searx.i2p')
+            +instances('http://searx.i2p')
 
     #searxng
         hr
@@ -47,10 +47,10 @@ section#search_page.option-block
             +latency('searxng')
         .tor
             include ../../widgets/instances.pug
-            +instances('https://searxng.onion')
+            +instances('http://searxng.onion')
         .i2p
             include ../../widgets/instances.pug
-            +instances('https://searxng.i2p')
+            +instances('http://searxng.i2p')
 
     #whoogle
         hr
@@ -60,9 +60,22 @@ section#search_page.option-block
             +latency('whoogle')
         .tor
             include ../../widgets/instances.pug
-            +instances('https://whoogle.onion')
+            +instances('http://whoogle.onion')
+        .i2p
+            include ../../widgets/instances.pug
+            +instances('http://whoogle.i2p')
+
+    #librex
+        hr
+        .normal
+            include ../../widgets/instances.pug
+            +instances('https://librex.com')
+            +latency('librex')
+        .tor
+            include ../../widgets/instances.pug
+            +instances('http://librex.onion')
         .i2p
             include ../../widgets/instances.pug
-            +instances('https://whoogle.i2p')
+            +instances('http://librex.i2p')
 
-    script(type="module" src="./widgets/search.js")
\ No newline at end of file
+    script(type="module" src="./widgets/search.js")