FEAT: NGINX Proxy Manager

pull/45/head
aidenpwnz 2 years ago
parent 057d5eca8f
commit 13afe82fa5

@ -2,21 +2,17 @@ import useSWR from "swr";
import Widget from "../widget";
import Block from "../block";
import { useState } from "react";
export default function Npm({ service }) {
const config = service.widget;
const { url } = config;
const [token, setToken] = useState();
const fetcher = async (reqUrl) => {
const { url, email, password } = config;
const urlConstructed = `${url}/api/tokens`;
const body = { identity: email, secret: password };
const { url, username, password } = config;
const loginUrl = `${url}/api/tokens`;
const body = { identity: username, secret: password };
if (!token) {
const res = await fetch(urlConstructed, {
const res = await fetch(loginUrl, {
method: "POST",
body: JSON.stringify(body),
headers: {
@ -35,16 +31,6 @@ export default function Npm({ service }) {
})
);
return res.json();
} else {
const resp = await fetch(reqUrl, {
method: "GET",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + token,
},
});
return resp.json();
}
};
const { data: infoData, error: infoError } = useSWR(`${url}/api/nginx/proxy-hosts`, fetcher);

@ -5,6 +5,11 @@
- My First Service:
href: http://localhosdt/
description: Homepage is awesome
widget:
type: npm # npm for NGINX Proxy Manager
url: http://localhost:81 # no slash at the end
username: aidenpwnz@proton.me # your email
password: AidenProxy1994! # your password
- My Second Group:
- My Second Service:

Loading…
Cancel
Save