diff --git a/public/locales/en/common.json b/public/locales/en/common.json
index 26f2e432..1347c1af 100644
--- a/public/locales/en/common.json
+++ b/public/locales/en/common.json
@@ -168,5 +168,10 @@
"jackett": {
"configured": "Configured",
"errored": "Errored"
+ },
+ "mastodon": {
+ "user_count": "Users",
+ "status_count": "Posts",
+ "domain_count": "Domains"
}
}
diff --git a/src/components/services/widget.jsx b/src/components/services/widget.jsx
index 01dec306..5e07618b 100644
--- a/src/components/services/widget.jsx
+++ b/src/components/services/widget.jsx
@@ -27,6 +27,7 @@ import Gotify from "./widgets/service/gotify";
import Prowlarr from "./widgets/service/prowlarr";
import Jackett from "./widgets/service/jackett";
import AdGuard from "./widgets/service/adguard";
+import Mastodon from "./widgets/service/mastodon";
const widgetMappings = {
docker: Docker,
@@ -56,6 +57,7 @@ const widgetMappings = {
prowlarr: Prowlarr,
jackett: Jackett,
adguard: AdGuard,
+ mastodon: Mastodon,
};
export default function Widget({ service }) {
diff --git a/src/components/services/widgets/service/mastodon.jsx b/src/components/services/widgets/service/mastodon.jsx
new file mode 100644
index 00000000..9d2ded4a
--- /dev/null
+++ b/src/components/services/widgets/service/mastodon.jsx
@@ -0,0 +1,37 @@
+import useSWR from "swr";
+import { useTranslation } from "react-i18next";
+
+import Widget from "../widget";
+import Block from "../block";
+
+import { formatApiUrl } from "utils/api-helpers";
+
+export default function Mastodon({ service }) {
+ const { t } = useTranslation();
+
+ const config = service.widget;
+
+ const { data: statsData, error: statsError } = useSWR(formatApiUrl(config, `instance`));
+
+ if (statsError) {
+ return ;
+ }
+
+ if (!statsData) {
+ return (
+
+
+
+
+
+ );
+ }
+
+ return (
+
+
+
+
+
+ );
+}
diff --git a/src/pages/api/services/proxy.js b/src/pages/api/services/proxy.js
index f0a7eed5..65dbe88b 100644
--- a/src/pages/api/services/proxy.js
+++ b/src/pages/api/services/proxy.js
@@ -81,6 +81,7 @@ const serviceProxyHandlers = {
sabnzbd: genericProxyHandler,
jackett: genericProxyHandler,
adguard: genericProxyHandler,
+ mastodon: genericProxyHandler,
// uses X-API-Key (or similar) header auth
gotify: credentialedProxyHandler,
portainer: credentialedProxyHandler,
diff --git a/src/utils/api-helpers.js b/src/utils/api-helpers.js
index be24f8a2..a8112efb 100644
--- a/src/utils/api-helpers.js
+++ b/src/utils/api-helpers.js
@@ -24,6 +24,7 @@ const formats = {
prowlarr: `{url}/api/v1/{endpoint}`,
jackett: `{url}/api/v2.0/{endpoint}?apikey={key}&configured=true`,
adguard: `{url}/control/{endpoint}`,
+ mastodon: `{url}/api/v1/{endpoint}`,
};
export function formatApiCall(api, args) {