mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-09 14:58:47 +00:00
utils cleanup, initial static generation
This commit is contained in:
parent
ec8700f3e9
commit
e1a3a82f75
86 changed files with 279 additions and 261 deletions
|
@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import Block from "components/services/widgets/block";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import genericProxyHandler from "utils/proxies/generic";
|
||||
import genericProxyHandler from "utils/proxy/handlers/generic";
|
||||
|
||||
const widget = {
|
||||
api: "{url}/control/{endpoint}",
|
||||
proxyHandler: genericProxyHandler,
|
||||
|
||||
mappings: {
|
||||
"stats": {
|
||||
stats: {
|
||||
endpoint: "stats",
|
||||
},
|
||||
},
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import Block from "components/services/widgets/block";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
@ -30,11 +30,13 @@ export default function Component({ service }) {
|
|||
|
||||
const yesterday = new Date(Date.now()).setHours(-24);
|
||||
const loginsLast24H = loginsData.reduce(
|
||||
(total, current) => current.x_cord >= yesterday ? total + current.y_cord : total
|
||||
, 0);
|
||||
(total, current) => (current.x_cord >= yesterday ? total + current.y_cord : total),
|
||||
0
|
||||
);
|
||||
const failedLoginsLast24H = failedLoginsData.reduce(
|
||||
(total, current) => current.x_cord >= yesterday ? total + current.y_cord : total
|
||||
, 0);
|
||||
(total, current) => (current.x_cord >= yesterday ? total + current.y_cord : total),
|
||||
0
|
||||
);
|
||||
|
||||
return (
|
||||
<Widget>
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
import credentialedProxyHandler from "utils/proxies/credentialed";
|
||||
import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
|
||||
|
||||
const widget = {
|
||||
api: "{url}/api/v3/{endpoint}",
|
||||
proxyHandler: credentialedProxyHandler,
|
||||
|
||||
mappings: {
|
||||
"users": {
|
||||
endpoint: "core/users?page_size=1"
|
||||
users: {
|
||||
endpoint: "core/users?page_size=1",
|
||||
},
|
||||
"login": {
|
||||
endpoint: "events/events/per_month/?action=login&query={}"
|
||||
login: {
|
||||
endpoint: "events/events/per_month/?action=login&query={}",
|
||||
},
|
||||
"login_failed": {
|
||||
endpoint: "events/events/per_month/?action=login_failed&query={}"
|
||||
login_failed: {
|
||||
endpoint: "events/events/per_month/?action=login_failed&query={}",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import Block from "components/services/widgets/block";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
import genericProxyHandler from "utils/proxies/generic";
|
||||
import { asJson } from "utils/api-helpers";
|
||||
import genericProxyHandler from "utils/proxy/handlers/generic";
|
||||
import { asJson } from "utils/proxy/api-helpers";
|
||||
|
||||
const widget = {
|
||||
api: "{url}/api/{endpoint}/wanted?apikey={key}",
|
||||
proxyHandler: genericProxyHandler,
|
||||
|
||||
mappings: {
|
||||
"movies": {
|
||||
movies: {
|
||||
endpoint: "movies",
|
||||
map: (data) => ({
|
||||
total: asJson(data).total,
|
||||
}),
|
||||
},
|
||||
"episodes": {
|
||||
episodes: {
|
||||
endpoint: "episodes",
|
||||
map: (data) => ({
|
||||
total: asJson(data).total,
|
||||
|
|
|
@ -6,7 +6,7 @@ import classNames from "classnames";
|
|||
import Widget from "components/services/widgets/widget";
|
||||
import Block from "components/services/widgets/block";
|
||||
import Dropdown from "components/services/dropdown";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
@ -27,7 +27,7 @@ export default function Component({ service }) {
|
|||
const { data: statsData, error: statsError } = useSWR(
|
||||
formatProxyUrl(config, "v1/cryptocurrency/quotes/latest", {
|
||||
symbol: `${symbols.join(",")}`,
|
||||
convert: `${currencyCode}`
|
||||
convert: `${currencyCode}`,
|
||||
})
|
||||
);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import credentialedProxyHandler from "utils/proxies/credentialed";
|
||||
import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
|
||||
|
||||
const widget = {
|
||||
api: "https://pro-api.coinmarketcap.com/{endpoint}",
|
||||
|
|
|
@ -12,18 +12,10 @@ export default function Component({ service }) {
|
|||
const config = service.widget;
|
||||
|
||||
const { data: statusData, error: statusError } = useSWR(
|
||||
`/api/docker/status/${config.container}/${config.server || ""}`,
|
||||
{
|
||||
refreshInterval: 5000,
|
||||
}
|
||||
`/api/docker/status/${config.container}/${config.server || ""}`
|
||||
);
|
||||
|
||||
const { data: statsData, error: statsError } = useSWR(
|
||||
`/api/docker/stats/${config.container}/${config.server || ""}`,
|
||||
{
|
||||
refreshInterval: 5000,
|
||||
}
|
||||
);
|
||||
const { data: statsData, error: statsError } = useSWR(`/api/docker/stats/${config.container}/${config.server || ""}`);
|
||||
|
||||
if (statsError || statusError) {
|
||||
return <Widget error={t("widget.api_error")} />;
|
||||
|
|
|
@ -4,7 +4,7 @@ import { BsVolumeMuteFill, BsFillPlayFill, BsPauseFill, BsCpu, BsFillCpuFill } f
|
|||
import { MdOutlineSmartDisplay } from "react-icons/md";
|
||||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import { formatProxyUrl, formatProxyUrlWithSegments } from "utils/api-helpers";
|
||||
import { formatProxyUrl, formatProxyUrlWithSegments } from "utils/proxy/api-helpers";
|
||||
|
||||
function ticksToTime(ticks) {
|
||||
const milliseconds = ticks / 10000;
|
||||
|
@ -164,7 +164,7 @@ export default function Component({ service }) {
|
|||
async function handlePlayCommand(session, command) {
|
||||
const url = formatProxyUrlWithSegments(config, "PlayControl", {
|
||||
sessionId: session.Id,
|
||||
command
|
||||
command,
|
||||
});
|
||||
await fetch(url).then(() => {
|
||||
sessionMutate();
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
import genericProxyHandler from "utils/proxies/generic";
|
||||
import genericProxyHandler from "utils/proxy/handlers/generic";
|
||||
|
||||
const widget = {
|
||||
api: "{url}/emby/{endpoint}?api_key={key}",
|
||||
proxyHandler: genericProxyHandler,
|
||||
|
||||
mappings: {
|
||||
"Sessions": {
|
||||
Sessions: {
|
||||
endpoint: "Sessions",
|
||||
},
|
||||
"PlayControl": {
|
||||
PlayControl: {
|
||||
method: "POST",
|
||||
enpoint: "Sessions/{sessionId}/Playing/{command}",
|
||||
segments: ["sessionId", "command"]
|
||||
}
|
||||
segments: ["sessionId", "command"],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import Block from "components/services/widgets/block";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
import credentialedProxyHandler from "utils/proxies/credentialed";
|
||||
import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
|
||||
|
||||
const widget = {
|
||||
api: "{url}/{endpoint}",
|
||||
proxyHandler: credentialedProxyHandler,
|
||||
|
||||
mappings: {
|
||||
"application": {
|
||||
endpoint: "application"
|
||||
application: {
|
||||
endpoint: "application",
|
||||
},
|
||||
"client": {
|
||||
endpoint: "client"
|
||||
client: {
|
||||
endpoint: "client",
|
||||
},
|
||||
"message": {
|
||||
endpoint: "message"
|
||||
message: {
|
||||
endpoint: "message",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import Block from "components/services/widgets/block";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import genericProxyHandler from "utils/proxies/generic";
|
||||
import genericProxyHandler from "utils/proxy/handlers/generic";
|
||||
|
||||
const widget = {
|
||||
api: "{url}/api/v2.0/{endpoint}?apikey={key}&configured=true",
|
||||
proxyHandler: genericProxyHandler,
|
||||
|
||||
mappings: {
|
||||
"indexers": {
|
||||
endpoint: "indexers"
|
||||
indexers: {
|
||||
endpoint: "indexers",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import Block from "components/services/widgets/block";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import credentialedProxyHandler from "utils/proxies/credentialed";
|
||||
import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
|
||||
|
||||
const widget = {
|
||||
api: "{url}/api/v1/{endpoint}",
|
||||
|
@ -6,7 +6,7 @@ const widget = {
|
|||
|
||||
mappings: {
|
||||
"request/count": {
|
||||
endpoint: "request/count"
|
||||
endpoint: "request/count",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import Block from "components/services/widgets/block";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import genericProxyHandler from "utils/proxies/generic";
|
||||
import { jsonArrayFilter } from "utils/api-helpers";
|
||||
import genericProxyHandler from "utils/proxy/handlers/generic";
|
||||
import { jsonArrayFilter } from "utils/proxy/api-helpers";
|
||||
|
||||
const widget = {
|
||||
api: "{url}/api/v1/{endpoint}?apikey={key}",
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import Block from "components/services/widgets/block";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import genericProxyHandler from "utils/proxies/generic";
|
||||
import genericProxyHandler from "utils/proxy/handlers/generic";
|
||||
|
||||
const widget = {
|
||||
api: "{url}/api/v1/{endpoint}",
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import Block from "components/services/widgets/block";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import getServiceWidget from "utils/service-helpers";
|
||||
import { formatApiCall } from "utils/api-helpers";
|
||||
import { formatApiCall } from "utils/proxy/api-helpers";
|
||||
import widgets from "widgets/widgets";
|
||||
|
||||
export default async function npmProxyHandler(req, res) {
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import Block from "components/services/widgets/block";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation("common");
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import Block from "components/services/widgets/block";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import credentialedProxyHandler from "utils/proxies/credentialed";
|
||||
import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
|
||||
|
||||
const widget = {
|
||||
api: "{url}/api/v1/{endpoint}",
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import Block from "components/services/widgets/block";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import credentialedProxyHandler from "utils/proxies/credentialed";
|
||||
import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
|
||||
|
||||
const widget = {
|
||||
api: "{url}/api/v1/{endpoint}",
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import Block from "components/services/widgets/block";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import genericProxyHandler from "utils/proxies/generic";
|
||||
import genericProxyHandler from "utils/proxy/handlers/generic";
|
||||
|
||||
const widget = {
|
||||
api: "{url}/admin/{endpoint}",
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import Block from "components/services/widgets/block";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import credentialedProxyHandler from "utils/proxies/credentialed";
|
||||
import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
|
||||
|
||||
const widget = {
|
||||
api: "{url}/api/endpoints/{env}/{endpoint}",
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import Block from "components/services/widgets/block";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import genericProxyHandler from "utils/proxies/generic";
|
||||
import genericProxyHandler from "utils/proxy/handlers/generic";
|
||||
|
||||
const widget = {
|
||||
api: "{url}/api/v1/{endpoint}",
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import Block from "components/services/widgets/block";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { formatApiCall } from "utils/api-helpers";
|
||||
import { addCookieToJar, setCookieHeader } from "utils/cookie-jar";
|
||||
import { httpProxy } from "utils/http";
|
||||
import { formatApiCall } from "utils/proxy/api-helpers";
|
||||
import { addCookieToJar, setCookieHeader } from "utils/proxy/cookie-jar";
|
||||
import { httpProxy } from "utils/proxy/http";
|
||||
import getServiceWidget from "utils/service-helpers";
|
||||
|
||||
async function login(widget, params) {
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import Block from "components/services/widgets/block";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import genericProxyHandler from "utils/proxies/generic";
|
||||
import { jsonArrayFilter } from "utils/api-helpers";
|
||||
import genericProxyHandler from "utils/proxy/handlers/generic";
|
||||
import { jsonArrayFilter } from "utils/proxy/api-helpers";
|
||||
|
||||
const widget = {
|
||||
api: "{url}/api/v3/{endpoint}?apikey={key}",
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import Block from "components/services/widgets/block";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import genericProxyHandler from "utils/proxies/generic";
|
||||
import { jsonArrayFilter } from "utils/api-helpers";
|
||||
import genericProxyHandler from "utils/proxy/handlers/generic";
|
||||
import { jsonArrayFilter } from "utils/proxy/api-helpers";
|
||||
|
||||
const widget = {
|
||||
api: "{url}/api/v1/{endpoint}?apikey={key}",
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import Block from "components/services/widgets/block";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import Block from "components/services/widgets/block";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import genericProxyHandler from "utils/proxies/generic";
|
||||
import genericProxyHandler from "utils/proxy/handlers/generic";
|
||||
|
||||
const widget = {
|
||||
api: "{url}/api/?apikey={key}&output=json&mode={endpoint}",
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import Block from "components/services/widgets/block";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import genericProxyHandler from "utils/proxies/generic";
|
||||
import { asJson } from "utils/api-helpers";
|
||||
import genericProxyHandler from "utils/proxy/handlers/generic";
|
||||
import { asJson } from "utils/proxy/api-helpers";
|
||||
|
||||
const widget = {
|
||||
api: "{url}/api/v3/{endpoint}?apikey={key}",
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import Block from "components/services/widgets/block";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import genericProxyHandler from "utils/proxies/generic";
|
||||
import genericProxyHandler from "utils/proxy/handlers/generic";
|
||||
|
||||
const widget = {
|
||||
api: "{url}/api/{endpoint}",
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import Block from "components/services/widgets/block";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import genericProxyHandler from "utils/proxies/generic";
|
||||
import genericProxyHandler from "utils/proxy/handlers/generic";
|
||||
|
||||
const widget = {
|
||||
api: "{url}/{endpoint}",
|
||||
|
|
|
@ -5,7 +5,7 @@ import { BsFillPlayFill, BsPauseFill, BsCpu, BsFillCpuFill } from "react-icons/b
|
|||
import { MdOutlineSmartDisplay, MdSmartDisplay } from "react-icons/md";
|
||||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
function millisecondsToTime(milliseconds) {
|
||||
const seconds = Math.floor((milliseconds / 1000) % 60);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import genericProxyHandler from "utils/proxies/generic";
|
||||
import genericProxyHandler from "utils/proxy/handlers/generic";
|
||||
|
||||
const widget = {
|
||||
api: "{url}/api/v2?apikey={key}&cmd={endpoint}",
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import Block from "components/services/widgets/block";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import genericProxyHandler from "utils/proxies/generic";
|
||||
import genericProxyHandler from "utils/proxy/handlers/generic";
|
||||
|
||||
const widget = {
|
||||
api: "{url}/api/{endpoint}",
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
import Widget from "components/services/widgets/widget";
|
||||
import Block from "components/services/widgets/block";
|
||||
import { formatProxyUrl } from "utils/api-helpers";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { httpProxy } from "utils/http";
|
||||
import { formatApiCall } from "utils/api-helpers";
|
||||
import { httpProxy } from "utils/proxy/http";
|
||||
import { formatApiCall } from "utils/proxy/api-helpers";
|
||||
import getServiceWidget from "utils/service-helpers";
|
||||
|
||||
export default async function transmissionProxyHandler(req, res) {
|
||||
|
@ -23,8 +23,8 @@ export default async function transmissionProxyHandler(req, res) {
|
|||
const body = JSON.stringify({
|
||||
method: "torrent-get",
|
||||
arguments: {
|
||||
fields: ["percentDone", "status", "rateDownload", "rateUpload"]
|
||||
}
|
||||
fields: ["percentDone", "status", "rateDownload", "rateUpload"],
|
||||
},
|
||||
});
|
||||
|
||||
const headers = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue