Skip to content

feat: integrate photosphere viewer with Nextcloud Viewer app (OCA.Viewer) - #181

Draft
R0Wi with Copilot wants to merge 2 commits into
masterfrom
copilot/integrate-into-viewer
Draft

R0Wi with Copilot wants to merge 2 commits into
masterfrom
copilot/integrate-into-viewer

Conversation

Copilot AI commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

The app previously rendered photosphere images in a custom full-page iframe overlay. This integrates it into the Nextcloud universal Viewer app (OCA.Viewer) so photospheres open inside the standard viewer modal.

New: Vue component + viewer handler registration

src/components/PhotoSphereViewer.vue — Vue 3 component wrapping @photo-sphere-viewer/core directly (no iframe). Reads XMP metadata (cropping config etc.) from the files-photospheres-xmp-metadata DAV attribute already present on the file Node, and renders the panorama into an inline <div>.

src/viewerHandler.js — Registers the component with OCA.Viewer on load:

window.OCA.Viewer.registerHandler({
  id: 'photosphere',
  mimes: ['image/jpeg'],
  group: null,           // no prev/next between photospheres yet
  component: PhotoSphereViewerComponent,
  canHandleFile(file) {
    const meta = getDavXmpMeta(file)
    return !!(meta && (meta.usePanoramaViewer === true || meta.usePanoramaViewer === 1))
  },
})

canHandleFile ensures regular JPEGs fall through to the default image viewer — only files carrying photosphere XMP metadata are intercepted.

Modified: fileAction.js delegate to OCA.Viewer

_actionHandler now calls OCA.Viewer.open({ path, fileInfo }) when OCA.Viewer is present, which triggers the registered component above. The iframe path is retained as a fallback for environments where the viewer app is absent.

Build / PHP wiring

  • webpack.js: added vue-loader rule + VueLoaderPlugin; viewerHandler added as an entry point.
  • AddScriptsAndStylesListener.php: loads viewerHandler after the viewer app (same dependency ordering as fileAction).
  • package.json: vue-loader ^17 as devDependency.
  • Listener unit test updated to assert viewerHandler is also enqueued.

Copilot AI changed the title [WIP] Integrate photophere viewer app into Nextcloud viewer feat: integrate photosphere viewer with Nextcloud Viewer app (OCA.Viewer) Jun 26, 2026
Copilot finished work on behalf of R0Wi June 26, 2026 19:36
Copilot AI requested a review from R0Wi June 26, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants