This repository has been archived on 2024-01-28. You can view files and clone it, but cannot push or open issues or pull requests.
Find a file
2021-11-04 18:27:52 +01:00
openscad-http-api Init 2021-11-04 18:27:52 +01:00
templates Init 2021-11-04 18:27:52 +01:00
.gitignore Init 2021-11-04 18:27:52 +01:00
flake.lock Init 2021-11-04 18:27:52 +01:00
flake.nix Init 2021-11-04 18:27:52 +01:00
LICENSE Init 2021-11-04 18:27:52 +01:00
README.md Init 2021-11-04 18:27:52 +01:00
requirements.txt Init 2021-11-04 18:27:52 +01:00
setup.py Init 2021-11-04 18:27:52 +01:00

openscad-http-api

WIP. Only a proof-of-concept.

See Known Issues for security implications.

Usage

For development:

FLASK_DEBUG=1 FLASK_APP=openscad-http-api nix develop -c python3 -m flask run

It makes the templates in the template directory relative to where you run that command available at /api/render/<template> on the port printed to stdout.

You can test that it works by rendering the provided default model:

curl http://127.0.0.1:5000/api/render/cube -XPOST -H "Content-Type: application/json" -d '{"size": 10}'

It should print out the STL representation of a 10×10×10 cube.

Known Issues

  • Does not sanitise user input, so arbitrary OpenSCAD code can be executed.
  • Does not validate user input
  • Not optimised for performance

License

GNU Affero General Public License version 3 (only). See LICENSE for details.