mirror of
https://github.com/Fluffy-Bean/image-gallery.git
synced 2025-06-06 10:23:12 +00:00
Moving to conf.json from manifest.json
This commit is contained in:
parent
3b24876900
commit
b3dbc2cb65
11 changed files with 113 additions and 119 deletions
80
account.php
80
account.php
|
@ -159,8 +159,9 @@
|
||||||
if ($user_info->is_admin($conn, $_SESSION['id'])) {
|
if ($user_info->is_admin($conn, $_SESSION['id'])) {
|
||||||
$sql_start = microtime(true);
|
$sql_start = microtime(true);
|
||||||
?>
|
?>
|
||||||
<div class="defaultDecoration defaultSpacing defaultFonts">
|
<div class="sanity-check defaultDecoration defaultSpacing defaultFonts">
|
||||||
<h2>Admin</h2>
|
<h2>Website</h2>
|
||||||
|
|
||||||
<h3>Invite Codes</h3>
|
<h3>Invite Codes</h3>
|
||||||
<?php
|
<?php
|
||||||
$token_request = mysqli_query($conn, "SELECT * FROM tokens WHERE used = 0");
|
$token_request = mysqli_query($conn, "SELECT * FROM tokens WHERE used = 0");
|
||||||
|
@ -177,8 +178,7 @@
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<br>
|
<br><h3>Admin</h3>
|
||||||
|
|
||||||
<div class="tabs">
|
<div class="tabs">
|
||||||
<button class="btn btn-neutral tablinks" onclick="openTab(event, 'logs')">Logs</button>
|
<button class="btn btn-neutral tablinks" onclick="openTab(event, 'logs')">Logs</button>
|
||||||
<button class="btn btn-neutral tablinks" onclick="openTab(event, 'bans')">Bans</button>
|
<button class="btn btn-neutral tablinks" onclick="openTab(event, 'bans')">Bans</button>
|
||||||
|
@ -378,48 +378,46 @@
|
||||||
evt.currentTarget.className += " active-tab";
|
evt.currentTarget.className += " active-tab";
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="sanity-check defaultDecoration defaultSpacing defaultFonts">
|
<br><h3>Sanity check</h3>
|
||||||
<h2>Sanity check</h2>
|
<?php
|
||||||
<?php
|
$check_sanity = $sanity->get_results();
|
||||||
$check_sanity = $sanity->get_results();
|
|
||||||
|
|
||||||
if (empty($check_sanity)) {
|
if (empty($check_sanity)) {
|
||||||
echo "<p class='alert alert-good'>No errors! Lookin' good :3</p>";
|
echo "<p class='alert alert-good'>No errors! Lookin' good :3</p>";
|
||||||
} else {
|
} else {
|
||||||
?>
|
?>
|
||||||
<style>
|
<style>
|
||||||
.sanity-check {
|
.sanity-check {
|
||||||
border-color: var(--warning);
|
border-color: var(--warning);
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<?php
|
|
||||||
foreach ($check_sanity as $result) {
|
|
||||||
if ($result['type'] == 'critical') {
|
|
||||||
echo "<p class='alert alert-bad'>
|
|
||||||
<img class='svg' src='assets/icons/warning.svg'>
|
|
||||||
".$result['message']."
|
|
||||||
</p>";
|
|
||||||
} elseif ($result['type'] == 'warning') {
|
|
||||||
echo "<p class='alert alert-warning'>
|
|
||||||
<img class='svg' src='assets/icons/warning.svg'>
|
|
||||||
".$result['message']."
|
|
||||||
</p>";
|
|
||||||
} else {
|
|
||||||
echo "<p class='alert alert-warning'>
|
|
||||||
<img class='svg' src='assets/icons/warning.svg'>
|
|
||||||
".$result['message']."
|
|
||||||
</p>";
|
|
||||||
}
|
}
|
||||||
|
</style>
|
||||||
|
<?php
|
||||||
|
foreach ($check_sanity as $result) {
|
||||||
|
if ($result['type'] == 'critical') {
|
||||||
|
echo "<p class='alert alert-bad'>
|
||||||
|
<img class='svg' src='assets/icons/warning.svg'>
|
||||||
|
".$result['message']."
|
||||||
|
</p>";
|
||||||
|
} elseif ($result['type'] == 'warning') {
|
||||||
|
echo "<p class='alert alert-warning'>
|
||||||
|
<img class='svg' src='assets/icons/warning.svg'>
|
||||||
|
".$result['message']."
|
||||||
|
</p>";
|
||||||
|
} else {
|
||||||
|
echo "<p class='alert alert-warning'>
|
||||||
|
<img class='svg' src='assets/icons/warning.svg'>
|
||||||
|
".$result['message']."
|
||||||
|
</p>";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "<br> <button class='btn btn-bad' disabled>
|
|
||||||
<img class='svg' src='assets/icons/wrench.svg'>
|
|
||||||
Attemp Autofix
|
|
||||||
</button>";
|
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
echo "<button class='btn btn-bad' disabled>
|
||||||
|
<img class='svg' src='assets/icons/wrench.svg'>
|
||||||
|
Attempt Autofix
|
||||||
|
</button>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
$sql_end = microtime(true);
|
$sql_end = microtime(true);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"license": "GPL 3.0",
|
"license": "GPL 3.0",
|
||||||
"version": "22.10.20",
|
"version": "22.11.01",
|
||||||
"branch": "main"
|
"branch": "main"
|
||||||
}
|
}
|
26
app/app.php
26
app/app.php
|
@ -378,7 +378,7 @@ class Setup {
|
||||||
mkdir("usr/conf");
|
mkdir("usr/conf");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_file(__DIR__."/../usr/conf/manifest.json")) {
|
if (!is_file(__DIR__."/../usr/conf/conf.json")) {
|
||||||
$manifest = array(
|
$manifest = array(
|
||||||
"website_name" => "Only Legs",
|
"website_name" => "Only Legs",
|
||||||
"website_description" => "A simple PHP gallery with multiple users in mind",
|
"website_description" => "A simple PHP gallery with multiple users in mind",
|
||||||
|
@ -392,7 +392,7 @@ class Setup {
|
||||||
"allowed_extensions" => array("jpg", "jpeg", "png", "webp")
|
"allowed_extensions" => array("jpg", "jpeg", "png", "webp")
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
file_put_contents(__DIR__."/../usr/conf/manifest.json", json_encode($manifest));
|
file_put_contents(__DIR__."/../usr/conf/conf.json", json_encode($manifest));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -402,17 +402,25 @@ class Sanity {
|
||||||
{
|
{
|
||||||
$results = array();
|
$results = array();
|
||||||
|
|
||||||
if (!is_file(__DIR__."/../usr/conf/manifest.json")) {
|
if (!is_file(__DIR__."/../usr/conf/msg.json")) {
|
||||||
$results[] = array('type'=>'critical', 'message'=>'manifest.json is missing');
|
$results[] = array('type'=>'warning', 'message'=>'msg.json is missing');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_file(__DIR__."/../usr/conf/conf.json")) {
|
||||||
|
if (is_file(__DIR__."/../usr/conf/manifest.json")) {
|
||||||
|
$results[] = array('type'=>'critical', 'message'=>'manifest.json is deprecated, please rename it to conf.json');
|
||||||
|
} else {
|
||||||
|
$results[] = array('type'=>'critical', 'message'=>'conf.json is missing, using conf.default.json instead');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$manifest = json_decode(file_get_contents(__DIR__."/../usr/conf/manifest.json"), true);
|
$manifest = json_decode(file_get_contents(__DIR__."/../usr/conf/conf.json"), true);
|
||||||
|
|
||||||
if (empty($manifest['user_name']) || $manifest['user_name'] == "[your name]") {
|
if (empty($manifest['user_name']) || $manifest['user_name'] == "[your name]") {
|
||||||
$results[] = array('type'=>'warning', 'message'=>'manifest.json is missing your name');
|
$results[] = array('type'=>'warning', 'message'=>'conf.json is missing your name');
|
||||||
}
|
}
|
||||||
if ($manifest['upload']['rename_on_upload']) {
|
if ($manifest['upload']['rename_on_upload']) {
|
||||||
if (empty($manifest['upload']['rename_to'])) {
|
if (empty($manifest['upload']['rename_to'])) {
|
||||||
$results[] = array('type'=>'critical', 'message'=>'manifest.json doesnt know what to rename your files to');
|
$results[] = array('type'=>'critical', 'message'=>'conf.json doesnt know what to rename your files to');
|
||||||
} else {
|
} else {
|
||||||
$rename_to = $manifest['upload']['rename_to'];
|
$rename_to = $manifest['upload']['rename_to'];
|
||||||
$rename_rate = 0;
|
$rename_rate = 0;
|
||||||
|
@ -426,9 +434,9 @@ class Sanity {
|
||||||
if (str_contains($rename_to, '{{username}}') || str_contains($rename_to, '{{userid}}')) $rename_rate += 1;
|
if (str_contains($rename_to, '{{username}}') || str_contains($rename_to, '{{userid}}')) $rename_rate += 1;
|
||||||
|
|
||||||
if ($rename_rate < 2) {
|
if ($rename_rate < 2) {
|
||||||
$results[] = array('type'=>'critical', 'message'=>'You will encounter errors when uploading images due to filenames, update your manifest.json');
|
$results[] = array('type'=>'critical', 'message'=>'You will encounter errors when uploading images due to filenames, update your conf.json');
|
||||||
} elseif ($rename_rate < 5 && $rename_rate > 2) {
|
} elseif ($rename_rate < 5 && $rename_rate > 2) {
|
||||||
$results[] = array('type'=>'warning', 'message'=>'You may encounter errors when uploading images due to filenames, concider modifying your manifest.json');
|
$results[] = array('type'=>'warning', 'message'=>'You may encounter errors when uploading images due to filenames, concider modifying your conf.json');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,8 @@ require_once dirname(__DIR__)."/app/conn.php";
|
||||||
require_once dirname(__DIR__)."/app/app.php";
|
require_once dirname(__DIR__)."/app/app.php";
|
||||||
require_once dirname(__DIR__)."/app/settings.php";
|
require_once dirname(__DIR__)."/app/settings.php";
|
||||||
|
|
||||||
ini_set('post_max_size', $upload_conf['max_filesize']."M");
|
ini_set('post_max_size', $upload_conf['max_filesize']);
|
||||||
ini_set('upload_max_filesize', ($upload_conf['upload_max'] + 1)."M");
|
ini_set('upload_max_filesize', $upload_conf['max_filesize']);
|
||||||
|
|
||||||
if ($user_settings['is_testing']) {
|
if ($user_settings['is_testing']) {
|
||||||
ini_set('display_errors', 1);
|
ini_set('display_errors', 1);
|
||||||
|
|
|
@ -8,7 +8,22 @@
|
||||||
| the default background and accent colour
|
| the default background and accent colour
|
||||||
|-------------------------------------------------------------
|
|-------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
$user_settings = json_decode(file_get_contents(__DIR__."/../usr/conf/manifest.json"), true);
|
$user_settings = json_decode(file_get_contents(__DIR__."/../usr/conf/conf.json"), true);
|
||||||
|
|
||||||
|
if (!is_file(__DIR__."/../usr/conf/conf.json")) {
|
||||||
|
$settings = json_decode(file_get_contents(__DIR__."/../usr/conf/conf.json"), true);
|
||||||
|
} else {
|
||||||
|
$settings = json_decode(file_get_contents(__DIR__."/../usr/conf.default.json"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_file(__DIR__."/../usr/conf/msg.json")) {
|
||||||
|
$user_welcome = json_decode(file_get_contents(__DIR__."/../usr/conf/msg.json"), true);
|
||||||
|
$user_welcome = $user_welcome['welcome'];
|
||||||
|
} else {
|
||||||
|
$user_welcome = array('Welcome to your new Only Legs installation! You can change this message in the settings page.');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$web_info = json_decode(file_get_contents(__DIR__."/app.json"), true);
|
$web_info = json_decode(file_get_contents(__DIR__."/app.json"), true);
|
||||||
|
|
||||||
$upload_conf = $user_settings["upload"];
|
$upload_conf = $user_settings["upload"];
|
19
css/main.css
19
css/main.css
|
@ -114,8 +114,6 @@ nav .btn {
|
||||||
@media (max-width: 550px) {
|
@media (max-width: 550px) {
|
||||||
nav {
|
nav {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
width: calc(100% - 1rem);
|
|
||||||
height: 2.5rem;
|
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: auto;
|
top: auto;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
@ -542,6 +540,7 @@ nav .btn {
|
||||||
|
|
||||||
.group-name {
|
.group-name {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
max-width: 90%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
|
@ -553,6 +552,8 @@ nav .btn {
|
||||||
font-family: "Secular One", sans-serif;
|
font-family: "Secular One", sans-serif;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gallery-group {
|
.gallery-group {
|
||||||
|
@ -585,6 +586,7 @@ nav .btn {
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
flex: 1 0 150px;
|
flex: 1 0 150px;
|
||||||
|
text-overflow: ellipsis;
|
||||||
transition: outline 0.1s cubic-bezier(0.19, 1, 0.22, 1);
|
transition: outline 0.1s cubic-bezier(0.19, 1, 0.22, 1);
|
||||||
}
|
}
|
||||||
.group-make:hover {
|
.group-make:hover {
|
||||||
|
@ -620,7 +622,9 @@ nav .btn {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.group-make button span {
|
.group-make button span {
|
||||||
|
max-width: 90%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
.group-make button img {
|
.group-make button img {
|
||||||
margin: 0.25rem;
|
margin: 0.25rem;
|
||||||
|
@ -628,16 +632,9 @@ nav .btn {
|
||||||
height: 2.5rem;
|
height: 2.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 800px) {
|
|
||||||
.group-make {
|
|
||||||
max-width: calc(25% - 0.5rem);
|
|
||||||
min-width: calc(25% - 0.5rem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@media (max-width: 550px) {
|
@media (max-width: 550px) {
|
||||||
.group-make {
|
.group-make > button > span {
|
||||||
max-width: calc(33.33% - 0.5rem);
|
display: none;
|
||||||
min-width: calc(33.33% - 0.5rem);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -481,6 +481,8 @@
|
||||||
.group-name {
|
.group-name {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
||||||
|
max-width: 90%;
|
||||||
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
|
@ -495,6 +497,9 @@
|
||||||
font-family: $font-body;
|
font-family: $font-body;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
|
||||||
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gallery-group {
|
.gallery-group {
|
||||||
|
@ -540,6 +545,8 @@
|
||||||
|
|
||||||
flex: 1 0 150px;
|
flex: 1 0 150px;
|
||||||
|
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
|
||||||
transition: outline 0.1s cubic-bezier(.19, 1, .22, 1);
|
transition: outline 0.1s cubic-bezier(.19, 1, .22, 1);
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
|
@ -587,7 +594,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
span {
|
span {
|
||||||
|
max-width: 90%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
img {
|
img {
|
||||||
|
@ -598,16 +607,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@media (max-width: 800px) {
|
|
||||||
.group-make {
|
|
||||||
max-width: calc(25% - 0.5rem);
|
|
||||||
min-width: calc(25% - 0.5rem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@media (max-width: 550px) {
|
@media (max-width: 550px) {
|
||||||
.group-make {
|
.group-make > button > span {
|
||||||
max-width: calc(33.33% - 0.5rem);
|
display: none;
|
||||||
min-width: calc(33.33% - 0.5rem);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -85,9 +85,6 @@ nav {
|
||||||
nav {
|
nav {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
||||||
width: calc(100% - 1rem);
|
|
||||||
height: 2.5rem;
|
|
||||||
|
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: auto;
|
top: auto;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
|
|
@ -95,9 +95,8 @@
|
||||||
echo "<h1>".$time_welc."!</h1>";
|
echo "<h1>".$time_welc."!</h1>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Random welcome message
|
// Random welcome message
|
||||||
$welcome_message = $user_settings['welcome_msg'];
|
echo "<p>".$user_welcome[array_rand($user_welcome, 1)]."</p>";
|
||||||
echo "<p>".$welcome_message[array_rand($welcome_message, 1)]."</p>";
|
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
|
17
usr/conf.default.json
Normal file
17
usr/conf.default.json
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"website_name": "Only Legs",
|
||||||
|
"website_description": "A simple PHP gallery with multiple users in mind",
|
||||||
|
"user_name": "[your name]",
|
||||||
|
"is_testing": true,
|
||||||
|
"upload": {
|
||||||
|
"max_filesize": "32M",
|
||||||
|
"rename_on_upload": true,
|
||||||
|
"rename_to": "IMG_{{username}}_{{time}}",
|
||||||
|
"allowed_extentions": [
|
||||||
|
"jpg",
|
||||||
|
"jpeg",
|
||||||
|
"png",
|
||||||
|
"webp"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,39 +0,0 @@
|
||||||
{
|
|
||||||
"website_name": "Only Legs",
|
|
||||||
"website_description": "A simple PHP gallery with multiple users in mind",
|
|
||||||
"welcome_msg": [
|
|
||||||
"*internal screaming*",
|
|
||||||
"Don't forget to drink water!",
|
|
||||||
"Bruh",
|
|
||||||
"Fluffy made this!",
|
|
||||||
"maybe",
|
|
||||||
"I'm gay",
|
|
||||||
"I wish we were better strangers.",
|
|
||||||
"<span style='color:#ffff00;'>Just like Minecraft!</span>",
|
|
||||||
"If I were you, I'd run now",
|
|
||||||
"This is the part where I kill you",
|
|
||||||
"SILICA GEL \"DO NOT EAT\".",
|
|
||||||
"This was supposed to be a simple project",
|
|
||||||
"AAAAAAAAAAAAAAAAAAAA",
|
|
||||||
"Let me out",
|
|
||||||
"nice",
|
|
||||||
"I'm glad you're here",
|
|
||||||
"The weather is dry",
|
|
||||||
"Need me a man 👀",
|
|
||||||
"Gods die too.",
|
|
||||||
"Eat hotchip and lie"
|
|
||||||
],
|
|
||||||
"user_name": "[your name]",
|
|
||||||
"is_testing": true,
|
|
||||||
"upload": {
|
|
||||||
"max_filesize": "32",
|
|
||||||
"rename_on_upload": true,
|
|
||||||
"rename_to": "IMG_{{username}}_{{time}}",
|
|
||||||
"allowed_extentions": [
|
|
||||||
"jpg",
|
|
||||||
"jpeg",
|
|
||||||
"png",
|
|
||||||
"webp"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue