From a8f43c81352e1acdaa49fe6afc9c98fd952b9be7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B3nio=20Da=20Silva?= <73810823+asilvafx@users.noreply.github.com> Date: Sat, 16 Nov 2024 00:16:04 +0000 Subject: [PATCH] Update Frontend.php --- app/core/models/Frontend.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/core/models/Frontend.php b/app/core/models/Frontend.php index 7e2c920..96671f3 100644 --- a/app/core/models/Frontend.php +++ b/app/core/models/Frontend.php @@ -30,6 +30,23 @@ function SecureDl($f3, $args) exit; } + function Assets($f3, $args) + { + $slug = empty($args[0]) ? '' : $args[0]; + + $file_url = BASE_PATH . '/ui/' . $slug; + if (!file_exists($file_url)) { + $f3->reroute('/'); + } else { + header('Content-Type: application/octet-stream'); + header("Content-Transfer-Encoding: Binary"); + header("Content-disposition: attachment; filename=\"" . basename($file_url) . "\""); + readfile($file_url); + } + exit; + } + + function Public($f3, $args) { $slug = empty($args[0]) ? '' : $args[0];