added custom settings for end users

This commit is contained in:
hnh.mtf 2022-03-09 13:18:24 +01:00
parent 9197e5f967
commit 966afd9f8c
13 changed files with 199 additions and 28 deletions

View File

@ -20,13 +20,13 @@
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 = null;
$config_replace_youtube_with_invidious = isset($_REQUEST["invidious"]) ? $_REQUEST["invidious"] : null;
*/
$config_disable_privacy_friendly_frontends = false; // setting this to true will disable all of them
$config_replace_youtube_with_invidious = "https://yewtu.be";
$config_replace_instagram_with_bibliogram = "https://bibliogram.pussthecat.org";
$config_replace_twitter_with_nitter = "https://nitter.namazso.eu";
$config_replace_reddit_with_libreddit = "https://libreddit.dothq.co";
$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";
/*
To send requests trough a proxy uncomment CURLOPT_PROXY and CURLOPT_PROXYTYPE:

View File

@ -1,4 +1,4 @@
<?php require "static/header.html"; ?>
<?php require "static/header.php"; ?>
<title>LibreX - Donate</title>
</head>
<body>
@ -6,7 +6,7 @@
<p>Support the host</p>
<span>(Your donation thingy goes here...)</span>
<p>Support the creator</p>
<span>Monero (XMR): <br/><br/><span style="background-color:black;">41dGQr9EwZBfYBY3fibTtJZYfssfRuzJZDSVDeneoVcgckehK3BiLxAV4FvEVJiVqdiW996zvMxhFB8G8ot9nBFqQ84VkuC</span></span>
<span>Monero (XMR): <br/><br/>41dGQr9EwZBfYBY3fibTtJZYfssfRuzJZDSVDeneoVcgckehK3BiLxAV4FvEVJiVqdiW996zvMxhFB8G8ot9nBFqQ84VkuC</span>
<img src="static/images/xmr.png" alt="xmr qr code"/>
</div>

View File

@ -1,4 +1,4 @@
<?php require "static/header.html"; ?>
<?php require "static/header.php"; ?>
<title>LibreX</title>
</head>

View File

@ -1,5 +1,5 @@
<?php require "static/header.html"; ?>
<?php require "static/header.php"; ?>
<title> <?php echo $_REQUEST["q"]; ?> - LibreX</title>
</head>
@ -21,7 +21,7 @@
>
<br>
<?php
$type = $_REQUEST["type"];
$type = isset($_REQUEST["type"]) ? (int) $_REQUEST["type"] : 0;
echo "<input type=\"hidden\" name=\"type\" value=\"$type\"/>";
?>
<button type="submit" style="display:none;"></button>
@ -40,7 +40,6 @@
require "config.php";
$page = isset($_REQUEST["p"]) ? (int) $_REQUEST["p"] : 0;
$type = isset($_REQUEST["type"]) ? (int) $_REQUEST["type"] : 0;
$query_encoded = urlencode($query);

66
settings.php Normal file
View File

@ -0,0 +1,66 @@
<?php
require "static/header.php";
require "config.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>
<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">
<br><br>
<label for="bibliogram">Bibliogram:</label>
<input type="text" name="bibliogram">
<br><br>
<label for="nitter">Nitter:</label>
<input type="text" name="nitter">
<br><br>
<label for="libreddit">Libreddit:</label>
<input type="text" name="libreddit">
</div>
<br>
<button type="submit" name="save" value="1">Save</button>
</form>
<?php
if (isset($_REQUEST["save"]))
{
$url = $_SERVER["HTTP_HOST"] . "/search.php?q=test&theme=" . $_REQUEST["theme"];
if (!empty($_REQUEST["invidious"]))
$url .= "&invidious=" . $_REQUEST["invidious"];
if (!empty($_REQUEST["bibliogram"]))
$url .= "&bibliogram=" . $_REQUEST["bibliogram"];
if (!empty($_REQUEST["nitter"]))
$url .= "&nitter=" . $_REQUEST["nitter"];
if (!empty($_REQUEST["libreddit"]))
$url .= "&nitter=" . $_REQUEST["libreddit"];
echo "<a href=\"$url\"><p>";
echo $url;
echo "</p>";
}
?>
<?php require "static/footer.html"; ?>

16
static/dark.css Normal file
View File

@ -0,0 +1,16 @@
:root {
--main-bg: #202124;
--main-fg: #e8eaed;
--alt-fg: #bd93f9;
--result-link-fg: #8ab4f8;
--result-fg: #999da2;
--button-bg: #303134;
--special-result-border: #bdc1c6;
--footer-fg: #999da2;
--footer-bg: #171717;
}

16
static/discord.css Normal file
View File

@ -0,0 +1,16 @@
:root {
--main-bg: #2f3136;
--main-fg: #dcddde;
--alt-fg: #bd93f9;
--result-link-fg: #747ff4;
--result-fg: #dcddde;
--button-bg: #36393f;
--special-result-border: #dcddde;
--footer-fg: #dcddde;
--footer-bg: #36393f;
}

View File

@ -1,6 +1,7 @@
<div class="footer-container">
<a href="/">LibreX</a>
<a href="https://github.com/hnhx/librex/" target="_blank">Source &amp; Instance list</a>
<a href="/settings.php">Settings</a>
<a href="/api.php" target="_blank">API</a>
<a href="/donate.php">Donate ❤️</a>
</div>

View File

@ -8,4 +8,5 @@
<link rel="stylesheet" type="text/css" href="static/styles.css"/>
<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"); ?>"/>

16
static/light.css Normal file
View File

@ -0,0 +1,16 @@
:root {
--main-bg: #fff;
--main-fg: #202124;
--alt-fg: #bd93f9;
--result-link-fg: #1a0dab;
--result-fg: #70757a;
--button-bg: #f2f2f2;
--special-result-border: #bdc1c6;
--footer-fg: #70757a;
--footer-bg: #f2f2f2;
}

16
static/night_owl.css Normal file
View File

@ -0,0 +1,16 @@
:root {
--main-bg: #011627;
--main-fg: #d6deeb;
--alt-fg: #bd93f9;
--result-link-fg: #5f7e97;
--result-fg: #d6deeb;
--button-bg: #122d42;
--special-result-border: #d6deeb;
--footer-fg: #d6deeb;
--footer-bg: #011627;
}

16
static/nord.css Normal file
View File

@ -0,0 +1,16 @@
:root {
--main-bg: #3B4252;
--main-fg: #E5E9F0;
--alt-fg: #bd93f9;
--result-link-fg: #88C0D0;
--result-fg: #D8DEE9;
--button-bg: #4C566A;
--special-result-border: #D8DEE9;
--footer-fg: #D8DEE9;
--footer-bg: #2E3440;
}

View File

@ -1,6 +1,6 @@
html {
color: #e8eaed;
background-color: #202124;
color: var(--main-fg);
background-color: var(--main-bg);
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
}
@ -16,7 +16,7 @@ button {
p {
font-size:18px;
color: #999da2;
color: var(--result-fg);
}
a,
@ -49,13 +49,19 @@ a:hover, .text-result-wrapper h2:hover {
border-radius: 25px;
}
.search-button-wrapper button {
.search-button-wrapper button,
.settings-container button,
.settings-container select {
color: inherit;
background-color: #303134;
background-color: var(--button-bg);
font-size: 14px;
border: none;
border-radius: 4px;
padding: 13px 10px 13px 10px;
}
.search-button-wrapper button {
margin: 30px 60px 0px 60px;
}
@ -95,11 +101,29 @@ a:hover, .text-result-wrapper h2:hover {
.sub-search-button-wrapper button {
border: none;
background-color: inherit;
color: #bd93f9;
color: var(--alt-fg);
font-size: 18px;
margin-right: 25px;
}
.settings-container {
margin-top: 10%;
text-align: center;
margin-left: 25%;
margin-right: 25%;
word-wrap: break-word;
}
.instances-container input {
color: inherit;
background-color: inherit;
padding: 5px;
font-size: inherit;
font-family: inherit;
border: 1px solid #5f6368;
border-radius: 5px;
}
.text-result-container,
#time,
.next-page-button-wrapper {
@ -113,7 +137,7 @@ a:hover, .text-result-wrapper h2:hover {
.special-result-container {
padding: 10px;
border: 1px solid #bdc1c6;
border: 1px solid var(--special-result-border);
width: 500px;
}
@ -125,12 +149,12 @@ a:hover, .text-result-wrapper h2:hover {
.text-result-wrapper a {
font-size: 14px;
color:#bdc1c6;
color: var(--result-fg);
}
.text-result-wrapper h2 {
font-size: 20px;
color: #8ab4f8;
color: var(--result-link-fg);
padding-top: 5px;
margin-top: 1px;
}
@ -138,7 +162,7 @@ a:hover, .text-result-wrapper h2:hover {
.special-result-container a {
display: flex;
margin-top: 10px;
color: #bd93f9;
color: var(--alt-fg);
font-size:14px;
}
@ -150,7 +174,7 @@ a:hover, .text-result-wrapper h2:hover {
.next-page-button-wrapper button {
border:none;
background-color: inherit;
color: #8ab4f8;
color: var(--result-link-fg);
font-size: 18px;
}
@ -166,7 +190,7 @@ a:hover, .text-result-wrapper h2:hover {
.image-result-container img {
margin: 10px;
border: 1px solid #5f6368;
border: 1px solid var(--button-bg);
}
.donate-container {
@ -175,7 +199,7 @@ a:hover, .text-result-wrapper h2:hover {
margin-left: auto;
margin-right: auto;
margin-top: 8%;
border: 1px solid #bdc1c6;
border: 1px solid var(--main-fg);
max-width: 500px;
padding:0px 20px 20px 20px;
}
@ -185,7 +209,7 @@ a:hover, .text-result-wrapper h2:hover {
}
.donate-container a {
color: #bd93f9;
color: var(--alt-fg);
}
.footer-container {
@ -193,7 +217,7 @@ a:hover, .text-result-wrapper h2:hover {
left: 0;
bottom: 0;
width: 100vw;
background-color: #171717;
background-color: var(--footer-bg);
padding-top: 15px;
padding-bottom: 15px;
border-top: 1px solid #303134;
@ -201,7 +225,7 @@ a:hover, .text-result-wrapper h2:hover {
}
.footer-container a {
color: #999da2;
color: var(--footer-fg);
margin-left: 15px;
margin-right: 15px;
}