mirror of
https://github.com/gethomepage/homepage.git
synced 2026-01-05 23:12:08 +08:00
Enhancement: more reliable wg-easy widget by custom proxy, use password header (#3966)
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user