diff --git a/admin/index.php b/admin/index.php index 103e276..c941729 100644 --- a/admin/index.php +++ b/admin/index.php @@ -8,6 +8,6 @@
- + \ No newline at end of file diff --git a/api/recive_all.php b/api/recive_all.php index bc0ac80..aeb01a8 100644 --- a/api/recive_all.php +++ b/api/recive_all.php @@ -4,6 +4,6 @@ $mediaDir = __DIR__ . '/../medias/'; $files = array_diff(scandir($mediaDir), ['.', '..']); - +shuffle($files); echo json_encode(['success' => true, 'files' => array_values($files)]); ?> diff --git a/scripts/admin.js b/scripts/admin.js index f9cd6e2..a13a067 100644 --- a/scripts/admin.js +++ b/scripts/admin.js @@ -3,6 +3,7 @@ document.addEventListener('DOMContentLoaded', () => { const basePath = ".." const apiPath = `${basePath}/api/recive_all.php`; const mediaPath = `${basePath}/medias/`; + function fetchMedias() { fetch(apiPath) @@ -28,5 +29,6 @@ document.addEventListener('DOMContentLoaded', () => { .catch(error => console.error('Stupid error :', error)); } + fetchMedias(); });