Add some options in settings page

This commit is contained in:
Knah Tsaeb 2024-07-02 11:50:00 +02:00
parent f4a3500fa1
commit a4d5afaec6
4 changed files with 16 additions and 3 deletions

View file

@ -96,6 +96,8 @@ class App {
$colorScheme = htmlspecialchars($_POST['colorScheme']); $colorScheme = htmlspecialchars($_POST['colorScheme']);
$view = htmlspecialchars($_POST['view']); $view = htmlspecialchars($_POST['view']);
$title = htmlspecialchars($_POST['title']); $title = htmlspecialchars($_POST['title']);
$visibility = htmlspecialchars($_POST['visibility']);
$desc = htmlspecialchars($_POST['desc']);
if (isset($_POST['reimport'])) { if (isset($_POST['reimport'])) {
if (htmlspecialchars($_POST['reimport']) == '1') { if (htmlspecialchars($_POST['reimport']) == '1') {
@ -106,7 +108,9 @@ class App {
$userConfig = [ $userConfig = [
'colorScheme' => $colorScheme, 'colorScheme' => $colorScheme,
'view' => $view, 'view' => $view,
'title' => $title 'title' => $title,
'visibility' => $visibility,
'desc' => $desc
]; ];
$config = Yaml::dump($userConfig); $config = Yaml::dump($userConfig);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 B

View file

@ -11,7 +11,7 @@ $defConfig['title'] = 'KT-HomePage';
$defConfig['desc'] = 'Dashboard de Knah Tsaeb'; $defConfig['desc'] = 'Dashboard de Knah Tsaeb';
$defConfig['favicon'] = 'assets/favicons/favicon-96x96.png'; $defConfig['favicon'] = 'assets/favicons/favicon-96x96.png';
$defConfig['noAuth'] = ['128.0.0.1']; $defConfig['noAuth'] = ['128.0.0.1'];
$defConfig['public'] = false; $defConfig['visibility'] = 'private';
$defConfig['colorScheme'] = 'dark'; $defConfig['colorScheme'] = 'dark';
$defConfig['view'] = 'full'; $defConfig['view'] = 'full';
@ -25,7 +25,7 @@ if (isset($_GET['logout'])) {
exit(); exit();
} }
if ($config['public'] === false) { if ($config['privatvisibility'] === 'private') {
if (!$KTH->canByPassAuth($defConfig['noAuth'])) { if (!$KTH->canByPassAuth($defConfig['noAuth'])) {
if (!Login::isLogged()) { if (!Login::isLogged()) {
if (file_exists('../data/users.yaml')) { if (file_exists('../data/users.yaml')) {

View file

@ -18,6 +18,15 @@ require 'titleBar.php';
<label for="title">Title</label> <label for="title">Title</label>
<input type="text" name="title" id="title" value="<?= $config['title']; ?>"> <input type="text" name="title" id="title" value="<?= $config['title']; ?>">
<label for="desc">Description (meta tag)</label>
<input type="text" name="desc" id="desc" value="<?= $config['desc']; ?>">
<label for="visibility">Visibility</label>
<select name="visibility" id="visibility">
<option value="private" <?= Select::isSelected('private', $config['visibility']); ?>>Private</option>
<option value="public" <?= Select::isSelected('public', $config['visibility']); ?>>Public</option>
</select>
<label for="colorScheme">Color scheme</label> <label for="colorScheme">Color scheme</label>
<select name="colorScheme" id="colorScheme"> <select name="colorScheme" id="colorScheme">
<option value="light" <?= Select::isSelected('light', $config['colorScheme']); ?>>Light</option> <option value="light" <?= Select::isSelected('light', $config['colorScheme']); ?>>Light</option>