Merge branch 'benphelps:main' into themes

This commit is contained in:
Ajay Kristipati 2023-01-09 16:25:58 -05:00 committed by GitHub
commit 99a884851d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 140 additions and 116 deletions

View File

@ -31,8 +31,8 @@
"public_ip": "Public IP" "public_ip": "Public IP"
}, },
"common": { "common": {
"bibyterate": "", "bibyterate": "{{value, rate(bits: false; binary: true)}}",
"bibitrate": "" "bibitrate": "{{value, rate(bits: true; binary: true)}}"
}, },
"widget": { "widget": {
"api_error": "APIエラー", "api_error": "APIエラー",

View File

@ -1,116 +1,116 @@
{ {
"widget": { "widget": {
"missing_type": "Missing Widget Type: {{type}}", "missing_type": "遺失的小工具類型: {{type}}",
"api_error": "API Error", "api_error": "API錯誤",
"status": "Status", "status": "狀態",
"information": "Information", "information": "資訊",
"url": "URL", "url": "URL",
"raw_error": "Raw Error", "raw_error": "Raw Error",
"response_data": "Response Data" "response_data": "Response Data"
}, },
"weather": { "weather": {
"current": "Current Location", "current": "目前位置",
"allow": "Click to allow", "allow": "點擊以允許",
"updating": "Updating", "updating": "更新中",
"wait": "Please wait" "wait": "請稍後"
}, },
"docker": { "docker": {
"rx": "RX", "rx": "接收",
"offline": "Offline", "offline": "離線",
"tx": "TX", "tx": "發送",
"mem": "MEM", "mem": "記憶體",
"cpu": "CPU", "cpu": "處理器",
"error": "Error", "error": "錯誤",
"unknown": "Unknown" "unknown": "未知的"
}, },
"emby": { "emby": {
"playing": "Playing", "playing": "正在播放",
"transcoding": "Transcoding", "transcoding": "轉碼",
"bitrate": "Bitrate", "bitrate": "位元率",
"no_active": "No Active Streams" "no_active": "暫無撥放"
}, },
"tautulli": { "tautulli": {
"playing": "Playing", "playing": "正在播放",
"transcoding": "Transcoding", "transcoding": "轉碼",
"bitrate": "Bitrate", "bitrate": "位元率",
"no_active": "No Active Streams" "no_active": "暫無撥放"
}, },
"jellyseerr": { "jellyseerr": {
"pending": "Pending", "pending": "待定",
"approved": "Approved", "approved": "已接受",
"available": "Available" "available": "可用的"
}, },
"search": { "search": {
"placeholder": "Search…" "placeholder": "搜尋…"
}, },
"resources": { "resources": {
"total": "Total", "total": "全部",
"free": "Free", "free": "剩餘",
"used": "Used", "used": "已使用",
"load": "Load", "load": "負載",
"cpu": "CPU" "cpu": "CPU"
}, },
"nzbget": { "nzbget": {
"rate": "Rate", "rate": "速率",
"remaining": "Remaining", "remaining": "剩餘",
"downloaded": "Downloaded" "downloaded": "已下載"
}, },
"sabnzbd": { "sabnzbd": {
"rate": "Rate", "rate": "速率",
"queue": "Queue", "queue": "佇列",
"timeleft": "Time Left" "timeleft": "剩餘時間"
}, },
"rutorrent": { "rutorrent": {
"active": "Active", "active": "Active",
"upload": "Upload", "upload": "上傳",
"download": "Download" "download": "下載"
}, },
"radarr": { "radarr": {
"movies": "Movies", "movies": "電影",
"wanted": "Wanted", "wanted": "欲觀看",
"queued": "Queued", "queued": "已加入佇列",
"missing": "Missing" "missing": "遺失"
}, },
"sonarr": { "sonarr": {
"wanted": "Wanted", "wanted": "欲觀看",
"queued": "Queued", "queued": "已加入佇列",
"series": "Series" "series": "系列"
}, },
"readarr": { "readarr": {
"wanted": "Wanted", "wanted": "欲觀看",
"queued": "Queued", "queued": "已加入佇列",
"books": "Books" "books": "書籍"
}, },
"ombi": { "ombi": {
"pending": "Pending", "pending": "待定",
"approved": "Approved", "approved": "已接受",
"available": "Available" "available": "可用的"
}, },
"overseerr": { "overseerr": {
"pending": "Pending", "pending": "待定",
"approved": "Approved", "approved": "已接受",
"available": "Available", "available": "可用的",
"processing": "Processing" "processing": "處理中"
}, },
"pihole": { "pihole": {
"queries": "Queries", "queries": "查詢",
"blocked": "Blocked", "blocked": "已阻擋",
"gravity": "Gravity" "gravity": "Gravity"
}, },
"speedtest": { "speedtest": {
"upload": "Upload", "upload": "上行",
"download": "Download", "download": "下行",
"ping": "Ping" "ping": "Ping"
}, },
"portainer": { "portainer": {
"running": "Running", "running": "運行中",
"stopped": "Stopped", "stopped": "已停止",
"total": "Total" "total": "總數"
}, },
"traefik": { "traefik": {
"routers": "Routers", "routers": "路由器",
"services": "Services", "services": "服務",
"middleware": "Middleware" "middleware": "中介軟體"
}, },
"gotify": { "gotify": {
"clients": "Clients", "clients": "Clients",
@ -118,8 +118,8 @@
"messages": "Messages" "messages": "Messages"
}, },
"npm": { "npm": {
"enabled": "Enabled", "enabled": "已啟用",
"disabled": "Disabled", "disabled": "已停用",
"total": "Total" "total": "Total"
}, },
"coinmarketcap": { "coinmarketcap": {
@ -137,8 +137,8 @@
"numberOfFailQueries": "Fail Queries" "numberOfFailQueries": "Fail Queries"
}, },
"transmission": { "transmission": {
"download": "Download", "download": "下載",
"upload": "Upload", "upload": "上傳",
"leech": "Leech", "leech": "Leech",
"seed": "Seed" "seed": "Seed"
}, },
@ -147,23 +147,23 @@
"errored": "Errored" "errored": "Errored"
}, },
"bazarr": { "bazarr": {
"missingEpisodes": "Missing Episodes", "missingEpisodes": "缺失的劇集",
"missingMovies": "Missing Movies" "missingMovies": "缺失的電影"
}, },
"lidarr": { "lidarr": {
"wanted": "Wanted", "wanted": "欲觀看",
"queued": "Queued", "queued": "已加入佇列",
"albums": "Albums" "albums": "專輯"
}, },
"adguard": { "adguard": {
"queries": "Queries", "queries": "查詢",
"blocked": "Blocked", "blocked": "已阻擋",
"filtered": "Filtered", "filtered": "已過濾",
"latency": "Latency" "latency": "延遲"
}, },
"qbittorrent": { "qbittorrent": {
"download": "Download", "download": "下載",
"upload": "Upload", "upload": "上傳",
"leech": "Leech", "leech": "Leech",
"seed": "Seed" "seed": "Seed"
}, },
@ -190,25 +190,25 @@
"vms": "VMs" "vms": "VMs"
}, },
"unifi": { "unifi": {
"users": "Users", "users": "使用者",
"uptime": "System Uptime", "uptime": "系統運行時間",
"days": "Days", "days": "",
"wan": "WAN", "wan": "WAN",
"lan_users": "LAN Users", "lan_users": "LAN使用者",
"wlan_users": "WLAN Users", "wlan_users": "WLAN使用者",
"up": "UP", "up": "UP",
"down": "DOWN", "down": "DOWN",
"wait": "Please wait", "wait": "請稍後",
"lan": "LAN", "lan": "LAN",
"wlan": "WLAN", "wlan": "WLAN",
"devices": "Devices", "devices": "設備",
"lan_devices": "LAN Devices", "lan_devices": "LAN設備",
"wlan_devices": "WLAN Devices" "wlan_devices": "WLAN設備"
}, },
"plex": { "plex": {
"streams": "Active Streams", "streams": "正在串流",
"movies": "Movies", "movies": "電影",
"tv": "TV Shows" "tv": "影集"
}, },
"glances": { "glances": {
"cpu": "CPU", "cpu": "CPU",
@ -313,8 +313,8 @@
"time": "{{value, number(style: unit; unitDisplay: long;)}}" "time": "{{value, number(style: unit; unitDisplay: long;)}}"
}, },
"navidrome": { "navidrome": {
"nothing_streaming": "No Active Streams", "nothing_streaming": "暫無撥放",
"please_wait": "Please Wait" "please_wait": "請稍後"
}, },
"pyload": { "pyload": {
"speed": "Speed", "speed": "Speed",
@ -332,7 +332,7 @@
"hd": "HD" "hd": "HD"
}, },
"ping": { "ping": {
"error": "Error", "error": "錯誤",
"ping": "Ping" "ping": "Ping"
}, },
"scrutiny": { "scrutiny": {
@ -345,22 +345,22 @@
"total": "Total" "total": "Total"
}, },
"deluge": { "deluge": {
"download": "Download", "download": "下載",
"upload": "Upload", "upload": "上傳",
"leech": "Leech", "leech": "Leech",
"seed": "Seed" "seed": "Seed"
}, },
"flood": { "flood": {
"download": "Download", "download": "下載",
"upload": "Upload", "upload": "上傳",
"leech": "Leech", "leech": "Leech",
"seed": "Seed" "seed": "Seed"
}, },
"tdarr": { "tdarr": {
"queue": "Queue", "queue": "佇列",
"processed": "Processed", "processed": "已處理",
"errored": "Errored", "errored": "錯誤",
"saved": "Saved" "saved": "已儲存"
}, },
"miniflux": { "miniflux": {
"read": "Read", "read": "Read",
@ -375,15 +375,15 @@
"bibitrate": "{{value, rate(bits: true; binary: true)}}" "bibitrate": "{{value, rate(bits: true; binary: true)}}"
}, },
"omada": { "omada": {
"connectedAp": "Connected APs", "connectedAp": "已連接的存取點",
"activeUser": "Active devices", "activeUser": "在線裝置",
"alerts": "Alerts", "alerts": "警示",
"connectedGateway": "Connected gateways", "connectedGateway": "已連接的閘道",
"connectedSwitches": "Connected switches" "connectedSwitches": "已連接的交換器"
}, },
"downloadstation": { "downloadstation": {
"download": "Download", "download": "下載",
"upload": "Upload", "upload": "上傳",
"leech": "Leech", "leech": "Leech",
"seed": "Seed" "seed": "Seed"
}, },

