mirror of
https://github.com/hnhx/librex.git
synced 2025-04-29 22:19:27 -04:00
improved settings
This commit is contained in:
parent
b06489c8b7
commit
ca5fdd0746
8 changed files with 106 additions and 69 deletions
|
@ -22,7 +22,7 @@ Your request will be **rejected** if your instance:
|
||||||
+ has been heavily modified
|
+ has been heavily modified
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
+ Ad / JavaScript / cookie free
|
+ Ad & JavaScript free
|
||||||
+ Torrent results from popular torrent sites
|
+ Torrent results from popular torrent sites
|
||||||
+ Special queries (e.g.: 1 btc to usd , what does xyz mean etc.)
|
+ Special queries (e.g.: 1 btc to usd , what does xyz mean etc.)
|
||||||
+ Tracking snippets from URLs are removed
|
+ Tracking snippets from URLs are removed
|
||||||
|
|
17
config.php
17
config.php
|
@ -12,21 +12,20 @@
|
||||||
$config_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";
|
$config_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 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.md
|
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 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 nitter instances: https://github.com/zedeus/nitter/wiki/Instances
|
||||||
Online libreddit instances: https://github.com/spikecodes/libreddit
|
Online libreddit instances: https://github.com/spikecodes/libreddit
|
||||||
|
|
||||||
If you don't want to replace YouTube for an example but you want to replace everything else:
|
If you don't want to replace YouTube for an example:
|
||||||
$config_replace_youtube_with_invidious = isset($_REQUEST["invidious"]) ? $_REQUEST["invidious"] : null;
|
$config_replace_youtube_with_invidious = isset($_COOKIE["invidious"]) ? $_COOKIE["invidious"] : null;
|
||||||
*/
|
*/
|
||||||
$config_disable_privacy_friendly_frontends = false; // setting this to true will disable all of them
|
$config_replace_youtube_with_invidious = isset($_COOKIE["invidious"]) ? $_COOKIE["invidious"] : "https://yewtu.be";
|
||||||
$config_replace_youtube_with_invidious = isset($_REQUEST["invidious"]) ? $_REQUEST["invidious"] : "https://yewtu.be";
|
$config_replace_instagram_with_bibliogram = isset($_COOKIE["bibliogram"]) ? $_COOKIE["bibliogram"] : "https://bibliogram.pussthecat.org";
|
||||||
$config_replace_instagram_with_bibliogram = isset($_REQUEST["bibliogram"]) ? $_REQUEST["bibliogram"] : "https://bibliogram.pussthecat.org";
|
$config_replace_twitter_with_nitter = isset($_COOKIE["nitter"]) ? $_COOKIE["nitter"] : "https://nitter.namazso.eu";
|
||||||
$config_replace_twitter_with_nitter = isset($_REQUEST["nitter"]) ? $_REQUEST["nitter"] : "https://nitter.namazso.eu";
|
$config_replace_reddit_with_libreddit = isset($_COOKIE["libreddit"]) ? $_COOKIE["libreddit"] : "https://libreddit.dothq.co";
|
||||||
$config_replace_reddit_with_libreddit = isset($_REQUEST["libreddit"]) ? $_REQUEST["libreddit"] : "https://libreddit.dothq.co";
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
To send requests trough a proxy uncomment CURLOPT_PROXY and CURLOPT_PROXYTYPE:
|
To send requests trough a proxy uncomment CURLOPT_PROXY and CURLOPT_PROXYTYPE:
|
||||||
|
|
|
@ -108,7 +108,6 @@
|
||||||
|
|
||||||
|
|
||||||
$url = $url->textContent;
|
$url = $url->textContent;
|
||||||
if (!$config_disable_privacy_friendly_frontends)
|
|
||||||
$url = check_for_privacy_friendly_alternative($url);
|
$url = check_for_privacy_friendly_alternative($url);
|
||||||
|
|
||||||
$title = $xpath->evaluate(".//h3", $result)[0];
|
$title = $xpath->evaluate(".//h3", $result)[0];
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$url = $url->textContent;
|
$url = $url->textContent;
|
||||||
if (!$config_disable_privacy_friendly_frontends)
|
|
||||||
$url = check_for_privacy_friendly_alternative($url);
|
$url = check_for_privacy_friendly_alternative($url);
|
||||||
|
|
||||||
$title = $xpath->evaluate(".//h3", $result)[0];
|
$title = $xpath->evaluate(".//h3", $result)[0];
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
<?php require "static/header.php"; ?>
|
<?php require "static/header.php"; ?>
|
||||||
|
|
||||||
<title> <?php echo $_REQUEST["q"]; ?> - LibreX</title>
|
<title> <?php echo $_REQUEST["q"]; ?> - LibreX</title>
|
||||||
|
|
93
settings.php
93
settings.php
|
@ -1,66 +1,99 @@
|
||||||
<?php
|
<?php require "static/header.php"; ?>
|
||||||
require "static/header.php";
|
|
||||||
require "config.php";
|
|
||||||
?>
|
|
||||||
|
|
||||||
<title>LibreX - Settings</title>
|
<title>LibreX - Settings</title>
|
||||||
</head>
|
</head>
|
||||||
<body class="settings-container">
|
<body>
|
||||||
<p>Since LibreX doesn't use any cookies for better user privacy, settings are passed trough query parameters.</p>
|
<div class="settings-container">
|
||||||
|
<h1>Settings</h1>
|
||||||
<form method="post" enctype="multipart/form-data" autocomplete="off">
|
<form method="post" enctype="multipart/form-data" autocomplete="off">
|
||||||
<label for="theme">Theme:</label>
|
<label for="theme">Theme:</label>
|
||||||
<select name="theme">
|
<select name="theme">
|
||||||
<option value="dark">Dark</option>
|
<?php
|
||||||
<option value="light">Light</option>
|
|
||||||
<option value="nord">Nord</option>
|
$themes = "<option value=\"dark\">Dark</option>
|
||||||
<option value="night_owl">Night Owl</option>
|
<option value=\"light\">Light</option>
|
||||||
<option value="discord">Discord</option>
|
<option value=\"nord\">Nord</option>
|
||||||
|
<option value=\"night_owl\">Night Owl</option>
|
||||||
|
<option value=\"discord\">Discord</option>";
|
||||||
|
|
||||||
|
if (isset($_COOKIE["theme"]))
|
||||||
|
{
|
||||||
|
$cookie_theme = $_COOKIE["theme"];
|
||||||
|
$themes = str_replace($cookie_theme . "\"", $cookie_theme . "\" selected", $themes);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo $themes;
|
||||||
|
?>
|
||||||
</select>
|
</select>
|
||||||
<br><br>
|
<br><br>
|
||||||
<p>Privacy friendly frontends</p>
|
<h2>Privacy friendly frontends</h2>
|
||||||
|
<p>Replace popular sites with privacy friendly frontends</p>
|
||||||
<div class="instances-container">
|
<div class="instances-container">
|
||||||
<label for="invidious">Invidious:</label>
|
<a for="invidious" href="https://docs.invidious.io/Invidious-Instances/" target="_blank">Invidious</a>
|
||||||
<input type="text" name="invidious">
|
<input type="text" name="invidious" placeholder="e.g.: https://yewtu.be" value=
|
||||||
|
<?php echo isset($_COOKIE["invidious"]) ? $_COOKIE["invidious"] : "\"\""; ?>
|
||||||
|
>
|
||||||
|
|
||||||
<br><br>
|
<br><br>
|
||||||
<label for="bibliogram">Bibliogram:</label>
|
<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">
|
<input type="text" name="bibliogram" value=
|
||||||
|
<?php echo isset($_COOKIE["bibliogram"]) ? $_COOKIE["bibliogram"] : "\"\""; ?>
|
||||||
|
>
|
||||||
|
|
||||||
<br><br>
|
<br><br>
|
||||||
<label for="nitter">Nitter:</label>
|
<a for="nitter" href="https://github.com/zedeus/nitter/wiki/Instances" target="_blank">Nitter</a>
|
||||||
<input type="text" name="nitter">
|
<input type="text" name="nitter" value=
|
||||||
|
<?php echo isset($_COOKIE["nitter"]) ? $_COOKIE["nitter"] : "\"\""; ?>
|
||||||
|
>
|
||||||
|
|
||||||
<br><br>
|
<br><br>
|
||||||
<label for="libreddit">Libreddit:</label>
|
<a for="libreddit" href=" https://github.com/spikecodes/libreddit" target="_blank">Libreddit</a>
|
||||||
<input type="text" name="libreddit">
|
<input type="text" name="libreddit" value=
|
||||||
|
<?php echo isset($_COOKIE["libreddit"]) ? $_COOKIE["libreddit"] : "\"\""; ?>
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<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>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if (isset($_REQUEST["save"]))
|
if (isset($_REQUEST["save"]))
|
||||||
{
|
{
|
||||||
$url = $_SERVER["HTTP_HOST"] . "/search.php?q=test&theme=" . $_REQUEST["theme"];
|
|
||||||
|
|
||||||
if (!empty($_REQUEST["invidious"]))
|
if (!empty($_REQUEST["invidious"]))
|
||||||
$url .= "&invidious=" . $_REQUEST["invidious"];
|
setcookie("invidious", $_REQUEST["invidious"]);
|
||||||
|
|
||||||
if (!empty($_REQUEST["bibliogram"]))
|
if (!empty($_REQUEST["bibliogram"]))
|
||||||
$url .= "&bibliogram=" . $_REQUEST["bibliogram"];
|
setcookie("bibliogram", $_REQUEST["bibliogram"]);
|
||||||
|
|
||||||
if (!empty($_REQUEST["nitter"]))
|
if (!empty($_REQUEST["nitter"]))
|
||||||
$url .= "&nitter=" . $_REQUEST["nitter"];
|
setcookie("nitter", $_REQUEST["nitter"]);
|
||||||
|
|
||||||
if (!empty($_REQUEST["libreddit"]))
|
if (!empty($_REQUEST["libreddit"]))
|
||||||
$url .= "&nitter=" . $_REQUEST["libreddit"];
|
setcookie("libreddit", $_REQUEST["libreddit"]);
|
||||||
|
|
||||||
echo "<a href=\"http://$url\" target=\"_blank\"><p>";
|
setcookie("theme", $_REQUEST["theme"]);
|
||||||
echo $url;
|
|
||||||
echo "</p>";
|
header("Location: /settings.php");
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
else if (isset($_REQUEST["reset"]))
|
||||||
|
{
|
||||||
|
if (isset($_SERVER['HTTP_COOKIE'])) {
|
||||||
|
$cookies = explode(';', $_SERVER['HTTP_COOKIE']);
|
||||||
|
foreach($cookies as $cookie) {
|
||||||
|
$parts = explode('=', $cookie);
|
||||||
|
$name = trim($parts[0]);
|
||||||
|
setcookie($name, '', time()-1000);
|
||||||
|
setcookie($name, '', time()-1000, '/');
|
||||||
|
}
|
||||||
|
|
||||||
|
header("Location: /settings.php");
|
||||||
|
die();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
<?php require "static/footer.html"; ?>
|
<?php require "static/footer.html"; ?>
|
|
@ -9,4 +9,4 @@
|
||||||
<link title="LibreX search" type="application/opensearchdescription+xml" href="/opensearch.xml?method=POST" rel="search"/>
|
<link title="LibreX search" type="application/opensearchdescription+xml" href="/opensearch.xml?method=POST" rel="search"/>
|
||||||
<link rel="shortcut icon" href="static/images/librex.png" />
|
<link rel="shortcut icon" href="static/images/librex.png" />
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="<?php echo "static/" . (isset($_REQUEST["theme"]) ? $_REQUEST["theme"] . ".css" : "dark.css"); ?>"/>
|
<link rel="stylesheet" type="text/css" href="<?php echo "static/" . (isset($_COOKIE["theme"]) ? $_COOKIE["theme"] . ".css" : "dark.css"); ?>"/>
|
|
@ -88,7 +88,8 @@ a:hover, .text-result-wrapper h2:hover {
|
||||||
margin-left: 150px;
|
margin-left: 150px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-button-wrapper button:hover {
|
.search-button-wrapper button:hover,
|
||||||
|
.settings-container button:hover {
|
||||||
border: 1px solid #5f6368;
|
border: 1px solid #5f6368;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
@ -107,13 +108,20 @@ a:hover, .text-result-wrapper h2:hover {
|
||||||
}
|
}
|
||||||
|
|
||||||
.settings-container {
|
.settings-container {
|
||||||
margin-top: 10%;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin-left: 25%;
|
|
||||||
margin-right: 25%;
|
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.settings-container button {
|
||||||
|
margin-right:10px;
|
||||||
|
margin-left:10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-container a {
|
||||||
|
color:inherit;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
.instances-container input {
|
.instances-container input {
|
||||||
color: inherit;
|
color: inherit;
|
||||||
background-color: inherit;
|
background-color: inherit;
|
||||||
|
|
Loading…
Add table
Reference in a new issue