Enhancement: remove wg-easy custom proxy, use password header
This commit is contained in:
parent
133d2d6e02
commit
996ec039b6
@ -88,6 +88,8 @@ export default async function credentialedProxyHandler(req, res, map) {
|
|||||||
if (widget.key) {
|
if (widget.key) {
|
||||||
headers.Cookie = `authenticated=${widget.key}`;
|
headers.Cookie = `authenticated=${widget.key}`;
|
||||||
}
|
}
|
||||||
|
} else if (widget.type === "wgeasy") {
|
||||||
|
headers.Authorization = widget.password;
|
||||||
} else {
|
} else {
|
||||||
headers["X-API-Key"] = `${widget.key}`;
|
headers["X-API-Key"] = `${widget.key}`;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,14 +5,14 @@ import useWidgetAPI from "utils/proxy/use-widget-api";
|
|||||||
export default function Component({ service }) {
|
export default function Component({ service }) {
|
||||||
const { widget } = service;
|
const { widget } = service;
|
||||||
|
|
||||||
const { data: infoData, error: infoError } = useWidgetAPI(widget);
|
const { data: infoData, error: infoError } = useWidgetAPI(widget, "client");
|
||||||
|
|
||||||
if (!widget.fields) {
|
if (!widget.fields) {
|
||||||
widget.fields = ["connected", "enabled", "total"];
|
widget.fields = ["connected", "enabled", "total"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (infoError) {
|
if (infoError || infoData?.statusCode > 400) {
|
||||||
return <Container service={service} error={infoError} />;
|
return <Container service={service} error={infoError ?? { message: infoData.statusMessage, data: infoData }} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!infoData) {
|
if (!infoData) {
|
||||||
|
|||||||
@ -1,8 +1,14 @@
|
|||||||
import wgeasyProxyHandler from "./proxy";
|
import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
|
||||||
|
|
||||||
const widget = {
|
const widget = {
|
||||||
api: "{url}/api/{endpoint}",
|
api: "{url}/api/{endpoint}",
|
||||||
proxyHandler: wgeasyProxyHandler,
|
proxyHandler: credentialedProxyHandler,
|
||||||
|
|
||||||
|
mappings: {
|
||||||
|
client: {
|
||||||
|
endpoint: "wireguard/client",
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default widget;
|
export default widget;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user