Skip to content

Commit 2f06560

Browse files
committed
fixed some inconsistency in the css, added disable frontends option, made the codebase cleaner
1 parent 95811de commit 2f06560

9 files changed

+51
-75
lines changed

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ git clone https://git.beparanoid.de/librex
3939
```
4040
### LibreX compared to other metasearch engines
4141

42-
| Metasearch engine | Works without JS | Privacy frontend redirect | Torrent results |
43-
|-|-|-|-|
44-
| LibreX ||||
45-
| SearXNG | | ❓ Only host can set it ||
46-
| Whoogle || ❓ Only host can set it ||
42+
| Metasearch engine | Works without JS | Privacy frontend redirect | Torrent results | API |
43+
|-|-|-|-|-|
44+
| LibreX |||||
45+
| SearXNG | ❓ Not user friendly | ❓ Only host can set it | ||
46+
| Whoogle || ❓ Only host can set it |||

auto_updater.sh

-7
This file was deleted.

config.php.example

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
// CURLOPT_PROXYTYPE => CURLPROXY_HTTP,
4040
CURLOPT_RETURNTRANSFER => true,
4141
CURLOPT_ENCODING => "",
42-
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",
42+
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",
4343
CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4,
4444
CURLOPT_CUSTOMREQUEST => "GET",
4545
CURLOPT_PROTOCOLS => CURLPROTO_HTTPS | CURLPROTO_HTTP,

image_proxy.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
$base_url_main_split = explode(".", strrev($base_url));
1212
$base_url_main = strrev($base_url_main_split[1]) . "." . strrev($base_url_main_split[0]);
1313

14-
if ($base_url_main == "qwant.com" || $base_url_main == "wikimedia.org" || $base_url_main == "brave.com")
14+
$allowed_domains = array("qwant.com", "wikimedia.org", "brave.com");
15+
16+
if (in_array($base_url_main, $allowed_domains))
1517
{
1618
$image = $url;
1719
$image_src = request($image);

librex_updater.service

-19
This file was deleted.

misc/tools.php

+6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ function try_replace_with_frontend($url, $frontend, $original)
2525
$frontend .= "/u";
2626
}
2727

28+
if (empty(trim($frontend)))
29+
return $url;
30+
2831
$url = $frontend . explode($original, $url)[1];
2932

3033
return $url;
@@ -35,6 +38,9 @@ function try_replace_with_frontend($url, $frontend, $original)
3538

3639
function check_for_privacy_frontend($url)
3740
{
41+
if (isset($_COOKIE["disable_frontends"]))
42+
return $url;
43+
3844
$frontends = array(
3945
"youtube.com" => "invidious",
4046
"instagram.com" => "bibliogram",

search.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</head>
99
<body>
1010
<form class="sub-search-container" method="get" autocomplete="off">
11-
<h1 class="logomobile"><a class="noDecoration" href="./">Libre<span class="X">X</span></a></h1>
11+
<h1 class="logomobile"><a class="no-decoration" href="./">Libre<span class="X">X</span></a></h1>
1212
<input type="text" name="q"
1313
<?php
1414
$query_encoded = urlencode($query);
@@ -48,7 +48,9 @@
4848
switch ($type)
4949
{
5050
case 0:
51-
if (substr($query, 0, 1) == "!" || substr(end(explode(" ", $query)), 0, 1) == "!")
51+
$query_parts = explode(" ", $query);
52+
$last_word_query = end($query_parts);
53+
if (substr($query, 0, 1) == "!" || substr($last_word_query, 0, 1) == "!")
5254
check_ddg_bang($query);
5355
require "engines/google/text.php";
5456
$results = get_text_results($query, $page);

settings.php

+13-22
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,17 @@
1515
}
1616
}
1717

18-
}
19-
20-
function better_setcookie($name)
21-
{
22-
if (!empty($_REQUEST[$name]))
23-
{
24-
setcookie($name, $_REQUEST[$name], time() + (86400 * 90), '/');
25-
$_COOKIE[$name] = $_REQUEST[$name];
26-
}
27-
}
28-
18+
}
19+
2920
if (isset($_REQUEST["save"]))
3021
{
31-
32-
better_setcookie("theme");
33-
34-
better_setcookie("disable_special");
35-
36-
better_setcookie("invidious");
37-
better_setcookie("bibliogram");
38-
better_setcookie("nitter");
39-
better_setcookie("libreddit");
40-
better_setcookie("proxitok");
41-
better_setcookie("wikiless");
22+
foreach($_POST as $key=>$value){
23+
if (!empty($value))
24+
{
25+
setcookie($key, $value, time() + (86400 * 90), '/');
26+
$_COOKIE[$name] = $value;
27+
}
28+
}
4229
}
4330

4431
if (isset($_REQUEST["save"]) || isset($_REQUEST["reset"]))
@@ -129,6 +116,10 @@ function better_setcookie($name)
129116
>
130117
</div>
131118
</div>
119+
<div>
120+
<label>Disable frontends</label>
121+
<input type="checkbox" name="disable_frontends" <?php echo isset($_COOKIE["disable_frontends"]) ? "checked" : ""; ?> >
122+
</div>
132123
<div>
133124
<button type="submit" name="save" value="1">Save</button>
134125
<button type="submit" name="reset" value="1">Reset</button>

static/css/styles.css

+19-18
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ a:hover,
101101
left: 20px;
102102
}
103103

104-
.noDecoration {
104+
.no-decoration {
105105
text-decoration: none;
106106
color: var(--main-fg);
107107
}
108108

109-
.noDecoration:hover {
109+
.no-decoration:hover {
110110
text-decoration: none;
111111
}
112112

@@ -144,6 +144,7 @@ a:hover,
144144
width: 450px;
145145
margin-left: auto;
146146
margin-right: auto;
147+
margin-bottom: 100px;
147148
}
148149

149150
.misc-container div {
@@ -198,14 +199,6 @@ a:hover,
198199
position: absolute;
199200
}
200201

201-
@media only screen and (max-width: 1320px) {
202-
.special-result-container {
203-
position: relative;
204-
float: none;
205-
margin-left: 165px;
206-
}
207-
}
208-
209202
.text-result-wrapper {
210203
max-width: 550px;
211204
word-wrap: break-word;
@@ -327,8 +320,24 @@ a:hover,
327320
color: #ff79c6;
328321
}
329322

323+
@media only screen and (max-width: 1320px) {
324+
.special-result-container {
325+
position: relative;
326+
float: none;
327+
margin-left: 165px;
328+
}
329+
}
330+
330331
/* mobile view */
331332
@media only screen and (max-width: 750px) {
333+
p {
334+
font-size: 16px;
335+
}
336+
337+
html {
338+
font-size: 14px;
339+
}
340+
332341
.search-container input {
333342
width: 80%;
334343
}
@@ -439,14 +448,6 @@ a:hover,
439448
margin-top: 10%;
440449
}
441450

442-
p {
443-
font-size: 16px;
444-
}
445-
446-
html {
447-
font-size: 14px;
448-
}
449-
450451
.text-result-container,
451452
#time,
452453
.next-page-button-wrapper {

0 commit comments

Comments
 (0)