From f8aa1ba391888f69f76dad37957a0aeb51746f73 Mon Sep 17 00:00:00 2001 From: Jason Fischer Date: Sun, 11 Sep 2022 19:49:18 -0700 Subject: [PATCH 01/32] Add Readarr and SABnzbd widgets --- README.md | 1 + public/locales/de/common.json | 10 +++++ public/locales/en/common.json | 10 +++++ public/locales/es/common.json | 10 +++++ public/locales/fr/common.json | 10 +++++ public/locales/it/common.json | 10 +++++ public/locales/nb-NO/common.json | 10 +++++ public/locales/nl/common.json | 10 +++++ public/locales/pt/common.json | 10 +++++ public/locales/ru/common.json | 10 +++++ public/locales/vi/common.json | 10 +++++ public/locales/zh-CN/common.json | 10 +++++ src/components/services/widget.jsx | 4 ++ .../services/widgets/service/readarr.jsx | 41 +++++++++++++++++++ .../services/widgets/service/sabnzbd.jsx | 37 +++++++++++++++++ src/pages/api/services/proxy.js | 2 + src/utils/api-helpers.js | 2 + 17 files changed, 197 insertions(+) create mode 100644 src/components/services/widgets/service/readarr.jsx create mode 100644 src/components/services/widgets/service/sabnzbd.jsx diff --git a/README.md b/README.md index 5167f9bc3..ae2ecf0f9 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ * Service Integration - Currently supports Sonarr, Radarr, Ombi, Emby, Jellyfin, Tautulli (Plex), Overseerr, Jellyseerr ([ilusi0n](https://github.com/benphelps/homepage/pull/34)), NZBGet, ruTorrent - Portainer, Traefik, Speedtest Tracker, PiHole, Nginx Proxy Manager ([aidenpwnz](https://github.com/benphelps/homepage/pull/45)) + - Readarr, SABnzbd ([JazzFisch]()) * Information & Utility Widgets - System Stats (Disk, CPU, Memory) - Weather via WeatherAPI.com or OpenWeatherMap ([AlexFullmoon](https://github.com/benphelps/homepage/pull/25)) diff --git a/public/locales/de/common.json b/public/locales/de/common.json index d7152f68a..94eff1692 100644 --- a/public/locales/de/common.json +++ b/public/locales/de/common.json @@ -36,6 +36,11 @@ "remaining": "Verblieben", "downloaded": "Heruntergeladen" }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, "rutorrent": { "active": "Aktiv", "upload": "Hochladen", @@ -51,6 +56,11 @@ "queued": "In Warteschlange", "movies": "Filme" }, + "readarr": { + "wanted": "Wanted", + "queued": "Queued", + "books": "Books" + }, "ombi": { "pending": "Ausstehend", "approved": "Genehmigt", diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 72c0e02ad..a92ee97aa 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -53,6 +53,11 @@ "remaining": "Remaining", "downloaded": "Downloaded" }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, "rutorrent": { "active": "Active", "upload": "Upload", @@ -68,6 +73,11 @@ "queued": "Queued", "movies": "Movies" }, + "readarr": { + "wanted": "Wanted", + "queued": "Queued", + "books": "Books" + }, "ombi": { "pending": "Pending", "approved": "Approved", diff --git a/public/locales/es/common.json b/public/locales/es/common.json index f80a0a2b4..66299c8e2 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -36,6 +36,11 @@ "remaining": "Restante", "downloaded": "Descargado" }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, "rutorrent": { "active": "Activo", "upload": "Subir", @@ -51,6 +56,11 @@ "queued": "Puesto en cola", "movies": "Películas" }, + "readarr": { + "wanted": "Wanted", + "queued": "Queued", + "books": "Books" + }, "ombi": { "pending": "Pendiente", "approved": "Aprobado", diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index 333a9e025..21fc296cf 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -36,6 +36,11 @@ "remaining": "Restante", "downloaded": "Téléchargé" }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, "rutorrent": { "active": "Active", "upload": "Téléverser", @@ -51,6 +56,11 @@ "queued": "En queue", "movies": "Films" }, + "readarr": { + "wanted": "Wanted", + "queued": "Queued", + "books": "Books" + }, "ombi": { "pending": "En attente", "approved": "Approuvée", diff --git a/public/locales/it/common.json b/public/locales/it/common.json index e582a7a93..316161f6e 100644 --- a/public/locales/it/common.json +++ b/public/locales/it/common.json @@ -51,6 +51,11 @@ "remaining": "Remaining", "downloaded": "Downloaded" }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, "rutorrent": { "active": "Active", "upload": "Upload", @@ -66,6 +71,11 @@ "queued": "Queued", "movies": "Movies" }, + "readarr": { + "wanted": "Wanted", + "queued": "Queued", + "books": "Books" + }, "ombi": { "pending": "Pending", "approved": "Approved", diff --git a/public/locales/nb-NO/common.json b/public/locales/nb-NO/common.json index a174a82dd..e605c8a28 100644 --- a/public/locales/nb-NO/common.json +++ b/public/locales/nb-NO/common.json @@ -36,6 +36,11 @@ "remaining": "Gjenstående", "downloaded": "Nedlastet" }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, "rutorrent": { "active": "Aktiv", "upload": "Opplasting", @@ -51,6 +56,11 @@ "queued": "I kø", "movies": "Filmer" }, + "readarr": { + "wanted": "Wanted", + "queued": "Queued", + "books": "Books" + }, "ombi": { "pending": "Venter", "approved": "Godkjent", diff --git a/public/locales/nl/common.json b/public/locales/nl/common.json index ada7e08fa..8ad0fc6b4 100644 --- a/public/locales/nl/common.json +++ b/public/locales/nl/common.json @@ -21,6 +21,11 @@ "remaining": "Overgebleven", "downloaded": "Gedownload" }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, "speedtest": { "upload": "Upload", "download": "Download", @@ -67,6 +72,11 @@ "wanted": "Gezocht", "queued": "In de wachtrij" }, + "readarr": { + "wanted": "Wanted", + "queued": "Queued", + "books": "Books" + }, "ombi": { "pending": "In afwachting", "approved": "Goedgekeurd", diff --git a/public/locales/pt/common.json b/public/locales/pt/common.json index 8b4688df7..a1749b5b4 100644 --- a/public/locales/pt/common.json +++ b/public/locales/pt/common.json @@ -36,6 +36,11 @@ "remaining": "Em falta", "downloaded": "Baixada" }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, "rutorrent": { "active": "Ativa", "upload": "Envio", @@ -51,6 +56,11 @@ "queued": "Enfileiradas", "movies": "Filmes" }, + "readarr": { + "wanted": "Wanted", + "queued": "Queued", + "books": "Books" + }, "ombi": { "pending": "Pendente", "approved": "Aprovada", diff --git a/public/locales/ru/common.json b/public/locales/ru/common.json index dd424d8dc..780b033b7 100644 --- a/public/locales/ru/common.json +++ b/public/locales/ru/common.json @@ -36,6 +36,11 @@ "remaining": "Осталось", "downloaded": "Загружено" }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, "rutorrent": { "active": "Активный", "upload": "Загрузить", @@ -51,6 +56,11 @@ "queued": "В очереди", "movies": "Фильмы" }, + "readarr": { + "wanted": "Wanted", + "queued": "Queued", + "books": "Books" + }, "ombi": { "pending": "Ожидание", "approved": "Одобрено", diff --git a/public/locales/vi/common.json b/public/locales/vi/common.json index 21fc74f65..bd2fdb78e 100644 --- a/public/locales/vi/common.json +++ b/public/locales/vi/common.json @@ -36,6 +36,11 @@ "remaining": "Còn lại", "downloaded": "Đã tải" }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, "rutorrent": { "active": "Hoạt động", "upload": "Tải lên", @@ -51,6 +56,11 @@ "queued": "Queued", "movies": "Movies" }, + "readarr": { + "wanted": "Wanted", + "queued": "Queued", + "books": "Books" + }, "ombi": { "pending": "Pending", "approved": "Approved", diff --git a/public/locales/zh-CN/common.json b/public/locales/zh-CN/common.json index 2deff5bf8..44c9d85a9 100644 --- a/public/locales/zh-CN/common.json +++ b/public/locales/zh-CN/common.json @@ -36,6 +36,11 @@ "remaining": "其余的", "downloaded": "下载" }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, "rutorrent": { "active": "积极的", "upload": "上传", @@ -51,6 +56,11 @@ "queued": "排队", "movies": "电影" }, + "readarr": { + "wanted": "Wanted", + "queued": "Queued", + "books": "Books" + }, "ombi": { "pending": "待办的", "approved": "得到正式认可的", diff --git a/src/components/services/widget.jsx b/src/components/services/widget.jsx index 41257a5c9..41942eadd 100644 --- a/src/components/services/widget.jsx +++ b/src/components/services/widget.jsx @@ -2,10 +2,12 @@ import { useTranslation } from "react-i18next"; import Sonarr from "./widgets/service/sonarr"; import Radarr from "./widgets/service/radarr"; +import Readarr from "./widgets/service/readarr"; import Ombi from "./widgets/service/ombi"; import Portainer from "./widgets/service/portainer"; import Emby from "./widgets/service/emby"; import Nzbget from "./widgets/service/nzbget"; +import SABnzbd from "./widgets/service/sabnzbd"; import Docker from "./widgets/service/docker"; import Pihole from "./widgets/service/pihole"; import Rutorrent from "./widgets/service/rutorrent"; @@ -21,11 +23,13 @@ const widgetMappings = { docker: Docker, sonarr: Sonarr, radarr: Radarr, + readarr: Readarr, ombi: Ombi, portainer: Portainer, emby: Emby, jellyfin: Jellyfin, nzbget: Nzbget, + sabnzbd: SABnzbd, pihole: Pihole, rutorrent: Rutorrent, speedtest: Speedtest, diff --git a/src/components/services/widgets/service/readarr.jsx b/src/components/services/widgets/service/readarr.jsx new file mode 100644 index 000000000..5aa0cba4d --- /dev/null +++ b/src/components/services/widgets/service/readarr.jsx @@ -0,0 +1,41 @@ +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 Readarr({ service }) { + const { t } = useTranslation(); + + const config = service.widget; + + const { data: booksData, error: booksError } = useSWR(formatApiUrl(config, "book")); + const { data: wantedData, error: wantedError } = useSWR(formatApiUrl(config, "wanted/missing")); + const { data: queueData, error: queueError } = useSWR(formatApiUrl(config, "queue/status")); + + if (booksError || wantedError || queueError) { + return ; + } + + if (!booksData || !wantedData || !queueData) { + return ( + + + + + + ); + } + + const have = booksData.filter((book) => book.statistics.bookFileCount > 0); + + return ( + + + + + + ); +} diff --git a/src/components/services/widgets/service/sabnzbd.jsx b/src/components/services/widgets/service/sabnzbd.jsx new file mode 100644 index 000000000..d1a08a27e --- /dev/null +++ b/src/components/services/widgets/service/sabnzbd.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 SABnzbd({ service }) { + const { t } = useTranslation(); + + const config = service.widget; + + const { data: queueData, error: queueError } = useSWR(formatApiUrl(config, "queue")); + + if (queueError) { + return ; + } + + if (!queueData) { + return ( + + + + + + ); + } + + return ( + + + + + + ); +} diff --git a/src/pages/api/services/proxy.js b/src/pages/api/services/proxy.js index c4ef2b3bc..985d64b83 100644 --- a/src/pages/api/services/proxy.js +++ b/src/pages/api/services/proxy.js @@ -11,9 +11,11 @@ const serviceProxyHandlers = { pihole: genericProxyHandler, radarr: genericProxyHandler, sonarr: genericProxyHandler, + readarr: genericProxyHandler, speedtest: genericProxyHandler, tautulli: genericProxyHandler, traefik: genericProxyHandler, + sabnzbd: genericProxyHandler, // uses X-API-Key header auth portainer: credentialedProxyHandler, jellyseerr: credentialedProxyHandler, diff --git a/src/utils/api-helpers.js b/src/utils/api-helpers.js index c8953a825..69cd60a28 100644 --- a/src/utils/api-helpers.js +++ b/src/utils/api-helpers.js @@ -13,6 +13,8 @@ const formats = { overseerr: `{url}/api/v1/{endpoint}`, ombi: `{url}/api/v1/{endpoint}`, npm: `{url}/api/{endpoint}`, + readarr: `{url}/api/v1/{endpoint}?apikey={key}`, + sabnzbd: `{url}/api/?apikey={key}&output=json&mode={endpoint}`, }; export function formatApiCall(api, args) { From 4531985032b4d0b26a12a81465e56a3ede3eee44 Mon Sep 17 00:00:00 2001 From: Ben Phelps Date: Mon, 12 Sep 2022 06:18:51 +0300 Subject: [PATCH 02/32] fix standalone docker widget --- src/utils/service-helpers.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utils/service-helpers.js b/src/utils/service-helpers.js index b32e93e70..b9ceabcfc 100644 --- a/src/utils/service-helpers.js +++ b/src/utils/service-helpers.js @@ -110,13 +110,18 @@ export function cleanServiceGroups(groups) { const cleanedService = { ...service }; if (cleanedService.widget) { - const { type } = cleanedService.widget; + const { type, server, container } = cleanedService.widget; cleanedService.widget = { type, service_name: service.name, service_group: serviceGroup.name, }; + + if (type === "docker") { + cleanedService.widget.server = server; + cleanedService.widget.container = container; + } } return cleanedService; From 1c158f743cffaa48c6a9e0e452ebd623b26d99ae Mon Sep 17 00:00:00 2001 From: Chris McGravey Date: Mon, 12 Sep 2022 01:30:42 -0500 Subject: [PATCH 03/32] - Add CoinMarketCap widget --- package.json | 1 + pnpm-lock.yaml | 6 + public/locales/en/common.json | 221 +++++++++--------- src/components/services/widget.jsx | 2 + .../widgets/service/coinmarketcap.jsx | 60 +++++ src/pages/api/services/proxy.js | 2 + src/utils/api-helpers.js | 1 + src/utils/proxies/coinmarketcap.js | 33 +++ 8 files changed, 217 insertions(+), 109 deletions(-) create mode 100644 src/components/services/widgets/service/coinmarketcap.jsx create mode 100644 src/utils/proxies/coinmarketcap.js diff --git a/package.json b/package.json index 5846f48fc..0e0a428b9 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "@headlessui/react": "^1.6.6", "@tailwindcss/forms": "^0.5.3", "classnames": "^2.3.1", + "currency-symbol-map": "^5.1.0", "dockerode": "^3.3.4", "i18next": "^21.9.1", "i18next-browser-languagedetector": "^6.1.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 55ce7d76a..b0c3bc1ea 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,6 +5,7 @@ specifiers: '@tailwindcss/forms': ^0.5.3 autoprefixer: ^10.4.8 classnames: ^2.3.1 + currency-symbol-map: ^5.1.0 dockerode: ^3.3.4 eslint: 8.22.0 eslint-config-airbnb: ^19.0.4 @@ -41,6 +42,7 @@ dependencies: '@headlessui/react': 1.6.6_biqbaboplfbrettd7655fr4n2y '@tailwindcss/forms': 0.5.3_tailwindcss@3.1.8 classnames: 2.3.1 + currency-symbol-map: 5.1.0 dockerode: 3.3.4 i18next: 21.9.1 i18next-browser-languagedetector: 6.1.5 @@ -699,6 +701,10 @@ packages: engines: {node: '>=4'} hasBin: true + /currency-symbol-map/5.1.0: + resolution: {integrity: sha512-LO/lzYRw134LMDVnLyAf1dHE5tyO6axEFkR3TXjQIOmMkAM9YL6QsiUwuXzZAmFnuDJcs4hayOgyIYtViXFrLw==} + dev: false + /damerau-levenshtein/1.0.8: resolution: {integrity: sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA==} dev: true diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 72c0e02ad..2f7728cb6 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -1,111 +1,114 @@ { - "common": { - "bytes": "{{value, bytes}}", - "bits": "{{value, bytes(bits: true)}}", - "bbytes": "{{value, bytes(binary: true)}}", - "bbits": "{{value, bytes(bits: true, binary: true)}}", - "byterate": "{{value, rate}}", - "bitrate": "{{value, rate(bits: true)}}", - "percent": "{{value, percent}}", - "number": "{{value, number}}", - "ms": "{{value, number}}" - }, - "widget": { - "missing_type": "Missing Widget Type: {{type}}", - "api_error": "API Error", - "status": "Status" - }, - "weather": { - "current": "Current Location", - "allow": "Click to allow", - "updating": "Updating", - "wait": "Please wait" - }, - "search": { - "placeholder": "Search…" - }, - "resources": { - "total": "Total", - "free": "Free", - "used": "Used" - }, - "docker": { - "rx": "RX", - "tx": "TX", - "mem": "MEM", - "cpu": "CPU", - "offline": "Offline" - }, - "emby": { - "playing": "Playing", - "transcoding": "Transcoding", - "bitrate": "Bitrate", - "no_active": "No Active Streams" - }, - "tautulli": { - "playing": "Playing", - "transcoding": "Transcoding", - "bitrate": "Bitrate", - "no_active": "No Active Streams" - }, - "nzbget": { - "rate": "Rate", - "remaining": "Remaining", - "downloaded": "Downloaded" - }, - "rutorrent": { - "active": "Active", - "upload": "Upload", - "download": "Download" - }, - "sonarr": { - "wanted": "Wanted", - "queued": "Queued", - "series": "Series" - }, - "radarr": { - "wanted": "Wanted", - "queued": "Queued", - "movies": "Movies" - }, - "ombi": { - "pending": "Pending", - "approved": "Approved", - "available": "Available" - }, - "jellyseerr": { - "pending": "Pending", - "approved": "Approved", - "available": "Available" - }, - "overseerr": { - "pending": "Pending", - "approved": "Approved", - "available": "Available" - }, - "pihole": { - "queries": "Queries", - "blocked": "Blocked", - "gravity": "Gravity" - }, - "speedtest": { - "upload": "Upload", - "download": "Download", - "ping": "Ping" - }, - "portainer": { - "running": "Running", - "stopped": "Stopped", - "total": "Total" - }, - "traefik": { - "routers": "Routers", - "services": "Services", - "middleware": "Middleware" - }, - "npm": { - "enabled": "Enabled", - "disabled": "Disabled", - "total": "Total" - } + "common": { + "bytes": "{{value, bytes}}", + "bits": "{{value, bytes(bits: true)}}", + "bbytes": "{{value, bytes(binary: true)}}", + "bbits": "{{value, bytes(bits: true, binary: true)}}", + "byterate": "{{value, rate}}", + "bitrate": "{{value, rate(bits: true)}}", + "percent": "{{value, percent}}", + "number": "{{value, number}}", + "ms": "{{value, number}}" + }, + "widget": { + "missing_type": "Missing Widget Type: {{type}}", + "api_error": "API Error", + "status": "Status" + }, + "weather": { + "current": "Current Location", + "allow": "Click to allow", + "updating": "Updating", + "wait": "Please wait" + }, + "search": { + "placeholder": "Search…" + }, + "resources": { + "total": "Total", + "free": "Free", + "used": "Used" + }, + "docker": { + "rx": "RX", + "tx": "TX", + "mem": "MEM", + "cpu": "CPU", + "offline": "Offline" + }, + "emby": { + "playing": "Playing", + "transcoding": "Transcoding", + "bitrate": "Bitrate", + "no_active": "No Active Streams" + }, + "tautulli": { + "playing": "Playing", + "transcoding": "Transcoding", + "bitrate": "Bitrate", + "no_active": "No Active Streams" + }, + "nzbget": { + "rate": "Rate", + "remaining": "Remaining", + "downloaded": "Downloaded" + }, + "rutorrent": { + "active": "Active", + "upload": "Upload", + "download": "Download" + }, + "sonarr": { + "wanted": "Wanted", + "queued": "Queued", + "series": "Series" + }, + "radarr": { + "wanted": "Wanted", + "queued": "Queued", + "movies": "Movies" + }, + "ombi": { + "pending": "Pending", + "approved": "Approved", + "available": "Available" + }, + "jellyseerr": { + "pending": "Pending", + "approved": "Approved", + "available": "Available" + }, + "overseerr": { + "pending": "Pending", + "approved": "Approved", + "available": "Available" + }, + "pihole": { + "queries": "Queries", + "blocked": "Blocked", + "gravity": "Gravity" + }, + "speedtest": { + "upload": "Upload", + "download": "Download", + "ping": "Ping" + }, + "portainer": { + "running": "Running", + "stopped": "Stopped", + "total": "Total" + }, + "traefik": { + "routers": "Routers", + "services": "Services", + "middleware": "Middleware" + }, + "npm": { + "enabled": "Enabled", + "disabled": "Disabled", + "total": "Total" + }, + "coinmarketcap": { + "configure": "Configure one or more crypto currencies to track" + } } diff --git a/src/components/services/widget.jsx b/src/components/services/widget.jsx index 41257a5c9..c2535597f 100644 --- a/src/components/services/widget.jsx +++ b/src/components/services/widget.jsx @@ -16,6 +16,7 @@ import Jellyseerr from "./widgets/service/jellyseerr"; import Overseerr from "./widgets/service/overseerr"; import Npm from "./widgets/service/npm"; import Tautulli from "./widgets/service/tautulli"; +import CoinMarketCap from "./widgets/service/coinmarketcap"; const widgetMappings = { docker: Docker, @@ -32,6 +33,7 @@ const widgetMappings = { traefik: Traefik, jellyseerr: Jellyseerr, overseerr: Overseerr, + coinmarketcap: CoinMarketCap, npm: Npm, tautulli: Tautulli, }; diff --git a/src/components/services/widgets/service/coinmarketcap.jsx b/src/components/services/widgets/service/coinmarketcap.jsx new file mode 100644 index 000000000..76e23692f --- /dev/null +++ b/src/components/services/widgets/service/coinmarketcap.jsx @@ -0,0 +1,60 @@ +import useSWR from "swr"; +import { useTranslation } from "react-i18next"; +import getSymbolFromCurrency from "currency-symbol-map"; + +import Widget from "../widget"; +import Block from "../block"; + +import { formatApiUrl } from "utils/api-helpers"; + +export default function CoinMarketCap({ service }) { + const { t } = useTranslation(); + + const config = service.widget; + const symbols = [...service.symbols]; + const currencyCode = service.currency ?? "USD"; + + const { data: statsData, error: statsError } = useSWR( + formatApiUrl(config, `v1/cryptocurrency/quotes/latest?symbol=${symbols.join(",")}&convert=${currencyCode}`) + ); + + if (!symbols || symbols.length === 0) { + return ; + } + + if (statsError) { + return ; + } + + if (!statsData) { + return ( + + + + ); + } + + const { data } = statsData; + const currencySymbol = getSymbolFromCurrency(currencyCode); + + return symbols.map((key) => ( + +
+
{data[key].name}
+
+
+ {currencySymbol} + {data[key].quote[currencyCode].price.toFixed(2)} +
+
0 ? "text-emerald-300" : "text-rose-300" + }`} + > + {data[key].quote[currencyCode].percent_change_1h.toFixed(2)}% +
+
+
+
+ )); +} diff --git a/src/pages/api/services/proxy.js b/src/pages/api/services/proxy.js index c4ef2b3bc..7b58765e6 100644 --- a/src/pages/api/services/proxy.js +++ b/src/pages/api/services/proxy.js @@ -3,6 +3,7 @@ import credentialedProxyHandler from "utils/proxies/credentialed"; import rutorrentProxyHandler from "utils/proxies/rutorrent"; import nzbgetProxyHandler from "utils/proxies/nzbget"; import npmProxyHandler from "utils/proxies/npm"; +import coinMarketCapProxyHandler from "utils/proxies/coinmarketcap"; const serviceProxyHandlers = { // uses query param auth @@ -20,6 +21,7 @@ const serviceProxyHandlers = { overseerr: credentialedProxyHandler, ombi: credentialedProxyHandler, // super specific handlers + coinmarketcap: coinMarketCapProxyHandler, rutorrent: rutorrentProxyHandler, nzbget: nzbgetProxyHandler, npm: npmProxyHandler, diff --git a/src/utils/api-helpers.js b/src/utils/api-helpers.js index c8953a825..9050d18d1 100644 --- a/src/utils/api-helpers.js +++ b/src/utils/api-helpers.js @@ -13,6 +13,7 @@ const formats = { overseerr: `{url}/api/v1/{endpoint}`, ombi: `{url}/api/v1/{endpoint}`, npm: `{url}/api/{endpoint}`, + coinmarketcap: `{url}/{endpoint}`, }; export function formatApiCall(api, args) { diff --git a/src/utils/proxies/coinmarketcap.js b/src/utils/proxies/coinmarketcap.js new file mode 100644 index 000000000..42611ec8c --- /dev/null +++ b/src/utils/proxies/coinmarketcap.js @@ -0,0 +1,33 @@ +import getServiceWidget from "utils/service-helpers"; +import { formatApiCall } from "utils/api-helpers"; +import { httpProxy } from "utils/http"; + +export default async function coinMarketCapProxyHandler(req, res) { + const { group, service, endpoint } = req.query; + + if (group && service) { + const widget = await getServiceWidget(group, service); + + if (widget) { + const url = new URL(formatApiCall(widget.type, { endpoint, ...widget })); + const [status, contentType, data] = await httpProxy(url, { + method: req.method, + withCredentials: true, + credentials: "include", + headers: { + "X-CMC_PRO_API_KEY": `${widget.key}`, + "Content-Type": "application/json", + }, + }); + + if (status === 204 || status === 304) { + return res.status(status).end(); + } + + if (contentType) res.setHeader("Content-Type", contentType); + return res.status(status).send(data); + } + } + + return res.status(400).json({ error: "Invalid proxy service type" }); +} From 769f36fa8e010d1a61dadd0e3bcc330ee67c8c97 Mon Sep 17 00:00:00 2001 From: Chris McGravey Date: Mon, 12 Sep 2022 01:38:29 -0500 Subject: [PATCH 04/32] - Change block to return configure translation text --- src/components/services/widgets/service/coinmarketcap.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/services/widgets/service/coinmarketcap.jsx b/src/components/services/widgets/service/coinmarketcap.jsx index 76e23692f..a05edcf16 100644 --- a/src/components/services/widgets/service/coinmarketcap.jsx +++ b/src/components/services/widgets/service/coinmarketcap.jsx @@ -19,7 +19,11 @@ export default function CoinMarketCap({ service }) { ); if (!symbols || symbols.length === 0) { - return ; + return ( + + + + ); } if (statsError) { From 83d7100dd10304d2f5edd514b1a34efde1347e87 Mon Sep 17 00:00:00 2001 From: Ben Phelps Date: Mon, 12 Sep 2022 09:41:44 +0300 Subject: [PATCH 05/32] normalize media streaming widget padding --- src/components/services/widgets/service/emby.jsx | 7 ++++--- src/components/services/widgets/service/tautulli.jsx | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/components/services/widgets/service/emby.jsx b/src/components/services/widgets/service/emby.jsx index fc9d3e505..35f31f181 100644 --- a/src/components/services/widgets/service/emby.jsx +++ b/src/components/services/widgets/service/emby.jsx @@ -27,6 +27,7 @@ function ticksToString(ticks) { } function SingleSessionEntry({ playCommand, session }) { + console.log(session); const { NowPlayingItem: { Name, SeriesName, RunTimeTicks }, PlayState: { PositionTicks, IsPaused, IsMuted }, @@ -175,7 +176,7 @@ export default function Emby({ service }) { if (playing.length === 0) { return ( -
+
{t("emby.no_active")}
@@ -189,7 +190,7 @@ export default function Emby({ service }) { if (playing.length === 1) { const session = playing[0]; return ( -
+
handlePlayCommand(currentSession, command)} session={session} @@ -199,7 +200,7 @@ export default function Emby({ service }) { } return ( -
+
{playing.map((session) => ( +
-
@@ -127,7 +127,7 @@ export default function Tautulli({ service }) { if (playing.length === 0) { return ( -
+
{t("tautulli.no_active")}
@@ -141,14 +141,14 @@ export default function Tautulli({ service }) { if (playing.length === 1) { const session = playing[0]; return ( -
+
); } return ( -
+
{playing.map((session) => ( ))} From 428fd6cbbae11134c8ff594a49822218390aa5d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Fern=C3=A1ndez=20S=C3=A1nchez?= Date: Sun, 11 Sep 2022 14:50:06 +0000 Subject: [PATCH 06/32] Translated using Weblate (Spanish) Currently translated at 100.0% (69 of 69 strings) Translation: Homepage/Homepage Translate-URL: https://hosted.weblate.org/projects/homepage/homepage/es/ --- public/locales/es/common.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/public/locales/es/common.json b/public/locales/es/common.json index 66299c8e2..f309d9427 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -23,13 +23,13 @@ "playing": "En ejecución", "transcoding": "Transcodificando", "bitrate": "Tasa de Bits", - "no_active": "No Active Streams" + "no_active": "No hay streams activos" }, "tautulli": { "playing": "En ejecución", "transcoding": "Transcodificación", "bitrate": "Tasa de bits", - "no_active": "No Active Streams" + "no_active": "No hay streams activos" }, "nzbget": { "rate": "Velocidad", @@ -103,8 +103,8 @@ "wait": "Espere, por favor" }, "overseerr": { - "pending": "Pending", - "approved": "Approved", - "available": "Available" + "pending": "Pendiente", + "approved": "Aprobado", + "available": "Disponible" } } From 8ef3d7c20e5e6953c2d06213f8d9f6979edd9cec Mon Sep 17 00:00:00 2001 From: Nonoss117 Date: Sun, 11 Sep 2022 16:06:20 +0000 Subject: [PATCH 07/32] Translated using Weblate (French) Currently translated at 53.6% (37 of 69 strings) Translation: Homepage/Homepage Translate-URL: https://hosted.weblate.org/projects/homepage/homepage/fr/ --- public/locales/fr/common.json | 38 +++++++++++++++++------------------ 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index 21fc296cf..98618c53a 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -8,28 +8,28 @@ "placeholder": "Recherche…" }, "resources": { - "total": "Totale", + "total": "Total", "free": "Libre", "used": "Utilisée" }, "docker": { "rx": "Rx", - "tx": "TX", - "mem": "Mem", - "cpu": "CPU", + "tx": "Tx", + "mem": "Mém", + "cpu": "Cpu", "offline": "Hors ligne" }, "emby": { - "playing": "En jouant", - "transcoding": "Transcoding", - "bitrate": "Débiter", - "no_active": "No Active Streams" + "playing": "En lecture", + "transcoding": "Transcodage", + "bitrate": "Débit", + "no_active": "Aucun flux actif" }, "tautulli": { - "playing": "En jouant", - "transcoding": "Transcoding", - "bitrate": "Débiter", - "no_active": "No Active Streams" + "playing": "En lecture", + "transcoding": "Transcodage", + "bitrate": "Débit", + "no_active": "Aucun flux actif" }, "nzbget": { "rate": "Évaluer", @@ -49,7 +49,7 @@ "sonarr": { "wanted": "Recherchée", "queued": "En queue", - "series": "Série" + "series": "Séries" }, "radarr": { "wanted": "Recherchée", @@ -84,7 +84,7 @@ "portainer": { "running": "Fonctionnement", "stopped": "Arrêté", - "total": "Totale" + "total": "Total" }, "traefik": { "routers": "Routeurs", @@ -93,8 +93,8 @@ }, "npm": { "enabled": "Activé", - "disabled": "Handicapée", - "total": "Totale" + "disabled": "Désactivé", + "total": "Total" }, "common": { "bbytes": "{{value, bytes(binary: true)}}", @@ -114,8 +114,8 @@ "wait": "Veuillez patienter" }, "overseerr": { - "pending": "Pending", - "approved": "Approved", - "available": "Available" + "pending": "En attente", + "approved": "Approuvée", + "available": "Disponible" } } From 04f98ae7a93d7a88f1bb14b19c4fa8940231522c Mon Sep 17 00:00:00 2001 From: Luca Pellegrino Date: Sun, 11 Sep 2022 19:34:34 +0000 Subject: [PATCH 08/32] Translated using Weblate (Italian) Currently translated at 100.0% (69 of 69 strings) Translation: Homepage/Homepage Translate-URL: https://hosted.weblate.org/projects/homepage/homepage/it/ --- public/locales/it/common.json | 84 +++++++++++++++++------------------ 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/public/locales/it/common.json b/public/locales/it/common.json index 316161f6e..e51573104 100644 --- a/public/locales/it/common.json +++ b/public/locales/it/common.json @@ -7,16 +7,16 @@ "rx": "RX" }, "emby": { - "playing": "Playing", + "playing": "In riproduzione", "transcoding": "Transcoding", "bitrate": "Bitrate", - "no_active": "No Active Streams" + "no_active": "Nessuno Stream Attivo" }, "tautulli": { - "playing": "Playing", + "playing": "In riproduzione", "transcoding": "Transcoding", "bitrate": "Bitrate", - "no_active": "No Active Streams" + "no_active": "Nessuno Stream Attivo" }, "speedtest": { "upload": "Upload", @@ -24,32 +24,32 @@ "ping": "Ping" }, "portainer": { - "running": "Running", - "stopped": "Stopped", - "total": "Total" + "running": "In esecuzione", + "stopped": "Fermati", + "total": "Totali" }, "traefik": { "routers": "Routers", - "services": "Services", + "services": "Servizi", "middleware": "Middleware" }, "widget": { "missing_type": "Missing Widget Type: {{type}}", - "api_error": "API Error", - "status": "Status" + "api_error": "Errore API", + "status": "Stato" }, "search": { - "placeholder": "Search…" + "placeholder": "Cerca…" }, "resources": { - "total": "Total", - "free": "Free", - "used": "Used" + "total": "Totale", + "free": "Libero", + "used": "In utilizzo" }, "nzbget": { "rate": "Rate", - "remaining": "Remaining", - "downloaded": "Downloaded" + "remaining": "Rimanente", + "downloaded": "Scaricato" }, "sabnzbd": { "rate": "Rate", @@ -57,19 +57,19 @@ "timeleft": "Time Left" }, "rutorrent": { - "active": "Active", + "active": "Attivo", "upload": "Upload", "download": "Download" }, "sonarr": { - "series": "Series", - "wanted": "Wanted", - "queued": "Queued" + "series": "Serie", + "wanted": "Rchiesti", + "queued": "In coda" }, "radarr": { - "wanted": "Wanted", - "queued": "Queued", - "movies": "Movies" + "wanted": "Richiesti", + "queued": "In coda", + "movies": "Film" }, "readarr": { "wanted": "Wanted", @@ -77,34 +77,34 @@ "books": "Books" }, "ombi": { - "pending": "Pending", - "approved": "Approved", - "available": "Available" + "pending": "In attesa", + "approved": "Approvati", + "available": "Disponibili" }, "jellyseerr": { - "pending": "Pending", - "approved": "Approved", - "available": "Available" + "pending": "In attesa", + "approved": "Approvati", + "available": "Disponibili" }, "pihole": { - "queries": "Queries", - "blocked": "Blocked", - "gravity": "Gravity" + "queries": "Richieste", + "blocked": "Bloccati", + "gravity": "Severità" }, "npm": { - "enabled": "Enabled", - "disabled": "Disabled", - "total": "Total" + "enabled": "Attivi", + "disabled": "Disabilitati", + "total": "Totali" }, "weather": { - "current": "Current Location", - "allow": "Click to allow", - "updating": "Updating", - "wait": "Please wait" + "current": "Posizione Attuale", + "allow": "Clicca per consentire", + "updating": "Aggiornamento in corso", + "wait": "Attendi per favore" }, "overseerr": { - "pending": "Pending", - "approved": "Approved", - "available": "Available" + "pending": "In attesa", + "approved": "Approvati", + "available": "Disponibili" } } From f84ff7cedc32f2d26149834c741b51988dfd2533 Mon Sep 17 00:00:00 2001 From: Ben Phelps Date: Mon, 12 Sep 2022 10:26:03 +0300 Subject: [PATCH 09/32] allow weblate to apply new strings --- public/locales/de/common.json | 10 ---------- public/locales/es/common.json | 10 ---------- public/locales/fr/common.json | 10 ---------- public/locales/it/common.json | 10 ---------- public/locales/nb-NO/common.json | 10 ---------- public/locales/nl/common.json | 10 ---------- public/locales/pt/common.json | 10 ---------- public/locales/ru/common.json | 10 ---------- public/locales/vi/common.json | 10 ---------- public/locales/zh-CN/common.json | 10 ---------- 10 files changed, 100 deletions(-) diff --git a/public/locales/de/common.json b/public/locales/de/common.json index 94eff1692..c5b47fcf9 100644 --- a/public/locales/de/common.json +++ b/public/locales/de/common.json @@ -31,16 +31,6 @@ "bitrate": "Bitrate", "no_active": "No Active Streams" }, - "nzbget": { - "rate": "Rate", - "remaining": "Verblieben", - "downloaded": "Heruntergeladen" - }, - "sabnzbd": { - "rate": "Rate", - "queue": "Queue", - "timeleft": "Time Left" - }, "rutorrent": { "active": "Aktiv", "upload": "Hochladen", diff --git a/public/locales/es/common.json b/public/locales/es/common.json index 66299c8e2..7be736c6d 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -31,16 +31,6 @@ "bitrate": "Tasa de bits", "no_active": "No Active Streams" }, - "nzbget": { - "rate": "Velocidad", - "remaining": "Restante", - "downloaded": "Descargado" - }, - "sabnzbd": { - "rate": "Rate", - "queue": "Queue", - "timeleft": "Time Left" - }, "rutorrent": { "active": "Activo", "upload": "Subir", diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index 21fc296cf..dbea05f7e 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -31,16 +31,6 @@ "bitrate": "Débiter", "no_active": "No Active Streams" }, - "nzbget": { - "rate": "Évaluer", - "remaining": "Restante", - "downloaded": "Téléchargé" - }, - "sabnzbd": { - "rate": "Rate", - "queue": "Queue", - "timeleft": "Time Left" - }, "rutorrent": { "active": "Active", "upload": "Téléverser", diff --git a/public/locales/it/common.json b/public/locales/it/common.json index 316161f6e..44f68bc26 100644 --- a/public/locales/it/common.json +++ b/public/locales/it/common.json @@ -46,16 +46,6 @@ "free": "Free", "used": "Used" }, - "nzbget": { - "rate": "Rate", - "remaining": "Remaining", - "downloaded": "Downloaded" - }, - "sabnzbd": { - "rate": "Rate", - "queue": "Queue", - "timeleft": "Time Left" - }, "rutorrent": { "active": "Active", "upload": "Upload", diff --git a/public/locales/nb-NO/common.json b/public/locales/nb-NO/common.json index e605c8a28..79185695e 100644 --- a/public/locales/nb-NO/common.json +++ b/public/locales/nb-NO/common.json @@ -31,16 +31,6 @@ "bitrate": "Bitrate", "no_active": "No Active Streams" }, - "nzbget": { - "rate": "Takt", - "remaining": "Gjenstående", - "downloaded": "Nedlastet" - }, - "sabnzbd": { - "rate": "Rate", - "queue": "Queue", - "timeleft": "Time Left" - }, "rutorrent": { "active": "Aktiv", "upload": "Opplasting", diff --git a/public/locales/nl/common.json b/public/locales/nl/common.json index 8ad0fc6b4..4d7c5c97a 100644 --- a/public/locales/nl/common.json +++ b/public/locales/nl/common.json @@ -16,16 +16,6 @@ "cpu": "CPU", "offline": "Offline" }, - "nzbget": { - "rate": "Rate", - "remaining": "Overgebleven", - "downloaded": "Gedownload" - }, - "sabnzbd": { - "rate": "Rate", - "queue": "Queue", - "timeleft": "Time Left" - }, "speedtest": { "upload": "Upload", "download": "Download", diff --git a/public/locales/pt/common.json b/public/locales/pt/common.json index a1749b5b4..c0f23da07 100644 --- a/public/locales/pt/common.json +++ b/public/locales/pt/common.json @@ -31,16 +31,6 @@ "bitrate": "Taxa de bits", "no_active": "No Active Streams" }, - "nzbget": { - "rate": "Avaliar", - "remaining": "Em falta", - "downloaded": "Baixada" - }, - "sabnzbd": { - "rate": "Rate", - "queue": "Queue", - "timeleft": "Time Left" - }, "rutorrent": { "active": "Ativa", "upload": "Envio", diff --git a/public/locales/ru/common.json b/public/locales/ru/common.json index 780b033b7..56d877bfb 100644 --- a/public/locales/ru/common.json +++ b/public/locales/ru/common.json @@ -31,16 +31,6 @@ "bitrate": "Битрейт", "no_active": "No Active Streams" }, - "nzbget": { - "rate": "Оценка", - "remaining": "Осталось", - "downloaded": "Загружено" - }, - "sabnzbd": { - "rate": "Rate", - "queue": "Queue", - "timeleft": "Time Left" - }, "rutorrent": { "active": "Активный", "upload": "Загрузить", diff --git a/public/locales/vi/common.json b/public/locales/vi/common.json index bd2fdb78e..84bf43b98 100644 --- a/public/locales/vi/common.json +++ b/public/locales/vi/common.json @@ -31,16 +31,6 @@ "bitrate": "Bitrate", "no_active": "No Active Streams" }, - "nzbget": { - "rate": "Rate", - "remaining": "Còn lại", - "downloaded": "Đã tải" - }, - "sabnzbd": { - "rate": "Rate", - "queue": "Queue", - "timeleft": "Time Left" - }, "rutorrent": { "active": "Hoạt động", "upload": "Tải lên", diff --git a/public/locales/zh-CN/common.json b/public/locales/zh-CN/common.json index 44c9d85a9..b6e7e159a 100644 --- a/public/locales/zh-CN/common.json +++ b/public/locales/zh-CN/common.json @@ -31,16 +31,6 @@ "bitrate": "比特率", "no_active": "No Active Streams" }, - "nzbget": { - "rate": "速度", - "remaining": "其余的", - "downloaded": "下载" - }, - "sabnzbd": { - "rate": "Rate", - "queue": "Queue", - "timeleft": "Time Left" - }, "rutorrent": { "active": "积极的", "upload": "上传", From 4480c26910c07c600c37c9c2fd0f997d730a3f87 Mon Sep 17 00:00:00 2001 From: Ben Phelps Date: Mon, 12 Sep 2022 10:32:40 +0300 Subject: [PATCH 10/32] allow weblate to apply new strings --- public/locales/it/common.json | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/public/locales/it/common.json b/public/locales/it/common.json index e51573104..1697b4489 100644 --- a/public/locales/it/common.json +++ b/public/locales/it/common.json @@ -46,16 +46,6 @@ "free": "Libero", "used": "In utilizzo" }, - "nzbget": { - "rate": "Rate", - "remaining": "Rimanente", - "downloaded": "Scaricato" - }, - "sabnzbd": { - "rate": "Rate", - "queue": "Queue", - "timeleft": "Time Left" - }, "rutorrent": { "active": "Attivo", "upload": "Upload", From 510973c7613c527728100a07b45400446cba72c9 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Mon, 12 Sep 2022 07:32:59 +0000 Subject: [PATCH 11/32] Translated using Weblate (German) Currently translated at 85.3% (64 of 75 strings) Translation: Homepage/Homepage Translate-URL: https://hosted.weblate.org/projects/homepage/homepage/de/ --- public/locales/de/common.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/public/locales/de/common.json b/public/locales/de/common.json index c5b47fcf9..8df8aa228 100644 --- a/public/locales/de/common.json +++ b/public/locales/de/common.json @@ -96,5 +96,15 @@ "pending": "Pending", "approved": "Approved", "available": "Available" + }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, + "nzbget": { + "rate": "Rate", + "remaining": "Remaining", + "downloaded": "Downloaded" } } From 6409188de8d04b5b4d5726d73b770123f69c7a8c Mon Sep 17 00:00:00 2001 From: Anonymous Date: Mon, 12 Sep 2022 07:32:59 +0000 Subject: [PATCH 12/32] Translated using Weblate (Spanish) Currently translated at 92.0% (69 of 75 strings) Translation: Homepage/Homepage Translate-URL: https://hosted.weblate.org/projects/homepage/homepage/es/ --- public/locales/es/common.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/public/locales/es/common.json b/public/locales/es/common.json index 0f5bb9110..57e8cd276 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -96,5 +96,15 @@ "pending": "Pendiente", "approved": "Aprobado", "available": "Disponible" + }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, + "nzbget": { + "rate": "Rate", + "remaining": "Remaining", + "downloaded": "Downloaded" } } From b88463a7859bacc000e8c7e7d6dab028d342a934 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Mon, 12 Sep 2022 07:33:00 +0000 Subject: [PATCH 13/32] Translated using Weblate (French) Currently translated at 53.3% (40 of 75 strings) Translation: Homepage/Homepage Translate-URL: https://hosted.weblate.org/projects/homepage/homepage/fr/ --- public/locales/fr/common.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index 625c83d5b..8838dc19c 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -107,5 +107,15 @@ "pending": "En attente", "approved": "Approuvée", "available": "Disponible" + }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, + "nzbget": { + "remaining": "Remaining", + "downloaded": "Downloaded", + "rate": "Rate" } } From 98cca4ca8bbcc3dbde1c23fca88e821bfe2ac192 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Mon, 12 Sep 2022 07:33:00 +0000 Subject: [PATCH 14/32] Translated using Weblate (Portuguese) Currently translated at 30.6% (23 of 75 strings) Translation: Homepage/Homepage Translate-URL: https://hosted.weblate.org/projects/homepage/homepage/pt/ --- public/locales/pt/common.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/public/locales/pt/common.json b/public/locales/pt/common.json index c0f23da07..b9518036b 100644 --- a/public/locales/pt/common.json +++ b/public/locales/pt/common.json @@ -107,5 +107,15 @@ "pending": "Pending", "approved": "Approved", "available": "Available" + }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, + "nzbget": { + "rate": "Rate", + "remaining": "Remaining", + "downloaded": "Downloaded" } } From d0dd52c5c23eac39716fa2121d950da42cc1efb5 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Mon, 12 Sep 2022 07:33:00 +0000 Subject: [PATCH 15/32] Translated using Weblate (Russian) Currently translated at 17.3% (13 of 75 strings) Translation: Homepage/Homepage Translate-URL: https://hosted.weblate.org/projects/homepage/homepage/ru/ --- public/locales/ru/common.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/public/locales/ru/common.json b/public/locales/ru/common.json index 56d877bfb..d2fbcd0c1 100644 --- a/public/locales/ru/common.json +++ b/public/locales/ru/common.json @@ -96,5 +96,15 @@ "pending": "Pending", "approved": "Approved", "available": "Available" + }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, + "nzbget": { + "rate": "Rate", + "remaining": "Remaining", + "downloaded": "Downloaded" } } From 34468e5bb0074d85471d164447ea4d32ba87c71f Mon Sep 17 00:00:00 2001 From: Anonymous Date: Mon, 12 Sep 2022 07:33:01 +0000 Subject: [PATCH 16/32] Translated using Weblate (Chinese (Simplified)) Currently translated at 80.0% (60 of 75 strings) Translation: Homepage/Homepage Translate-URL: https://hosted.weblate.org/projects/homepage/homepage/zh_Hans/ --- public/locales/zh-CN/common.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/public/locales/zh-CN/common.json b/public/locales/zh-CN/common.json index b6e7e159a..90a2c51b7 100644 --- a/public/locales/zh-CN/common.json +++ b/public/locales/zh-CN/common.json @@ -96,5 +96,15 @@ "pending": "Pending", "approved": "Approved", "available": "Available" + }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, + "nzbget": { + "rate": "Rate", + "remaining": "Remaining", + "downloaded": "Downloaded" } } From 34bf49845f472446e578482ef33fb01b692cf5ec Mon Sep 17 00:00:00 2001 From: Anonymous Date: Mon, 12 Sep 2022 07:33:01 +0000 Subject: [PATCH 17/32] Translated using Weblate (Italian) Currently translated at 92.0% (69 of 75 strings) Translation: Homepage/Homepage Translate-URL: https://hosted.weblate.org/projects/homepage/homepage/it/ --- public/locales/it/common.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/public/locales/it/common.json b/public/locales/it/common.json index 1697b4489..8db3fc133 100644 --- a/public/locales/it/common.json +++ b/public/locales/it/common.json @@ -96,5 +96,15 @@ "pending": "In attesa", "approved": "Approvati", "available": "Disponibili" + }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, + "nzbget": { + "rate": "Rate", + "remaining": "Remaining", + "downloaded": "Downloaded" } } From fe971d23f8a7ab61cecd382ed94f510d02c0b558 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Mon, 12 Sep 2022 07:32:59 +0000 Subject: [PATCH 18/32] =?UTF-8?q?Translated=20using=20Weblate=20(Norwegian?= =?UTF-8?q?=20Bokm=C3=A5l)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently translated at 85.3% (64 of 75 strings) Translation: Homepage/Homepage Translate-URL: https://hosted.weblate.org/projects/homepage/homepage/nb_NO/ --- public/locales/nb-NO/common.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/public/locales/nb-NO/common.json b/public/locales/nb-NO/common.json index 79185695e..3ddf6dc49 100644 --- a/public/locales/nb-NO/common.json +++ b/public/locales/nb-NO/common.json @@ -96,5 +96,15 @@ "pending": "Pending", "approved": "Approved", "available": "Available" + }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, + "nzbget": { + "rate": "Rate", + "downloaded": "Downloaded", + "remaining": "Remaining" } } From 1d4b3eee9b82a7b23b1980c425167b7a4d6df71c Mon Sep 17 00:00:00 2001 From: Anonymous Date: Mon, 12 Sep 2022 07:33:01 +0000 Subject: [PATCH 19/32] Translated using Weblate (Vietnamese) Currently translated at 44.0% (33 of 75 strings) Translation: Homepage/Homepage Translate-URL: https://hosted.weblate.org/projects/homepage/homepage/vi/ --- public/locales/vi/common.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/public/locales/vi/common.json b/public/locales/vi/common.json index 84bf43b98..6e42ce44d 100644 --- a/public/locales/vi/common.json +++ b/public/locales/vi/common.json @@ -96,5 +96,15 @@ "pending": "Pending", "approved": "Approved", "available": "Available" + }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, + "nzbget": { + "rate": "Rate", + "remaining": "Remaining", + "downloaded": "Downloaded" } } From 5ee5adbb1ea586dbbd3b5d0912fdaa4838561966 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Mon, 12 Sep 2022 07:33:02 +0000 Subject: [PATCH 20/32] Translated using Weblate (Dutch) Currently translated at 82.6% (62 of 75 strings) Translation: Homepage/Homepage Translate-URL: https://hosted.weblate.org/projects/homepage/homepage/nl/ --- public/locales/nl/common.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/public/locales/nl/common.json b/public/locales/nl/common.json index 4d7c5c97a..6e5cfe45d 100644 --- a/public/locales/nl/common.json +++ b/public/locales/nl/common.json @@ -96,5 +96,15 @@ "pending": "Pending", "approved": "Approved", "available": "Available" + }, + "sabnzbd": { + "rate": "Rate", + "queue": "Queue", + "timeleft": "Time Left" + }, + "nzbget": { + "rate": "Rate", + "remaining": "Remaining", + "downloaded": "Downloaded" } } From ee9194fce12dacc7c661c55317f4ebbee841203f Mon Sep 17 00:00:00 2001 From: Anonymous Date: Mon, 12 Sep 2022 07:41:23 +0000 Subject: [PATCH 21/32] Translated using Weblate (German) Currently translated at 84.2% (64 of 76 strings) Translation: Homepage/Homepage Translate-URL: https://hosted.weblate.org/projects/homepage/homepage/de/ --- public/locales/de/common.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/locales/de/common.json b/public/locales/de/common.json index 8df8aa228..b43389f68 100644 --- a/public/locales/de/common.json +++ b/public/locales/de/common.json @@ -106,5 +106,8 @@ "rate": "Rate", "remaining": "Remaining", "downloaded": "Downloaded" + }, + "coinmarketcap": { + "configure": "Configure one or more crypto currencies to track" } } From 867c6f9e97a6d75bce6bf6bfbdce09d1bc5e07eb Mon Sep 17 00:00:00 2001 From: Anonymous Date: Mon, 12 Sep 2022 07:41:23 +0000 Subject: [PATCH 22/32] Translated using Weblate (Spanish) Currently translated at 90.7% (69 of 76 strings) Translation: Homepage/Homepage Translate-URL: https://hosted.weblate.org/projects/homepage/homepage/es/ --- public/locales/es/common.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/locales/es/common.json b/public/locales/es/common.json index 57e8cd276..98f04c84a 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -106,5 +106,8 @@ "rate": "Rate", "remaining": "Remaining", "downloaded": "Downloaded" + }, + "coinmarketcap": { + "configure": "Configure one or more crypto currencies to track" } } From 80a31c8427bee03306066a6750af11731203c623 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Mon, 12 Sep 2022 07:41:23 +0000 Subject: [PATCH 23/32] Translated using Weblate (French) Currently translated at 52.6% (40 of 76 strings) Translation: Homepage/Homepage Translate-URL: https://hosted.weblate.org/projects/homepage/homepage/fr/ --- public/locales/fr/common.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index 8838dc19c..d1c86c727 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -117,5 +117,8 @@ "remaining": "Remaining", "downloaded": "Downloaded", "rate": "Rate" + }, + "coinmarketcap": { + "configure": "Configure one or more crypto currencies to track" } } From 42356166c08a94d7a096d9aea891f611acba6d28 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Mon, 12 Sep 2022 07:41:23 +0000 Subject: [PATCH 24/32] Translated using Weblate (Portuguese) Currently translated at 30.2% (23 of 76 strings) Translation: Homepage/Homepage Translate-URL: https://hosted.weblate.org/projects/homepage/homepage/pt/ --- public/locales/pt/common.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/locales/pt/common.json b/public/locales/pt/common.json index b9518036b..6564d2d0b 100644 --- a/public/locales/pt/common.json +++ b/public/locales/pt/common.json @@ -117,5 +117,8 @@ "rate": "Rate", "remaining": "Remaining", "downloaded": "Downloaded" + }, + "coinmarketcap": { + "configure": "Configure one or more crypto currencies to track" } } From 2499d25ce62c332f5991ed789f9341e339c998a4 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Mon, 12 Sep 2022 07:41:23 +0000 Subject: [PATCH 25/32] Translated using Weblate (Russian) Currently translated at 17.1% (13 of 76 strings) Translation: Homepage/Homepage Translate-URL: https://hosted.weblate.org/projects/homepage/homepage/ru/ --- public/locales/ru/common.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/locales/ru/common.json b/public/locales/ru/common.json index d2fbcd0c1..17934885a 100644 --- a/public/locales/ru/common.json +++ b/public/locales/ru/common.json @@ -106,5 +106,8 @@ "rate": "Rate", "remaining": "Remaining", "downloaded": "Downloaded" + }, + "coinmarketcap": { + "configure": "Configure one or more crypto currencies to track" } } From 200ab220e863bd74b5969f8d3c60b76887b02a0b Mon Sep 17 00:00:00 2001 From: Anonymous Date: Mon, 12 Sep 2022 07:41:23 +0000 Subject: [PATCH 26/32] Translated using Weblate (Chinese (Simplified)) Currently translated at 78.9% (60 of 76 strings) Translation: Homepage/Homepage Translate-URL: https://hosted.weblate.org/projects/homepage/homepage/zh_Hans/ --- public/locales/zh-CN/common.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/locales/zh-CN/common.json b/public/locales/zh-CN/common.json index 90a2c51b7..7f57f4884 100644 --- a/public/locales/zh-CN/common.json +++ b/public/locales/zh-CN/common.json @@ -106,5 +106,8 @@ "rate": "Rate", "remaining": "Remaining", "downloaded": "Downloaded" + }, + "coinmarketcap": { + "configure": "Configure one or more crypto currencies to track" } } From ebee953ebc54ac0741abcaf2cf5e7e7bdd497567 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Mon, 12 Sep 2022 07:41:23 +0000 Subject: [PATCH 27/32] Translated using Weblate (Italian) Currently translated at 90.7% (69 of 76 strings) Translation: Homepage/Homepage Translate-URL: https://hosted.weblate.org/projects/homepage/homepage/it/ --- public/locales/it/common.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/locales/it/common.json b/public/locales/it/common.json index 8db3fc133..6b284a0ca 100644 --- a/public/locales/it/common.json +++ b/public/locales/it/common.json @@ -106,5 +106,8 @@ "rate": "Rate", "remaining": "Remaining", "downloaded": "Downloaded" + }, + "coinmarketcap": { + "configure": "Configure one or more crypto currencies to track" } } From a792d213e9ed34edfc762436158abc87560477fc Mon Sep 17 00:00:00 2001 From: Anonymous Date: Mon, 12 Sep 2022 07:41:22 +0000 Subject: [PATCH 28/32] =?UTF-8?q?Translated=20using=20Weblate=20(Norwegian?= =?UTF-8?q?=20Bokm=C3=A5l)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently translated at 84.2% (64 of 76 strings) Translation: Homepage/Homepage Translate-URL: https://hosted.weblate.org/projects/homepage/homepage/nb_NO/ --- public/locales/nb-NO/common.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/locales/nb-NO/common.json b/public/locales/nb-NO/common.json index 3ddf6dc49..86c80f9c9 100644 --- a/public/locales/nb-NO/common.json +++ b/public/locales/nb-NO/common.json @@ -106,5 +106,8 @@ "rate": "Rate", "downloaded": "Downloaded", "remaining": "Remaining" + }, + "coinmarketcap": { + "configure": "Configure one or more crypto currencies to track" } } From 898e30d6de25753f2769d4bd3775d62192f147b1 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Mon, 12 Sep 2022 07:41:23 +0000 Subject: [PATCH 29/32] Translated using Weblate (Vietnamese) Currently translated at 43.4% (33 of 76 strings) Translation: Homepage/Homepage Translate-URL: https://hosted.weblate.org/projects/homepage/homepage/vi/ --- public/locales/vi/common.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/locales/vi/common.json b/public/locales/vi/common.json index 6e42ce44d..f84d16023 100644 --- a/public/locales/vi/common.json +++ b/public/locales/vi/common.json @@ -106,5 +106,8 @@ "rate": "Rate", "remaining": "Remaining", "downloaded": "Downloaded" + }, + "coinmarketcap": { + "configure": "Configure one or more crypto currencies to track" } } From 7bf1bf53695c8ed4667787d7ee48f1050b834939 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Mon, 12 Sep 2022 07:41:23 +0000 Subject: [PATCH 30/32] Translated using Weblate (Dutch) Currently translated at 81.5% (62 of 76 strings) Translation: Homepage/Homepage Translate-URL: https://hosted.weblate.org/projects/homepage/homepage/nl/ --- public/locales/nl/common.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/locales/nl/common.json b/public/locales/nl/common.json index 6e5cfe45d..20c4b8a8c 100644 --- a/public/locales/nl/common.json +++ b/public/locales/nl/common.json @@ -106,5 +106,8 @@ "rate": "Rate", "remaining": "Remaining", "downloaded": "Downloaded" + }, + "coinmarketcap": { + "configure": "Configure one or more crypto currencies to track" } } From 366014053927205648561ecac443c5ab7bbc2f05 Mon Sep 17 00:00:00 2001 From: Ben Phelps Date: Mon, 12 Sep 2022 10:59:56 +0300 Subject: [PATCH 31/32] consolidate api handlers --- src/pages/api/services/proxy.js | 5 ++--- src/utils/proxies/coinmarketcap.js | 33 ------------------------------ src/utils/proxies/credentialed.js | 16 +++++++++++---- 3 files changed, 14 insertions(+), 40 deletions(-) delete mode 100644 src/utils/proxies/coinmarketcap.js diff --git a/src/pages/api/services/proxy.js b/src/pages/api/services/proxy.js index 5c78a9cce..fbc053daa 100644 --- a/src/pages/api/services/proxy.js +++ b/src/pages/api/services/proxy.js @@ -3,7 +3,6 @@ import credentialedProxyHandler from "utils/proxies/credentialed"; import rutorrentProxyHandler from "utils/proxies/rutorrent"; import nzbgetProxyHandler from "utils/proxies/nzbget"; import npmProxyHandler from "utils/proxies/npm"; -import coinMarketCapProxyHandler from "utils/proxies/coinmarketcap"; const serviceProxyHandlers = { // uses query param auth @@ -17,13 +16,13 @@ const serviceProxyHandlers = { tautulli: genericProxyHandler, traefik: genericProxyHandler, sabnzbd: genericProxyHandler, - // uses X-API-Key header auth + // uses X-API-Key (or similar) header auth portainer: credentialedProxyHandler, jellyseerr: credentialedProxyHandler, overseerr: credentialedProxyHandler, ombi: credentialedProxyHandler, + coinmarketcap: credentialedProxyHandler, // super specific handlers - coinmarketcap: coinMarketCapProxyHandler, rutorrent: rutorrentProxyHandler, nzbget: nzbgetProxyHandler, npm: npmProxyHandler, diff --git a/src/utils/proxies/coinmarketcap.js b/src/utils/proxies/coinmarketcap.js deleted file mode 100644 index 42611ec8c..000000000 --- a/src/utils/proxies/coinmarketcap.js +++ /dev/null @@ -1,33 +0,0 @@ -import getServiceWidget from "utils/service-helpers"; -import { formatApiCall } from "utils/api-helpers"; -import { httpProxy } from "utils/http"; - -export default async function coinMarketCapProxyHandler(req, res) { - const { group, service, endpoint } = req.query; - - if (group && service) { - const widget = await getServiceWidget(group, service); - - if (widget) { - const url = new URL(formatApiCall(widget.type, { endpoint, ...widget })); - const [status, contentType, data] = await httpProxy(url, { - method: req.method, - withCredentials: true, - credentials: "include", - headers: { - "X-CMC_PRO_API_KEY": `${widget.key}`, - "Content-Type": "application/json", - }, - }); - - if (status === 204 || status === 304) { - return res.status(status).end(); - } - - if (contentType) res.setHeader("Content-Type", contentType); - return res.status(status).send(data); - } - } - - return res.status(400).json({ error: "Invalid proxy service type" }); -} diff --git a/src/utils/proxies/credentialed.js b/src/utils/proxies/credentialed.js index 6b4cbf0ab..70df64726 100644 --- a/src/utils/proxies/credentialed.js +++ b/src/utils/proxies/credentialed.js @@ -10,14 +10,22 @@ export default async function credentialedProxyHandler(req, res) { if (widget) { const url = new URL(formatApiCall(widget.type, { endpoint, ...widget })); + + const headers = { + "Content-Type": "application/json", + }; + + if (widget.type === "coinmarketcap") { + headers["X-CMC_PRO_API_KEY"] = `${widget.key}`; + } else { + headers["X-API-Key"] = `${widget.key}`; + } + const [status, contentType, data] = await httpProxy(url, { method: req.method, withCredentials: true, credentials: "include", - headers: { - "X-API-Key": `${widget.key}`, - "Content-Type": "application/json", - }, + headers, }); if (status === 204 || status === 304) { From cd53440eff030c3e4be0ee6cef1aaf26475f3116 Mon Sep 17 00:00:00 2001 From: Ben Phelps Date: Mon, 12 Sep 2022 11:00:15 +0300 Subject: [PATCH 32/32] fix search and weather widget spacing --- src/components/widgets/openweathermap/weather.jsx | 8 ++++---- src/components/widgets/search/search.jsx | 2 +- src/components/widgets/weather/weather.jsx | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/widgets/openweathermap/weather.jsx b/src/components/widgets/openweathermap/weather.jsx index b01eb3c4f..4173871d7 100644 --- a/src/components/widgets/openweathermap/weather.jsx +++ b/src/components/widgets/openweathermap/weather.jsx @@ -16,7 +16,7 @@ function Widget({ options }) { if (error || data?.cod === 401 || data?.error) { return ( -
+
@@ -32,7 +32,7 @@ function Widget({ options }) { if (!data) { return ( -
+
@@ -49,7 +49,7 @@ function Widget({ options }) { const unit = options.units === "metric" ? "celsius" : "fahrenheit"; return ( -
+
requestLocation()} className="flex flex-col justify-center"> +