Skip to content

Feature/macos nsfp fileprovider#848

Open
mj-obs wants to merge 2 commits intoopencloud-eu:mainfrom
mj-obs:feature/macos-nsfp-fileprovider
Open

Feature/macos nsfp fileprovider#848
mj-obs wants to merge 2 commits intoopencloud-eu:mainfrom
mj-obs:feature/macos-nsfp-fileprovider

Conversation

@mj-obs
Copy link

@mj-obs mj-obs commented Mar 18, 2026

No description provided.

mj-obs added 2 commits March 18, 2026 09:46
Implement a new VFS backend (mode: MacOSNSFileProvider/nsfp) that uses
Apple's NSFileProvider framework to provide native Files on Demand
support on macOS 12+.

Architecture:
- VfsNSFP plugin: manages NSFileProvider domain lifecycle, syncs file
  metadata and access tokens to the App Group shared container, and
  triggers periodic sync cycles via a 30-second poll timer.
- FileProvider extension (appex): runs as a separate sandboxed process,
  enumerates items from a shared plist, downloads files via direct
  WebDAV requests, and uploads new files via HTTP PUT/MKCOL.
- NsfpDomainManager: handles async domain registration/removal with
  fileproviderd, including stale domain cleanup and fallback recovery.
- NsfpXpcHandler: anonymous NSXPCListener for future bidirectional
  communication between the main app and the extension.

Key features:
- Transparent file hydration with real download progress in Finder
- Direct WebDAV upload for files dragged into the virtual folder
- Automatic metadata refresh after each sync cycle
- Server-side deletion detection for NSFP-managed files in discovery
- Stale item cleanup on HTTP 404 during fetch
- Change tracking with didDeleteItemsWithIdentifiers for Finder updates
- User-friendly localized error messages
- Token refresh handling with race condition prevention

Changes to existing code:
- vfs.h/cpp: add MacOSNSFileProvider mode enum and VfsSetupParams
  constructor with spaceId/displayName/syncEngine
- discovery.cpp: handle NSFP files during remote deletion detection
- syncjournaldb.cpp: add getFileRecordsByFileId helper
- httpcredentials.h: expose accessToken for shared container config
- CMakeLists.txt: wire up extension and plugin build targets
Replace hardcoded Team ID (P4D766R5ZA) with the CMake cache variable
APPLE_DEVELOPMENT_TEAM so any developer can build and sign the app
with their own Apple Developer account.

The App Group identifier is now derived at configure time as
${APPLE_DEVELOPMENT_TEAM}.${APPLICATION_REV_DOMAIN} and passed to:
- Entitlements (via configure_file)
- Info.plist (via CMake variable expansion)
- ObjC sources (via compile definition APP_GROUP_IDENTIFIER)
- Xcode build attributes (DEVELOPMENT_TEAM)

Usage: cmake -DAPPLE_DEVELOPMENT_TEAM=XXXXXXXXXX ..
@sh4tteredd
Copy link

sh4tteredd commented Mar 22, 2026

That's a very cool feature, but I'm not able to try it out

/Users/lolo/Downloads/opencloud-desktop-feature-macos-nsfp-fileprovider/CMakeLists.txt:15: error: Cannot find source file:

  nsfpdiagnostic.mm

Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm
.ccm .cxxm .c++m .h .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90
.f95 .f03 .hip .ispc

Am I missing something?

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