})->where('id', '([0-9]+)(-[0-9]+)?')
->whereAlpha('version')
->where('hash', '[0-9a-f]{32}')
- ->withoutMiddleware([CheckIfAdmin::class]);
+ ->withoutMiddleware([CheckIfAdmin::class])
+ ->name('fluidbook_preview');
Route::match(['get'], $segment . '/preview/{version}/{id}_{hash}_{time}/{path?}', function ($version, $id, $hash, $time, $path = 'index.html') use ($segment, $controller) {
return $this->_preview($segment, $version, $id, $hash, $time, $path);
->where('hash', '[0-9a-f]{32}')
->where('path', '.*')
->whereAlpha('version')
- ->withoutMiddleware([CheckIfAdmin::class]);
+ ->withoutMiddleware([CheckIfAdmin::class])
+ ->name('fluidbook_preview_with_time');
$this->_baseRoutes($segment, $controller);
}
public static function socialImagePath($id, $ext = 'jpg')
{
- return Files::mkdir(protected_path('fluidbookpublication/socialimage')) . '/' . $id . '.' . $ext;
+ return Files::mkdir(protected_path('fluidbookpublication/socialimage')) . $id . '.' . $ext;
}
/**
if (!file_exists($lock) || filemtime($lock) < time() - 3600) {
touch($lock);
- $params = ['nointerface' => 1, 'force' => (file_exists($res) && filemtime($res) < $limit) || isset($_GET['forcecompile'])];
- $url = backpack_url('/fluidbook-publication/preview/' . $id . '_' . $fluidbook->hash . '_' . time() . '/', $params);
+ $force = (file_exists($res) && filemtime($res) < $limit) || isset($_GET['forcecompile']);
+ $url = route('fluidbook_preview_with_time', ['version' => 'online', 'id' => $id, 'hash' => $fluidbook->hash, 'time' => time(), 'nointerface' => 1, 'force' => $force ? '1' : '0']);
$w = 1200;
$h = 628;