mirror of
https://github.com/hnhx/librex.git
synced 2025-01-25 02:03:04 -03: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
|
||||
|
||||
# Features
|
||||
+ Ad / JavaScript / cookie free
|
||||
+ Ad & JavaScript free
|
||||
+ Torrent results from popular torrent sites
|
||||
+ Special queries (e.g.: 1 btc to usd , what does xyz mean etc.)
|
||||
+ 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";
|
||||
|
||||
/*
|
||||
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 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 but you want to replace everything else:
|
||||
$config_replace_youtube_with_invidious = isset($_REQUEST["invidious"]) ? $_REQUEST["invidious"] : null;
|
||||
If you don't want to replace YouTube for an example:
|
||||
$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($_REQUEST["invidious"]) ? $_REQUEST["invidious"] : "https://yewtu.be";
|
||||
$config_replace_instagram_with_bibliogram = isset($_REQUEST["bibliogram"]) ? $_REQUEST["bibliogram"] : "https://bibliogram.pussthecat.org";
|
||||
$config_replace_twitter_with_nitter = isset($_REQUEST["nitter"]) ? $_REQUEST["nitter"] : "https://nitter.namazso.eu";
|
||||
$config_replace_reddit_with_libreddit = isset($_REQUEST["libreddit"]) ? $_REQUEST["libreddit"] : "https://libreddit.dothq.co";
|
||||
$config_replace_youtube_with_invidious = isset($_COOKIE["invidious"]) ? $_COOKIE["invidious"] : "https://yewtu.be";
|
||||
$config_replace_instagram_with_bibliogram = isset($_COOKIE["bibliogram"]) ? $_COOKIE["bibliogram"] : "https://bibliogram.pussthecat.org";
|
||||
$config_replace_twitter_with_nitter = isset($_COOKIE["nitter"]) ? $_COOKIE["nitter"] : "https://nitter.namazso.eu";
|
||||
$config_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:
|
||||
|
|
|
@ -108,8 +108,7 @@
|
|||
|
||||
|
||||
$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];
|
||||
$description = $xpath->evaluate(".//div[contains(@class, 'VwiC3b')]", $result)[0];
|
||||
|
|
|
@ -22,8 +22,7 @@
|
|||
continue;
|
||||
|
||||
$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];
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
<?php require "static/header.php"; ?>
|
||||
|
||||
<title> <?php echo $_REQUEST["q"]; ?> - LibreX</title>
|
||||
|
|
131
settings.php
131
settings.php
|
@ -1,66 +1,99 @@
|
|||
<?php
|
||||
require "static/header.php";
|
||||
require "config.php";
|
||||
?>
|
||||
<?php require "static/header.php"; ?>
|
||||
|
||||
<title>LibreX - Settings</title>
|
||||
</head>
|
||||
<body class="settings-container">
|
||||
<p>Since LibreX doesn't use any cookies for better user privacy, settings are passed trough query parameters.</p>
|
||||
<body>
|
||||
<div class="settings-container">
|
||||
<h1>Settings</h1>
|
||||
<form method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
<label for="theme">Theme:</label>
|
||||
<select name="theme">
|
||||
<?php
|
||||
|
||||
$themes = "<option value=\"dark\">Dark</option>
|
||||
<option value=\"light\">Light</option>
|
||||
<option value=\"nord\">Nord</option>
|
||||
<option value=\"night_owl\">Night Owl</option>
|
||||
<option value=\"discord\">Discord</option>";
|
||||
|
||||
<form method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
<label for="theme">Theme:</label>
|
||||
<select name="theme">
|
||||
<option value="dark">Dark</option>
|
||||
<option value="light">Light</option>
|
||||
<option value="nord">Nord</option>
|
||||
<option value="night_owl">Night Owl</option>
|
||||
<option value="discord">Discord</option>
|
||||
</select>
|
||||
<br><br>
|
||||
<p>Privacy friendly frontends</p>
|
||||
<div class="instances-container">
|
||||
<label for="invidious">Invidious:</label>
|
||||
<input type="text" name="invidious">
|
||||
if (isset($_COOKIE["theme"]))
|
||||
{
|
||||
$cookie_theme = $_COOKIE["theme"];
|
||||
$themes = str_replace($cookie_theme . "\"", $cookie_theme . "\" selected", $themes);
|
||||
}
|
||||
|
||||
echo $themes;
|
||||
?>
|
||||
</select>
|
||||
<br><br>
|
||||
<label for="bibliogram">Bibliogram:</label>
|
||||
<input type="text" name="bibliogram">
|
||||
<h2>Privacy friendly frontends</h2>
|
||||
<p>Replace popular sites with privacy friendly frontends</p>
|
||||
<div class="instances-container">
|
||||
<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=
|
||||
<?php echo isset($_COOKIE["invidious"]) ? $_COOKIE["invidious"] : "\"\""; ?>
|
||||
>
|
||||
|
||||
<br><br>
|
||||
<label for="nitter">Nitter:</label>
|
||||
<input type="text" name="nitter">
|
||||
<br><br>
|
||||
<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=
|
||||
<?php echo isset($_COOKIE["bibliogram"]) ? $_COOKIE["bibliogram"] : "\"\""; ?>
|
||||
>
|
||||
|
||||
<br><br>
|
||||
<label for="libreddit">Libreddit:</label>
|
||||
<input type="text" name="libreddit">
|
||||
</div>
|
||||
<br>
|
||||
<button type="submit" name="save" value="1">Save</button>
|
||||
</form>
|
||||
<br><br>
|
||||
<a for="nitter" href="https://github.com/zedeus/nitter/wiki/Instances" target="_blank">Nitter</a>
|
||||
<input type="text" name="nitter" value=
|
||||
<?php echo isset($_COOKIE["nitter"]) ? $_COOKIE["nitter"] : "\"\""; ?>
|
||||
>
|
||||
|
||||
<br><br>
|
||||
<a for="libreddit" href=" https://github.com/spikecodes/libreddit" target="_blank">Libreddit</a>
|
||||
<input type="text" name="libreddit" value=
|
||||
<?php echo isset($_COOKIE["libreddit"]) ? $_COOKIE["libreddit"] : "\"\""; ?>
|
||||
>
|
||||
</div>
|
||||
<br>
|
||||
<button type="submit" name="save" value="1">Save</button>
|
||||
<button type="submit" name="reset" value="1">Reset</button>
|
||||
</form>
|
||||
|
||||
|
||||
<?php
|
||||
if (isset($_REQUEST["save"]))
|
||||
{
|
||||
$url = $_SERVER["HTTP_HOST"] . "/search.php?q=test&theme=" . $_REQUEST["theme"];
|
||||
<?php
|
||||
if (isset($_REQUEST["save"]))
|
||||
{
|
||||
if (!empty($_REQUEST["invidious"]))
|
||||
setcookie("invidious", $_REQUEST["invidious"]);
|
||||
|
||||
if (!empty($_REQUEST["invidious"]))
|
||||
$url .= "&invidious=" . $_REQUEST["invidious"];
|
||||
if (!empty($_REQUEST["bibliogram"]))
|
||||
setcookie("bibliogram", $_REQUEST["bibliogram"]);
|
||||
|
||||
if (!empty($_REQUEST["bibliogram"]))
|
||||
$url .= "&bibliogram=" . $_REQUEST["bibliogram"];
|
||||
if (!empty($_REQUEST["nitter"]))
|
||||
setcookie("nitter", $_REQUEST["nitter"]);
|
||||
|
||||
if (!empty($_REQUEST["nitter"]))
|
||||
$url .= "&nitter=" . $_REQUEST["nitter"];
|
||||
if (!empty($_REQUEST["libreddit"]))
|
||||
setcookie("libreddit", $_REQUEST["libreddit"]);
|
||||
|
||||
if (!empty($_REQUEST["libreddit"]))
|
||||
$url .= "&nitter=" . $_REQUEST["libreddit"];
|
||||
setcookie("theme", $_REQUEST["theme"]);
|
||||
|
||||
echo "<a href=\"http://$url\" target=\"_blank\"><p>";
|
||||
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"; ?>
|
|
@ -9,4 +9,4 @@
|
|||
<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="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;
|
||||
}
|
||||
|
||||
.search-button-wrapper button:hover {
|
||||
.search-button-wrapper button:hover,
|
||||
.settings-container button:hover {
|
||||
border: 1px solid #5f6368;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
@ -107,13 +108,20 @@ a:hover, .text-result-wrapper h2:hover {
|
|||
}
|
||||
|
||||
.settings-container {
|
||||
margin-top: 10%;
|
||||
text-align: center;
|
||||
margin-left: 25%;
|
||||
margin-right: 25%;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.settings-container button {
|
||||
margin-right:10px;
|
||||
margin-left:10px;
|
||||
}
|
||||
|
||||
.settings-container a {
|
||||
color:inherit;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.instances-container input {
|
||||
color: inherit;
|
||||
background-color: inherit;
|
||||
|
|
Loading…
Add table
Reference in a new issue