Skip to content

nebo.files.url: show the owner's files from a granted folder - #11

Merged
localrivet merged 2 commits into
mainfrom
app-files-read
Oct 23, 2026
Merged

localrivet merged 2 commits into
mainfrom
app-files-read

Conversation

@localrivet

Copy link
Copy Markdown
Contributor

What

nebo.files.url(path): the address of one of the owner's files (relative to ~/NeboAI) for an <img>, <video>, <audio> or fetch(). The file must be inside a folder the app's manifest grants with filesystem:read:<folder>; Nebo serves it read only, with byte ranges, through the app's own route /api/v1/apps/<id>/files/<path> (nebo PR, linked below).

video.src = nebo.files.url('Media/Projects/reel/versions/reel-v3.mp4');

The address works in every place a page opens:

Where Address
Desktop window neboapp://<id>/api/v1/apps/<id>/files/... (a media element's address is never rewritten the way fetch() is, so it uses the window's own scheme)
Browser on the bot http://localhost:27895/api/v1/apps/<id>/files/...
Tunnel (mobile app, web) https://neboai.com/t/<bot>/api/v1/apps/<id>/files/...
App-view pass http://127.0.0.1:27895/k/<pass>/api/v1/apps/<id>/files/...

Each path part is percent-encoded; empty parts are dropped. Pages never build /api/v1/... addresses.

Also

  • README section for nebo.files.url (grant, 403/404 rules, hidden folders).
  • test/files.test.mjs: a zero-dependency node:test suite for every address form; pnpm test / npm test, now run in CI after the build.
  • dist/ rebuilt; nebo's served copy (app/static/sdk/nebo.global.js) is updated in the nebo PR.

Tests

  • pnpm build ok
  • pnpm test: 4/4 pass

🤖 Generated with Claude Code

https://claude.ai/code/session_015dw5RFwzdZPHuB2VsN3Mcx

localrivet and others added 2 commits October 21, 2026 13:43
… granted

A page shows the owner's own files (photos, renders, a project's
project.json) through the app's own file route,
/api/v1/apps/<id>/files/<path>, inside the folders its manifest grants
with filesystem:read:<folder>. files.url builds that address in every
place a page is open: the desktop window (its neboapp:// scheme, since a
media element's address is never rewritten the way fetch is), a browser
on the bot, the tunnel (/t/<bot>) and an app-view pass (/k/<pass>). Pages
never build /api/v1 addresses themselves.

Adds a zero-dependency node:test suite for every address form, run in CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015dw5RFwzdZPHuB2VsN3Mcx
Nebo now confines every app page to its own app (NeboLoop/nebo#1009): the
page runs in an origin of its own and proves itself with its app's pass,
which Nebo writes into the page's base (nebo-base-url, /k/<pass>).

- getBaseUrl reads nebo-base-url first, on the desktop too, so the
  page's socket and the films files.url gives go to Nebo directly with
  the pass and stream.
- getAppId finds the app under /t/<bot> and /k/<pass>.
- files.url refuses a '.' or '..' part and encodes the app id.
- README: where a page runs (sandbox, pass, localStorage kept in the
  app's store, grants and owner consent), and files.url as it is now:
  hidden folders are never served, installed apps need the owner's OK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015dw5RFwzdZPHuB2VsN3Mcx
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