From 2f0656012cdd91c9f4daa274319355441f4887ca Mon Sep 17 00:00:00 2001 From: hnhx Date: Fri, 16 Sep 2022 10:23:57 +0200 Subject: [PATCH] fixed some inconsistency in the css, added disable frontends option, made the codebase cleaner --- README.md | 10 +++++----- auto_updater.sh | 7 ------- config.php.example | 2 +- image_proxy.php | 4 +++- librex_updater.service | 19 ------------------- misc/tools.php | 6 ++++++ search.php | 6 ++++-- settings.php | 35 +++++++++++++---------------------- static/css/styles.css | 37 +++++++++++++++++++------------------ 9 files changed, 51 insertions(+), 75 deletions(-) delete mode 100755 auto_updater.sh delete mode 100644 librex_updater.service diff --git a/README.md b/README.md index 338a4cc..5b9c2b6 100644 --- a/README.md +++ b/README.md @@ -39,8 +39,8 @@ git clone https://git.beparanoid.de/librex ``` ### LibreX compared to other metasearch engines -| Metasearch engine | Works without JS | Privacy frontend redirect | Torrent results | -|-|-|-|-| -| LibreX | ✅ | ✅ | ✅ | -| SearXNG | ✅ | ❓ Only host can set it | ✅ | -| Whoogle | ✅ | ❓ Only host can set it | ❌ | +| Metasearch engine | Works without JS | Privacy frontend redirect | Torrent results | API | +|-|-|-|-|-| +| LibreX | ✅ | ✅ | ✅ | ✅ | +| SearXNG | ❓ Not user friendly | ❓ Only host can set it | ✅ | ✅ | +| Whoogle | ✅ | ❓ Only host can set it | ❌ | ❌ | diff --git a/auto_updater.sh b/auto_updater.sh deleted file mode 100755 index b0458f8..0000000 --- a/auto_updater.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -while true; do - git stash - git pull - sleep 60 -done - diff --git a/config.php.example b/config.php.example index 5d90e18..c43bb25 100644 --- a/config.php.example +++ b/config.php.example @@ -39,7 +39,7 @@ // CURLOPT_PROXYTYPE => CURLPROXY_HTTP, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", - CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36", + CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36", CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_PROTOCOLS => CURLPROTO_HTTPS | CURLPROTO_HTTP, diff --git a/image_proxy.php b/image_proxy.php index 9521952..4f0a8d4 100644 --- a/image_proxy.php +++ b/image_proxy.php @@ -11,7 +11,9 @@ $base_url_main_split = explode(".", strrev($base_url)); $base_url_main = strrev($base_url_main_split[1]) . "." . strrev($base_url_main_split[0]); - if ($base_url_main == "qwant.com" || $base_url_main == "wikimedia.org" || $base_url_main == "brave.com") + $allowed_domains = array("qwant.com", "wikimedia.org", "brave.com"); + + if (in_array($base_url_main, $allowed_domains)) { $image = $url; $image_src = request($image); diff --git a/librex_updater.service b/librex_updater.service deleted file mode 100644 index 50196f1..0000000 --- a/librex_updater.service +++ /dev/null @@ -1,19 +0,0 @@ -[Unit] -Description=LibreX - A privacy respecting free as in freedom meta search engine -After=syslog.target -After=network.target - -[Service] -RestartSec=10s -Type=simple - -User=librex -Group=librex - -WorkingDirectory=/path/to/librex -ExecStart=/path/to/librex/auto_updater.sh - -Restart=always - -[Install] -WantedBy=multi-user.target diff --git a/misc/tools.php b/misc/tools.php index b2ca595..6811697 100644 --- a/misc/tools.php +++ b/misc/tools.php @@ -25,6 +25,9 @@ $frontend .= "/u"; } + if (empty(trim($frontend))) + return $url; + $url = $frontend . explode($original, $url)[1]; return $url; @@ -35,6 +38,9 @@ function check_for_privacy_frontend($url) { + if (isset($_COOKIE["disable_frontends"])) + return $url; + $frontends = array( "youtube.com" => "invidious", "instagram.com" => "bibliogram", diff --git a/search.php b/search.php index 830f626..0596614 100644 --- a/search.php +++ b/search.php @@ -8,7 +8,7 @@
-

LibreX

+

LibreX

$value){ + if (!empty($value)) + { + setcookie($key, $value, time() + (86400 * 90), '/'); + $_COOKIE[$name] = $value; + } + } } if (isset($_REQUEST["save"]) || isset($_REQUEST["reset"])) @@ -129,6 +116,10 @@ > +
+ + > +
diff --git a/static/css/styles.css b/static/css/styles.css index 1f8a41e..4b393e2 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -101,12 +101,12 @@ a:hover, left: 20px; } -.noDecoration { +.no-decoration { text-decoration: none; color: var(--main-fg); } -.noDecoration:hover { +.no-decoration:hover { text-decoration: none; } @@ -144,6 +144,7 @@ a:hover, width: 450px; margin-left: auto; margin-right: auto; + margin-bottom: 100px; } .misc-container div { @@ -198,14 +199,6 @@ a:hover, position: absolute; } -@media only screen and (max-width: 1320px) { - .special-result-container { - position: relative; - float: none; - margin-left: 165px; - } -} - .text-result-wrapper { max-width: 550px; word-wrap: break-word; @@ -327,8 +320,24 @@ a:hover, color: #ff79c6; } +@media only screen and (max-width: 1320px) { + .special-result-container { + position: relative; + float: none; + margin-left: 165px; + } +} + /* mobile view */ @media only screen and (max-width: 750px) { + p { + font-size: 16px; + } + + html { + font-size: 14px; + } + .search-container input { width: 80%; } @@ -439,14 +448,6 @@ a:hover, margin-top: 10%; } - p { - font-size: 16px; - } - - html { - font-size: 14px; - } - .text-result-container, #time, .next-page-button-wrapper {