streamer mode fix#512
Conversation
|
Resolves one part of esphome/issues#4709 |
| </style> | ||
| `; | ||
| const isSecrets = this._isSecrets(); | ||
| if (isSecrets && this.streamerMode && !this._showSecrets) { |
There was a problem hiding this comment.
This feels weird to put it in this component. Instead, this dialog should be it’s own code that is called from the “Secrets” button. When user confirms, it will continue to open the editor.
There was a problem hiding this comment.
That could be an approach, but this will work for when I've implemented routing the secrets page will have it;s own url /secrets the button will be a link to the page not a change in state...
There was a problem hiding this comment.
We can always attach an event listener to the link to avoid it linking in streamer mode.
There was a problem hiding this comment.
I don't understand why you're not ok with this being in the editor.
There was already logic for the editor to handle secrets differently (no install & ace websocket not started)
so I don't see why it cannot be given 1 extra parameter (streamer mode) in order to show the warning 1st
There was a problem hiding this comment.
A component should do 1 thing. This makes it very complicated with doing completely different things. Also, it's a prompt to a user so we should follow the convention of asking that as a dialog.
There was a problem hiding this comment.
@balloob are you happy with this change?
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
…ome_dashboard into bugfix-streaming-mode
| import { ColoredConsole, coloredConsoleStyles } from "../util/console-color"; | ||
| import { fireEvent } from "../util/fire-event"; | ||
|
|
||
| export class ESPHomeBlurSecrets { |
There was a problem hiding this comment.
Why is this inside remote-process ? This can be in it's own file and doesn't have to be a class
There was a problem hiding this comment.
I din't think it needed its own file as it is so small - and it needs to be a class as it is used as a static/global variable, I find this a better approach than using the window object to set globals...
| </div> | ||
| <main></main> | ||
| ${isSecrets && this.streamerMode && !this._showSecrets | ||
| ? html`<streamer-warning |
There was a problem hiding this comment.
It should be it's own dialog like how we open the wizard. The editor shouldn't know it's opening a secret. Just the header should, if streamer mode enabeld, prompt to confirm the user wants that before opening the editor. The editor should not be aware of streamer mode.
There was a problem hiding this comment.
The editor is already aware of secrets - thats not something new...
And as mentioned before, I think this is better here for when the secrets have its own URL (the other part I am working on), the header wont be able to show a popup if the user went directly to /secrets...
There was a problem hiding this comment.
The only way a user can go to secrets is by pressing the button in the top toolbar. If they go any other way, streamer mode does not have to guard for that. The dialog needs to be it's own file.
|
Sorry to open this again, but |
|
Closing due to inactivity. Feel free to reopen or make a new PR if you'd like to continue working on this. Thanks |

Toggle the streamer mode in the add-on config to protect your secrets:
