From cb85cc0794f3ae5343e9db9da92a9d0a67606955 Mon Sep 17 00:00:00 2001 From: Jonas Date: Wed, 23 Jul 2025 18:45:42 +0200 Subject: [PATCH 1/6] fix(share): Dispatch `ShareLinkAccessedEvent` (richdocuments in viewer) Richdocuments listens on this event to inject its viewer registration. Required to be able to open documents in richdocuments in a public share. Signed-off-by: Jonas --- lib/Controller/PublicStartController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Controller/PublicStartController.php b/lib/Controller/PublicStartController.php index f710e569e..f99d7101d 100644 --- a/lib/Controller/PublicStartController.php +++ b/lib/Controller/PublicStartController.php @@ -11,6 +11,7 @@ use OCA\Collectives\Db\CollectiveShareMapper; use OCA\DAV\Connector\Sabre\PublicAuth; +use OCA\Files_Sharing\Event\ShareLinkAccessedEvent; use OCA\Viewer\Event\LoadViewer; use OCP\App\IAppManager; use OCP\AppFramework\AuthPublicShareController; @@ -110,7 +111,8 @@ public function showShare(): PublicTemplateResponse { if ($appsMissing = $this->checkDependencies()) { return new PublicTemplateResponse('collectives', 'error', ['appsMissing' => $appsMissing]); // templates/error.php } - $this->eventDispatcher->dispatch(LoadViewer::class, new LoadViewer()); + $this->eventDispatcher->dispatchTyped(new LoadViewer()); + $this->eventDispatcher->dispatchTyped(new ShareLinkAccessedEvent($this->getShare(), 'show')); $response = new PublicTemplateResponse('collectives', 'main', [ // templates/main.php 'id-app-content' => '#app-content-vue', 'id-app-navigation' => '#app-navigation-vue', From 8becc7527960b5365982113bdaed542acb916361 Mon Sep 17 00:00:00 2001 From: Jonas Date: Wed, 23 Jul 2025 18:47:48 +0200 Subject: [PATCH 2/6] fix(attachments): Allow to open attachments in viewer in public share Try to give correct path depending on whether we're in a public share or not. Signed-off-by: Jonas --- src/components/PageSidebar/SidebarTabAttachments.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/PageSidebar/SidebarTabAttachments.vue b/src/components/PageSidebar/SidebarTabAttachments.vue index 2ffd2b03d..4172205e7 100644 --- a/src/components/PageSidebar/SidebarTabAttachments.vue +++ b/src/components/PageSidebar/SidebarTabAttachments.vue @@ -321,9 +321,12 @@ export default { clickAttachment(attachment, ev) { // Show in viewer if the mimetype is supported - if (!this.isPublic && window.OCA.Viewer.availableHandlers.map(handler => handler.mimes).flat().includes(attachment.mimetype)) { + if (window.OCA.Viewer?.availableHandlers.map(handler => handler.mimes).flat().includes(attachment.mimetype)) { + const path = this.isPublic + ? `/${attachment.internalPath}` + : attachment.path ev.preventDefault() - window.OCA.Viewer.open({ path: attachment.path }) + window.OCA.Viewer.open({ path }) } }, From c6b1d8757ccda6df8bdfa7358263be209986aa70 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 24 Jul 2025 11:48:28 +0200 Subject: [PATCH 3/6] fix(attachments): isPublic and sharingToken inputs in template The viewers webdav client is initialized before the vue app is mounted. So we need to provide the inputs before the app is mounted already. Signed-off-by: Max --- lib/Controller/PublicStartController.php | 1 + templates/main.php | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lib/Controller/PublicStartController.php b/lib/Controller/PublicStartController.php index f99d7101d..b7edb1c7b 100644 --- a/lib/Controller/PublicStartController.php +++ b/lib/Controller/PublicStartController.php @@ -116,6 +116,7 @@ public function showShare(): PublicTemplateResponse { $response = new PublicTemplateResponse('collectives', 'main', [ // templates/main.php 'id-app-content' => '#app-content-vue', 'id-app-navigation' => '#app-navigation-vue', + 'token' => $this->getToken(), ]); $response->setFooterVisible(false); return $response; diff --git a/templates/main.php b/templates/main.php index 31f901a96..4f6ace728 100644 --- a/templates/main.php +++ b/templates/main.php @@ -12,3 +12,7 @@
+'); + print_unescaped(''); +} ?> From 6304ba99bc74a47bf86fbe7dcf3ed8aabd1c0f39 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 24 Jul 2025 20:46:08 +0200 Subject: [PATCH 4/6] fix(attachments): richdocuments guest name entry above viewer When opening an attachment with rich documents from a public collective share a name entry will be shown above the viewer. Keep the viewer z-index to make sure the name entry is visible. Signed-off-by: Max --- src/components/Nav/TemplatesDialog.vue | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/Nav/TemplatesDialog.vue b/src/components/Nav/TemplatesDialog.vue index e76f9eccf..dea215bba 100644 --- a/src/components/Nav/TemplatesDialog.vue +++ b/src/components/Nav/TemplatesDialog.vue @@ -6,6 +6,7 @@