mirror of
https://github.com/hnhx/librex.git
synced 2025-04-29 14:09:27 -04:00
improved mobile css, privacy friendly frontends are now only managed by the user
This commit is contained in:
parent
b30be1ebc6
commit
0405992309
8 changed files with 134 additions and 149 deletions
20
config.php
20
config.php
|
@ -10,22 +10,6 @@
|
|||
"disable_bittorent_search" => false,
|
||||
"bittorent_trackers" => "&tr=http%3A%2F%2Fnyaa.tracker.wf%3A7777%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Fexodus.desync.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.torrent.eu.org%3A451%2Fannounce",
|
||||
|
||||
/*
|
||||
These are privacy friendly front-ends for popular sites, these settings can be managed by end users as well for their session via cookies.
|
||||
|
||||
Online invidious instances: https://docs.invidious.io/Invidious-Instances/
|
||||
Online bibliogram instances: https://git.sr.ht/~cadence/bibliogram-docs/tree/master/docs/Instances.md
|
||||
Online nitter instances: https://github.com/zedeus/nitter/wiki/Instances
|
||||
Online libreddit instances: https://github.com/spikecodes/libreddit
|
||||
|
||||
If you don't want to replace YouTube for an example:
|
||||
$replace_youtube_with_invidious = isset($_COOKIE["invidious"]) ? $_COOKIE["invidious"] : null;
|
||||
*/
|
||||
"replace_youtube_with_invidious" => isset($_COOKIE["invidious"]) ? $_COOKIE["invidious"] : "https://yewtu.be",
|
||||
"replace_instagram_with_bibliogram" => isset($_COOKIE["bibliogram"]) ? $_COOKIE["bibliogram"] : "https://bibliogram.pussthecat.org",
|
||||
"replace_twitter_with_nitter" => isset($_COOKIE["nitter"]) ? $_COOKIE["nitter"] : "https://nitter.namazso.eu",
|
||||
"replace_reddit_with_libreddit" => isset($_COOKIE["libreddit"]) ? $_COOKIE["libreddit"] : "https://libreddit.dothq.co",
|
||||
|
||||
/*
|
||||
To send requests trough a proxy uncomment CURLOPT_PROXY and CURLOPT_PROXYTYPE:
|
||||
|
||||
|
@ -37,10 +21,6 @@
|
|||
CURLPROXY_SOCKS5
|
||||
CURLPROXY_SOCKS5_HOSTNAME
|
||||
|
||||
As an example, for a TOR connection you would use these settings:
|
||||
CURLOPT_PROXY => "127.0.0.1:9050",
|
||||
CURLOPT_PROXYTYPE => CURLPROXY_SOCKS5,
|
||||
|
||||
!!! ONLY CHANGE THE OTHER OPTIONS IF YOU KNOW WHAT YOU ARE DOING !!!
|
||||
*/
|
||||
"curl_settings" => array(
|
||||
|
|
12
donate.php
12
donate.php
|
@ -3,11 +3,13 @@
|
|||
<title>LibreX - Donate</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="donate-container">
|
||||
<p>Support the host</p>
|
||||
<span>(Your donation thingy goes here...)</span>
|
||||
<p>Support the creator</p>
|
||||
<span>Monero (XMR): <br/><br/>41dGQr9EwZBfYBY3fibTtJZYfssfRuzJZDSVDeneoVcgckehK3BiLxAV4FvEVJiVqdiW996zvMxhFB8G8ot9nBFqQ84VkuC</span>
|
||||
<div class="misc-container">
|
||||
<h1>Donate</h1>
|
||||
<h2>Support the host of this instance</h2>
|
||||
<p>(Your donation thingy goes here...)</p>
|
||||
<h2>Support the creator</h2>
|
||||
<h3>Monero (XMR):</h3>
|
||||
<p>41dGQr9EwZBfYBY3fibTtJZYfssfRuzJZDSVDeneoVcgckehK3BiLxAV4FvEVJiVqdiW996zvMxhFB8G8ot9nBFqQ84VkuC</p>
|
||||
<img src="static/images/xmr.png" alt="xmr qr code"/>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -107,6 +107,7 @@
|
|||
|
||||
|
||||
$url = $url->textContent;
|
||||
if (substr_count($_SERVER["HTTP_COOKIE"], " ") >= 1)
|
||||
$url = check_for_privacy_friendly_alternative($url);
|
||||
|
||||
$title = $xpath->evaluate(".//h3", $result)[0];
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
continue;
|
||||
|
||||
$url = $url->textContent;
|
||||
if (substr_count($_SERVER["HTTP_COOKIE"], " ") >= 1)
|
||||
$url = check_for_privacy_friendly_alternative($url);
|
||||
|
||||
$title = $xpath->evaluate(".//h3", $result)[0];
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<a href="/">LibreX</a>
|
||||
<a href="https://github.com/hnhx/librex/" target="_blank">Source & Instance list</a>
|
||||
<a href="/settings.php">Settings</a>
|
||||
<a href="https://based-or-botnet.neocities.org/" target="_blank">Privacy guides</a>
|
||||
<a href="/api.php" target="_blank">API</a>
|
||||
<a href="/donate.php">Donate ❤️</a>
|
||||
</div>
|
||||
|
|
|
@ -8,21 +8,19 @@
|
|||
|
||||
function check_for_privacy_friendly_alternative($url)
|
||||
{
|
||||
global $config;
|
||||
|
||||
if ($config->replace_youtube_with_invidious != null && strpos($url, "youtube.com"))
|
||||
$url = $config->replace_youtube_with_invidious . explode("youtube.com", $url)[1];
|
||||
else if ($config->replace_instagram_with_bibliogram != null && strpos($url, "instagram.com"))
|
||||
if (isset($_COOKIE["invidious"]) && strpos($url, "youtube.com"))
|
||||
$url = $_COOKIE["invidious"] . explode("youtube.com", $url)[1];
|
||||
else if (isset($_COOKIE["bibliogram"]) && strpos($url, "instagram.com"))
|
||||
{
|
||||
if (!strpos($url, "/p/"))
|
||||
$config->replace_instagram_with_bibliogram .= "/u";
|
||||
$_COOKIE["bibliogram"] .= "/u";
|
||||
|
||||
$url = $config->replace_instagram_with_bibliogram . explode("instagram.com", $url)[1];
|
||||
$url = $_COOKIE["bibliogram"] . explode("instagram.com", $url)[1];
|
||||
}
|
||||
else if ($config->replace_twitter_with_nitter != null && strpos($url, "twitter.com"))
|
||||
$url = $config->replace_twitter_with_nitter . explode("twitter.com", $url)[1];
|
||||
else if ($config->replace_reddit_with_libreddit != null && strpos($url, "reddit.com"))
|
||||
$url = $config->replace_reddit_with_libreddit . explode("reddit.com", $url)[1];
|
||||
else if (isset($_COOKIE["nitter"]) && strpos($url, "twitter.com"))
|
||||
$url = $_COOKIE["nitter"] . explode("twitter.com", $url)[1];
|
||||
else if (isset($_COOKIE["libreddit"]) && strpos($url, "reddit.com"))
|
||||
$url = $_COOKIE["libreddit"] . explode("reddit.com", $url)[1];
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
|
41
settings.php
41
settings.php
|
@ -3,9 +3,10 @@
|
|||
<title>LibreX - Settings</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="settings-container">
|
||||
<div class="misc-container">
|
||||
<h1>Settings</h1>
|
||||
<form method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
<div>
|
||||
<label for="theme">Theme:</label>
|
||||
<select name="theme">
|
||||
<?php
|
||||
|
@ -26,36 +27,43 @@
|
|||
echo $themes;
|
||||
?>
|
||||
</select>
|
||||
<br><br>
|
||||
</div>
|
||||
<h2>Privacy friendly frontends</h2>
|
||||
<p>Replace popular sites with privacy friendly frontends</p>
|
||||
<p>For an example if you want to view YouTube without getting spied on, click on "Invidious", find the instance that is most suitable for you then paste it in (correct format: https://url.domain)</p>
|
||||
<div class="instances-container">
|
||||
|
||||
<div>
|
||||
<a for="invidious" href="https://docs.invidious.io/Invidious-Instances/" target="_blank">Invidious</a>
|
||||
<input type="text" name="invidious" placeholder="e.g.: https://yewtu.be" value=
|
||||
<input type="text" name="invidious" placeholder="Replace YouTube" value=
|
||||
<?php echo isset($_COOKIE["invidious"]) ? $_COOKIE["invidious"] : "\"\""; ?>
|
||||
>
|
||||
</div>
|
||||
|
||||
<br><br>
|
||||
<div>
|
||||
<a for="bibliogram" href="https://git.sr.ht/~cadence/bibliogram-docs/tree/master/docs/Instances.md" target="_blank">Bibliogram</a>
|
||||
<input type="text" name="bibliogram" value=
|
||||
<input type="text" name="bibliogram" placeholder="Replace Instagram" value=
|
||||
<?php echo isset($_COOKIE["bibliogram"]) ? $_COOKIE["bibliogram"] : "\"\""; ?>
|
||||
>
|
||||
</div>
|
||||
|
||||
<br><br>
|
||||
<div>
|
||||
<a for="nitter" href="https://github.com/zedeus/nitter/wiki/Instances" target="_blank">Nitter</a>
|
||||
<input type="text" name="nitter" value=
|
||||
<input type="text" name="nitter" placeholder="Replace Twitter" value=
|
||||
<?php echo isset($_COOKIE["nitter"]) ? $_COOKIE["nitter"] : "\"\""; ?>
|
||||
>
|
||||
</div>
|
||||
|
||||
<br><br>
|
||||
<div>
|
||||
<a for="libreddit" href="https://github.com/spikecodes/libreddit" target="_blank">Libreddit</a>
|
||||
<input type="text" name="libreddit" value=
|
||||
<input type="text" name="libreddit" placeholder="Replace Reddit" value=
|
||||
<?php echo isset($_COOKIE["libreddit"]) ? $_COOKIE["libreddit"] : "\"\""; ?>
|
||||
>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit" name="save" value="1">Save</button>
|
||||
<button type="submit" name="reset" value="1">Reset</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
|
@ -74,6 +82,7 @@
|
|||
if (!empty($_REQUEST["libreddit"]))
|
||||
setcookie("libreddit", $_REQUEST["libreddit"]);
|
||||
|
||||
|
||||
setcookie("theme", $_REQUEST["theme"]);
|
||||
|
||||
header("Location: /settings.php");
|
||||
|
@ -81,13 +90,13 @@
|
|||
}
|
||||
else if (isset($_REQUEST["reset"]))
|
||||
{
|
||||
if (isset($_SERVER['HTTP_COOKIE'])) {
|
||||
$cookies = explode(';', $_SERVER['HTTP_COOKIE']);
|
||||
if (isset($_SERVER["HTTP_COOKIE"])) {
|
||||
$cookies = explode(";", $_SERVER["HTTP_COOKIE"]);
|
||||
foreach($cookies as $cookie) {
|
||||
$parts = explode('=', $cookie);
|
||||
$parts = explode("=", $cookie);
|
||||
$name = trim($parts[0]);
|
||||
setcookie($name, '', time()-1000);
|
||||
setcookie($name, '', time()-1000, '/');
|
||||
setcookie($name, "", time()-1000);
|
||||
setcookie($name, "", time()-1000, "/");
|
||||
}
|
||||
|
||||
header("Location: /settings.php");
|
||||
|
|
|
@ -24,6 +24,10 @@ a,
|
|||
text-decoration: none;
|
||||
}
|
||||
|
||||
.text-result-wrapper a:visited h2 {
|
||||
color: var(--alt-fg);
|
||||
}
|
||||
|
||||
a:hover, .text-result-wrapper h2:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
@ -50,8 +54,8 @@ a:hover, .text-result-wrapper h2:hover {
|
|||
}
|
||||
|
||||
.search-button-wrapper button,
|
||||
.settings-container button,
|
||||
.settings-container select {
|
||||
.misc-container button,
|
||||
.misc-container select {
|
||||
color: inherit;
|
||||
background-color: var(--button-bg);
|
||||
font-size: 14px;
|
||||
|
@ -89,7 +93,7 @@ a:hover, .text-result-wrapper h2:hover {
|
|||
}
|
||||
|
||||
.search-button-wrapper button:hover,
|
||||
.settings-container button:hover {
|
||||
.misc-container button:hover {
|
||||
border: 1px solid #5f6368;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
@ -107,21 +111,33 @@ a:hover, .text-result-wrapper h2:hover {
|
|||
margin-right: 25px;
|
||||
}
|
||||
|
||||
.settings-container {
|
||||
.misc-container {
|
||||
text-align: center;
|
||||
word-wrap: break-word;
|
||||
width: 450px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.settings-container button {
|
||||
.misc-container div {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.misc-container button {
|
||||
margin-right:10px;
|
||||
margin-left:10px;
|
||||
}
|
||||
|
||||
.settings-container a {
|
||||
.misc-container a {
|
||||
color:inherit;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.instances-container div {
|
||||
text-align: left;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
.instances-container input {
|
||||
color: inherit;
|
||||
background-color: inherit;
|
||||
|
@ -130,6 +146,7 @@ a:hover, .text-result-wrapper h2:hover {
|
|||
font-family: inherit;
|
||||
border: 1px solid #5f6368;
|
||||
border-radius: 5px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.text-result-container,
|
||||
|
@ -183,7 +200,8 @@ a:hover, .text-result-wrapper h2:hover {
|
|||
border:none;
|
||||
background-color: inherit;
|
||||
color: var(--result-link-fg);
|
||||
font-size: 18px;
|
||||
font-size: 20px;
|
||||
margin-right: 6px;
|
||||
}
|
||||
|
||||
.next-page-button-wrapper #page {
|
||||
|
@ -208,25 +226,6 @@ a:hover, .text-result-wrapper h2:hover {
|
|||
margin: 10px;
|
||||
}
|
||||
|
||||
.donate-container {
|
||||
text-align: center;
|
||||
word-wrap: break-word;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
margin-top: 8%;
|
||||
border: 1px solid var(--main-fg);
|
||||
max-width: 500px;
|
||||
padding:0px 20px 20px 20px;
|
||||
}
|
||||
|
||||
.donate-container img {
|
||||
margin-top:10px;
|
||||
}
|
||||
|
||||
.donate-container a {
|
||||
color: var(--alt-fg);
|
||||
}
|
||||
|
||||
.footer-container {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
|
@ -283,7 +282,7 @@ a:hover, .text-result-wrapper h2:hover {
|
|||
margin:0;
|
||||
padding:0;
|
||||
display: flex;
|
||||
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
.sub-search-button-wrapper img {
|
||||
|
@ -296,7 +295,6 @@ a:hover, .text-result-wrapper h2:hover {
|
|||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
padding:0;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
@ -306,17 +304,12 @@ a:hover, .text-result-wrapper h2:hover {
|
|||
max-width: 80%;
|
||||
}
|
||||
|
||||
.donate-container {
|
||||
max-width: 80%;
|
||||
.misc-container {
|
||||
margin-bottom: 200px;
|
||||
width: 95%;
|
||||
}
|
||||
|
||||
.donate-container img {
|
||||
display: block;
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
}
|
||||
|
||||
.settings-container {
|
||||
margin-bottom: 100px;
|
||||
.search-container h1 {
|
||||
font-size: 55px;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue