Skip to content

A self-hosted media server and file management system

prevent history requests when not logged in

aminnausin1abb5836a037
diff --git a/public/js/main.js b/public/js/main.js
index 0f92d940..ed928aa8 100644
--- a/public/js/main.js
+++ b/public/js/main.js
@@ -127,7 +127,8 @@ function cycleSideBar(state){
//#endregion
-async function loadHistory(limit = 30){
+async function loadHistory(limit = 10){
+ if(!user) return;
const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
fetch(`/api/records?limit=${limit}`, {
method: 'get',
@@ -150,6 +151,7 @@ async function loadHistory(limit = 30){
}
async function addToHistory(id){
+ if(!user) return;
const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
fetch(`/api/records`, {
diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php
index b20b6c03..08f1ff2a 100644
--- a/resources/views/home.blade.php
+++ b/resources/views/home.blade.php
@@ -4,6 +4,11 @@
var stateVideoDirectory = <?php echo json_encode($dir ?? 'anime') ?>;
var stateFolderName = <?php echo json_encode($folder_name ?? 'ODDTAXI') ?>;
</script>
+ @auth
+ <script>var user = true;</script>
+ @else
+ <script>var user = false;</script>
+ @endauth
<div class=" hidden p-6 max-w-sm mx-auto bg-white rounded-xl shadow-lg flex items-center space-x-4">
<div class="shrink-0">
<img class="h-12 w-12" src="storage/avatars/12345.jpg" alt="ChitChat Logo">