diff --git a/src/components/bookmarks/item.jsx b/src/components/bookmarks/item.jsx
index c3c5b452..b87d4a56 100644
--- a/src/components/bookmarks/item.jsx
+++ b/src/components/bookmarks/item.jsx
@@ -1,6 +1,6 @@
import { useContext } from "react";
-import { SettingsContext } from "utils/settings-context";
+import { SettingsContext } from "utils/contexts/settings";
export default function Item({ bookmark }) {
const { hostname } = new URL(bookmark.href);
diff --git a/src/components/color-toggle.jsx b/src/components/color-toggle.jsx
index c05fb2f2..aab94d72 100644
--- a/src/components/color-toggle.jsx
+++ b/src/components/color-toggle.jsx
@@ -3,7 +3,7 @@ import { IoColorPalette } from "react-icons/io5";
import { Popover, Transition } from "@headlessui/react";
import classNames from "classnames";
-import { ColorContext } from "utils/color-context";
+import { ColorContext } from "utils/contexts/color";
const colors = [
"slate",
diff --git a/src/components/services/item.jsx b/src/components/services/item.jsx
index 7974789f..efbf9076 100644
--- a/src/components/services/item.jsx
+++ b/src/components/services/item.jsx
@@ -6,7 +6,7 @@ import Status from "./status";
import Widget from "./widget";
import Docker from "widgets/docker/component";
-import { SettingsContext } from "utils/settings-context";
+import { SettingsContext } from "utils/contexts/settings";
function resolveIcon(icon) {
if (icon.startsWith("http")) {
@@ -85,14 +85,16 @@ export default function Item({ service }) {
)}
-
-
-
+ {service.container && service.server && (
+
+
+
+ )}
{service.widget && }
diff --git a/src/components/theme-toggle.jsx b/src/components/theme-toggle.jsx
index ecbb1762..3cc1fccf 100644
--- a/src/components/theme-toggle.jsx
+++ b/src/components/theme-toggle.jsx
@@ -1,7 +1,7 @@
import { useContext } from "react";
import { MdDarkMode, MdLightMode, MdToggleOff, MdToggleOn } from "react-icons/md";
-import { ThemeContext } from "utils/theme-context";
+import { ThemeContext } from "utils/contexts/theme";
export default function ThemeToggle() {
const { theme, setTheme } = useContext(ThemeContext);
diff --git a/src/components/widget.jsx b/src/components/widget.jsx
index ae579542..a5ed1eb3 100644
--- a/src/components/widget.jsx
+++ b/src/components/widget.jsx
@@ -1,18 +1,12 @@
-import WeatherApi from "components/widgets/weather/weather";
-import OpenWeatherMap from "components/widgets/openweathermap/weather";
-import Resources from "components/widgets/resources/resources";
-import Search from "components/widgets/search/search";
-import Greeting from "components/widgets/greeting/greeting";
-import DateTime from "components/widgets/datetime/datetime";
+import dynamic from "next/dynamic";
const widgetMappings = {
- weather: WeatherApi, // This key will be deprecated in the future
- weatherapi: WeatherApi,
- openweathermap: OpenWeatherMap,
- resources: Resources,
- search: Search,
- greeting: Greeting,
- datetime: DateTime,
+ weatherapi: dynamic(() => import("components/widgets/weather/weather")),
+ openweathermap: dynamic(() => import("components/widgets/openweathermap/weather")),
+ resources: dynamic(() => import("components/widgets/resources/resources")),
+ search: dynamic(() => import("components/widgets/search/search")),
+ greeting: dynamic(() => import("components/widgets/greeting/greeting")),
+ datetime: dynamic(() => import("components/widgets/datetime/datetime")),
};
export default function Widget({ widget }) {
diff --git a/src/components/widgets/openweathermap/icon.jsx b/src/components/widgets/openweathermap/icon.jsx
index da65bc91..a2b01ba1 100644
--- a/src/components/widgets/openweathermap/icon.jsx
+++ b/src/components/widgets/openweathermap/icon.jsx
@@ -1,4 +1,4 @@
-import mapIcon from "utils/owm-condition-map";
+import mapIcon from "utils/weather/owm-condition-map";
export default function Icon({ condition, timeOfDay }) {
const IconComponent = mapIcon(condition, timeOfDay);
diff --git a/src/components/widgets/openweathermap/weather.jsx b/src/components/widgets/openweathermap/weather.jsx
index 5c78d74c..9037eb3a 100644
--- a/src/components/widgets/openweathermap/weather.jsx
+++ b/src/components/widgets/openweathermap/weather.jsx
@@ -80,20 +80,22 @@ export default function OpenWeatherMap({ options }) {
const requestLocation = () => {
setRequesting(true);
- navigator.geolocation.getCurrentPosition(
- (position) => {
- setLocation({ latitude: position.coords.latitude, longitude: position.coords.longitude });
- setRequesting(false);
- },
- () => {
- setRequesting(false);
- },
- {
- enableHighAccuracy: true,
- maximumAge: 1000 * 60 * 60 * 3,
- timeout: 1000 * 30,
- }
- );
+ if (typeof window !== "undefined") {
+ navigator.geolocation.getCurrentPosition(
+ (position) => {
+ setLocation({ latitude: position.coords.latitude, longitude: position.coords.longitude });
+ setRequesting(false);
+ },
+ () => {
+ setRequesting(false);
+ },
+ {
+ enableHighAccuracy: true,
+ maximumAge: 1000 * 60 * 60 * 3,
+ timeout: 1000 * 30,
+ }
+ );
+ }
};
if (!requesting && !location) requestLocation();
diff --git a/src/components/widgets/weather/icon.jsx b/src/components/widgets/weather/icon.jsx
index e501b0a8..79406ae7 100644
--- a/src/components/widgets/weather/icon.jsx
+++ b/src/components/widgets/weather/icon.jsx
@@ -1,4 +1,4 @@
-import mapIcon from "utils/condition-map";
+import mapIcon from "utils/weather/condition-map";
export default function Icon({ condition, timeOfDay }) {
const IconComponent = mapIcon(condition, timeOfDay);
diff --git a/src/components/widgets/weather/weather.jsx b/src/components/widgets/weather/weather.jsx
index 9fe3b242..1c92f839 100644
--- a/src/components/widgets/weather/weather.jsx
+++ b/src/components/widgets/weather/weather.jsx
@@ -81,20 +81,22 @@ export default function WeatherApi({ options }) {
const requestLocation = () => {
setRequesting(true);
- navigator.geolocation.getCurrentPosition(
- (position) => {
- setLocation({ latitude: position.coords.latitude, longitude: position.coords.longitude });
- setRequesting(false);
- },
- () => {
- setRequesting(false);
- },
- {
- enableHighAccuracy: true,
- maximumAge: 1000 * 60 * 60 * 3,
- timeout: 1000 * 30,
- }
- );
+ if (typeof window !== "undefined") {
+ navigator.geolocation.getCurrentPosition(
+ (position) => {
+ setLocation({ latitude: position.coords.latitude, longitude: position.coords.longitude });
+ setRequesting(false);
+ },
+ () => {
+ setRequesting(false);
+ },
+ {
+ enableHighAccuracy: true,
+ maximumAge: 1000 * 60 * 60 * 3,
+ timeout: 1000 * 30,
+ }
+ );
+ }
};
if (!requesting && !location) requestLocation();
diff --git a/src/pages/_app.jsx b/src/pages/_app.jsx
index 6cdef8a0..e87bd90a 100644
--- a/src/pages/_app.jsx
+++ b/src/pages/_app.jsx
@@ -7,9 +7,9 @@ import "styles/theme.css";
import "styles/manrope.css";
import nextI18nextConfig from "../../next-i18next.config";
-import { ColorProvider } from "utils/color-context";
-import { ThemeProvider } from "utils/theme-context";
-import { SettingsProvider } from "utils/settings-context";
+import { ColorProvider } from "utils/contexts/color";
+import { ThemeProvider } from "utils/contexts/theme";
+import { SettingsProvider } from "utils/contexts/settings";
function MyApp({ Component, pageProps }) {
return (
diff --git a/src/pages/api/bookmarks.js b/src/pages/api/bookmarks.js
index c50add44..63d1e29e 100644
--- a/src/pages/api/bookmarks.js
+++ b/src/pages/api/bookmarks.js
@@ -1,25 +1,5 @@
-import { promises as fs } from "fs";
-import path from "path";
-
-import yaml from "js-yaml";
-
-import checkAndCopyConfig from "utils/config";
+import { bookmarksResponse } from "utils/config/api-response";
export default async function handler(req, res) {
- checkAndCopyConfig("bookmarks.yaml");
-
- const bookmarksYaml = path.join(process.cwd(), "config", "bookmarks.yaml");
- const fileContents = await fs.readFile(bookmarksYaml, "utf8");
- const bookmarks = yaml.load(fileContents);
-
- // map easy to write YAML objects into easy to consume JS arrays
- const bookmarksArray = bookmarks.map((group) => ({
- name: Object.keys(group)[0],
- bookmarks: group[Object.keys(group)[0]].map((entries) => ({
- name: Object.keys(entries)[0],
- ...entries[Object.keys(entries)[0]][0],
- })),
- }));
-
- res.send(bookmarksArray);
+ res.send(await bookmarksResponse());
}
diff --git a/src/pages/api/proxy.js b/src/pages/api/proxy.js
index ff7ca357..7ab95edc 100644
--- a/src/pages/api/proxy.js
+++ b/src/pages/api/proxy.js
@@ -2,7 +2,7 @@ import https from "https";
import getRawBody from "raw-body";
-import { httpRequest, httpsRequest } from "utils/http";
+import { httpRequest, httpsRequest } from "utils/proxy/http";
export const config = {
api: {
diff --git a/src/pages/api/services/index.js b/src/pages/api/services/index.js
index 52951fbb..46d0a721 100644
--- a/src/pages/api/services/index.js
+++ b/src/pages/api/services/index.js
@@ -1,43 +1,5 @@
-/* eslint-disable no-console */
-import { servicesFromConfig, servicesFromDocker, cleanServiceGroups } from "utils/service-helpers";
+import { servicesResponse } from "utils/config/api-response";
export default async function handler(req, res) {
- let discoveredServices;
- let configuredServices;
-
- try {
- discoveredServices = cleanServiceGroups(await servicesFromDocker());
- } catch (e) {
- console.error("Failed to discover services, please check docker.yaml for errors or remove example entries.");
- console.error(e);
- discoveredServices = [];
- }
-
- try {
- configuredServices = cleanServiceGroups(await servicesFromConfig());
- } catch (e) {
- console.error("Failed to load services.yaml, please check for errors");
- console.error(e);
- configuredServices = [];
- }
-
- const mergedGroupsNames = [
- ...new Set([discoveredServices.map((group) => group.name), configuredServices.map((group) => group.name)].flat()),
- ];
-
- const mergedGroups = [];
-
- mergedGroupsNames.forEach((groupName) => {
- const discoveredGroup = discoveredServices.find((group) => group.name === groupName) || { services: [] };
- const configuredGroup = configuredServices.find((group) => group.name === groupName) || { services: [] };
-
- const mergedGroup = {
- name: groupName,
- services: [...discoveredGroup.services, ...configuredGroup.services].filter((service) => service),
- };
-
- mergedGroups.push(mergedGroup);
- });
-
- res.send(mergedGroups);
+ res.send(await servicesResponse());
}
diff --git a/src/pages/api/services/proxy.js b/src/pages/api/services/proxy.js
index 895f8617..31c21a98 100644
--- a/src/pages/api/services/proxy.js
+++ b/src/pages/api/services/proxy.js
@@ -1,6 +1,6 @@
-import { formatApiCall } from "utils/api-helpers";
+import { formatApiCall } from "utils/proxy/api-helpers";
import createLogger from "utils/logger";
-import genericProxyHandler from "utils/proxies/generic";
+import genericProxyHandler from "utils/proxy/handlers/generic";
import widgets from "widgets/widgets";
const logger = createLogger("servicesProxy");
diff --git a/src/pages/api/widgets/index.js b/src/pages/api/widgets/index.js
index 3e96c26b..513e02e9 100644
--- a/src/pages/api/widgets/index.js
+++ b/src/pages/api/widgets/index.js
@@ -1,22 +1,5 @@
-import { promises as fs } from "fs";
-import path from "path";
-
-import yaml from "js-yaml";
-
-import checkAndCopyConfig from "utils/config";
+import { widgetsResponse } from "utils/config/api-response";
export default async function handler(req, res) {
- checkAndCopyConfig("widgets.yaml");
-
- const widgetsYaml = path.join(process.cwd(), "config", "widgets.yaml");
- const fileContents = await fs.readFile(widgetsYaml, "utf8");
- const widgets = yaml.load(fileContents);
-
- // map easy to write YAML objects into easy to consume JS arrays
- const widgetsArray = widgets.map((group) => ({
- type: Object.keys(group)[0],
- options: { ...group[Object.keys(group)[0]] },
- }));
-
- res.send(widgetsArray);
+ res.send(await widgetsResponse());
}
diff --git a/src/pages/api/widgets/openweathermap.js b/src/pages/api/widgets/openweathermap.js
index 93eeb93d..b94c9d8d 100644
--- a/src/pages/api/widgets/openweathermap.js
+++ b/src/pages/api/widgets/openweathermap.js
@@ -1,4 +1,4 @@
-import cachedFetch from "utils/cached-fetch";
+import cachedFetch from "utils/proxy/cached-fetch";
import { getSettings } from "utils/config";
export default async function handler(req, res) {
diff --git a/src/pages/api/widgets/weather.js b/src/pages/api/widgets/weather.js
index 5154a6dc..893d3054 100644
--- a/src/pages/api/widgets/weather.js
+++ b/src/pages/api/widgets/weather.js
@@ -1,4 +1,4 @@
-import cachedFetch from "utils/cached-fetch";
+import cachedFetch from "utils/proxy/cached-fetch";
import { getSettings } from "utils/config";
export default async function handler(req, res) {
diff --git a/src/pages/index.jsx b/src/pages/index.jsx
index 614201c9..a1faafb7 100644
--- a/src/pages/index.jsx
+++ b/src/pages/index.jsx
@@ -1,5 +1,5 @@
/* eslint-disable react/no-array-index-key */
-import useSWR from "swr";
+import useSWR, { SWRConfig } from "swr";
import Head from "next/head";
import dynamic from "next/dynamic";
import { useTranslation } from "next-i18next";
@@ -13,9 +13,10 @@ import Widget from "components/widget";
import Revalidate from "components/revalidate";
import createLogger from "utils/logger";
import { getSettings } from "utils/config";
-import { ColorContext } from "utils/color-context";
-import { ThemeContext } from "utils/theme-context";
-import { SettingsContext } from "utils/settings-context";
+import { ColorContext } from "utils/contexts/color";
+import { ThemeContext } from "utils/contexts/theme";
+import { SettingsContext } from "utils/contexts/settings";
+import { bookmarksResponse, servicesResponse, widgetsResponse } from "utils/config/api-response";
const ThemeToggle = dynamic(() => import("components/theme-toggle"), {
ssr: false,
@@ -37,9 +38,18 @@ export async function getStaticProps() {
logger = createLogger("index");
const { providers, ...settings } = getSettings();
+ const services = await servicesResponse();
+ const bookmarks = await bookmarksResponse();
+ const widgets = await widgetsResponse();
+
return {
props: {
initialSettings: settings,
+ fallback: {
+ "/api/services": services,
+ "/api/bookmarks": bookmarks,
+ "/api/widgets": widgets,
+ },
...(await serverSideTranslations(settings.language ?? "en")),
},
};
@@ -56,7 +66,7 @@ export async function getStaticProps() {
}
}
-export default function Index({ initialSettings }) {
+export default function Index({ initialSettings, fallback }) {
const { data: errorsData } = useSWR("/api/validate");
if (errorsData && errorsData.length > 0) {
@@ -83,7 +93,11 @@ export default function Index({ initialSettings }) {
);
}
- return ;
+ return (
+ fetch(resource, init).then((res) => res.json()) }}>
+
+
+ );
}
function Home({ initialSettings }) {
diff --git a/src/utils/config/api-response.js b/src/utils/config/api-response.js
new file mode 100644
index 00000000..502b2796
--- /dev/null
+++ b/src/utils/config/api-response.js
@@ -0,0 +1,84 @@
+/* eslint-disable no-console */
+import { promises as fs } from "fs";
+import path from "path";
+
+import yaml from "js-yaml";
+
+import checkAndCopyConfig from "utils/config";
+import { servicesFromConfig, servicesFromDocker, cleanServiceGroups } from "utils/service-helpers";
+
+export async function bookmarksResponse() {
+ checkAndCopyConfig("bookmarks.yaml");
+
+ const bookmarksYaml = path.join(process.cwd(), "config", "bookmarks.yaml");
+ const fileContents = await fs.readFile(bookmarksYaml, "utf8");
+ const bookmarks = yaml.load(fileContents);
+
+ // map easy to write YAML objects into easy to consume JS arrays
+ const bookmarksArray = bookmarks.map((group) => ({
+ name: Object.keys(group)[0],
+ bookmarks: group[Object.keys(group)[0]].map((entries) => ({
+ name: Object.keys(entries)[0],
+ ...entries[Object.keys(entries)[0]][0],
+ })),
+ }));
+
+ return bookmarksArray;
+}
+
+export async function widgetsResponse() {
+ checkAndCopyConfig("widgets.yaml");
+
+ const widgetsYaml = path.join(process.cwd(), "config", "widgets.yaml");
+ const fileContents = await fs.readFile(widgetsYaml, "utf8");
+ const widgets = yaml.load(fileContents);
+
+ // map easy to write YAML objects into easy to consume JS arrays
+ const widgetsArray = widgets.map((group) => ({
+ type: Object.keys(group)[0],
+ options: { ...group[Object.keys(group)[0]] },
+ }));
+
+ return widgetsArray;
+}
+
+export async function servicesResponse() {
+ let discoveredServices;
+ let configuredServices;
+
+ try {
+ discoveredServices = cleanServiceGroups(await servicesFromDocker());
+ } catch (e) {
+ console.error("Failed to discover services, please check docker.yaml for errors or remove example entries.");
+ console.error(e);
+ discoveredServices = [];
+ }
+
+ try {
+ configuredServices = cleanServiceGroups(await servicesFromConfig());
+ } catch (e) {
+ console.error("Failed to load services.yaml, please check for errors");
+ console.error(e);
+ configuredServices = [];
+ }
+
+ const mergedGroupsNames = [
+ ...new Set([discoveredServices.map((group) => group.name), configuredServices.map((group) => group.name)].flat()),
+ ];
+
+ const mergedGroups = [];
+
+ mergedGroupsNames.forEach((groupName) => {
+ const discoveredGroup = discoveredServices.find((group) => group.name === groupName) || { services: [] };
+ const configuredGroup = configuredServices.find((group) => group.name === groupName) || { services: [] };
+
+ const mergedGroup = {
+ name: groupName,
+ services: [...discoveredGroup.services, ...configuredGroup.services].filter((service) => service),
+ };
+
+ mergedGroups.push(mergedGroup);
+ });
+
+ return mergedGroups;
+}
diff --git a/src/utils/color-context.jsx b/src/utils/contexts/color.jsx
similarity index 100%
rename from src/utils/color-context.jsx
rename to src/utils/contexts/color.jsx
diff --git a/src/utils/settings-context.jsx b/src/utils/contexts/settings.jsx
similarity index 100%
rename from src/utils/settings-context.jsx
rename to src/utils/contexts/settings.jsx
diff --git a/src/utils/theme-context.jsx b/src/utils/contexts/theme.jsx
similarity index 100%
rename from src/utils/theme-context.jsx
rename to src/utils/contexts/theme.jsx
diff --git a/src/utils/api-helpers.js b/src/utils/proxy/api-helpers.js
similarity index 100%
rename from src/utils/api-helpers.js
rename to src/utils/proxy/api-helpers.js
diff --git a/src/utils/cached-fetch.js b/src/utils/proxy/cached-fetch.js
similarity index 100%
rename from src/utils/cached-fetch.js
rename to src/utils/proxy/cached-fetch.js
diff --git a/src/utils/cookie-jar.js b/src/utils/proxy/cookie-jar.js
similarity index 100%
rename from src/utils/cookie-jar.js
rename to src/utils/proxy/cookie-jar.js
diff --git a/src/utils/proxies/credentialed.js b/src/utils/proxy/handlers/credentialed.js
similarity index 94%
rename from src/utils/proxies/credentialed.js
rename to src/utils/proxy/handlers/credentialed.js
index 098fd8bc..7bea34f7 100644
--- a/src/utils/proxies/credentialed.js
+++ b/src/utils/proxy/handlers/credentialed.js
@@ -1,6 +1,6 @@
import getServiceWidget from "utils/service-helpers";
-import { formatApiCall } from "utils/api-helpers";
-import { httpProxy } from "utils/http";
+import { formatApiCall } from "utils/proxy/api-helpers";
+import { httpProxy } from "utils/proxy/http";
import createLogger from "utils/logger";
import widgets from "widgets/widgets";
diff --git a/src/utils/proxies/generic.js b/src/utils/proxy/handlers/generic.js
similarity index 93%
rename from src/utils/proxies/generic.js
rename to src/utils/proxy/handlers/generic.js
index 0f911aeb..b25042f1 100644
--- a/src/utils/proxies/generic.js
+++ b/src/utils/proxy/handlers/generic.js
@@ -1,6 +1,6 @@
import getServiceWidget from "utils/service-helpers";
-import { formatApiCall } from "utils/api-helpers";
-import { httpProxy } from "utils/http";
+import { formatApiCall } from "utils/proxy/api-helpers";
+import { httpProxy } from "utils/proxy/http";
import createLogger from "utils/logger";
import widgets from "widgets/widgets";
diff --git a/src/utils/http.js b/src/utils/proxy/http.js
similarity index 96%
rename from src/utils/http.js
rename to src/utils/proxy/http.js
index bfeec046..feed71dd 100644
--- a/src/utils/http.js
+++ b/src/utils/proxy/http.js
@@ -2,7 +2,7 @@
/* eslint-disable no-param-reassign */
import { http, https } from "follow-redirects";
-import { addCookieToJar, setCookieHeader } from "utils/cookie-jar";
+import { addCookieToJar, setCookieHeader } from "./cookie-jar";
function addCookieHandler(url, params) {
setCookieHeader(url, params);
diff --git a/src/utils/service-helpers.js b/src/utils/service-helpers.js
index 595d5e36..8918e264 100644
--- a/src/utils/service-helpers.js
+++ b/src/utils/service-helpers.js
@@ -121,15 +121,16 @@ export function cleanServiceGroups(groups) {
cleanedService.widget = {
type,
- currency,
- symbols,
service_name: service.name,
service_group: serviceGroup.name,
};
+ if (currency) cleanedService.widget.currency = currency;
+ if (symbols) cleanedService.widget.symbols = symbols;
+
if (type === "docker") {
- cleanedService.widget.server = server;
- cleanedService.widget.container = container;
+ if (server) cleanedService.widget.server = server;
+ if (container) cleanedService.widget.container = container;
}
}
diff --git a/src/utils/condition-map.js b/src/utils/weather/condition-map.js
similarity index 100%
rename from src/utils/condition-map.js
rename to src/utils/weather/condition-map.js
diff --git a/src/utils/owm-condition-map.js b/src/utils/weather/owm-condition-map.js
similarity index 100%
rename from src/utils/owm-condition-map.js
rename to src/utils/weather/owm-condition-map.js
diff --git a/src/widgets/adguard/component.jsx b/src/widgets/adguard/component.jsx
index edbf14e9..e6f0d6be 100644
--- a/src/widgets/adguard/component.jsx
+++ b/src/widgets/adguard/component.jsx
@@ -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();
diff --git a/src/widgets/adguard/widget.js b/src/widgets/adguard/widget.js
index ecbdf12a..fe8d060d 100644
--- a/src/widgets/adguard/widget.js
+++ b/src/widgets/adguard/widget.js
@@ -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",
},
},
diff --git a/src/widgets/authentik/component.jsx b/src/widgets/authentik/component.jsx
index 365060b2..63fef6f3 100644
--- a/src/widgets/authentik/component.jsx
+++ b/src/widgets/authentik/component.jsx
@@ -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 (
diff --git a/src/widgets/authentik/widget.js b/src/widgets/authentik/widget.js
index e665d526..7a7b532f 100644
--- a/src/widgets/authentik/widget.js
+++ b/src/widgets/authentik/widget.js
@@ -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={}",
},
},
};
diff --git a/src/widgets/bazarr/component.jsx b/src/widgets/bazarr/component.jsx
index c2e3b7cb..fd0630ce 100644
--- a/src/widgets/bazarr/component.jsx
+++ b/src/widgets/bazarr/component.jsx
@@ -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();
diff --git a/src/widgets/bazarr/widget.js b/src/widgets/bazarr/widget.js
index 9f12c18e..5b89b2b4 100644
--- a/src/widgets/bazarr/widget.js
+++ b/src/widgets/bazarr/widget.js
@@ -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,
diff --git a/src/widgets/coinmarketcap/component.jsx b/src/widgets/coinmarketcap/component.jsx
index 7cdb03af..88f70041 100644
--- a/src/widgets/coinmarketcap/component.jsx
+++ b/src/widgets/coinmarketcap/component.jsx
@@ -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}`,
})
);
diff --git a/src/widgets/coinmarketcap/widget.js b/src/widgets/coinmarketcap/widget.js
index f493e62f..fcbafadf 100644
--- a/src/widgets/coinmarketcap/widget.js
+++ b/src/widgets/coinmarketcap/widget.js
@@ -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}",
diff --git a/src/widgets/docker/component.jsx b/src/widgets/docker/component.jsx
index bf015060..a9c26b1c 100644
--- a/src/widgets/docker/component.jsx
+++ b/src/widgets/docker/component.jsx
@@ -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 ;
diff --git a/src/widgets/emby/component.jsx b/src/widgets/emby/component.jsx
index 5096174d..c3217b3a 100644
--- a/src/widgets/emby/component.jsx
+++ b/src/widgets/emby/component.jsx
@@ -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();
diff --git a/src/widgets/emby/widget.js b/src/widgets/emby/widget.js
index 42157522..1bb5a726 100644
--- a/src/widgets/emby/widget.js
+++ b/src/widgets/emby/widget.js
@@ -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"],
+ },
},
};
diff --git a/src/widgets/gotify/component.jsx b/src/widgets/gotify/component.jsx
index 178dedca..943a7478 100644
--- a/src/widgets/gotify/component.jsx
+++ b/src/widgets/gotify/component.jsx
@@ -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();
diff --git a/src/widgets/gotify/widget.js b/src/widgets/gotify/widget.js
index 2ad71180..251f35f9 100644
--- a/src/widgets/gotify/widget.js
+++ b/src/widgets/gotify/widget.js
@@ -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",
},
},
};
diff --git a/src/widgets/jackett/component.jsx b/src/widgets/jackett/component.jsx
index 738355fc..e1d4083f 100644
--- a/src/widgets/jackett/component.jsx
+++ b/src/widgets/jackett/component.jsx
@@ -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();
diff --git a/src/widgets/jackett/widget.js b/src/widgets/jackett/widget.js
index d787c3e4..9d2a9b5c 100644
--- a/src/widgets/jackett/widget.js
+++ b/src/widgets/jackett/widget.js
@@ -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",
},
},
};
diff --git a/src/widgets/jellyseerr/component.jsx b/src/widgets/jellyseerr/component.jsx
index 74685ddc..1254d8d4 100644
--- a/src/widgets/jellyseerr/component.jsx
+++ b/src/widgets/jellyseerr/component.jsx
@@ -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();
diff --git a/src/widgets/jellyseerr/widget.js b/src/widgets/jellyseerr/widget.js
index 4b823efc..d752e339 100644
--- a/src/widgets/jellyseerr/widget.js
+++ b/src/widgets/jellyseerr/widget.js
@@ -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",
},
},
};
diff --git a/src/widgets/lidarr/component.jsx b/src/widgets/lidarr/component.jsx
index fc0e7a95..588ca94b 100644
--- a/src/widgets/lidarr/component.jsx
+++ b/src/widgets/lidarr/component.jsx
@@ -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();
diff --git a/src/widgets/lidarr/widget.js b/src/widgets/lidarr/widget.js
index aac84b74..6ff93254 100644
--- a/src/widgets/lidarr/widget.js
+++ b/src/widgets/lidarr/widget.js
@@ -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}",
diff --git a/src/widgets/mastodon/component.jsx b/src/widgets/mastodon/component.jsx
index fbee420f..cbd3635d 100644
--- a/src/widgets/mastodon/component.jsx
+++ b/src/widgets/mastodon/component.jsx
@@ -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();
diff --git a/src/widgets/mastodon/widget.js b/src/widgets/mastodon/widget.js
index c9761c5e..2daebb0f 100644
--- a/src/widgets/mastodon/widget.js
+++ b/src/widgets/mastodon/widget.js
@@ -1,4 +1,4 @@
-import genericProxyHandler from "utils/proxies/generic";
+import genericProxyHandler from "utils/proxy/handlers/generic";
const widget = {
api: "{url}/api/v1/{endpoint}",
diff --git a/src/widgets/npm/component.jsx b/src/widgets/npm/component.jsx
index 59a709e8..0d2ab75e 100644
--- a/src/widgets/npm/component.jsx
+++ b/src/widgets/npm/component.jsx
@@ -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();
diff --git a/src/widgets/npm/proxy.js b/src/widgets/npm/proxy.js
index bd612a50..44e760eb 100644
--- a/src/widgets/npm/proxy.js
+++ b/src/widgets/npm/proxy.js
@@ -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) {
diff --git a/src/widgets/nzbget/component.jsx b/src/widgets/nzbget/component.jsx
index fe85cdb5..c57ba415 100644
--- a/src/widgets/nzbget/component.jsx
+++ b/src/widgets/nzbget/component.jsx
@@ -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");
diff --git a/src/widgets/ombi/component.jsx b/src/widgets/ombi/component.jsx
index 55435b54..d2b9544b 100644
--- a/src/widgets/ombi/component.jsx
+++ b/src/widgets/ombi/component.jsx
@@ -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();
diff --git a/src/widgets/ombi/widget.js b/src/widgets/ombi/widget.js
index d0dbea93..e7928e7e 100644
--- a/src/widgets/ombi/widget.js
+++ b/src/widgets/ombi/widget.js
@@ -1,4 +1,4 @@
-import credentialedProxyHandler from "utils/proxies/credentialed";
+import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
const widget = {
api: "{url}/api/v1/{endpoint}",
diff --git a/src/widgets/overseerr/component.jsx b/src/widgets/overseerr/component.jsx
index 0201ca81..cb49dfba 100644
--- a/src/widgets/overseerr/component.jsx
+++ b/src/widgets/overseerr/component.jsx
@@ -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();
diff --git a/src/widgets/overseerr/widget.js b/src/widgets/overseerr/widget.js
index b46bad90..d752e339 100644
--- a/src/widgets/overseerr/widget.js
+++ b/src/widgets/overseerr/widget.js
@@ -1,4 +1,4 @@
-import credentialedProxyHandler from "utils/proxies/credentialed";
+import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
const widget = {
api: "{url}/api/v1/{endpoint}",
diff --git a/src/widgets/pihole/component.jsx b/src/widgets/pihole/component.jsx
index fea8e68c..e6c6862d 100644
--- a/src/widgets/pihole/component.jsx
+++ b/src/widgets/pihole/component.jsx
@@ -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();
diff --git a/src/widgets/pihole/widget.js b/src/widgets/pihole/widget.js
index 5198ea2c..2e20fe8a 100644
--- a/src/widgets/pihole/widget.js
+++ b/src/widgets/pihole/widget.js
@@ -1,4 +1,4 @@
-import genericProxyHandler from "utils/proxies/generic";
+import genericProxyHandler from "utils/proxy/handlers/generic";
const widget = {
api: "{url}/admin/{endpoint}",
diff --git a/src/widgets/portainer/component.jsx b/src/widgets/portainer/component.jsx
index 272b8449..171a7f46 100644
--- a/src/widgets/portainer/component.jsx
+++ b/src/widgets/portainer/component.jsx
@@ -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();
diff --git a/src/widgets/portainer/widget.js b/src/widgets/portainer/widget.js
index 3a75a6e6..ca3d5bb0 100644
--- a/src/widgets/portainer/widget.js
+++ b/src/widgets/portainer/widget.js
@@ -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}",
diff --git a/src/widgets/prowlarr/component.jsx b/src/widgets/prowlarr/component.jsx
index c7ebdf96..9a351493 100644
--- a/src/widgets/prowlarr/component.jsx
+++ b/src/widgets/prowlarr/component.jsx
@@ -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();
diff --git a/src/widgets/prowlarr/widget.js b/src/widgets/prowlarr/widget.js
index a19b83a3..3b7b2787 100644
--- a/src/widgets/prowlarr/widget.js
+++ b/src/widgets/prowlarr/widget.js
@@ -1,4 +1,4 @@
-import genericProxyHandler from "utils/proxies/generic";
+import genericProxyHandler from "utils/proxy/handlers/generic";
const widget = {
api: "{url}/api/v1/{endpoint}",
diff --git a/src/widgets/qbittorrent/component.jsx b/src/widgets/qbittorrent/component.jsx
index 1c98541b..d38c7eaf 100644
--- a/src/widgets/qbittorrent/component.jsx
+++ b/src/widgets/qbittorrent/component.jsx
@@ -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();
diff --git a/src/widgets/qbittorrent/proxy.js b/src/widgets/qbittorrent/proxy.js
index dfb46a25..e9a83e13 100644
--- a/src/widgets/qbittorrent/proxy.js
+++ b/src/widgets/qbittorrent/proxy.js
@@ -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) {
diff --git a/src/widgets/radarr/component.jsx b/src/widgets/radarr/component.jsx
index 94b85acd..856724ef 100644
--- a/src/widgets/radarr/component.jsx
+++ b/src/widgets/radarr/component.jsx
@@ -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();
diff --git a/src/widgets/radarr/widget.js b/src/widgets/radarr/widget.js
index 8e832559..da3f2a6b 100644
--- a/src/widgets/radarr/widget.js
+++ b/src/widgets/radarr/widget.js
@@ -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}",
diff --git a/src/widgets/readarr/component.jsx b/src/widgets/readarr/component.jsx
index 131d94d7..64852ded 100644
--- a/src/widgets/readarr/component.jsx
+++ b/src/widgets/readarr/component.jsx
@@ -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();
diff --git a/src/widgets/readarr/widget.js b/src/widgets/readarr/widget.js
index f826cf1f..75a5e817 100644
--- a/src/widgets/readarr/widget.js
+++ b/src/widgets/readarr/widget.js
@@ -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}",
diff --git a/src/widgets/rutorrent/component.jsx b/src/widgets/rutorrent/component.jsx
index 5766fbab..0f3a45bd 100644
--- a/src/widgets/rutorrent/component.jsx
+++ b/src/widgets/rutorrent/component.jsx
@@ -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();
diff --git a/src/widgets/sabnzbd/component.jsx b/src/widgets/sabnzbd/component.jsx
index 7e77ae04..6ca6e35a 100644
--- a/src/widgets/sabnzbd/component.jsx
+++ b/src/widgets/sabnzbd/component.jsx
@@ -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();
diff --git a/src/widgets/sabnzbd/widget.js b/src/widgets/sabnzbd/widget.js
index 67e64e97..e3097376 100644
--- a/src/widgets/sabnzbd/widget.js
+++ b/src/widgets/sabnzbd/widget.js
@@ -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}",
diff --git a/src/widgets/sonarr/component.jsx b/src/widgets/sonarr/component.jsx
index f46c0f86..05f5ecb4 100644
--- a/src/widgets/sonarr/component.jsx
+++ b/src/widgets/sonarr/component.jsx
@@ -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();
diff --git a/src/widgets/sonarr/widget.js b/src/widgets/sonarr/widget.js
index 45d6e533..32780bda 100644
--- a/src/widgets/sonarr/widget.js
+++ b/src/widgets/sonarr/widget.js
@@ -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}",
diff --git a/src/widgets/speedtest/component.jsx b/src/widgets/speedtest/component.jsx
index 6e30231f..bc15f840 100644
--- a/src/widgets/speedtest/component.jsx
+++ b/src/widgets/speedtest/component.jsx
@@ -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();
diff --git a/src/widgets/speedtest/widget.js b/src/widgets/speedtest/widget.js
index 6c89b913..b227848a 100644
--- a/src/widgets/speedtest/widget.js
+++ b/src/widgets/speedtest/widget.js
@@ -1,4 +1,4 @@
-import genericProxyHandler from "utils/proxies/generic";
+import genericProxyHandler from "utils/proxy/handlers/generic";
const widget = {
api: "{url}/api/{endpoint}",
diff --git a/src/widgets/strelaysrv/component.jsx b/src/widgets/strelaysrv/component.jsx
index 1e057830..b77be020 100644
--- a/src/widgets/strelaysrv/component.jsx
+++ b/src/widgets/strelaysrv/component.jsx
@@ -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();
diff --git a/src/widgets/strelaysrv/widget.js b/src/widgets/strelaysrv/widget.js
index b0c8139b..713f05b4 100644
--- a/src/widgets/strelaysrv/widget.js
+++ b/src/widgets/strelaysrv/widget.js
@@ -1,4 +1,4 @@
-import genericProxyHandler from "utils/proxies/generic";
+import genericProxyHandler from "utils/proxy/handlers/generic";
const widget = {
api: "{url}/{endpoint}",
diff --git a/src/widgets/tautulli/component.jsx b/src/widgets/tautulli/component.jsx
index 084d457b..a4bb1d81 100644
--- a/src/widgets/tautulli/component.jsx
+++ b/src/widgets/tautulli/component.jsx
@@ -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);
diff --git a/src/widgets/tautulli/widget.js b/src/widgets/tautulli/widget.js
index 4f723994..7450e15a 100644
--- a/src/widgets/tautulli/widget.js
+++ b/src/widgets/tautulli/widget.js
@@ -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}",
diff --git a/src/widgets/traefik/component.jsx b/src/widgets/traefik/component.jsx
index a87b35ee..5ffb767f 100644
--- a/src/widgets/traefik/component.jsx
+++ b/src/widgets/traefik/component.jsx
@@ -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();
diff --git a/src/widgets/traefik/widget.js b/src/widgets/traefik/widget.js
index ed39af2c..aa92fa1e 100644
--- a/src/widgets/traefik/widget.js
+++ b/src/widgets/traefik/widget.js
@@ -1,4 +1,4 @@
-import genericProxyHandler from "utils/proxies/generic";
+import genericProxyHandler from "utils/proxy/handlers/generic";
const widget = {
api: "{url}/api/{endpoint}",
diff --git a/src/widgets/transmission/component.jsx b/src/widgets/transmission/component.jsx
index b935f4b5..c4e7560a 100644
--- a/src/widgets/transmission/component.jsx
+++ b/src/widgets/transmission/component.jsx
@@ -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();
diff --git a/src/widgets/transmission/proxy.js b/src/widgets/transmission/proxy.js
index cd909a68..5d118922 100644
--- a/src/widgets/transmission/proxy.js
+++ b/src/widgets/transmission/proxy.js
@@ -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 = {