]> _ Git - bastide-resah.git/commitdiff
wip #6871 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 18 Apr 2024 14:54:02 +0000 (16:54 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 18 Apr 2024 14:54:02 +0000 (16:54 +0200)
app/Http/Controllers/CatalogController.php
routes/web.php

index 8f25bde2d2db39e8426cbf9b0113a89a5ad378bb..94895e676e2ace29034724baf7fe931674430203 100644 (file)
@@ -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);
+    }
+
 }
index a420db092f3b6d0d67335650ee233663a1c45588..1571c5e45141809ad1cc3355e6978f672c98328d 100644 (file)
@@ -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', '.*');