View File

@ -30,6 +30,8 @@ export default async function credentialedProxyHandler(req, res, map) {
headers["X-gotify-Key"] = `${widget.key}`; headers["X-gotify-Key"] = `${widget.key}`;
} else if (widget.type === "authentik") { } else if (widget.type === "authentik") {
headers.Authorization = `Bearer ${widget.key}`; headers.Authorization = `Bearer ${widget.key}`;
} else if (widget.type === "truenas") {
headers.Authorization = `Bearer ${widget.key}`;
} else if (widget.type === "proxmox") { } else if (widget.type === "proxmox") {
headers.Authorization = `PVEAPIToken=${widget.username}=${widget.password}`; headers.Authorization = `PVEAPIToken=${widget.username}=${widget.password}`;
} else if (widget.type === "autobrr") { } else if (widget.type === "autobrr") {

View File

@ -4,8 +4,8 @@ import { formatProxyUrl } from "./api-helpers";
export default function useWidgetAPI(widget, ...options) { export default function useWidgetAPI(widget, ...options) {
const config = {}; const config = {};
if (options?.refreshInterval) { if (options && options[1]?.refreshInterval) {
config.refreshInterval = options.refreshInterval; config.refreshInterval = options[1].refreshInterval;
} }
const { data, error } = useSWR(formatProxyUrl(widget, ...options), config); const { data, error } = useSWR(formatProxyUrl(widget, ...options), config);
// make the data error the top-level error // make the data error the top-level error

View File

@ -1,9 +1,31 @@
import { jsonArrayFilter } from "utils/proxy/api-helpers"; import { jsonArrayFilter } from "utils/proxy/api-helpers";
import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
import genericProxyHandler from "utils/proxy/handlers/generic"; import genericProxyHandler from "utils/proxy/handlers/generic";
import getServiceWidget from "utils/config/service-helpers";
const widget = { const widget = {
api: "{url}/api/v2.0/{endpoint}", api: "{url}/api/v2.0/{endpoint}",
proxyHandler: genericProxyHandler, proxyHandler: async (req, res, map) => { // choose proxy handler based on widget settings
const { group, service } = req.query;
if (group && service) {
const widgetOpts = await getServiceWidget(group, service);
let handler;
if (widgetOpts.username && widgetOpts.password) {
handler = genericProxyHandler;
} else if (widgetOpts.key) {
handler = credentialedProxyHandler;
}
if (handler) {
return handler(req, res, map);
}
return res.status(500).json({ error: "Username / password or API key required" });
}
return res.status(500).json({ error: "Error parsing widget request" });
},
mappings: { mappings: {
alerts: { alerts: {