Adding autofix badges
Profile picture shows up in Nav Moved backgrounds to new folder
|
@ -117,6 +117,8 @@
|
|||
object-fit: contain;
|
||||
|
||||
background-color: #15151533;
|
||||
|
||||
border-radius: var(--rad);
|
||||
}
|
||||
/*
|
||||
Notification header
|
||||
|
|
35
account.php
|
@ -396,19 +396,32 @@
|
|||
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>";
|
||||
<img class='svg' src='assets/icons/warning.svg'>
|
||||
".$result['message'];
|
||||
|
||||
if (isset($result['link'])) echo " <a class='link' href='".$result['link']."'>Link</a>";
|
||||
|
||||
if ($result['fix'] == 'auto') {
|
||||
echo "<span class='badge badge-primary'>Auto fix available</span>";
|
||||
} elseif ($result['fix'] == 'manual') {
|
||||
echo "<span class='badge badge-critical'>Manual fix required</span>";
|
||||
}
|
||||
|
||||
echo "</p>";
|
||||
} else {
|
||||
echo "<p class='alert alert-warning'>
|
||||
<img class='svg' src='assets/icons/warning.svg'>
|
||||
".$result['message']."
|
||||
</p>";
|
||||
<img class='svg' src='assets/icons/warning.svg'>
|
||||
".$result['message'];
|
||||
|
||||
if (isset($result['link'])) echo " <a class='link' href='".$result['link']."'>Link</a>";
|
||||
|
||||
if ($result['fix'] == 'auto') {
|
||||
echo "<span class='badge badge-primary'>Auto fix available</span>";
|
||||
} elseif ($result['fix'] == 'manual') {
|
||||
echo "<span class='badge badge-critical'>Manual fix required</span>";
|
||||
}
|
||||
|
||||
echo "</p>";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
72
app/app.php
|
@ -433,24 +433,24 @@ class Sanity {
|
|||
$results = array();
|
||||
|
||||
if (!is_file(__DIR__."/../usr/conf/msg.json")) {
|
||||
$results[] = array('type'=>'warning', 'message'=>'msg.json is missing');
|
||||
$results[] = array('type'=>'warning', 'message'=>'msg.json is missing', 'fix'=>'auto');
|
||||
}
|
||||
|
||||
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');
|
||||
$results[] = array('type'=>'critical', 'message'=>'manifest.json is deprecated, please rename it to conf.json', 'fix'=>'manual');
|
||||
} else {
|
||||
$results[] = array('type'=>'critical', 'message'=>'conf.json is missing, using conf.default.json instead');
|
||||
$results[] = array('type'=>'critical', 'message'=>'conf.json is missing, using conf.default.json instead', 'fix'=>'auto');
|
||||
}
|
||||
} else {
|
||||
$manifest = json_decode(file_get_contents(__DIR__."/../usr/conf/conf.json"), true);
|
||||
|
||||
if (empty($manifest['user_name']) || $manifest['user_name'] == "[your name]") {
|
||||
$results[] = array('type'=>'warning', 'message'=>'conf.json is missing your name');
|
||||
$results[] = array('type'=>'warning', 'message'=>'conf.json is missing your name', 'fix'=>'manual');
|
||||
}
|
||||
if ($manifest['upload']['rename_on_upload']) {
|
||||
if (empty($manifest['upload']['rename_to'])) {
|
||||
$results[] = array('type'=>'critical', 'message'=>'conf.json doesnt know what to rename your files to');
|
||||
$results[] = array('type'=>'critical', 'message'=>'conf.json doesnt know what to rename your files to', 'fix'=>'manual');
|
||||
} else {
|
||||
$rename_to = $manifest['upload']['rename_to'];
|
||||
$rename_rate = 0;
|
||||
|
@ -464,15 +464,15 @@ class Sanity {
|
|||
if (str_contains($rename_to, '{{username}}') || str_contains($rename_to, '{{userid}}')) $rename_rate += 1;
|
||||
|
||||
if ($rename_rate < 2) {
|
||||
$results[] = array('type'=>'critical', 'message'=>'You will encounter errors when uploading images due to filenames, update your conf.json');
|
||||
$results[] = array('type'=>'critical', 'message'=>'You will encounter errors when uploading images due to filenames, update your conf.json', 'fix'=>'manual');
|
||||
} 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 conf.json');
|
||||
$results[] = array('type'=>'warning', 'message'=>'You may encounter errors when uploading images due to filenames, concider modifying your conf.json', 'fix'=>'manual');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($manifest['is_testing']) {
|
||||
$results[] = array('type'=>'warning', 'message'=>'You are currently in testing mode, errors will be displayed to the user');
|
||||
$results[] = array('type'=>'warning', 'message'=>'You are currently in testing mode, errors will be displayed to the user. This is not recommended for production use.');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -484,16 +484,16 @@ class Sanity {
|
|||
$results = array();
|
||||
|
||||
if (!is_dir("usr/images")) {
|
||||
$results[] = array('type'=>'critical', 'message'=>'You need to setup an images folder, follow the guide on the GitHub repo');
|
||||
$results[] = array('type'=>'critical', 'message'=>'You need to setup an images folder.', 'fix'=>'auto');
|
||||
}
|
||||
if (!is_dir("usr/images/pfp")) {
|
||||
$results[] = array('type'=>'critical', 'message'=>'You need to setup an pfp folder, follow the guide on the GitHub repo');
|
||||
$results[] = array('type'=>'critical', 'message'=>'You need to setup an pfp folder.', 'fix'=>'auto');
|
||||
}
|
||||
if (!is_dir("usr/images/previews")) {
|
||||
$results[] = array('type'=>'critical', 'message'=>'You need to setup an previews folder, follow the guide on the GitHub repo');
|
||||
$results[] = array('type'=>'critical', 'message'=>'You need to setup an previews folder.', 'fix'=>'auto');
|
||||
}
|
||||
if (!is_dir("usr/images/thumbnails")) {
|
||||
$results[] = array('type'=>'critical', 'message'=>'You need to setup an thumbnails folder, follow the guide on the GitHub repo');
|
||||
$results[] = array('type'=>'critical', 'message'=>'You need to setup an thumbnails folder.', 'fix'=>'auto');
|
||||
}
|
||||
|
||||
return $results;
|
||||
|
@ -502,8 +502,11 @@ class Sanity {
|
|||
function check_version(): array
|
||||
{
|
||||
$results = array();
|
||||
$app_local = json_decode(file_get_contents(__DIR__."/app.json"), true);
|
||||
|
||||
// Local app info
|
||||
$app_local = json_decode(file_get_contents(__DIR__."/gallery.json"), true);
|
||||
|
||||
// Repo app info
|
||||
$curl_url = "https://raw.githubusercontent.com/Fluffy-Bean/image-gallery/".$app_local['branch']."/app/settings/manifest.json";
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
|
@ -514,13 +517,44 @@ class Sanity {
|
|||
$app_repo = json_decode($result, true);
|
||||
|
||||
if ($app_local['version'] < $app_repo['version']) {
|
||||
$results[] = array('type'=>'critical', 'message'=>'You are not running the latest version of the app v'.$app_repo['version']);
|
||||
$results[] = array('type'=>'critical', 'message'=>'You are not running the latest version of the app v'.$app_repo['version'], 'fix'=>'manual');
|
||||
} elseif ($app_local['version'] > $app_repo['version']) {
|
||||
$results[] = array('type'=>'critical', 'message'=>'You are running a version of the app that is newer than the latest release v'.$app_repo['version']);
|
||||
$results[] = array('type'=>'critical', 'message'=>'You are running a version of the app that is newer than the latest release v'.$app_repo['version'], 'fix'=>'manual');
|
||||
}
|
||||
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
$results[] = array('type'=>'warning', 'message'=>'Your current version of PHP is '.PHP_VERSION.' The reccomended version is 8.0.0 or higher');
|
||||
$results[] = array('type'=>'warning', 'message'=>'Your current version of PHP is '.PHP_VERSION.' The reccomended version is 8.0.0 or higher', 'link'=>'https://www.php.net/downloads.php');
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
function check_permissions(): array
|
||||
{
|
||||
$results = array();
|
||||
|
||||
if (!is_writable("usr/images")) {
|
||||
$results[] = array('type'=>'critical', 'message'=>'You need to make the images folder writable', 'fix'=>'manual');
|
||||
}
|
||||
if (!is_writable("usr/images/pfp")) {
|
||||
$results[] = array('type'=>'critical', 'message'=>'You need to make the pfp folder writable', 'fix'=>'manual');
|
||||
}
|
||||
if (!is_writable("usr/images/previews")) {
|
||||
$results[] = array('type'=>'critical', 'message'=>'You need to make the previews folder writable', 'fix'=>'manual');
|
||||
}
|
||||
if (!is_writable("usr/images/thumbnails")) {
|
||||
$results[] = array('type'=>'critical', 'message'=>'You need to make the thumbnails folder writable', 'fix'=>'manual');
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
function check_freshinstall(): array
|
||||
{
|
||||
$results = array();
|
||||
|
||||
if (!is_dir("usr/conf") && !is_dir("usr/images")) {
|
||||
$results[] = array('type'=>'warning', 'message'=>'You are running a fresh install, please configure your app through the settings. Alternatively you can import usr folder from a previous install', 'fix'=>'manual');
|
||||
}
|
||||
|
||||
return $results;
|
||||
|
@ -536,9 +570,15 @@ class Sanity {
|
|||
foreach ($this->check_files() as $result) {
|
||||
$results[] = $result;
|
||||
}
|
||||
foreach ($this->check_permissions() as $result) {
|
||||
$results[] = $result;
|
||||
}
|
||||
foreach ($this->check_version() as $result) {
|
||||
$results[] = $result;
|
||||
}
|
||||
foreach ($this->check_freshinstall() as $result) {
|
||||
$results[] = $result;
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"license": "GPL 3.0",
|
||||
"version": "22.11.01",
|
||||
"version": "22.11.02",
|
||||
"branch": "main"
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
$exec_start = microtime(true);
|
||||
$exec_start = microtime(true); // Track how long it took to generate the page
|
||||
|
||||
require_once dirname(__DIR__)."/app/conn.php";
|
||||
require_once dirname(__DIR__)."/app/app.php";
|
||||
|
|
|
@ -19,4 +19,4 @@ if (is_file(__DIR__."/../usr/conf/msg.json")) {
|
|||
$user_welcome = $user_welcome['welcome'];
|
||||
}
|
||||
|
||||
$web_info = json_decode(file_get_contents(__DIR__."/app.json"), true);
|
||||
$web_info = json_decode(file_get_contents(__DIR__."/gallery.json"), true);
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
|
@ -16,11 +16,18 @@ $loggedin = new Account();
|
|||
<hr>
|
||||
<?php
|
||||
if ($_SESSION["loggedin"]) {
|
||||
$profile_info = $user_info->get_user_info($conn, $_SESSION['id']);
|
||||
|
||||
?>
|
||||
<a class='btn' href='upload.php'><img class='svg' src='assets/icons/upload.svg'><span class='nav-hide'>Upload</span></a>
|
||||
<hr>
|
||||
<a class='btn' href='account.php'><img class='svg' src='assets/icons/gear.svg'><span class='nav-hide'><?php echo substr($_SESSION["username"], 0, 15); ?></span></a>
|
||||
<?php
|
||||
|
||||
if (is_file("usr/images/pfp/".$profile_info['pfp_path'])) {
|
||||
echo "<a class='btn' href='account.php'><img class='svg' src='usr/images/pfp/".$profile_info['pfp_path']."'><span class='nav-hide'>".substr($_SESSION["username"], 0, 15)."</span></a>";
|
||||
} else {
|
||||
echo "<a class='btn' href='account.php'><img class='svg' src='assets/icons/gear.svg'><span class='nav-hide'>".substr($_SESSION["username"], 0, 15)."</span></a>";
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<a class='btn' href='account.php'><img class='svg' src='assets/icons/sign-in.svg'><span class='nav-hide'>Login</span></a>
|
||||
|
|
41
css/main.css
|
@ -114,6 +114,7 @@ nav .btn {
|
|||
@media (max-width: 550px) {
|
||||
nav {
|
||||
margin: 0;
|
||||
padding-bottom: 1rem;
|
||||
position: fixed;
|
||||
top: auto;
|
||||
bottom: 0;
|
||||
|
@ -990,7 +991,7 @@ html {
|
|||
max-width: 100vw;
|
||||
position: relative;
|
||||
background-color: #151515;
|
||||
background-image: url("../assets/bg.svg");
|
||||
background-image: url("../assets/backgrounds/bg.svg");
|
||||
background-position: center;
|
||||
background-size: cover;
|
||||
background-repeat: no-repeat;
|
||||
|
@ -1127,6 +1128,39 @@ a.btn {
|
|||
background-image: linear-gradient(to right, rgba(140, 151, 125, 0.3), rgba(21, 21, 21, 0));
|
||||
}
|
||||
|
||||
/*
|
||||
|-------------------------------------------------------------
|
||||
| BADGES
|
||||
|-------------------------------------------------------------
|
||||
*/
|
||||
.badge {
|
||||
display: inline-block;
|
||||
box-sizing: border-box;
|
||||
margin: 0 0.25rem;
|
||||
padding: 0.2em 0.4em;
|
||||
border: #121212 0.2rem solid;
|
||||
border-radius: 0.4rem;
|
||||
color: #E8E3E3;
|
||||
font-size: 0.8em;
|
||||
font-weight: bold;
|
||||
line-height: 1;
|
||||
vertical-align: baseline;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
}
|
||||
.badge.badge-primary {
|
||||
background: rgba(140, 151, 125, 0.3);
|
||||
border: #8C977D 0.2rem solid;
|
||||
}
|
||||
.badge.badge-critical {
|
||||
background: rgba(182, 100, 103, 0.3);
|
||||
border: #B66467 0.2rem solid;
|
||||
}
|
||||
.badge.badge-warning {
|
||||
background: rgba(216, 166, 87, 0.3);
|
||||
border: #D8A657 0.2rem solid;
|
||||
}
|
||||
|
||||
/*
|
||||
|-------------------------------------------------------------
|
||||
| FORM SIZING
|
||||
|
@ -1151,10 +1185,11 @@ textarea {
|
|||
*/
|
||||
.svg {
|
||||
margin: 0 0.2rem 0.1rem 0;
|
||||
width: 19px;
|
||||
height: 18px;
|
||||
width: 1.15rem;
|
||||
height: 1.1rem;
|
||||
vertical-align: middle;
|
||||
display: inline;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -29,7 +29,7 @@ html {
|
|||
position: relative;
|
||||
|
||||
background-color: $bg;
|
||||
background-image: url("../assets/bg.svg");
|
||||
background-image: url("../assets/backgrounds/bg.svg");
|
||||
|
||||
background-position: center;
|
||||
background-size: cover;
|
||||
|
@ -196,6 +196,48 @@ a.btn {
|
|||
background-image: linear-gradient(to right, rgba($page-accent, 0.3), rgba($bg, 0));
|
||||
}
|
||||
|
||||
/*
|
||||
|-------------------------------------------------------------
|
||||
| BADGES
|
||||
|-------------------------------------------------------------
|
||||
*/
|
||||
@mixin badge($color, $fg: $color) {
|
||||
background: rgba($color, 0.3);
|
||||
border: $color $border-thickness solid;
|
||||
}
|
||||
|
||||
.badge {
|
||||
display: inline-block;
|
||||
box-sizing: border-box;
|
||||
margin: 0 0.25rem;
|
||||
padding: 0.2em 0.4em;
|
||||
border: $black $border-thickness solid;
|
||||
@if $rad <= 0 {
|
||||
border-radius: 3px;
|
||||
} @else {
|
||||
border-radius: $rad;
|
||||
}
|
||||
color: $fg;
|
||||
font-size: 0.8em;
|
||||
font-weight: bold;
|
||||
line-height: 1;
|
||||
vertical-align: baseline;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
|
||||
&.badge-primary {
|
||||
@include badge($page-accent);
|
||||
}
|
||||
|
||||
&.badge-critical {
|
||||
@include badge($red);
|
||||
}
|
||||
|
||||
&.badge-warning {
|
||||
@include badge($orange);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|-------------------------------------------------------------
|
||||
| FORM SIZING
|
||||
|
@ -221,12 +263,18 @@ textarea {
|
|||
.svg {
|
||||
margin: 0 0.2rem 0.1rem 0;
|
||||
|
||||
width: 19px;
|
||||
height: 18px;
|
||||
width: 1.15rem;
|
||||
height: 1.1rem;
|
||||
|
||||
vertical-align: middle;
|
||||
|
||||
display: inline;
|
||||
|
||||
@if calc($rad - 0.5rem) > 0 {
|
||||
border-radius: calc($rad - 0.5rem);
|
||||
} @else {
|
||||
border-radius: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -84,6 +84,7 @@ nav {
|
|||
@media (max-width: 550px) {
|
||||
nav {
|
||||
margin: 0;
|
||||
padding-bottom: 1rem;
|
||||
|
||||
position: fixed;
|
||||
top: auto;
|
||||
|
|