tractordev / wanix

Experimental, local-first, web-native, Unix-like development environment
https://wanix.sh
MIT License
206 stars 11 forks source link

githubfs #84

Closed progrium closed 4 months ago

progrium commented 5 months ago

Given a GitHub repository and access token, this filesystem will use the GitHub API to expose a read-write filesystem of the repository contents. If not given a branch, its root will contain all branches as directories.

This is for an upcoming demo to make live edits to a GitHub Pages site by modifying files in the gh-pages branch directly. Long-term versions of this will possibly actually use Git in Wanix or provide some kind of copy-on-write then manually push mechanism. For now this is just a direct file read and file replace mutable filesystem.

Although this would normally be something user configurable/mountable, that depends on working out #14. For the demo we can just use a custom build of the kernel for deployments that need this.

progrium commented 5 months ago

Btw, implementing this in Go using the net/http package will use the browser fetch when compiled to JS. And so far, making requests to just get file contents like https://api.github.com/repos/tractordev/wanix/contents/README.md doesn't seem to have CORS getting in the way.

progrium commented 5 months ago

Using https://raw.githubusercontent.com/tractordev/wanix/master/README.md will be blocked by CORS.

Parzival-3141 commented 4 months ago

If not given a branch, its root will contain all branches as directories.

Perhaps instead of being configurable, this should be the default behavior. It'd simplify the implementation and UX; queries always with the branch name (e.g. master/src/main.go). Running ls in the root would list all branches. We'd also have the ability to expose a default_branch subdir, though 90% of use cases probably won't need it.

progrium commented 4 months ago

sounds fine