mirror of
https://github.com/Ahwxorg/librey/
synced 2024-12-06 19:16:48 +01:00
add default theme config option
This commit is contained in:
@@ -8,6 +8,9 @@
|
||||
"language" => "",
|
||||
"number_of_results" => 10,
|
||||
|
||||
// The default theme css to use
|
||||
"default_theme" => "dark",
|
||||
|
||||
// You can use any Invidious instance here
|
||||
"invidious_instance_for_video_results" => "https://invidious.snopyta.org",
|
||||
|
||||
|
||||
+4
-2
@@ -1,4 +1,6 @@
|
||||
<?php require_once "locale/localization.php"; ?>
|
||||
<?php require_once "locale/localization.php";
|
||||
$GLOBALS["opts"] = require_once "config.php";
|
||||
?>
|
||||
<!DOCTYPE html >
|
||||
<html lang="en">
|
||||
<head>
|
||||
@@ -9,6 +11,6 @@
|
||||
<link rel="stylesheet" type="text/css" href="static/css/styles.css"/>
|
||||
<link title="<?php printtext("page_title"); ?>" type="application/opensearchdescription+xml" href="opensearch.xml?method=POST" rel="search"/>
|
||||
<link rel="stylesheet" type="text/css" href="<?php
|
||||
$theme = $_REQUEST["theme"] ?? trim(htmlspecialchars($_COOKIE["theme"] ?? "amoled"));
|
||||
$theme = $_REQUEST["theme"] ?? trim(htmlspecialchars($_COOKIE["theme"] ?? $GLOBALS["opts"]->default_theme ?? "dark"));
|
||||
echo "static/css/" . $theme . ".css";
|
||||
?>"/>
|
||||
|
||||
@@ -60,7 +60,10 @@
|
||||
}
|
||||
|
||||
function load_opts() {
|
||||
$opts = require_once "config.php";
|
||||
if (isset($GLOBALS["opts"]))
|
||||
$opts = $GLOBALS["opts"];
|
||||
else
|
||||
$opts = require_once "config.php";
|
||||
|
||||
# account for the old, misspelled options
|
||||
if (isset($opts->disable_bittorent_search))
|
||||
@@ -76,7 +79,7 @@
|
||||
$opts->type = (int) ($_REQUEST["t"] ?? 0);
|
||||
$opts->page = (int) ($_REQUEST["p"] ?? 0);
|
||||
|
||||
$opts->theme = $_REQUEST["theme"] ?? trim(htmlspecialchars($_COOKIE["theme"] ?? "amoled"));
|
||||
$opts->theme = $_REQUEST["theme"] ?? trim(htmlspecialchars($_COOKIE["theme"] ?? $opts->default_theme ?? "dark"));
|
||||
|
||||
$opts->safe_search = (int) ($_REQUEST["safe"] ?? 0) == 1 || isset($_COOKIE["safe_search"]);
|
||||
|
||||
|
||||
+8
-5
@@ -38,9 +38,9 @@
|
||||
die();
|
||||
}
|
||||
|
||||
$opts = load_opts();
|
||||
|
||||
require_once "misc/header.php";
|
||||
$opts = load_opts();
|
||||
?>
|
||||
|
||||
<title>LibreY - <?php printtext("settings_title");?></title>
|
||||
@@ -53,7 +53,9 @@
|
||||
<label for="theme"><?php printtext("settings_theme");?>:</label>
|
||||
<select name="theme">
|
||||
<?php
|
||||
$themes = "<option value=\"amoled\">AMOLED</option>
|
||||
$default = $opts->default_theme ?? "dark";
|
||||
$themes = "
|
||||
<option value=\"dark\">Dark</option>
|
||||
<option value=\"darker\">Darker</option>
|
||||
<option value=\"amoled\">AMOLED</option>
|
||||
<option value=\"light\">Light</option>
|
||||
@@ -73,11 +75,12 @@
|
||||
<option value=\"ubuntu\">Ubuntu</option>
|
||||
<option value=\"tokyo_night\">Tokyo Night</option>";
|
||||
|
||||
if (isset($opts->theme)) {
|
||||
$theme = $opts->theme;
|
||||
$themes = str_replace($theme . "\"", $theme . "\" selected", $themes);
|
||||
if (!isset($opts->theme)) {
|
||||
$theme = $default;
|
||||
}
|
||||
|
||||
$theme = $opts->theme;
|
||||
$themes = str_replace($theme . "\"", $theme . "\" selected", $themes);
|
||||
echo $themes;
|
||||
?>
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user