mirror of
https://github.com/hnhx/librex.git
synced 2025-01-25 02:03:04 -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
|
||||
|
||||
| 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 | ❌ | ❌ |
|
||||
|
|
|
@ -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_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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
||||
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",
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<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"
|
||||
<?php
|
||||
$query_encoded = urlencode($query);
|
||||
|
@ -48,7 +48,9 @@
|
|||
switch ($type)
|
||||
{
|
||||
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);
|
||||
require "engines/google/text.php";
|
||||
$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"]))
|
||||
{
|
||||
|
||||
better_setcookie("theme");
|
||||
|
||||
better_setcookie("disable_special");
|
||||
|
||||
better_setcookie("invidious");
|
||||
better_setcookie("bibliogram");
|
||||
better_setcookie("nitter");
|
||||
better_setcookie("libreddit");
|
||||
better_setcookie("proxitok");
|
||||
better_setcookie("wikiless");
|
||||
foreach($_POST as $key=>$value){
|
||||
if (!empty($value))
|
||||
{
|
||||
setcookie($key, $value, time() + (86400 * 90), '/');
|
||||
$_COOKIE[$name] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_REQUEST["save"]) || isset($_REQUEST["reset"]))
|
||||
|
@ -129,6 +116,10 @@
|
|||
>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label>Disable frontends</label>
|
||||
<input type="checkbox" name="disable_frontends" <?php echo isset($_COOKIE["disable_frontends"]) ? "checked" : ""; ?> >
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit" name="save" value="1">Save</button>
|
||||
<button type="submit" name="reset" value="1">Reset</button>
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue