mirror of
https://github.com/esphome/esphome.git
synced 2025-09-22 13:12:22 +01:00
preen
This commit is contained in:
@@ -27,10 +27,15 @@ CODEOWNERS = ["@esphome/core"]
|
|||||||
DEPENDENCIES = ["network"]
|
DEPENDENCIES = ["network"]
|
||||||
|
|
||||||
|
|
||||||
|
def supports_sha256() -> bool:
|
||||||
|
"""Check if the current platform supports SHA256 for OTA authentication."""
|
||||||
|
return bool(CORE.is_esp32 or CORE.is_esp8266 or CORE.is_rp2040 or CORE.is_libretiny)
|
||||||
|
|
||||||
|
|
||||||
def AUTO_LOAD():
|
def AUTO_LOAD():
|
||||||
"""Conditionally auto-load sha256 only on platforms that support it."""
|
"""Conditionally auto-load sha256 only on platforms that support it."""
|
||||||
base_components = ["md5", "socket"]
|
base_components = ["md5", "socket"]
|
||||||
if CORE.is_esp32 or CORE.is_esp8266 or CORE.is_rp2040 or CORE.is_libretiny:
|
if supports_sha256():
|
||||||
return base_components + ["sha256"]
|
return base_components + ["sha256"]
|
||||||
return base_components
|
return base_components
|
||||||
|
|
||||||
@@ -136,7 +141,7 @@ async def to_code(config):
|
|||||||
cg.add(var.set_port(config[CONF_PORT]))
|
cg.add(var.set_port(config[CONF_PORT]))
|
||||||
|
|
||||||
# Only include SHA256 support on platforms that have it
|
# Only include SHA256 support on platforms that have it
|
||||||
if CORE.is_esp32 or CORE.is_esp8266 or CORE.is_rp2040 or CORE.is_libretiny:
|
if supports_sha256():
|
||||||
cg.add_define("USE_OTA_SHA256")
|
cg.add_define("USE_OTA_SHA256")
|
||||||
|
|
||||||
if CONF_PASSWORD in config:
|
if CONF_PASSWORD in config:
|
||||||
|
Reference in New Issue
Block a user