homebridge / homebridge-config-ui-x

The Homebridge UI. Monitor, configure and backup Homebridge from a browser.
https://homebridge.io
MIT License
2.59k stars 369 forks source link

Update how a plugin's author is determined to handle NPM schema change #2079

Open PatrickStankard opened 1 week ago

PatrickStankard commented 1 week ago

:recycle: Current situation

NPM stopped returning the maintainers key from the registry when viewing a versioned package. Is this intentional? Nobody knows. I have a support ticket open with NPM since last Thursday, and the thread on GitHub Communities hasn't seen a response. This change has prevented the Homebridge UI from showing a plugin's author, as well as showing users that there is a Homebridge UI update from within Homebridge.

:bulb: Proposed solution

Update how a plugin's author is determined: first, attempt to get it from the latest package from NPM (which is what is currently done). If it's not set there, get it from the top-level package metadata. Since getting it from the top-level package metadata can be expensive for packages with many versions, cache the author for 24 hours. This change will continue to work if NPM starts setting maintainers at the version level again, or if they never revert the change that stopped setting maintainers at the version level.