From c9299b5410a55fa867826e389d16a48479a78504 Mon Sep 17 00:00:00 2001
From: Frankie B <git@diskfloppy.me>
Date: Tue, 11 Jun 2024 18:02:01 +0100
Subject: Merge MVC rewrite into master (#21)

* Just commit it all

* Require auth

* crap

* Update homepage

* Block AI scrapers

* Update cache update script

* Add dummy file

* Remove unnecessary lastfm config var

* Use withQueryParameters for LastFM API

* Fix embeds

* Update example env

* Smard
---
 resources/views/admin/bookmarks.blade.php      | 28 ++++++++++++++++++++++
 resources/views/admin/guestbook.blade.php      | 32 ++++++++++++++++++++++++++
 resources/views/admin/import-success.blade.php | 12 ++++++++++
 resources/views/admin/import.blade.php         | 18 +++++++++++++++
 4 files changed, 90 insertions(+)
 create mode 100644 resources/views/admin/bookmarks.blade.php
 create mode 100644 resources/views/admin/guestbook.blade.php
 create mode 100644 resources/views/admin/import-success.blade.php
 create mode 100644 resources/views/admin/import.blade.php

(limited to 'resources/views/admin')

diff --git a/resources/views/admin/bookmarks.blade.php b/resources/views/admin/bookmarks.blade.php
new file mode 100644
index 0000000..f06539c
--- /dev/null
+++ b/resources/views/admin/bookmarks.blade.php
@@ -0,0 +1,28 @@
+<x-layout>
+    <x-slot:title>Admin | Bookmarks</x-slot:title>
+    @foreach($categories as $category)
+        <div class="info-section info-admin-section">
+            <h2>{{ $category->name }}</h2>
+            <table class="info-admin">
+                <tr>
+                    <th>ID</th>
+                    <th>Name</th>
+                    <th>Description</th>
+                    <th>URL</th>
+                    <th>Priority</th>
+                    <th class="blank"></th>
+                </tr>
+                @foreach($category->sites as $site)
+                    <tr>
+                        <td>{{ $site->id }}</td>
+                        <td>{{ $site->name }}</td>
+                        <td>{{ $site->description }}</td>
+                        <td>{{ $site->url }}</td>
+                        <td>{{ $site->priority }}</td>
+                        <td><a href="?action=delete&id={{ $site->id }}"><button>Delete</button></a></td>
+                    </tr>
+                @endforeach
+            </table>
+        </div>
+    @endforeach
+</x-layout>
diff --git a/resources/views/admin/guestbook.blade.php b/resources/views/admin/guestbook.blade.php
new file mode 100644
index 0000000..1f5dab3
--- /dev/null
+++ b/resources/views/admin/guestbook.blade.php
@@ -0,0 +1,32 @@
+<x-layout>
+    <x-slot:title>Admin | Guestbook</x-slot:title>
+    <div class="info-section">
+        <h2>Statistics</h2>
+        <hr>
+        <strong>Unique IP addresses:</strong> {{ $guestbook_unique_addr }}<br>
+        <strong>Entries:</strong> {{ $guestbook_entry_count }}
+    </div>
+    <br>
+    <div class="info-section">
+        <h2>Entries</h2>
+        <hr>
+        <table class="info-admin fullwidth">
+            <tr>
+                <th>ID</th>
+                <th>Name</th>
+                <th>IP Address</th>
+                <th>Message</th>
+                <th class="blank"></th>
+            </tr>
+            @foreach ($entries as $entry)
+                <tr>
+                    <td>{{ $entry->id }}</td>
+                    <td>{{ $entry->name }}</td>
+                    <td>{{ $entry->ip }}</td>
+                    <td>{{ $entry->message }}</td>
+                    <td><a href="?action=delete&id={{ $entry->id }}"><button>Delete</button></a></td>
+                </tr>
+            @endforeach
+        </table>
+    </div>
+</x-layout>
diff --git a/resources/views/admin/import-success.blade.php b/resources/views/admin/import-success.blade.php
new file mode 100644
index 0000000..f6d5eb3
--- /dev/null
+++ b/resources/views/admin/import-success.blade.php
@@ -0,0 +1,12 @@
+<x-layout>
+    <x-slot:title>Admin | Import</x-slot:title>
+    <div class="info-section">
+        <h2>Imported data</h2>
+        <hr>
+        <ul>
+        @foreach($tables as $name => $data)
+            <li><strong>{{ ucwords(str_replace('__', ' ', $name)) }}:</strong> {{ $data['count'] }} record(s)</li>
+        @endforeach
+        </ul>
+    </div>
+</x-layout>
diff --git a/resources/views/admin/import.blade.php b/resources/views/admin/import.blade.php
new file mode 100644
index 0000000..e663724
--- /dev/null
+++ b/resources/views/admin/import.blade.php
@@ -0,0 +1,18 @@
+<x-layout>
+    <x-slot:title>Admin | Import</x-slot:title>
+    <form class="import" action="{{ route('admin.import.submit') }}" method="post" enctype="multipart/form-data">
+        @csrf
+        <label for="data_file"><strong>File:</strong></label>
+        <input class="file" type="file" name="data_file" accept=".json"><br>
+        <h2>What to import:</h2>
+        <input type="checkbox" name="guestbook__entries" checked>
+        <label for="guestbook__entries">Guestbook Entries</label><br>
+        <input type="checkbox" name="guestbook__bans" checked>
+        <label for="guestbook__bans">Guestbook Bans</label><br>
+        <input type="checkbox" name="guestbook__entries" checked>
+        <label for="bookmark__categories">Bookmark Categories</label><br>
+        <input type="checkbox" name="guestbook__entries" checked>
+        <label for="bookmark_sites">Bookmark Sites</label><br>
+        <button type="submit">Import</button>
+    </form>
+</x-layout>
-- 
cgit v1.2.3-54-g00ecf