hassio-addons / addon-grocy

Grocy - Home Assistant Community Add-ons
https://addons.community
MIT License
319 stars 60 forks source link

data/custom_js.html is not loaded #304

Closed TheRealVira closed 2 years ago

TheRealVira commented 2 years ago

Problem/Motivation

Whether this is a feature request or a bug I am unsure of. Following the original documentation of Grocy for adding custom js without having to modify the application itself does not work as is.

Expected behavior

Based on their documentation:

https://github.com/grocy/grocy#adding-your-own-css-or-js-without-to-have-to-modify-the-application-itself

When the file data/custom_js.html exists, the contents of the file will be added just before </body> (end of body) on every page.

Actual behavior

When creating a dedicated folder+file the custom content is not loaded before </body> on every page. Neither is there any visual error or log entry about it.

image image

Steps to reproduce

  1. Create a data folder under config/custom_components/grocy.
  2. Create a custom_js.html file under the new data directory containing whatever script you want to add.
  3. Restart Grocy

Proposed changes

  1. On boot; Force copy everything from the custom data folder into the correct location.

I assume that the "real" data directory for Grocy is somewhere different than the addon-grocy component. Force copying everything from the custom component "addon-grocy" to the "real Grocy" on boot will probably be enough. Optionally a hash comparison check between each file could be implemented to see if there is a new version to use. That way you could reduce actions to files which are different between the data folders.

github-actions[bot] commented 2 years ago

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!