From: Vincent Vanwaelscappel Date: Thu, 18 Apr 2024 14:54:02 +0000 (+0200) Subject: wip #6871 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=e8a96a383922683b8c8beabf15dc16e16b9e2316;p=bastide-resah.git wip #6871 @0.5 --- diff --git a/app/Http/Controllers/CatalogController.php b/app/Http/Controllers/CatalogController.php index 8f25bde..94895e6 100644 --- a/app/Http/Controllers/CatalogController.php +++ b/app/Http/Controllers/CatalogController.php @@ -2,20 +2,30 @@ namespace App\Http\Controllers; -use App\Fluidbook\Compiler\Compiler; -use App\Models\FluidbookHealthIssues; use Cubist\Backpack\Http\Controllers\Base\XSendFileController; use Cubist\Util\PHP; class CatalogController extends Controller { - public function index($path = 'index.html') + public function index($path = '', $forceGuest = false) { PHP::neverStop(false); + if (!$path && !str_ends_with($_SERVER['REQUEST_URI'], '/')) { + return redirect($_SERVER['REQUEST_URI'] . '/index.html'); + } + if (!$path) { + $path = 'index.html'; + } - $cpath = auth()->guest() ? 'fluidbooks/catalogue_invite' : 'fluidbooks/catalogue'; + $cpath = $forceGuest || auth()->guest() ? 'fluidbooks/catalogue_invite' : 'fluidbooks/catalogue'; $relayPath = base_path($cpath) . '/' . $path; return XSendFileController::sendfile($relayPath); } + + public function guest($path = '') + { + return $this->index($path, true); + } + } diff --git a/routes/web.php b/routes/web.php index a420db0..1571c5e 100644 --- a/routes/web.php +++ b/routes/web.php @@ -3,3 +3,4 @@ use Illuminate\Support\Facades\Route; Route::get('/catalogue/{path?}', \App\Http\Controllers\CatalogController::class . '@index')->where('path', '.*'); +Route::get('/catalogue_invite/{path?}', \App\Http\Controllers\CatalogController::class . '@guest')->where('path', '.*');