mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 09:17:46 +01:00
Require arduino in webserver for better validation (#2941)
This commit is contained in:
parent
e152f128c8
commit
cc5947467f
1 changed files with 32 additions and 25 deletions
|
@ -22,7 +22,8 @@ AUTO_LOAD = ["json", "web_server_base"]
|
|||
web_server_ns = cg.esphome_ns.namespace("web_server")
|
||||
WebServer = web_server_ns.class_("WebServer", cg.Component, cg.Controller)
|
||||
|
||||
CONFIG_SCHEMA = cv.Schema(
|
||||
CONFIG_SCHEMA = cv.All(
|
||||
cv.Schema(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(WebServer),
|
||||
cv.Optional(CONF_PORT, default=80): cv.port,
|
||||
|
@ -36,8 +37,12 @@ CONFIG_SCHEMA = cv.Schema(
|
|||
cv.Optional(CONF_JS_INCLUDE): cv.file_,
|
||||
cv.Optional(CONF_AUTH): cv.Schema(
|
||||
{
|
||||
cv.Required(CONF_USERNAME): cv.All(cv.string_strict, cv.Length(min=1)),
|
||||
cv.Required(CONF_PASSWORD): cv.All(cv.string_strict, cv.Length(min=1)),
|
||||
cv.Required(CONF_USERNAME): cv.All(
|
||||
cv.string_strict, cv.Length(min=1)
|
||||
),
|
||||
cv.Required(CONF_PASSWORD): cv.All(
|
||||
cv.string_strict, cv.Length(min=1)
|
||||
),
|
||||
}
|
||||
),
|
||||
cv.GenerateID(CONF_WEB_SERVER_BASE_ID): cv.use_id(
|
||||
|
@ -45,8 +50,10 @@ CONFIG_SCHEMA = cv.Schema(
|
|||
),
|
||||
cv.Optional(CONF_INCLUDE_INTERNAL, default=False): cv.boolean,
|
||||
cv.Optional(CONF_OTA, default=True): cv.boolean,
|
||||
}
|
||||
).extend(cv.COMPONENT_SCHEMA)
|
||||
},
|
||||
).extend(cv.COMPONENT_SCHEMA),
|
||||
cv.only_with_arduino,
|
||||
)
|
||||
|
||||
|
||||
@coroutine_with_priority(40.0)
|
||||
|
|
Loading…
Reference in a new issue