Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for GitHub file path in link instead of inline model #57

Open
tenstad opened this issue Nov 6, 2024 · 3 comments
Open

Support for GitHub file path in link instead of inline model #57

tenstad opened this issue Nov 6, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@tenstad
Copy link

tenstad commented Nov 6, 2024

Would be nice to be able to link to something like https://ochafik.com/openscad2?file=https://github.com/tenstad/keyboard/blob/main/keyboard.scad, and then render the scad code at that location.

@ochafik ochafik added the enhancement New feature or request label Dec 24, 2024
@ochafik
Copy link
Collaborator

ochafik commented Dec 25, 2024

Hi @tenstad , thanks for the suggestion!

Fetching arbitrary files on the web is tricky as it requires CORS headers (which I don't think are set on github.com), or going through some proxy server.

In the meantime I could potentially add https://github.com/tenstad/keyboard (looks cool!!) to the list of bundled libraries (just added a #testpath:/libraries/keyboard.scad syntax for e2e testing of bundled files, could make it cleaner), if it's licensed under GPL2+ or compatible (e.g. Apache 2.0, MIT...). Currently all libs are loaded but I hope to make this lazier to scale to more libs.

@tenstad
Copy link
Author

tenstad commented Dec 25, 2024

Tried curl -v https://raw.githubusercontent.com/tenstad/keyboard/refs/heads/main/keyboard.scad and got the following, meaning it could work?

< vary: Authorization,Accept-Encoding,Origin
< access-control-allow-origin: *
< cross-origin-resource-policy: cross-origin

Anyways, added a MIT license, so feel free to bundle it regardless of this issue!

@ochafik
Copy link
Collaborator

ochafik commented Dec 26, 2024

Thanks for clearing that, my confusion came from the text-only content-type header (for security reasons).

I've added a #url=... in #93 for testing purposes, but I'd need to give it a bit more love (& UI integration) before it's considered an official api.

https://ochafik.com/openscad2/#url=https://github.com/tenstad/keyboard/blob/main/keyboard.scad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants