mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-02 13:33:40 +01:00
Enhancement: support basic auth to ESPHome widget (#4429)
This commit is contained in:
parent
b853c566b2
commit
6b2a3da7ee
@ -16,5 +16,6 @@ To group both `offline` and `unknown` devices together, users should use the `of
|
||||
widget:
|
||||
type: esphome
|
||||
url: http://esphome.host.or.ip:port
|
||||
key: myesphomecookie # only if auth enabled, get the value from a request from the frontend e.g. `authenticated=myesphomecookie`
|
||||
username: myesphomeuser # only if auth enabled
|
||||
password: myesphomepass # only if auth enabled
|
||||
```
|
||||
|
@ -89,7 +89,9 @@ export default async function credentialedProxyHandler(req, res, map) {
|
||||
} else if (widget.type === "myspeed") {
|
||||
headers.Password = `${widget.password}`;
|
||||
} else if (widget.type === "esphome") {
|
||||
if (widget.key) {
|
||||
if (widget.username && widget.password) {
|
||||
headers.Authorization = `Basic ${Buffer.from(`${widget.username}:${widget.password}`).toString("base64")}`;
|
||||
} else if (widget.key) {
|
||||
headers.Cookie = `authenticated=${widget.key}`;
|
||||
}
|
||||
} else if (widget.type === "wgeasy") {
|
||||
|
Loading…
x
Reference in New Issue
Block a user