Add plugin entry: pdf-viewer - #101
Open
xMinor-1 wants to merge 1 commit into
Open
Conversation
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.
What the plugin does
PDF Viewer makes PDFs readable inside BB instead of downloading them:
fileOpenerfor thepdfextension, so a PDF linked from amessage, picked in the file picker, or opened with
bb thread openrendersin a panel tab with the browser's own paging, zoom, search and print.
PDFs are listed) and reopens recent documents. Recents are stored in the
plugin's own KV and can be turned off with a boolean setting.
Source release
git:https://github.com/xMinor-1/bb-plugins.git,subdir plugins/pdf-viewerpdf-viewer/v0.1.0(tagPrefix: "pdf-viewer/"), range^0.1.0bb >=0.39,bbPluginSdk >=0.4.8Plugin checks
npm test— 13 vitest cases (range parsing,Content-Dispositionencoding,the document registry's expiry and sweeping, path helpers)
npx tsc --noEmit— cleanbb plugin build .— clean, and the plugin runs on bb 0.39.036 MB file to exercise the streaming path and
RangeresponsesMarketplace checks
npm ci --ignore-scripts,npm run build,npm run checkall succeedicons/pdf-viewer-8ac376f7.svg(SVG, 380 bytes, no scriptsor remote references)
Notes for reviewers
Two transports, chosen by size:
bb.sdk.files.createPreview, confined to thedocument's own directory and leased for an hour. This is the default because
it is BB's native transport: it reaches other connected hosts and keeps
working when the app is opened remotely.
the server's own host is served by the plugin's own
local-auth GET routewith
Rangesupport. That route never accepts a path from the client: thebackend registers the resolved document in an in-memory registry and the URL
carries only an opaque id that expires after an hour. Host locality is
established by comparing against the host id in BB's data directory, so a
same-looking path on a different host is never read from local disk.
No external services, no network calls, no credentials. The plugin reads files
the user asks for through BB's own file APIs and, for oversized local
documents,
node:fsread streams.