From e30f1a847895747772e3462e11e0882545052835 Mon Sep 17 00:00:00 2001
From: mctaylors <cantsendmails@mctaylors.ru>
Date: Fri, 15 Mar 2024 00:10:12 +0300
Subject: [PATCH] Add back button, update filename display

Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
---
 assets/common.css         | 5 +++++
 assets/index.css          | 6 ++++++
 assets/svg/arrow_back.svg | 1 +
 index.php                 | 8 +++++---
 4 files changed, 17 insertions(+), 3 deletions(-)
 create mode 100644 assets/svg/arrow_back.svg

diff --git a/assets/common.css b/assets/common.css
index f96c460..1eb1475 100644
--- a/assets/common.css
+++ b/assets/common.css
@@ -52,4 +52,9 @@ a.card {
     text-align: center;
     background-color: #000a;
     backdrop-filter: blur(8px);
+}
+
+img.svg {
+    /* #eee, loss: 0.0 */
+    filter: invert(99%) sepia(4%) saturate(173%) hue-rotate(88deg) brightness(114%) contrast(87%);
 }
\ No newline at end of file
diff --git a/assets/index.css b/assets/index.css
index 75dc2b0..8dcebcf 100644
--- a/assets/index.css
+++ b/assets/index.css
@@ -15,6 +15,12 @@ body {
     border-radius: 12px;
 }
 
+.card > .button {
+    width: 32px;
+    height: 32px;
+    margin: 12px auto;
+}
+
 .content > .title {
     font-weight: bold;
 }
diff --git a/assets/svg/arrow_back.svg b/assets/svg/arrow_back.svg
new file mode 100644
index 0000000..cba0c8b
--- /dev/null
+++ b/assets/svg/arrow_back.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="m313-440 224 224-57 56-320-320 320-320 57 56-224 224h487v80H313Z"/></svg>
\ No newline at end of file
diff --git a/index.php b/index.php
index b874950..ec1b48f 100644
--- a/index.php
+++ b/index.php
@@ -7,14 +7,16 @@
     <meta name="viewport" content="initial-scale=0.75 user-scalable=no" />
 </head>
 <body>
+<a class="card" href="..">
+    <img src="/assets/svg/arrow_back.svg" alt="" class="svg button" />
+</a>
 <?php
-$request_uri = $_SERVER['REQUEST_URI'];
-$filtered_request = urldecode(strtok(substr($request_uri, 1), '?'));
+$filtered_request = urldecode(strtok(substr($_SERVER['REQUEST_URI'], 1), '?'));
 foreach(glob($filtered_request . '*.mp3') as $file) {
     echo '<a class="card" href="/' . $file . '">
         <img src="artwork.jpg" alt="" />
         <div class="content">
-            <span class="title">' . $file . '</span>
+            <span class="title">' . str_replace($filtered_request, '', $file) . '</span>
         </div>
     </a>';
 }