Enhancement: more reliable wg-easy widget by custom proxy, use password header (#3966)

This commit is contained in:
shamoon
2024-09-09 11:40:11 -07:00
committed by GitHub
parent 133d2d6e02
commit 2d0beabe9a
4 changed files with 13 additions and 90 deletions

View File

@@ -5,14 +5,14 @@ import useWidgetAPI from "utils/proxy/use-widget-api";
export default function Component({ service }) {
const { widget } = service;
const { data: infoData, error: infoError } = useWidgetAPI(widget);
const { data: infoData, error: infoError } = useWidgetAPI(widget, "client");
if (!widget.fields) {
widget.fields = ["connected", "enabled", "total"];
}
if (infoError) {
return <Container service={service} error={infoError} />;
if (infoError || infoData?.statusCode > 400) {
return <Container service={service} error={infoError ?? { message: infoData.statusMessage, data: infoData }} />;
}
if (!infoData) {