diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index bacc1fa7..bd80a153 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -88,7 +88,7 @@ jobs: # https://github.com/docker/build-push-action - name: Build and push Docker image id: build-and-push - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v4 with: context: . push: ${{ github.event_name != 'pull_request' }} diff --git a/public/locales/en/common.json b/public/locales/en/common.json index edb70055..f144182f 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -448,9 +448,11 @@ "videos": "Videos", "storage": "Storage" }, - "komga": { - "libraries": "Libraries", - "series": "Series", - "books": "Books" + "uptimekuma": { + "up": "Sites Up", + "down": "Sites Down", + "uptime": "Uptime", + "incident": "Incident", + "m": "m" } -} +} \ No newline at end of file diff --git a/public/locales/es/common.json b/public/locales/es/common.json index d0540c10..d2db4ce5 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -280,8 +280,8 @@ "quicklaunch": { "bookmark": "Marcadores", "service": "Servicio", - "search": "Search", - "custom": "Custom" + "search": "Buscar", + "custom": "Personalizado" }, "homebridge": { "available_update": "Sistema", @@ -434,9 +434,9 @@ "memory_usage": "Memoria" }, "immich": { - "users": "Users", - "photos": "Photos", - "videos": "Videos", - "storage": "Storage" + "users": "Usuarios", + "photos": "Fotos", + "videos": "Vídeos", + "storage": "Almacenamiento" } } diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index 8384535c..ae4f28fe 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -280,8 +280,8 @@ "quicklaunch": { "bookmark": "Signet", "service": "Service", - "search": "Search", - "custom": "Custom" + "search": "Recherche", + "custom": "Personnalisé" }, "homebridge": { "available_update": "Système", diff --git a/public/locales/pt-BR/common.json b/public/locales/pt-BR/common.json index e20ebf03..90d2e298 100644 --- a/public/locales/pt-BR/common.json +++ b/public/locales/pt-BR/common.json @@ -31,10 +31,10 @@ "missing_type": "Tipo de Widget ausente: {{type}}", "api_error": "Erro da API", "status": "Status", - "information": "Information", + "information": "Informação", "url": "URL", "raw_error": "Raw Error", - "response_data": "Response Data" + "response_data": "Dados de Resposta" }, "weather": { "current": "Localização atual", @@ -53,13 +53,13 @@ "cpu": "CPU" }, "docker": { - "rx": "Rx", - "tx": "Tx", - "mem": "Mem", + "rx": "Recebido", + "tx": "Transmitido", + "mem": "Memória", "cpu": "CPU", "offline": "Desligado", - "error": "Error", - "unknown": "Unknown" + "error": "Erro", + "unknown": "Desconhecido" }, "emby": { "playing": "Reproduzindo", @@ -99,7 +99,7 @@ "wanted": "Desejado", "queued": "Na fila", "movies": "Filmes", - "missing": "Missing" + "missing": "Faltando" }, "lidarr": { "wanted": "Desejado", @@ -129,7 +129,7 @@ "pending": "Pendente", "approved": "Aprovado", "available": "Disponível", - "processing": "Processing" + "processing": "Processando" }, "pihole": { "queries": "Consultas", @@ -148,9 +148,9 @@ "ping": "Ping" }, "traefik": { - "routers": "Rotas", + "routers": "Roteadores", "services": "Serviços", - "middleware": "Middleware" + "middleware": "Software intermediario" }, "npm": { "enabled": "Habilitado", @@ -164,10 +164,10 @@ }, "prowlarr": { "enableIndexers": "Indexadores", - "numberOfGrabs": "Grabs", - "numberOfQueries": "Queries", + "numberOfGrabs": "Pegos", + "numberOfQueries": "Consultas", "numberOfFailGrabs": "Fail Grabs", - "numberOfFailQueries": "Fail Queries" + "numberOfFailQueries": "Consultas Falhas" }, "jackett": { "configured": "Configurado", @@ -179,36 +179,36 @@ "domain_count": "Domínios" }, "authentik": { - "users": "Users", + "users": "Usuários", "loginsLast24H": "Logins (24h)", "failedLoginsLast24H": "Failed Logins (24h)" }, "proxmox": { - "mem": "MEM", - "cpu": "CPU", + "mem": "Memória", + "cpu": "Processador", "lxc": "LXC", "vms": "VMs" }, "unifi": { - "users": "Users", - "uptime": "System Uptime", - "days": "Days", + "users": "Usuários", + "uptime": "Tempo de Funcionamento", + "days": "Dias", "wan": "WAN", - "lan_users": "LAN Users", - "wlan_users": "WLAN Users", - "up": "UP", - "down": "DOWN", - "wait": "Please wait", + "lan_users": "Usuarios locais", + "wlan_users": "Usuarios WLAN", + "up": "LIGADO", + "down": "CÁIDO", + "wait": "Por favor guarde", "lan": "LAN", "wlan": "WLAN", - "devices": "Devices", - "lan_devices": "LAN Devices", - "wlan_devices": "WLAN Devices" + "devices": "Dispositivos", + "lan_devices": "Dispositivos LAN", + "wlan_devices": "Dispositivos WLAN" }, "plex": { - "streams": "Active Streams", - "movies": "Movies", - "tv": "TV Shows" + "streams": "Transmissões ativas", + "movies": "Filmes", + "tv": "Séries de TV" }, "glances": { "cpu": "CPU", @@ -222,10 +222,10 @@ "wmo": { "1-night": "Mainly Clear", "2-day": "Partly Cloudy", - "2-night": "Partly Cloudy", - "3-day": "Cloudy", - "3-night": "Cloudy", - "45-day": "Foggy", + "2-night": "Parcialmente nublado", + "3-day": "Nublado", + "3-night": "Nublado", + "45-day": "Névoa", "45-night": "Foggy", "48-day": "Foggy", "48-night": "Foggy", @@ -233,9 +233,9 @@ "57-day": "Freezing Drizzle", "99-day": "Thunderstorm With Hail", "99-night": "Thunderstorm With Hail", - "0-day": "Sunny", + "0-day": "Ensolarado", "53-day": "Drizzle", - "0-night": "Clear", + "0-night": "Limpo", "1-day": "Mainly Sunny", "51-day": "Light Drizzle", "51-night": "Light Drizzle", @@ -315,8 +315,8 @@ "time": "{{value, number(style: unit; unitDisplay: long;)}}" }, "navidrome": { - "nothing_streaming": "No Active Streams", - "please_wait": "Please Wait" + "nothing_streaming": "Sem transmissões ativas", + "please_wait": "Por favor aguarde" }, "pyload": { "speed": "Speed", @@ -334,7 +334,7 @@ "hd": "HD" }, "ping": { - "error": "Error", + "error": "Erro", "ping": "Ping" }, "scrutiny": { @@ -359,14 +359,14 @@ "seed": "Seed" }, "tdarr": { - "queue": "Queue", - "processed": "Processed", - "errored": "Errored", - "saved": "Saved" + "queue": "Fila", + "processed": "Processado", + "errored": "Erro", + "saved": "Salvo" }, "miniflux": { - "read": "Read", - "unread": "Unread" + "read": "Lidos", + "unread": "Não Lidos" }, "nextdns": { "wait": "Please Wait", @@ -377,11 +377,11 @@ "bibitrate": "{{value, rate(bits: true; binary: true)}}" }, "omada": { - "connectedAp": "Connected APs", - "activeUser": "Active devices", - "alerts": "Alerts", - "connectedGateway": "Connected gateways", - "connectedSwitches": "Connected switches" + "connectedAp": "Pontos de acesso conectados", + "activeUser": "Dispositivos ativos", + "alerts": "Alertas", + "connectedGateway": "Gateways conectados", + "connectedSwitches": "Interruptores conectados" }, "downloadstation": { "download": "Download", diff --git a/public/locales/uk/common.json b/public/locales/uk/common.json index b22fed8a..81219c0b 100644 --- a/public/locales/uk/common.json +++ b/public/locales/uk/common.json @@ -342,8 +342,8 @@ "quicklaunch": { "bookmark": "Закладка", "service": "Сервіс", - "search": "Search", - "custom": "Custom" + "search": "Пошук", + "custom": "Користувацький" }, "homebridge": { "available_update": "Система", @@ -428,15 +428,15 @@ "status": "Стан" }, "proxmoxbackupserver": { - "datastore_usage": "Datastore", - "failed_tasks_24h": "Failed Tasks 24h", + "datastore_usage": "Сховище даних", + "failed_tasks_24h": "Невиконані завдання 24 години", "cpu_usage": "CPU", - "memory_usage": "Memory" + "memory_usage": "Пам'ять" }, "immich": { - "users": "Users", - "photos": "Photos", - "videos": "Videos", - "storage": "Storage" + "users": "Користувачі", + "photos": "Фотографії", + "videos": "Відео", + "storage": "Сховище" } } diff --git a/public/locales/zh-CN/common.json b/public/locales/zh-CN/common.json index d98ce40f..408dc9c6 100644 --- a/public/locales/zh-CN/common.json +++ b/public/locales/zh-CN/common.json @@ -12,7 +12,7 @@ "placeholder": "搜索…" }, "resources": { - "total": "共", + "total": "总计", "free": "空闲", "used": "已用", "load": "负载", diff --git a/src/components/services/status.jsx b/src/components/services/status.jsx index eaf32030..81d48589 100644 --- a/src/components/services/status.jsx +++ b/src/components/services/status.jsx @@ -30,8 +30,8 @@ export default function Status({ service }) { } return ( -
-
{data.health ?? data.status}
+
+
{data.health || data.status}
); } diff --git a/src/pages/_app.jsx b/src/pages/_app.jsx index e99303ab..e304ccae 100644 --- a/src/pages/_app.jsx +++ b/src/pages/_app.jsx @@ -6,6 +6,7 @@ import Head from "next/head"; import "styles/globals.css"; import "styles/theme.css"; import "styles/manrope.css"; +import "styles/custom.css"; import nextI18nextConfig from "../../next-i18next.config"; import { ColorProvider } from "utils/contexts/color"; diff --git a/src/styles/custom.css b/src/styles/custom.css new file mode 100644 index 00000000..cbc9cf6a --- /dev/null +++ b/src/styles/custom.css @@ -0,0 +1,3 @@ +/* +Mount this file and define your custom styles +*/ \ No newline at end of file diff --git a/src/widgets/components.js b/src/widgets/components.js index 91b27773..f09dc16e 100644 --- a/src/widgets/components.js +++ b/src/widgets/components.js @@ -64,6 +64,7 @@ const components = { watchtower: dynamic(() => import("./watchtower/component")), xteve: dynamic(() => import("./xteve/component")), immich: dynamic(() => import("./immich/component")), + uptimekuma: dynamic(() => import("./uptimekuma/component")), }; export default components; diff --git a/src/widgets/uptimekuma/component.jsx b/src/widgets/uptimekuma/component.jsx new file mode 100644 index 00000000..d71f9a63 --- /dev/null +++ b/src/widgets/uptimekuma/component.jsx @@ -0,0 +1,55 @@ +import { useTranslation } from "next-i18next"; + +import Container from "components/services/widget/container"; +import useWidgetAPI from "utils/proxy/use-widget-api"; +import Block from "components/services/widget/block"; + +export default function Component({ service }) { + const { t } = useTranslation(); + + const { widget } = service; + + const { data: statusData, error: statusError } = useWidgetAPI(widget, "status_page"); + const { data: heartbeatData, error: heartbeatError } = useWidgetAPI(widget, "heartbeat"); + + if (statusError || heartbeatError) { + return ; + } + + if (!statusData || !heartbeatData) { + return ( + + + + + + + ); + } + + let sitesUp = 0; + let sitesDown = 0; + Object.values(heartbeatData.heartbeatList).forEach((siteList) => { + const lastHeartbeat = siteList[siteList.length - 1]; + if (lastHeartbeat?.status === 1) { + sitesUp += 1; + } else { + sitesDown += 1; + } + }); + + // Adapted from https://github.com/bastienwirtz/homer/blob/b7cd8f9482e6836a96b354b11595b03b9c3d67cd/src/components/services/UptimeKuma.vue#L105 + const uptimeList = Object.values(heartbeatData.uptimeList); + const percent = uptimeList.reduce((a, b) => a + b, 0) / uptimeList.length || 0; + const uptime = (percent * 100).toFixed(1); + const incidentTime = statusData.incident ? (Math.abs(new Date(statusData.incident?.createdDate) - new Date()) / 1000) / (60 * 60) : null; + + return ( + + + + + {incidentTime && } + + ); +} diff --git a/src/widgets/uptimekuma/widget.js b/src/widgets/uptimekuma/widget.js new file mode 100644 index 00000000..928534b3 --- /dev/null +++ b/src/widgets/uptimekuma/widget.js @@ -0,0 +1,18 @@ +// import credentialedProxyHandler from "utils/proxy/handlers/credentialed"; +import genericProxyHandler from "utils/proxy/handlers/generic"; + +const widget = { + api: "{url}/api/{endpoint}/{slug}", + proxyHandler: genericProxyHandler, + + mappings: { + status_page: { + endpoint: "status-page", + }, + heartbeat: { + endpoint: "status-page/heartbeat", + }, + } +}; + +export default widget; diff --git a/src/widgets/widgets.js b/src/widgets/widgets.js index d99a69da..688f09a0 100644 --- a/src/widgets/widgets.js +++ b/src/widgets/widgets.js @@ -58,6 +58,7 @@ import unifi from "./unifi/widget"; import watchtower from "./watchtower/widget"; import xteve from "./xteve/widget"; import immich from "./immich/widget"; +import uptimekuma from "./uptimekuma/widget"; const widgets = { adguard, @@ -123,6 +124,7 @@ const widgets = { watchtower, xteve, immich, + uptimekuma, }; export default widgets;