1
mirror of https://github.com/home-assistant/core synced 2024-08-02 23:40:32 +02:00
Commit Graph

333 Commits

Author SHA1 Message Date
Paulus Schoutsen
63f8e437ed
Add Home Assistant Content user (#64337) 2022-01-21 10:06:39 -08:00
epenet
6f631c542c
Import hassio (#64561)
* Import hassio

* Fix HassioAPIError

* Use relative import

* Adjust import

Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-20 19:03:26 +01:00
Erik Montnemery
2eab3c8de1
Import persistent notification (part 3) (#63900) 2022-01-11 09:51:16 -08:00
epenet
40e77e2af0
Fix type hint in http register_view (#63385)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-04 21:25:16 -08:00
Tobias Sauerwein
2c904c0974
Bump mypy to 0.930 (#62642)
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2021-12-27 17:55:17 +01:00
Paulus Schoutsen
914f7f85ec
Add local only users (#57598) 2021-11-29 14:01:03 -08:00
Simone Chemelli
5fc51130ea
Replace util.get_local_ip in favor of components.network.async_get_source_ip() - part 4 (#58669)
Co-authored-by: J. Nick Koston <nick@koston.org>
2021-11-15 09:18:57 -08:00
Paulus Schoutsen
6ef64f6b1c
Fix CORS error in emulated_hue (#59570) 2021-11-11 22:11:41 -08:00
Bram Kragten
28c07f5c43
Fix CORS (#59360)
* Fix CORS

* rename

* Update view.py
2021-11-09 18:30:51 +01:00
Marc Mueller
4c68662612
Use assignment expressions 34 (#58823) 2021-10-31 19:01:16 +01:00
Ville Skyttä
b52c5c82b1
Use http.HTTPStatus in components/[gh]* (#58246) 2021-10-23 20:34:53 +02:00
Marc Mueller
aa7dc78a1e
Use assignment expressions 11 (#57792) 2021-10-17 20:15:48 +02:00
Ville Skyttä
cc97502a0c
Use HTTPStatus instead of HTTP_* consts in aiohttp web response statuses (#56541) 2021-10-01 09:27:44 -07:00
Marc Mueller
565a9fea6b
Import Callable from collections.abc (2) (#56776) 2021-09-29 14:06:51 +02:00
Ville Skyttä
d8d34fdd3b
Prefer HTTPStatus over int in HA view JSON functions (#56504)
* Prefer HTTPStatus over int in HA view JSON functions

* Update zwave tests to not expect a fixed typo
2021-09-22 21:59:52 +03:00
Ruslan Sayfutdinov
7195b8222b
Bump PyJWT to 2.1.0 (#55911) 2021-09-07 20:59:02 -07:00
Paulus Schoutsen
27e29b714c
Bump cloud to 0.47.1 (#55312)
* Bump cloud to 0.47.0

* Bump reqs

* Bump to 0.47.1

* Do not load hass_nabucasa during http startup

* fix some tests

* Fix test

Co-authored-by: Ludeeus <ludeeus@ludeeus.dev>
2021-09-01 09:54:54 -07:00
Ville Skyttä
59809503d1
Various type hint related improvements (#54971)
* Avoid some implicit generic Anys

* Fix hassio discovery view type hints

* Fix http view result type in assert message
2021-08-21 13:58:49 +02:00
Paulus Schoutsen
bab7d46c9b
Guard partial upgrade (#54617) 2021-08-15 19:56:56 -07:00
Paulus Schoutsen
38a7bdbcf3
Do not process forwarded for headers for cloud requests (#54364) 2021-08-10 01:45:56 +02:00
Marc Mueller
10bfc78365
Fix missing encoding with open() (#53593)
* Fix missing encoding with open()

* Fix tests

* Improve open - frontend
2021-07-28 09:41:45 +02:00
Joakim Plate
d339e3bd8c
Reject trusted network access from proxies (#52388) 2021-07-02 11:49:42 +02:00
Joakim Plate
eedf1c3ebe
Reject requests from the proxy itself (#52073)
* Reject requests from the proxy itself

* Adjust tests
2021-06-27 19:02:51 +02:00
Franck Nijhof
33e08f38da
Raise bad request when receiving HTTP request from untrusted proxy (#51839)
* Raise bad request when receiving HTTP request from untrusted proxy

* Fix code comment
2021-06-17 04:41:19 +02:00
Franck Nijhof
cdd1f6b2f0
Always load middle to handle forwarded proxy data (#51332) 2021-06-01 09:38:55 -07:00
Paulus Schoutsen
bd0373388d
Trusted networks auth provider warns if detects a requests with x-forwarded-for header while the http integration is not configured for reverse proxies (#51319)
* Trusted networks auth provider to require http integration configured for proxies to allow logging in with requests with x-forwarded-for header

* Make it a warning
2021-06-01 12:51:44 +02:00
Ruslan Sayfutdinov
ce15f28642
Add missing type hints in http component (#50411) 2021-05-10 14:30:47 -07:00
J. Nick Koston
a4432557d3
Defer writing http config until after startup has calmed down (#50000) 2021-05-02 19:48:49 -10:00
Marc Mueller
c07646db5d
Update typing syntax (#49480)
* Update typing syntax

* Replace typing imports with ones from collections where possible

* Changes after review
2021-04-20 17:40:41 +02:00
Franck Nijhof
055cdc64c0
Add support for IoT class in manifest (#46935) 2021-04-15 10:21:38 +02:00
J. Nick Koston
81e6ad0744
Replace http startup logic with async_when_setup_or_start (#48784) 2021-04-13 14:10:58 -07:00
Erik Montnemery
f5545badac
Quote media_source paths (#49054)
* Quote path in async_sign_path

* Address review comments, add tests

* Update tests/testing_config/media/Epic Sax Guy 10 Hours.mp4

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-04-12 18:32:12 +02:00
Ville Skyttä
3cd52b695d
Upgrade flake8 and dependencies, enable flake8-noqa (#48393)
* Upgrade flake8 to 3.9.0

https://flake8.pycqa.org/en/latest/release-notes/3.9.0.html

* Upgrade pydocstyle to 6.0.0

https://www.pydocstyle.org/en/latest/release_notes.html#september-13th-2020
https://www.pydocstyle.org/en/latest/release_notes.html#march-18th-2021

* Upgrade flake8-docstrings to 1.6.0, enable flake8-noqa

https://gitlab.com/pycqa/flake8-docstrings/-/blob/1.6.0/HISTORY.rst
https://github.com/plinss/flake8-noqa/issues/1

* Upgrade/pin pyflakes to 2.3.1

https://github.com/PyCQA/pyflakes/blob/2.3.1/NEWS.rst

* Pin pycodestyle to 2.7.0
2021-03-27 10:22:11 +01:00
Franck Nijhof
6932cf9534
Use contextlib.suppress where possible (#48189) 2021-03-23 14:36:43 +01:00
Franck Nijhof
dc15f243e6
Upgrade pyupgrade to v2.11.0 (#48220) 2021-03-22 13:29:39 +01:00
Marc Mueller
5cdd945f44
Update typing 08 (#48058) 2021-03-18 09:25:40 +01:00
Bram Kragten
e3105c7eb1
Revert CORS changes for my home assistant (#47064)
* Revert CORS changes for my home assistant

* Update test_init.py

* Update test_init.py
2021-02-25 15:28:22 -08:00
Franck Nijhof
22389043eb
Remove base_url fallback (#46316) 2021-02-10 14:31:11 +01:00
Bram Kragten
6f446cf627
Add my component (#46058)
Co-authored-by: Franck Nijhof <git@frenck.dev>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-02-08 14:44:46 +01:00
Joakim Plate
38d2cacf7a
Support blocking trusted network from new ip (#44630)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-01-28 12:06:20 +01:00
Paulus Schoutsen
b9a525a9a7
Add an HTTP view to dump the Z-Wave JS state (#45452)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2021-01-26 10:27:20 +01:00
gregod
cf9ea6f82d
Sanitize user-agent in wrong_login message (#45251) 2021-01-18 09:21:30 +01:00
Franck Nijhof
dee0f887de
Extend filter and filter tests (#45179) 2021-01-15 10:30:29 +01:00
Franck Nijhof
f047d04882
Add filtering 2021-01-14 20:02:01 +01:00
Stefan Agner
ab25c5a2bd
Shutdown asyncio http server within 10 seconds (#45033)
If there are open requests, the http server waits up to 60 seconds.
However, some requests (such as the Reboot button) seems to keep a
connection open and needlessly slow down the reboot process:

```
Jan 11 00:52:54 homeassistant eb034fca9c7d[404]: 2021-01-11 00:52:54 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event homeassistant_stop[L]>
Jan 11 00:52:54 homeassistant eb034fca9c7d[404]: 2021-01-11 00:52:54 DEBUG (MainThread) [homeassistant.helpers.restore_state] Dumping states 111
Jan 11 00:52:54 homeassistant eb034fca9c7d[404]: 2021-01-11 00:52:54 DEBUG (MainThread) [homeassistant.helpers.restore_state] Dumping states
Jan 11 00:52:54 homeassistant eb034fca9c7d[404]: 2021-01-11 00:52:54 INFO (MainThread) [homeassistant.components.websocket_api.http.connection] [281473359593728] Connection closed by client
Jan 11 00:52:56 homeassistant eb034fca9c7d[404]: 2021-01-11 00:52:56 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [281473359593728] Disconnected
Jan 11 00:53:54 homeassistant eb034fca9c7d[404]: 2021-01-11 00:53:54 DEBUG (MainThread) [homeassistant.core] Waited 60 seconds for task: <Task pending name='Task-585' coro=<async_setup.<locals>.stop_server() running at /usr/src/homeassistant/homeassistant/components/http/__init__.py:228> wait_for=<_GatheringFuture pending cb=[<TaskWakeupMethWrapper object at 0xffff9f112f70>()]> cb=[_wait.<locals>._on_completion() at /usr/local/lib/python3.8/asyncio/tasks.py:518]>
...
```
2021-01-11 09:36:14 +01:00
Paulus Schoutsen
20ed40d7ad
Use utcnow from date util for http.ban (#43686) 2020-11-27 17:04:52 +01:00
Paulus Schoutsen
5ecaa9e4d2
Add log message server startup (#43177) 2020-11-13 14:39:50 +01:00
J. Nick Koston
3267823165
Update http to use async_add_executor_job (#41529) 2020-10-09 09:29:07 +02:00
Paulus Schoutsen
fbbfd46fb8
Add .well-known/password-change (#39613) 2020-09-03 18:13:33 +02:00
Ville Skyttä
b4bac0f7a0
Exception chaining and wrapping improvements (#39320)
* Remove unnecessary exception re-wraps

* Preserve exception chains on re-raise

We slap "from cause" to almost all possible cases here. In some cases it
could conceivably be better to do "from None" if we really want to hide
the cause. However those should be in the minority, and "from cause"
should be an improvement over the corresponding raise without a "from"
in all cases anyway.

The only case where we raise from None here is in plex, where the
exception for an original invalid SSL cert is not the root cause for
failure to validate a newly fetched one.

Follow local convention on exception variable names if there is a
consistent one, otherwise `err` to match with majority of codebase.

* Fix mistaken re-wrap in homematicip_cloud/hap.py

Missed the difference between HmipConnectionError and
HmipcConnectionError.

* Do not hide original error on plex new cert validation error

Original is not the cause for the new one, but showing old in the
traceback is useful nevertheless.
2020-08-28 13:50:32 +02:00