summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--README.md5
-rw-r--r--public/404.php2
-rw-r--r--src/config.sample.php1
4 files changed, 9 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index c6d12f5..665c2a6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
/.vscode
userdata/
*.db
-config.php \ No newline at end of file
+config.php
+custom_static/ \ No newline at end of file
diff --git a/README.md b/README.md
index a81ae18..6128375 100644
--- a/README.md
+++ b/README.md
@@ -53,6 +53,11 @@ server {
root /www/tinyemotesinstance/public;
index index.php;
+ location ~ ^/static/?(.*)$ {
+ root /www/tinyemotesinstance/public;
+ try_files /custom_static/$1 /static/$1 =404;
+ }
+
location / {
try_files $uri $uri/ /index.php?$query_string;
}
diff --git a/public/404.php b/public/404.php
index 58aa7db..cd7e12e 100644
--- a/public/404.php
+++ b/public/404.php
@@ -31,7 +31,7 @@ $reason = str_safe($_GET["error_reason"] ?? "Not found", 200);
<section style="position: absolute; right: 6px; bottom: 6px;">
<img src="/static/img/404/<?php
- $files = scandir("static/img/404");
+ $files = scandir(INSTANCE_STATIC_FOLDER . "/img/404");
array_splice($files, 0, 2);
echo $files[random_int(0, count($files) - 1)];
?>" alt=""></img>
diff --git a/src/config.sample.php b/src/config.sample.php
index 5962a20..f1c3a45 100644
--- a/src/config.sample.php
+++ b/src/config.sample.php
@@ -1,6 +1,7 @@
<?php
// INSTANCE
define("INSTANCE_NAME", "TinyEmotes");
+define("INSTANCE_STATIC_FOLDER", "static"); // Static folder. Used only in /404.php.
// DATABASE
define("DB_USER", "ENTER_DATABASE_USER"); // Database user. MANDATORY!