mirror of
https://github.com/hnhx/librex.git
synced 2025-01-26 10:43:05 -03:00
fixed some inconsistency in the css, added disable frontends option, made the codebase cleaner
This commit is contained in:
parent
95811de0f9
commit
2f0656012c
9 changed files with 51 additions and 75 deletions
10
README.md
10
README.md
|
@ -39,8 +39,8 @@ git clone https://git.beparanoid.de/librex
|
||||||
```
|
```
|
||||||
### LibreX compared to other metasearch engines
|
### LibreX compared to other metasearch engines
|
||||||
|
|
||||||
| Metasearch engine | Works without JS | Privacy frontend redirect | Torrent results |
|
| Metasearch engine | Works without JS | Privacy frontend redirect | Torrent results | API |
|
||||||
|-|-|-|-|
|
|-|-|-|-|-|
|
||||||
| LibreX | ✅ | ✅ | ✅ |
|
| LibreX | ✅ | ✅ | ✅ | ✅ |
|
||||||
| SearXNG | ✅ | ❓ Only host can set it | ✅ |
|
| SearXNG | ❓ Not user friendly | ❓ Only host can set it | ✅ | ✅ |
|
||||||
| Whoogle | ✅ | ❓ Only host can set it | ❌ |
|
| Whoogle | ✅ | ❓ Only host can set it | ❌ | ❌ |
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
while true; do
|
|
||||||
git stash
|
|
||||||
git pull
|
|
||||||
sleep 60
|
|
||||||
done
|
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
// CURLOPT_PROXYTYPE => CURLPROXY_HTTP,
|
// CURLOPT_PROXYTYPE => CURLPROXY_HTTP,
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_ENCODING => "",
|
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_IPRESOLVE => CURL_IPRESOLVE_V4,
|
||||||
CURLOPT_CUSTOMREQUEST => "GET",
|
CURLOPT_CUSTOMREQUEST => "GET",
|
||||||
CURLOPT_PROTOCOLS => CURLPROTO_HTTPS | CURLPROTO_HTTP,
|
CURLOPT_PROTOCOLS => CURLPROTO_HTTPS | CURLPROTO_HTTP,
|
||||||
|
|
|
@ -11,7 +11,9 @@
|
||||||
$base_url_main_split = explode(".", strrev($base_url));
|
$base_url_main_split = explode(".", strrev($base_url));
|
||||||
$base_url_main = strrev($base_url_main_split[1]) . "." . strrev($base_url_main_split[0]);
|
$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 = $url;
|
||||||
$image_src = request($image);
|
$image_src = request($image);
|
||||||
|
|
|
@ -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
|
|
|
@ -25,6 +25,9 @@
|
||||||
$frontend .= "/u";
|
$frontend .= "/u";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty(trim($frontend)))
|
||||||
|
return $url;
|
||||||
|
|
||||||
$url = $frontend . explode($original, $url)[1];
|
$url = $frontend . explode($original, $url)[1];
|
||||||
|
|
||||||
return $url;
|
return $url;
|
||||||
|
@ -35,6 +38,9 @@
|
||||||
|
|
||||||
function check_for_privacy_frontend($url)
|
function check_for_privacy_frontend($url)
|
||||||
{
|
{
|
||||||
|
if (isset($_COOKIE["disable_frontends"]))
|
||||||
|
return $url;
|
||||||
|
|
||||||
$frontends = array(
|
$frontends = array(
|
||||||
"youtube.com" => "invidious",
|
"youtube.com" => "invidious",
|
||||||
"instagram.com" => "bibliogram",
|
"instagram.com" => "bibliogram",
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form class="sub-search-container" method="get" autocomplete="off">
|
<form class="sub-search-container" method="get" autocomplete="off">
|
||||||
<h1 class="logomobile"><a class="noDecoration" href="./">Libre<span class="X">X</span></a></h1>
|
<h1 class="logomobile"><a class="no-decoration" href="./">Libre<span class="X">X</span></a></h1>
|
||||||
<input type="text" name="q"
|
<input type="text" name="q"
|
||||||
<?php
|
<?php
|
||||||
$query_encoded = urlencode($query);
|
$query_encoded = urlencode($query);
|
||||||
|
@ -48,7 +48,9 @@
|
||||||
switch ($type)
|
switch ($type)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
if (substr($query, 0, 1) == "!" || substr(end(explode(" ", $query)), 0, 1) == "!")
|
$query_parts = explode(" ", $query);
|
||||||
|
$last_word_query = end($query_parts);
|
||||||
|
if (substr($query, 0, 1) == "!" || substr($last_word_query, 0, 1) == "!")
|
||||||
check_ddg_bang($query);
|
check_ddg_bang($query);
|
||||||
require "engines/google/text.php";
|
require "engines/google/text.php";
|
||||||
$results = get_text_results($query, $page);
|
$results = get_text_results($query, $page);
|
||||||
|
|
35
settings.php
35
settings.php
|
@ -15,30 +15,17 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function better_setcookie($name)
|
|
||||||
{
|
|
||||||
if (!empty($_REQUEST[$name]))
|
|
||||||
{
|
|
||||||
setcookie($name, $_REQUEST[$name], time() + (86400 * 90), '/');
|
|
||||||
$_COOKIE[$name] = $_REQUEST[$name];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_REQUEST["save"]))
|
if (isset($_REQUEST["save"]))
|
||||||
{
|
{
|
||||||
|
foreach($_POST as $key=>$value){
|
||||||
better_setcookie("theme");
|
if (!empty($value))
|
||||||
|
{
|
||||||
better_setcookie("disable_special");
|
setcookie($key, $value, time() + (86400 * 90), '/');
|
||||||
|
$_COOKIE[$name] = $value;
|
||||||
better_setcookie("invidious");
|
}
|
||||||
better_setcookie("bibliogram");
|
}
|
||||||
better_setcookie("nitter");
|
|
||||||
better_setcookie("libreddit");
|
|
||||||
better_setcookie("proxitok");
|
|
||||||
better_setcookie("wikiless");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST["save"]) || isset($_REQUEST["reset"]))
|
if (isset($_REQUEST["save"]) || isset($_REQUEST["reset"]))
|
||||||
|
@ -129,6 +116,10 @@
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<label>Disable frontends</label>
|
||||||
|
<input type="checkbox" name="disable_frontends" <?php echo isset($_COOKIE["disable_frontends"]) ? "checked" : ""; ?> >
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button type="submit" name="save" value="1">Save</button>
|
<button type="submit" name="save" value="1">Save</button>
|
||||||
<button type="submit" name="reset" value="1">Reset</button>
|
<button type="submit" name="reset" value="1">Reset</button>
|
||||||
|
|
|
@ -101,12 +101,12 @@ a:hover,
|
||||||
left: 20px;
|
left: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.noDecoration {
|
.no-decoration {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: var(--main-fg);
|
color: var(--main-fg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.noDecoration:hover {
|
.no-decoration:hover {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,6 +144,7 @@ a:hover,
|
||||||
width: 450px;
|
width: 450px;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
|
margin-bottom: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.misc-container div {
|
.misc-container div {
|
||||||
|
@ -198,14 +199,6 @@ a:hover,
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media only screen and (max-width: 1320px) {
|
|
||||||
.special-result-container {
|
|
||||||
position: relative;
|
|
||||||
float: none;
|
|
||||||
margin-left: 165px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-result-wrapper {
|
.text-result-wrapper {
|
||||||
max-width: 550px;
|
max-width: 550px;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
|
@ -327,8 +320,24 @@ a:hover,
|
||||||
color: #ff79c6;
|
color: #ff79c6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 1320px) {
|
||||||
|
.special-result-container {
|
||||||
|
position: relative;
|
||||||
|
float: none;
|
||||||
|
margin-left: 165px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* mobile view */
|
/* mobile view */
|
||||||
@media only screen and (max-width: 750px) {
|
@media only screen and (max-width: 750px) {
|
||||||
|
p {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
.search-container input {
|
.search-container input {
|
||||||
width: 80%;
|
width: 80%;
|
||||||
}
|
}
|
||||||
|
@ -439,14 +448,6 @@ a:hover,
|
||||||
margin-top: 10%;
|
margin-top: 10%;
|
||||||
}
|
}
|
||||||
|
|
||||||
p {
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
html {
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-result-container,
|
.text-result-container,
|
||||||
#time,
|
#time,
|
||||||
.next-page-button-wrapper {
|
.next-page-button-wrapper {
|
||||||
|
|
Loading…
Add table
Reference in a new issue