Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom ui path not recognised #1379

Closed
1 of 3 tasks
thieren opened this issue Jul 9, 2022 · 11 comments
Closed
1 of 3 tasks

custom ui path not recognised #1379

thieren opened this issue Jul 9, 2022 · 11 comments
Labels

Comments

@thieren
Copy link

thieren commented Jul 9, 2022

Describe The Bug

Hi!

I'm working with the homebridge-eufy-security team and have recently redesigned the custom ui screen which utilises plugin-ui-utils.
As mentioned here it should be possible to set a custom path to the ui through config.schema.json but for me this setting is ignored. It always falls back to the default ./homebridge-ui/public/index.html
I looked briefly at the source and found that this setting is read in this repo rather then plugin-ui-utils, so I've opened an issue here.

An example branch can be found here

Let me know if the issue lies somewhere else.

Logs

[9.7.2022, 10:00:15] [Homebridge UI] [homebridge-eufy-security] ENOENT: no such file or directory, open '/usr/lib/node_modules/homebridge-eufy-security/homebridge-ui/public/index.html'

Config

{
  "pluginAlias": "EufySecurity",
  "pluginType": "platform",
  "singular": true,
  "customUi": true,
  "customUiPath": "./dist/homebridge-ui"
}

Homebridge UI Version

4.49.0

Homebridge Version

1.5.0

Node.js Version

16.13.0

Operating System

Ubuntu / Debian (or a variant)

Environment Info

  • Using Docker?
  • Using Hyper-V?
  • Using hb-service?

Raspberry Pi Model

No response

@thieren thieren added the bug label Jul 9, 2022
@oznu
Copy link
Member

oznu commented Jul 9, 2022

It seems to be working when I build the plugin locally:

image

The UI may aggressively cache the customUiPath - please make sure you've tried to do a full restart of Homebridge UI (Drop down menu top right -> Homebridge Settings -> Force Service Restart).

@oznu
Copy link
Member

oznu commented Jul 9, 2022

I did initially get this error, but it's unrelated to the problem you were facing:

[09/07/2022, 18:28:54] [Homebridge UI] [homebridge-eufy-security] node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module '../package.json'
Require stack:
- /Users/xxxxx/src/homebridge/Homebridge-eufy-plugin/dist/homebridge-ui/server.js

After fixing that it loaded fine.

@thieren
Copy link
Author

thieren commented Jul 9, 2022

Thx for your fast feedback.

The UI may aggressively cache the customUiPath - please make sure you've tried to do a full restart of Homebridge UI (Drop down menu top right -> Homebridge Settings -> Force Service Restart).

Force restart did help. But didn't realise that there is a difference to normal restart before.
This way I don't think it's suitable for our plugin since most users would face this issue. (we used default path before, but the new path would suit our new workspace structure better).

Could the path caching be reset on normal restart?

@oznu
Copy link
Member

oznu commented Jul 9, 2022

The cache is per version of the plugin, and since you can't publish the same version twice, it will never be an issue in the real world.

@oznu
Copy link
Member

oznu commented Jul 9, 2022

My last comment may not be correct sorry.

@oznu
Copy link
Member

oznu commented Jul 9, 2022

Expecting users to also update the UI might be an issue, you can probably get away with creating a symlink from ./homebridge-ui to ./dist/homebridge-ui and publishing it as part of the package:

ln -s dist/homebridge-ui homebridge-ui

@thieren
Copy link
Author

thieren commented Jul 9, 2022

But wouldn't users running homebridge on windows have problems with symlinks?

@oznu oznu closed this as completed in 757452f Jul 9, 2022
@oznu
Copy link
Member

oznu commented Jul 9, 2022

Probably, but you're looking at less than 2% of total Homebridge users who run on Windows natively.

Fixed in 4.49.1-test.1

@thieren
Copy link
Author

thieren commented Jul 9, 2022

Wow. Thx for the fast fix!

@oznu
Copy link
Member

oznu commented Jul 10, 2022

I forgot to mention this yesterday. You should probably move the Angular and other UI dependencies to devDependencies, as once the bundle is created you don't need these at run time, and making your users install all these packages alongside your plugin will just slow things down.

https://github.com/thieren/Homebridge-eufy-plugin/blob/customUiPath/package.json#L37

@thieren
Copy link
Author

thieren commented Jul 10, 2022

I forgot to mention this yesterday. You should probably move the Angular and other UI dependencies to devDependencies, as once the bundle is created you don't need these at run time, and making your users install all these packages alongside your plugin will just slow things down.

https://github.com/thieren/Homebridge-eufy-plugin/blob/customUiPath/package.json#L37

Yeah you're likely right. I just used the default dependencies generated by ng new when creating a new angular app.
But will look into it and move the dependencies not needed. Thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants