From: Vincent Vanwaelscappel Date: Fri, 27 Feb 2026 14:49:11 +0000 (+0100) Subject: wip #7868 @2 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=ce101d25c6719639f1d42ee0b332ca44932add35;p=fluidbook-toolbox.git wip #7868 @2 --- diff --git a/.docker/fluidbook-workshop/html/.htaccess b/.docker/fluidbook-workshop/html/.htaccess index bfc83ca5e..8e28dcf44 100644 --- a/.docker/fluidbook-workshop/html/.htaccess +++ b/.docker/fluidbook-workshop/html/.htaccess @@ -5,6 +5,7 @@ Options +FollowSymlinks RewriteBase / RewriteRule ^viewerh/(.+)$ https://toolbox.fluidbook.com/fluidbook-publication/preview/$1 [R=308,L] + RewriteRule ^viewer/(.+)$ https://toolbox.fluidbook.com/fluidbook-publication/preview/$1 [R=308,L] RewriteRule ^viewers/(.+)$ https://toolbox.fluidbook.com/fluidbook-publication/preview/scorm/$1 [R=308,L] RewriteRule ^publications$ https://toolbox.fluidbook.com/fluidbook-publication/ [R=308,L] diff --git a/app/Console/Commands/HemsleyEnableLinkShortener.php b/app/Console/Commands/HemsleyEnableLinkShortener.php new file mode 100644 index 000000000..d98cb4b32 --- /dev/null +++ b/app/Console/Commands/HemsleyEnableLinkShortener.php @@ -0,0 +1,24 @@ +orderBy('id', 'ASC')->get(); + foreach ($fluidbooks as $fb) { + $fb->linkShortener = 3; + $fb->saveQuietly(); + } + + AuditLinkRegister::dispatchSync(); + } +} diff --git a/app/Http/Controllers/Admin/Operations/FluidbookCollection/AuditLinksOperation.php b/app/Http/Controllers/Admin/Operations/FluidbookCollection/AuditLinksOperation.php index 60e64c1e1..0ca3755bb 100644 --- a/app/Http/Controllers/Admin/Operations/FluidbookCollection/AuditLinksOperation.php +++ b/app/Http/Controllers/Admin/Operations/FluidbookCollection/AuditLinksOperation.php @@ -269,6 +269,7 @@ trait AuditLinksOperation 500 => __('There is a problem on the server. This should be temporary'), 502 => __('There is a problem on the server. This should be temporary'), 503 => __('There is a problem on the server. This should be temporary'), + 601 => __('There was too many redirection. This could be due a redirection infinite loop'), 628 => __('The auditing tool was blocked by CloudFlare DDOS Protection. Please check manually'), 603 => __('The auditing tool was blocked by CloudFlare DDOS Protection. Please check manually'), 695 => __('There is a problem with the SSL certificate. The auditing tool could not check if the URL is valid or not. Please check manually'), diff --git a/app/Http/Controllers/Admin/Operations/FluidbookPublication/DownloadOperation.php b/app/Http/Controllers/Admin/Operations/FluidbookPublication/DownloadOperation.php index 40e897d53..a5b39066a 100644 --- a/app/Http/Controllers/Admin/Operations/FluidbookPublication/DownloadOperation.php +++ b/app/Http/Controllers/Admin/Operations/FluidbookPublication/DownloadOperation.php @@ -28,7 +28,9 @@ trait DownloadOperation protected function setupDownloadDefaults() { - $this->crud->addButtonFromView('line', 'download', 'fluidbook_publication.download', 'end'); + if (backpack_user() !== null && backpack_user()->company != 1880) { + $this->crud->addButtonFromView('line', 'download', 'fluidbook_publication.download', 'end'); + } } protected function delivery($id) diff --git a/app/Jobs/AuditLinkRegister.php b/app/Jobs/AuditLinkRegister.php index eaa1adafb..941ca5c85 100644 --- a/app/Jobs/AuditLinkRegister.php +++ b/app/Jobs/AuditLinkRegister.php @@ -6,6 +6,7 @@ use App\Fluidbook\Link\LinksData; use App\Models\FluidbookAuditLink; use App\Models\FluidbookPublication; use App\Models\FluidbookCollection; +use App\Models\LinkShortener; use App\Models\ShortLink; use Fluidbook\Tools\Links\Link as LinkAlias; use Illuminate\Support\Arr; @@ -28,11 +29,14 @@ class AuditLinkRegister extends Base $publications = array_merge($publications, $collection->getFluidbooksID()); } + $linkShortenerPublications = []; + // Add fluidbooks that have enabled linkShortener foreach (DB::table('fluidbook_publication')->get() as $p) { $s = json_decode($p->settings); if (isset($s->linkShortener) && $s->linkShortener && $s->linkShortener !== 'none') { $publications[] = $p->id; + $linkShortenerPublications[$p->id] = $s->linkShortener; } } @@ -64,6 +68,8 @@ class AuditLinkRegister extends Base return (preg_match('/^https?:\/\//', trim($n['to']))) || $n['type'] == LinkAlias::WEBVIDEO; }); + $ls = $linkShortenerPublications[$publication] ?? false; + foreach ($links as $link) { $seen[] = $publication . '_' . $link['uid']; $link['to'] = trim($link['to']); @@ -73,6 +79,10 @@ class AuditLinkRegister extends Base } } + if ($ls) { + LinkShortener::shorturl($link['to'], $ls); + } + if (isset($existing[$publication . '_' . $link['uid']])) { $l = $existing[$publication . '_' . $link['uid']]; if ($l['url'] == $link['to'] && $l['page'] == $link['page']) {