diff options
author | ManeraKai <manerakai@protonmail.com> | 2022-11-21 06:12:40 +0300 |
---|---|---|
committer | ManeraKai <manerakai@protonmail.com> | 2022-11-21 06:12:40 +0300 |
commit | 5296d833286e7bf75ca3c3cbc85113ca80b3e53e (patch) | |
tree | a84ecccacf1f0f107ab13ff355f1c8bdab5543e1 /src/pages | |
parent | updated instances (diff) | |
parent | Fixed Bypass not working https://github.com/libredirect/libredirect/issues/475 (diff) | |
download | libredirect-5296d833286e7bf75ca3c3cbc85113ca80b3e53e.zip |
Merge https://github.com/libredirect/libredirect
Diffstat (limited to 'src/pages')
-rw-r--r-- | src/pages/background/background.js | 1 | ||||
-rw-r--r-- | src/pages/options/widgets/about.ejs | 59 | ||||
-rw-r--r-- | src/pages/options/widgets/general.ejs | 73 | ||||
-rw-r--r-- | src/pages/options/widgets/services.ejs | 55 | ||||
-rw-r--r-- | src/pages/options/widgets/services.js | 34 | ||||
-rw-r--r-- | src/pages/stylesheets/styles.css | 17 |
6 files changed, 128 insertions, 111 deletions
diff --git a/src/pages/background/background.js b/src/pages/background/background.js index 71fff06c..3a695048 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -56,7 +56,6 @@ browser.webRequest.onBeforeRequest.addListener( } catch { return null } - if (tabIdRedirects[details.tabId] == false) return null let newUrl = servicesHelper.redirect(url, details.type, initiator, tabIdRedirects[details.tabId]) diff --git a/src/pages/options/widgets/about.ejs b/src/pages/options/widgets/about.ejs index 09cdab1d..a90e8b9e 100644 --- a/src/pages/options/widgets/about.ejs +++ b/src/pages/options/widgets/about.ejs @@ -1,28 +1,37 @@ -<section class="option-block" id="about_page"> -<div class="some-block option-block"> - <h1 data-localise="__MSG_about__">About</h1> -</div> -<hr> -<div class="about"> +<section class="option-block" id="about_page"> + <div class="some-block option-block"> - <h4>Donate: ♥️</h4> - <h4><a href='https://libredirect.codeberg.page/donate'>https://libredirect.codeberg.page/donate</a> </h4> + <h1 data-localise="__MSG_about__">About</h1> </div> - <div class="some-block option-block"> - <h4>FAQ:</h4> - <h4><a href='https://libredirect.codeberg.page/faq'>https://libredirect.codeberg.page/faq</a></h4> - </div> - <div class="some-block option-block"> - <h4>Docs:</h4> - <h4><a href='https://libredirect.codeberg.page/docs'>https://libredirect.codeberg.page/docs</a></h4> - </div> - <div class="some-block option-block"> - <h4>Source Code:</h4> - <h4><a href='https://libredirect.codeberg.page/source_code'>https://libredirect.codeberg.page/source_code</a></h4> - </div> - <div class="some-block option-block"> - <h4>Forked from:</h4> - <h4><a href="https://github.com/SimonBrazell/privacy-redirect">Privacy Redirect</a></h4> + + <hr> + + <div class="about"> + + <div class="some-block option-block"> + <h4>Donate: ♥️</h4> + <h4><a href='https://libredirect.codeberg.page/donate'>https://libredirect.codeberg.page/donate</a> </h4> + </div> + + <div class="some-block option-block"> + <h4>FAQ:</h4> + <h4><a href='https://libredirect.codeberg.page/faq'>https://libredirect.codeberg.page/faq</a></h4> + </div> + + <div class="some-block option-block"> + <h4>Docs:</h4> + <h4><a href='https://libredirect.codeberg.page/docs'>https://libredirect.codeberg.page/docs</a></h4> + </div> + + <div class="some-block option-block"> + <h4>Source Code:</h4> + <h4><a href='https://libredirect.codeberg.page/source_code'>https://libredirect.codeberg.page/source_code</a></h4> + </div> + + <div class="some-block option-block"> + <h4>Forked from:</h4> + <h4><a href="https://github.com/SimonBrazell/privacy-redirect">Privacy Redirect</a></h4> + </div> + </div> -</div> -</section> +</section> \ No newline at end of file diff --git a/src/pages/options/widgets/general.ejs b/src/pages/options/widgets/general.ejs index e24046db..fef052df 100644 --- a/src/pages/options/widgets/general.ejs +++ b/src/pages/options/widgets/general.ejs @@ -2,7 +2,8 @@ <div class="some-block option-block"> <h1 data-localise="__MSG_general__">General</h1> </div> - <hr> + <hr /> + <div class="some-block option-block"> <h4 data-localise="__MSG_theme__">Theme</h4> <select id="theme"> @@ -11,38 +12,46 @@ <option value="dark" data-localise="__MSG_dark__">Dark</option> </select> </div> + <div class="some-block option-block"> <h4 data-localise="__MSG_network__">Network</h4> <select id="network"> <% for (const network in config.networks) { -%> -<option value="<%= network %>"><%= config.networks[network].name %></option> + <option value="<%= network %>"><%= config.networks[network].name %></option> <% }; %> -</select> + </select> </div> + <div id="network-fallback"> <div class="some-block option-block"> <h4 data-localise="__MSG_networkFallback__">Fallback to clearnet if no instances are available for the current network</h4> - <input id="network-fallback-checkbox" type="checkbox"> + <input id="network-fallback-checkbox" type="checkbox" /> </div> </div> + <div class="some-block option-block"> <h4 data-localise="__MSG_autoRedirect__"></h4> - <input id="auto-redirect" type="checkbox"> + <input id="auto-redirect" type="checkbox" /> </div> + <form> <div class="some-block option-block"> <h4 data-localise="__MSG_latencyThreshold">Latency Threshold</h4> <output id="latency-output" for="latencyInput" name="latencyOutput"></output> - <input id="latency-input" type="range" min="50" max="5000" value="1000" name="latencyInput" step="50"> + <input id="latency-input" type="range" min="50" max="5000" value="1000" name="latencyInput" step="50" /> </div> </form> + + <hr> + <div class="some-block option-block"> - <h4 data-localise="__MSG_exceptions__"></h4> + <h4 data-localise="__MSG_exclude_from_redirecting_">Excluded from redirecting</h4> </div> + <form id="custom-exceptions-instance-form"> <div class="some-block option-block"> - <div class="some-block" style="padding:0;"> - <input id="exceptions-custom-instance" placeholder="https://www.google.com" type="url"> + <div class="some-block" style="padding: 0"> + <input id="exceptions-custom-instance" placeholder="https://www.google.com" type="url" /> <select id="exceptions-custom-instance-type"> <option value="url">URL</option> <option value="regex">Regex</option> @@ -55,48 +64,38 @@ </button> </div> </form> + + <hr> + <div class="checklist" id="exceptions-custom-checklist"></div> - <div class="buttons buttons-inline"><a class="button button-inline" id="update-instances"> + + <div class="buttons buttons-inline"> + <a class="button button-inline" id="update-instances"> <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> <path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"></path> </svg> - <x data-localise="__MSG_updateInstances__">Update Instances</x></a> </div> - <div class="buttons buttons-inline"> - <label class="button button-inline" id="import_settings_text" for="import-settings"> + <x data-localise="__MSG_updateInstances__">Update Instances</x> + </a> + </div> + + <div class="buttons buttons-inline"> + <label class="button button-inline" id="import_settings_text" for="import-settings"> <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> <x data-localise="__MSG_importSettings__">Import Settings</x> </label> - <input class="button button-inline" id="import-settings" type="file" style="display:none;"> <a class="button button-inline" id="export-settings"> + <input class="button button-inline" id="import-settings" type="file" style="display: none" /> <a class="button button-inline" id="export-settings"> <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> <path d="M10.09 15.59L11.5 17l5-5-5-5-1.41 1.41L12.67 11H3v2h9.67l-2.58 2.59zM19 3H5c-1.11 0-2 .9-2 2v4h2V5h14v14H5v-4H3v4c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"></path> - </svg> - <x data-localise="__MSG_exportSettings__">Export Settings</x></a> <a class="button button-inline" id="reset-settings"> + </svg> <x data-localise="__MSG_exportSettings__">Export Settings</x></a> <a class="button button-inline" id="reset-settings"> <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> <path d="M12,5V2L8,6l4,4V7c3.31,0,6,2.69,6,6c0,2.97-2.17,5.43-5,5.91v2.02c3.95-0.49,7-3.85,7-7.93C20,8.58,16.42,5,12,5z"></path> <path d="M6,13c0-1.65,0.67-3.15,1.76-4.24L6.34,7.34C4.9,8.79,4,10.79,4,13c0,4.08,3.05,7.44,7,7.93v-2.02 C8.17,18.43,6,15.97,6,13z"></path> </svg> - <x data-localise="__MSG_resetSettings__">Reset Settings</x></a> + <x data-localise="__MSG_resetSettings__">Reset Settings</x> + </a> </div> - <hr> - <div class="some-block option-block"> - <h4 data-localise="__MSG_customPopup__">Customize Popup</h4> - </div> - <div class="checklist-popup" id="popup-frontends-checklist"> - <% for (const service in config.services) { -%> -<div> - <div> - <% if (config.services[service].imageType != "svgMono") { _%> - <img src="../../../assets/images/<%= service %>-icon.<%= config.services[service].imageType %>"> - <% } else { _%> - <%- include ('src/assets/images/' + service + '-icon.svg') %> - <% } _%> - <label data-localise="__MSG_<%= service %>__" for="<%= service %>"><%= config.services[service].name %></label> - </div> - <input id="<%= service %>" type="checkbox"> - </div> - <% }; %> -</div> + <script type="module" src="./widgets/general.js"></script> -</section> +</section> \ No newline at end of file diff --git a/src/pages/options/widgets/services.ejs b/src/pages/options/widgets/services.ejs index 44c6a9f3..109f6689 100644 --- a/src/pages/options/widgets/services.ejs +++ b/src/pages/options/widgets/services.ejs @@ -3,12 +3,16 @@ <div class="some-block option-block"> <h1 data-localise="__MSG_<%= service %>__"><%= config.services[service].name %></h1> </div> - <hr> + <hr /> <div class="some-block option-block"> <h4 data-localise="__MSG_enable__">Enable</h4> - <input id="<%= service %>-enabled" type="checkbox"> + <input id="<%= service %>-enabled" type="checkbox" /> </div> - <% if (Object.keys(config.services[service].frontends).length > 1) { %> + <div class="some-block option-block"> + <h4 data-localise="__MSG_show_in_popup__">Show in Popup</h4> + <input id="<%= service %>" type="checkbox" /> + </div> + <% if (Object.keys(config.services[service].frontends).length> 1) { %> <div class="some-block option-block"> <h4 data-localise="__MSG_frontend__">Frontend</h4> <select id="<%= service %>-frontend"> @@ -21,16 +25,12 @@ <div class="some-block option-block"> <h4 data-localise="__MSG_embed_frontend__">Embed Frontend</h4> <select id="<%= service %>-embedFrontend"> - <% for (const frontend in config.services[service].frontends) { -%> - <% if (config.services[service].frontends[frontend].embeddable) { _%> + <% for (const frontend in config.services[service].frontends) { -%> <% if (config.services[service].frontends[frontend].embeddable) { _%> <option value="<%= frontend %>"><%= config.services[service].frontends[frontend].name %></option> - <% } _%> - <% } %> + <% } _%> <% } %> </select> </div> - <% } _%> - <% } _%> - <% if (config.services[service].embeddable) { _%> + <% } _%> <% } _%> <% if (config.services[service].embeddable) { _%> <div class="some-block option-block"> <h4 data-localise="__MSG_redirectType__">Redirect Type</h4> <select id="<%= service %>-redirectType"> @@ -40,23 +40,32 @@ </select> </div> <% } _%> - <hr> - <% for (const frontend in config.services[service].frontends) { -%> - <% if (config.services[service].frontends[frontend].instanceList) { _%> + <hr /> + <% for (const frontend in config.services[service].frontends) { -%> <% if (config.services[service].frontends[frontend].instanceList) { _%> <div id="<%= frontend %>"> <% for (const network in config.networks) { -%> + <div class="buttons buttons-inline"> + <label class="button button-inline" id="latency-<%= frontend %>-label" for="latency-<%= frontend %>"> + <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> + + <x data-localise="__MSG_testInstancesLatency__">Test Instances Latency</x> + </label> + <input class="button button-inline" id="latency-<%= frontend %>" style="display: none" /> + </div> <div class="<%= network %>"> <div class="some-block option-block"> <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4> </div> <div class="checklist"></div> - <hr> + <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://<%= frontend %>.<%= config.networks[network].tld %>" type="url"> + <input class="custom-instance" placeholder="http://<%= frontend %>.<%= config.networks[network].tld %>" 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> @@ -65,22 +74,12 @@ </div> </form> <div class="checklist custom-checklist"></div> - <% if (network == "clearnet") { _%> - <div class="buttons buttons-inline"> - <label class="button button-inline" id="latency-<%= frontend %>-label" for="latency-<%= frontend %>"> - <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> - <x data-localise="__MSG_testInstancesLatency__">Test Instances Latency</x> - </label> - <input class="button button-inline" id="latency-<%= frontend %>" style="display:none;"> - </div> + <% if (network=="clearnet" ) { _%> <% } _%> </div> <% } %> </div> - <% } _%> - <% } %> + <% } _%> <% } %> </section> <% } %> -<script type="module" src="./widgets/services.js"></script> +<script type="module" src="./widgets/services.js"></script> \ No newline at end of file diff --git a/src/pages/options/widgets/services.js b/src/pages/options/widgets/services.js index 37385faa..12904130 100644 --- a/src/pages/options/widgets/services.js +++ b/src/pages/options/widgets/services.js @@ -31,28 +31,32 @@ function changeFrontendsSettings(service) { for (const frontend in config.services[service].frontends) { if (config.services[service].frontends[frontend].instanceList) { const frontendDiv = document.getElementById(frontend) - if (frontend == divs[service].frontend.value) { - frontendDiv.style.display = "block" - } else { - frontendDiv.style.display = "none" + if (typeof divs[service].frontend !== "undefined") { + if (frontend == divs[service].frontend.value) { + frontendDiv.style.display = "block" + } else { + frontendDiv.style.display = "none" + } } } } if (config.services[service].embeddable) { - if (!config.services[service].frontends[divs[service].frontend.value].embeddable) { - divs[service].embedFrontend.disabled = false - for (const frontend in config.services[service].frontends) { - if (config.services[service].frontends[frontend].embeddable) { - const frontendDiv = document.getElementById(frontend) - if (frontend == divs[service].embedFrontend.value) { - frontendDiv.style.display = "block" - } else { - frontendDiv.style.display = "none" + if (typeof divs[service].frontend !== "undefined") { + if (!config.services[service].frontends[divs[service].frontend.value].embeddable) { + divs[service].embedFrontend.disabled = false + for (const frontend in config.services[service].frontends) { + if (config.services[service].frontends[frontend].embeddable) { + const frontendDiv = document.getElementById(frontend) + if (frontend == divs[service].embedFrontend.value) { + frontendDiv.style.display = "block" + } else { + frontendDiv.style.display = "none" + } } } - } - } else if (Object.keys(config.services[service].frontends).length > 1) divs[service].embedFrontend.disabled = true + } else if (Object.keys(config.services[service].frontends).length > 1) divs[service].embedFrontend.disabled = true + } } } diff --git a/src/pages/stylesheets/styles.css b/src/pages/stylesheets/styles.css index 0df2f9fa..5f2871e4 100644 --- a/src/pages/stylesheets/styles.css +++ b/src/pages/stylesheets/styles.css @@ -79,7 +79,6 @@ select { margin: 0; max-width: 500px; border-radius: 3px; - cursor: pointer; } input[type="url"], @@ -110,11 +109,19 @@ section.option-block h2 { body.option { display: flex; padding: 40px; - width: 900px; + width: 1100px; +} + +section.links { + display: flex; + flex-wrap: wrap; + flex-direction: column; + width: 300px; + max-height: 720px; } section.links div { - margin: 20px 0; + margin: 10px; width: max-content; } @@ -458,7 +465,7 @@ body div section { display: none; } -div.about > div { +div.about>div { justify-content: start; width: 520px; } @@ -480,4 +487,4 @@ input:disabled { div.about a { width: 500px; display: inline-block; -} +} \ No newline at end of file |