Repository navigation
App share: the Share dialog opens only on the device whose page asked - #776
Merged
Merged
Conversation
nebo.share broadcast app_share_requested to every client with no origin, so the desktop came forward and opened the Share dialog for a share made in the app on the phone or the web app (and for a #775 "Share a link" the page answered there). The app page now opens with ?client=<clientId> beside ?thread=; the SDK sends it as `client` (NeboLoop/app-sdk#10; the body survives the neboapp:// proxy and the tunnel); share_file stamps the event with EventOrigin; the listener opens only through opensHere(data, 'nowhere'). An unclaimed share opens nowhere; the file is in Work either way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HtFKzcuyNHcb9tJBW1tz3e
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Share dialog for an app's file now opens only on the device whose page asked for it. Before this change, a share made in an app on the mobile app or the web app also opened the dialog on the desktop.
Root cause.
POST /apps/{id}/share(nebo.share) sentapp_share_requestedto every client with no origin on it. Each client's listener then setshareRequest, focused its window, moved to the app's chat, and opened the dialog. The page's request carried no client id: the SDK sends onlythread, and the desktop'sneboapp://proxy drops headers such asX-Nebo-Client. This was also the path an app's page uses to answer a #775 "Share a link" request. The other #775 path, where the reply hands over a file, was already local to the device that picked the entry (linkAsk).Fix: one origin rule (
EventOrigin/opensHere)?client=<clientId>beside?thread=(apps/launcher.ts, for both the Tauri window and the browser popup). A window left from before a reload of the main window is reopened, so its page names the current client.nebo.share(app-sdk nebo.share names the device the page is open on app-sdk#10, bundle copied toapp/static/sdk/nebo.global.js) sendsclientin the request body, besidethread. The body survives theneboapp://proxy and the tunnel.share_filestamps the event withEventOrigin { client_id, session_id: thread }through the newshare_requested_event.shareRequestOf, which usesopensHere(data, 'nowhere'). Only the client whose page asked sets the request, focuses its window and opens the dialog. A share that no client claims opens nowhere; the file is still in Work. Other clients still see the thread as usual.sdk-more.md) now says where the dialog opens.The mobile app has a matching change in NeboLoop/nebo-mobile: the app page carries the mobile app's client id, and the Share link screen opens only for its own client.
Tests
cargo test -p nebo-server --lib share_tests: the event names the client whose page asked (phone B or desktop A). A page that names no client givesclient_id: null. A body from an older SDK still parses.stores/appShare.test.ts: a share started from client B (the phone) gives no request on A. A share started from A opens on A. An unclaimed share opens nowhere. A malformed event opens nothing.apps/launcher.test.ts: the page is opened withthreadandclient=<clientId>.cargo test -p nebo-tools --lib app_studio,cargo build -p nebo-cli,pnpm check(0 errors),pnpm build.🤖 Generated with Claude Code
https://claude.ai/code/session_01HtFKzcuyNHcb9tJBW1tz3e