new-tab: Redirect gemini:// zu Web-Proxy
authorMalte Bublitz <malte@rolltreppe3.de>
Mon, 3 Oct 2022 03:36:07 +0000 (05:36 +0200)
committerMalte Bublitz <malte@rolltreppe3.de>
Mon, 3 Oct 2022 03:36:07 +0000 (05:36 +0200)
js/new-tab.js

index 4085108c10a4a26575169ce63f41d518597a257f..27a277b2c798c479cc45ccc1c6fed0e27c6e59ca 100644 (file)
@@ -34,9 +34,12 @@ window.onload = function() {
         */
        document.querySelector("#search form").addEventListener('submit', (event) => {
                if (document.querySelector("input[type=search]").value.startsWith("http://") || document.querySelector("input[type=search]").value.startsWith("https://")) {
-                       console.info('location.href = document.querySelector("input[type=search]").value;')
+                       console.debug('location.href = document.querySelector("input[type=search]").value;')
                        location.href = document.querySelector("input[type=search]").value;
                        event.preventDefault();
+               } elseif (document.querySelector("input[type=search]").value.startsWith("gemini://")) {
+                       console.debug("Redirecting to Gemini Proxy…");
+                       location.href = 'https://portal.mozz.us/gemini/' + document.querySelector("input[type=search]").value.replace("gemini://", "https://portal.mozz.us/gemini/");
                }
        });
 };