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);
+ }
+
}
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', '.*');