feat: add minimal external API bridge for trusted websites#9
Open
Antoinevdlb wants to merge 1 commit intoXatpy:mainfrom
Open
feat: add minimal external API bridge for trusted websites#9Antoinevdlb wants to merge 1 commit intoXatpy:mainfrom
Antoinevdlb wants to merge 1 commit intoXatpy:mainfrom
Conversation
Made-with: Cursor
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.
Hello! 👋
I’ve been building Antoine’s Archive, a web app for Xteink users to discover books and send them to their X4 in a streamlined way.
I posted a demo here:
Reddit demo thread
The goal is simple: make it easier for users to go from “found a book” to “sent to my X4” with as little friction as possible.
Right now, users often need multiple tools/extensions for similar upload actions. I’d love to avoid that duplication and use Send to X4 as the shared bridge.
So this PR proposes a small external API bridge that lets trusted websites call a few core actions (ping/status/upload), while keeping your existing popup workflow unchanged.
In short:
one extension ecosystem
less duplicated code
better UX for users
no breaking changes to current users
Summary
externally_connectableallowlist for trusted website originsruntime.onMessageExternalAPI in the service workerx4.ping,x4.status,x4.uploadWhy
This keeps the extension popup-first behavior unchanged while allowing a trusted hosted UI (e.g. Antoine's Archive) to integrate without requiring users to configure both app settings and extension popup flows separately.
API contract (minimal)
x4.ping->{ ok: true }x4.statuswith{ firmwareType, host }-> connectivity payloadx4.uploadwith{ firmwareType, host, filename, dataBase64 }-> upload resultSafety
Test plan
x4.pingand confirm successx4.statuswith stock + crosspoint host settingsx4.uploadand verify EPUB arrives on deviceMade with Cursor