I get it that posting to this topic is a bit broad, please redirect if appropriate.
I am running emonPi with an 7" LCD in kiosk mode displaying my basic house dashboard.
- I dunno how permissions work but I am auto-logged in, yet the admin menu is missing
- I can logout and back in (need a keyboard) or SSH in (need another computer) to access the admin shutdown button (or just shutdown)
- Is there a way to connect a button on the dashboard to the shutdown routine? I dug through the admin code (I know nothing about PHP). and found a post command to "shutdownPi:“halt”. But couldn’t figure out if there is a simple web API to trigger it… Or, for that matter, how I would link that to a virtual feed that could be triggered by the button widget.
Can I just clone the button widget and have it do the shutdown post, rename it to power switch and then add it to the list of widgets (wherever that is defined)?
I am willing to do the work and learn new languages/schema but would appreciate being pointed in the right direction. There is a lot to learn for an old C/C++ embedded widget programmer with minimal exposure to wrangling web pages in C and Python.
Admin access disappears if the session is activated using the “remember me” feature. See this line here which does not assign admin access emoncms/user_model.php at master · emoncms/emoncms · GitHub
The shutdown command is actioned here: https://github.com/emoncms/emoncms/blob/master/Modules/admin/admin_main_view.php#L128 the admin view does ideally need refactoring so that there is a separation of concerns, there is a lot of controller & model code mixed in with the view, it would be good to have specific end points in the admin controller for this, here: emoncms/admin_controller.php at master · emoncms/emoncms · GitHub
If there was a shutdown end point in the admin controller you could then access that from a modified button widget by modifying this ajax call accordingly dashboard/button_render.js at master · emoncms/dashboard · GitHub
Ok, I have a project! Thanks for the roadmap. I have a zillion more questions, but will play around a bit before asking them (who knows I might answer some myself).
One of the most annoying aspects of the interface, is that the ‘Log Out’ (top right) does not change to ‘Log In’ when the session expires and when you do need to log back in you get the annoying red banner page saying (something like) ‘authentication required’ rather than just taking you to the log in page.
Even better would be an option not to expire the session, ever (perhaps on a per user basis) especially as most folk use it internally on their own PC on their own network.
@TrystanLea, um, isn’t that logic backwards? If I click remember me, I expect the browser to ‘remember’ it is me and not expire the session.
IME the session expires whether I select remember me or not.