diff --git a/public/locales/en/common.json b/public/locales/en/common.json
index 8436d28ba..032c1dfef 100644
--- a/public/locales/en/common.json
+++ b/public/locales/en/common.json
@@ -406,5 +406,11 @@
"streams_all": "All Streams",
"streams_active": "Active Streams",
"streams_xepg": "XEPG Channels"
+ },
+ "opnsense": {
+ "cpu": "CPU Load",
+ "memory": "Active Memory",
+ "wanUpload": "WAN Upload",
+ "wanDownload": "WAN Download"
}
}
diff --git a/src/widgets/components.js b/src/widgets/components.js
index 4ee443acb..10277732f 100644
--- a/src/widgets/components.js
+++ b/src/widgets/components.js
@@ -29,6 +29,7 @@ const components = {
nzbget: dynamic(() => import("./nzbget/component")),
omada: dynamic(() => import("./omada/component")),
ombi: dynamic(() => import("./ombi/component")),
+ opnsense: dynamic(() => import("./opnsense/component")),
overseerr: dynamic(() => import("./overseerr/component")),
paperlessngx: dynamic(() => import("./paperlessngx/component")),
pihole: dynamic(() => import("./pihole/component")),
diff --git a/src/widgets/opnsense/component.jsx b/src/widgets/opnsense/component.jsx
new file mode 100644
index 000000000..53396b31e
--- /dev/null
+++ b/src/widgets/opnsense/component.jsx
@@ -0,0 +1,48 @@
+import { useTranslation } from "next-i18next";
+
+import Container from "components/services/widget/container";
+import Block from "components/services/widget/block";
+import useWidgetAPI from "utils/proxy/use-widget-api";
+
+export default function Component({ service }) {
+ const { t } = useTranslation();
+
+ const { widget } = service;
+
+ const { data: activityData, error: activityError } = useWidgetAPI(widget, "activity");
+ const { data: interfaceData, error: interfaceError } = useWidgetAPI(widget, "interface");
+
+ if (activityError || interfaceError) {
+ const finalError = activityError ?? interfaceError;
+ return ;
+ }
+
+ if (!activityData || !interfaceData) {
+ return (
+
+
+
+
+
+
+ );
+ }
+
+
+ const cpuIdle = activityData.headers[2].match(/ ([0-9.]+)% idle/)[1];
+ const cpu = 100 - parseFloat(cpuIdle);
+ const memory = activityData.headers[3].match(/Mem: (.+) Active,/)[1];
+
+ const wanUpload = interfaceData.interfaces.wan['bytes transmitted'];
+ const wanDownload = interfaceData.interfaces.wan['bytes received'];
+
+ return (
+
+
+
+
+
+
+
+ );
+}
diff --git a/src/widgets/opnsense/widget.js b/src/widgets/opnsense/widget.js
new file mode 100644
index 000000000..a144ee4cc
--- /dev/null
+++ b/src/widgets/opnsense/widget.js
@@ -0,0 +1,24 @@
+
+import genericProxyHandler from "utils/proxy/handlers/generic";
+
+const widget = {
+ api: "{url}/api/{endpoint}",
+ proxyHandler: genericProxyHandler,
+
+ mappings: {
+ activity: {
+ endpoint: "diagnostics/activity/getActivity",
+ validate: [
+ "headers"
+ ]
+ },
+ interface: {
+ endpoint: "diagnostics/traffic/interface",
+ validate: [
+ "interfaces"
+ ]
+ }
+ },
+};
+
+export default widget;
diff --git a/src/widgets/widgets.js b/src/widgets/widgets.js
index 0c53b3886..3e73e55f3 100644
--- a/src/widgets/widgets.js
+++ b/src/widgets/widgets.js
@@ -24,6 +24,7 @@ import npm from "./npm/widget";
import nzbget from "./nzbget/widget";
import omada from "./omada/widget";
import ombi from "./ombi/widget";
+import opnsense from "./opnsense/widget";
import overseerr from "./overseerr/widget";
import paperlessngx from "./paperlessngx/widget";
import pihole from "./pihole/widget";
@@ -80,6 +81,7 @@ const widgets = {
nzbget,
omada,
ombi,
+ opnsense,
overseerr,
paperlessngx,
pihole,