frontend icon indicating copy to clipboard operation
frontend copied to clipboard

Add webhook trigger allowed_methods/local_only options

Open esev opened this issue 3 years ago • 5 comments

Proposed change

Add Overflow menu for configuring allow_internet/allow_methods options on webhook triggers. These options are being added in https://github.com/home-assistant/core/pull/66494.

Type of change

  • [ ] Dependency upgrade
  • [ ] Bugfix (non-breaking change which fixes an issue)
  • [x] New feature (thank you!)
  • [ ] Breaking change (fix/feature causing existing functionality to break)
  • [ ] Code quality improvements to existing code or addition of tests

Example configuration

automation:
  trigger:
    - platform: webhook
      webhook_id: "some_hook_id"
      allowed_methods:
        - POST
        - PUT
      local_only: true

Screenshot 2022-02-16 4 01 12 PM Screenshot 2022-02-16 4 01 35 PM

Additional information

  • This PR fixes or closes issue: fixes https://github.com/home-assistant/core/issues/65348
  • This PR is related to issue or discussion: https://github.com/home-assistant/core/pull/66494
  • Link to documentation pull request: https://github.com/home-assistant/home-assistant.io/pull/21637

Checklist

  • [x] The code change is tested and works locally.
  • [x] There is no commented out code in this PR.
  • [ ] Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

esev avatar Feb 14 '22 01:02 esev

We cannot have 2 overflow menus. That looks weird.

balloob avatar Feb 14 '22 07:02 balloob

We cannot have 2 overflow menus. That looks weird.

I think I misinterpreted your suggestion in https://github.com/home-assistant/core/pull/65928

Although I would even move that into the overflow menu so that we don't have to confuse the user always with it.

Did you mean to dynamically include it into the overflow menu for the ha-automation-trigger-row? I agree that the double mdiDotsVertical icon for the overflow menu looks odd. What would you think about just switching the icon to mdiCog?

esev avatar Feb 14 '22 07:02 esev

cog is definitely an improvement. Maybe @matthiasdebaat also has an idea for improvement.

balloob avatar Feb 14 '22 07:02 balloob

Just a small consistency thingy maybe, we recently added a similar feature for users:

CleanShot 2022-02-15 at 08 26 15@2x

In this case, it uses: Allow only local, while this PR adds: Allow for internet.

Should we create consistency here and use same logic/wording? (As in toggle to allow local only, instead of allowing internet access).

frenck avatar Feb 15 '22 07:02 frenck

I suspect the default is off/false for the Can only log in from the local network user feature. That's also what I was going for here too; the user would need to enable something to change the setting from the default state.

That said, changing to the same language makes sense to me. In the Python code, the existing webhook setting is local_only. So this would also make the python side more consistent also. I'll rename the config option to be local_only instead of allow_internet and update the three PRs to match after work tonight.

esev avatar Feb 15 '22 17:02 esev

Backend has been merged.

frenck avatar Apr 14 '23 10:04 frenck