Is it possible to add a custom HTML page to Octoprint? I would like to create a functionality that:
requires only HTML, JS, CSS and no server side logic,
requires a full webpage,
utilizes existing Octoprint functionality, e.g. read temperatures or extrude now,
ideally does not require an additional login, but uses the existing authentication session of Octoprint.
So my plan is to create a new webpage, and let Octoprint to host it from the same origin, and the page call the same backend endpoints that the current Octoprint UI does.
I don't want to set up another webserver just for a simple webpage, so can I create a page that will be served by the Octoprint webserver?
If you really want to serve it from OctoPrint's built in server: Not without writing a plugin. If that is an option, take a look at the BlueprintPlugin mixin.
Thanks for the link, Brandon. This is a very interesting article, and if I understand correctly the author used Nginx to host that landing page. I'll try that, but I was hoping to find a simpler solution.
I am trying to do something similar to balassy, to have a webpage for calculation of 3D printing costs (I'm unhappy with the existent plugins) in parallel to Octoprint's webpage. I don't need access to Octoprint functionality, just cura_engine and php, and I only need to display one html file.
It is so simple that I find it hard to accept that I need to install nginx or apache2 to get it to work. Can someone please point me in the right direction? Thank you very much.
OctoPrint does not serve HTML pages - it renders Jinja templates, which turn into HTML in memory. It does not work as a server like you think it is going to, every route on the server has to be registered.
Static assets can be put into static folders for plugins, and the core OctoPrint source and these are served as-is from the static folder. I don't recommend that you edit the installed files in place, since they will be overwritten on updates. Use a blueprint or asset plugin mixin.
The best bet, as set out above is either create a plugin, or use something external such as installing nginx. However, on OctoPi Haproxy is running, not nginx, so you will have to spend some time configuring the two to not conflict once you have installed.