Skip to content

Commit

Permalink
GitHub Filesystem (#105)
Browse files Browse the repository at this point in the history
* githubfs: basic file and directory reading

Still WIP.

Needed patch the bootloader to ignore nonlocal requests. This is a
temporary workaround, in the future we want to make a special endpoint
for external requests and monkeypatch fetch to use it for external
hostnames.

* githubfs: fix `ReadDir`, mount in filesystem, and tidying

The filesystem is read only for now, but commands like `ls` and `cat` work
great. You'll have to paste your own Github Token in `fs.go`, ideally we can
pull this from the shell environment but the shell might not even be compiled
by the time `githubfs` is mounted.

* githubfs: index by branch

* githubfs: sync branches and fix `ReadDir`

Moved `ReadDir` since there's no point in making it a top level func.
Enforce using basename for `fileInfo.name` to match the API, added
extra branch/path info.

This is starting to get messy. After adding directory and write
operations I want to review and maybe refactor.

* githubfs: file creation, writing, and seeking

Abstract requesting into it's own function. Implement proper reading/writing
instead of reusing the response's `ReadCloser`.

* githubfs: WIP `Remove` implementation

Doesn't support directories or `RemoveAll`, but now you can delete files.

* indexedfs: small stuff
  • Loading branch information
Parzival-3141 authored Feb 29, 2024
1 parent 7923797 commit fdc4346
Show file tree
Hide file tree
Showing 4 changed files with 643 additions and 5 deletions.
1 change: 1 addition & 0 deletions dev/bootloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ if (globalThis["ServiceWorkerGlobalScope"] && self instanceof ServiceWorkerGloba
url.pathname.startsWith(`${basePath}sys/dev`) ||
url.pathname.startsWith(`${basePath}bootloader`) ||
url.pathname.startsWith(`${basePath}index.html`) ||
url.hostname !== "localhost" || // TEMPORARY WORKAROUND
!host) return;

reqId++;
Expand Down
Loading

0 comments on commit fdc4346

Please sign in to comment.