Skip to content

Conversation

@loxK
Copy link

@loxK loxK commented Feb 4, 2026

Description

This PR adds an optional bridge feature that enables deep integration between RoundCube and Nextcloud services when used with the NextBridge RoundCube plugin.

Features

When enabled, users can:

  • Attach files from Nextcloud - Pick files from Nextcloud storage and attach them to emails
  • Save attachments to Nextcloud - Save email attachments directly to Nextcloud files
  • Insert share links - Create and insert public share links into emails
  • Add to Calendar - Add calendar invitations (.ics files) directly to Nextcloud Calendar

How it works

┌────────────────────────────────────────────────────────────┐
│                      Nextcloud                             │
│  ┌─────────────────────────────────────────────────────┐   │
│  │                  mail_roundcube                     │   │
│  │  ┌─────────────┐    postMessage    ┌─────────────┐  │   │
│  │  │  Vue App    │◄──────────────────│  Injected   │  │   │
│  │  │  (Bridge)   │                   │  Client     │  │   │
│  │  └──────┬──────┘                   └──────┬──────┘  │   │
│  └─────────┼────────────────────────────────┼──────────┘   │
│            │                                │              │
│     WebDAV/CalDAV                    ┌──────┴──────┐       │
│     OCS APIs                         │  RoundCube  │       │
│                                      │  (iframe)   │       │
│                                      │  NextBridge │       │
│                                      │   plugin    │       │
│                                      └─────────────┘       │
└────────────────────────────────────────────────────────────┘
  1. Bridge Client Injection - When RoundCube loads, a NextcloudBridge JavaScript object is injected into the iframe
  2. RoundCube Plugin - The NextBridge plugin uses this object to request file/calendar operations
  3. Nextcloud Handlers - The bridge handles requests using Nextcloud's APIs (WebDAV, CalDAV, OCS Sharing)

Admin Setting

A new checkbox "Enable RoundCube bridge" in admin settings allows enabling/disabling this feature. Disabled by default.

Calendar Integration

The new CalendarController handles a specific edge case with Nextcloud's soft-delete feature:

  • When an event is deleted in Nextcloud Calendar, it's soft-deleted (marked with deleted_at)
  • The UID constraint remains in the database
  • Re-adding an event with the same UID via CalDAV fails with 412 Precondition Failed
  • The controller detects and purges orphaned UIDs before inserting new events

Related

Testing

  1. Enable the bridge in admin settings
  2. Install NextBridge plugin in RoundCube
  3. Test file picking, saving, share links, and calendar integration

Add optional bridge feature that enables RoundCube (via NextBridge plugin)
to integrate with Nextcloud services:

- Pick files from Nextcloud to attach to emails
- Save email attachments to Nextcloud
- Create and insert public share links
- Add calendar invitations (.ics) to Nextcloud Calendar

The bridge uses postMessage API for secure iframe communication.
A new admin setting allows enabling/disabling this feature.

The CalendarController handles orphaned UIDs from soft-deleted events,
fixing the 412 Precondition Failed error when re-adding deleted events.
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.

1 participant