Commit Graph

376 Commits (20d1a0fc7745e44f1ca5521b6a558a48a9cb7189)

Author SHA1 Message Date
J. Nick Koston e27554f7a6
Improve http handler performance (#93324) 2023-05-21 13:36:03 -05:00
J. Nick Koston 3f43184187
Speed up signing paths (#93127) 2023-05-17 22:01:13 +02:00
Erik Montnemery 043812bfc3
Bump hass-nabucasa to 0.67.1 (#92484)
* Bump hass-nabucasa to 0.67.1

* Fix typing
2023-05-08 10:51:47 +02:00
Franck Nijhof b033232b06
Filter out ASCII tab or newline from input URLs (#90348) 2023-03-27 13:49:40 -04:00
J. Nick Koston 72b09bfee7
Subclass aiohttp requests to use json helper (#90214)
* Subclass aiohttp requests to use json helper

* Subclass aiohttp requests to use json helper

* remove unneeded

* revert for new pr

* override loads is never used so drop it

* override loads is never used so drop it
2023-03-24 15:37:43 -04:00
J. Nick Koston dd0f05b980
Avoid calling the http access logging when logging is disabled (#90152) 2023-03-23 09:55:02 -10:00
Paulus Schoutsen 12352b2ce1
Always enforce URL param ordering for signed URLs (#90148)
Always enforce URL param ordering
2023-03-22 22:54:09 -04:00
J. Nick Koston ca576d45ac
Cache decode of JWT tokens (#90013) 2023-03-22 16:03:41 -10:00
Marc Mueller 386533a16f
Update mypy to 1.1.1 (#89268)
* Update mypy to 1.1.1
* Update pydantic to 1.10.6
2023-03-08 22:57:54 +01:00
Franck Nijhof 95ed6fbc08
Small improvements to middleware filter (#88921)
Small improvements middleware filter
2023-02-28 12:07:17 -05:00
epenet ba23816a0c
Inverse json import logic (#88099)
* Fix helpers and util

* Adjust components

* Move back errors

* Add report

* mypy

* mypy

* Assert deprecation messages

* Move test_json_loads_object

* Adjust tests

* Fix rebase

* Adjust pylint plugin

* Fix plugin

* Adjust references

* Adjust backup tests
2023-02-16 11:37:57 +01:00
Erik Montnemery 899adef590
Sort manifests 4 (#87025) 2023-02-08 20:27:05 +01:00
Franck Nijhof ca1a12898c
Enable Ruff D212 (#87347) 2023-02-03 23:08:48 +01:00
Paulus Schoutsen 9c0856787d
Improve JSON errors from HTTP view (#87042) 2023-01-31 20:37:26 +01:00
Franck Nijhof d4955a3d87
Replace assert False by raising an error (#86686) 2023-01-26 16:51:43 +01:00
Marc Mueller 8abce25948
Update Union typing (4) [Py310] (#86427) 2023-01-23 09:04:40 +01:00
Marc Mueller 45b4b0e990
Import `ParamSpec` from typing [Py310] (#86413)
* Import ParamSpec from typing [Py310]

* Update additional imports
2023-01-23 07:28:43 +01:00
Franck Nijhof 79b52a2b41
Stricter pylint message control (#86154) 2023-01-20 13:47:55 +01:00
Mike Degatano 87aacf9fbe
Increase max line size for ingress addons (#85775) 2023-01-13 13:30:28 +01:00
Franck Nijhof cb13418bab
String formatting and max line length - Part 2 (#84393) 2022-12-22 11:38:59 +01:00
Joakim Plate 8bd4125390
Test corrections noticed during pytest upgrade (#82579)
* Withing trigger a call to coordinator after init

* Stop discovery task on STOP event

* Stop dsmr connection task on STOP

* Use autospec in modem_serial tests

close on AioSerial is non async, and should not be mocked as a coroutine

* Make sure responder is specced correctly

tests/components/emulated_hue/test_init.py::test_setup_works
  /Users/joakim/src/hass/home-assistant/homeassistant/components/emulated_hue/__init__.py:119: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
    protocol.close()

* Don't assume Pymodbus is the only thing logging

* Use gather instead of wait

```
homeassistant/components/homeassistant/__init__.py:208: DeprecationWarning: The explicit passing of coroutine objects to asyncio.wait() is deprecated since Python 3.8, and scheduled for removal in Python 3.11.
```

* Increase wait time for automation tests

Assuming exit within 1 seconds is unreasonable on a potentially loaded
test machine.

* Avoid changing app state after startup
2022-11-23 20:53:28 +01:00
Franck Nijhof 2b27cfdabb
Set system & entity integration types (#79593) 2022-10-04 10:36:42 -04:00
epenet 454bdcc00d
Expose http constants in root (#78267) 2022-09-12 18:41:18 +02:00
Franck Nijhof 91180923ae
Fix HTTP 404 being logged as a stack trace (#75861) 2022-07-28 16:43:32 +02:00
Marc Mueller af7df260a0
Fix small type issues [core] (#75760) 2022-07-26 16:28:22 +02:00
Marc Mueller b1ed1543c8
Improve http decorator typing (#75541) 2022-07-21 13:07:42 +02:00
Franck Nijhof 9a4a7e2f4d
Extend failed login message with the request URL (#75218) 2022-07-14 21:43:14 +02:00
epenet 16900dcef1
Make Store a generic class (#74617) 2022-07-09 22:32:57 +02:00
J. Nick Koston 0c29b68cf8
Switch linear search to a dict lookup for ip bans (#74482) 2022-07-07 10:57:44 +02:00
J. Nick Koston 332cf3cd2d
Resolve and caches paths for CachingStaticResource in the executor (#74474) 2022-07-06 13:49:48 -05:00
J. Nick Koston 8dfb0cb4e7
Fix SIGN_QUERY_PARAM in check in auth_middleware (#74479) 2022-07-05 21:09:33 -07:00
J. Nick Koston 8b067e83f7
Initial orjson support take 3 (#73849)
* Initial orjson support take 2

Still need to work out problem building wheels

--

Redux of #72754 / #32153 Now possible since the following is solved:
ijl/orjson#220 (comment)

This implements orjson where we use our default encoder.  This does not implement orjson where `ExtendedJSONEncoder` is used as these areas tend to be called far less frequently.  If its desired, this could be done in a followup, but it seemed like a case of diminishing returns (except maybe for large diagnostics files, or traces, but those are not expected to be downloaded frequently).

Areas where this makes a perceptible difference:
- Anything that subscribes to entities (Initial subscribe_entities payload)
- Initial download of registries on first connection / restore
- History queries
- Saving states to the database
- Large logbook queries
- Anything that subscribes to events (appdaemon)

Cavets:
orjson supports serializing dataclasses natively (and much faster) which
eliminates the need to implement `as_dict` in many places
when the data is already in a dataclass. This works
well as long as all the data in the dataclass can also
be serialized. I audited all places where we have an `as_dict`
for a dataclass and found only backups needs to be adjusted (support for `Path` needed to be added for backups).  I was a little bit worried about `SensorExtraStoredData` with `Decimal` but it all seems to work out from since it converts it before it gets to the json encoding cc @dgomes

If it turns out to be a problem we can disable this
with option |= [orjson.OPT_PASSTHROUGH_DATACLASS](https://github.com/ijl/orjson#opt_passthrough_dataclass) and it
will fallback to `as_dict`

Its quite impressive for history queries
<img width="1271" alt="Screen_Shot_2022-05-30_at_23_46_30" src="https://user-images.githubusercontent.com/663432/171145699-661ad9db-d91d-4b2d-9c1a-9d7866c03a73.png">

* use for views as well

* handle UnicodeEncodeError

* tweak

* DRY

* DRY

* not needed

* fix tests

* Update tests/components/http/test_view.py

* Update tests/components/http/test_view.py

* black

* templates
2022-06-22 21:59:51 +02:00
Christopher Bailey 0461ec1566
Fix auth_sign_path with query params (take 2) (#73829) 2022-06-22 10:09:21 -05:00
J. Nick Koston 1e0a3246f4
Revert "Fix auth_sign_path with query params (#73240)" (#73808) 2022-06-21 22:45:16 -05:00
Christopher Bailey 67618311fa
Fix auth_sign_path with query params (#73240)
Co-authored-by: J. Nick Koston <nick@koston.org>
2022-06-21 14:21:47 -05:00
Franck Nijhof 5f44d0f8f9
Clean up accessing storage.Store helper via hass (#72009) 2022-05-17 18:45:57 +02:00
Marc Mueller 93cbb331e5
Update Mypy to 0.950 (#70948)
Co-authored-by: J. Nick Koston <nick@koston.org>
2022-04-27 20:49:54 -05:00
Marc Mueller 53245c6523
Update pylint to 2.13.0 (#68656) 2022-03-25 15:14:48 -07:00
Franck Nijhof 3afadf8adb
Revert "Block peer certs on supervisor" (#67104) 2022-02-23 12:32:07 +01:00
Paulus Schoutsen 938b64081b
Block peer certs on supervisor (#66837)
Co-authored-by: Pascal Vizeli <pvizeli@syshack.ch>
Co-authored-by: Mike Degatano <michael.degatano@gmail.com>
2022-02-22 13:59:40 -08:00
J. Nick Koston 3bf2be1765
Startup with an emergency self signed cert if the ssl certificate cannot be loaded (#66707) 2022-02-18 16:08:26 -08:00
Marc Mueller 370832f527
Fix http typing (#66506) 2022-02-14 13:40:31 +01:00
Franck Nijhof fa09cf663e
Update black to 22.1.0 (#65788) 2022-02-05 14:19:37 +01:00
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