Compare commits

..
1 Commits
Author SHA1 Message Date
Crowdin Bot acddd9183e New Crowdin translations by GitHub Action
Lint / Linting Checks (push) Has been cancelled
Tests / vitest (1) (push) Has been cancelled
Tests / vitest (2) (push) Has been cancelled
Tests / vitest (3) (push) Has been cancelled
Tests / vitest (4) (push) Has been cancelled
2026-08-30 00:57:15 +00:00
6 changed files with 215 additions and 252 deletions
+2 -3
View File
@@ -9,9 +9,7 @@ See the [crowdsec docs](https://docs.crowdsec.net/docs/local_api/intro/#machines
in most instances you can use the default credentials (`/etc/crowdsec/local_api_credentials.yaml`).
!!! note
`alerts` counts alerts raised by your own engine in the last 24 hours. Alerts originating from the
CrowdSec community blocklist are excluded.
Without the `limit24h` option, the widget will fetch all alerts which is limited to 100 by the API to avoid performance issues.
Allowed fields: `["alerts", "bans"]`.
@@ -21,4 +19,5 @@ widget:
url: http://crowdsechostorip:port
username: localhost # machine_id in crowdsec
password: password
limit24h: true # optional, limits alerts to last 24h. Default: false
```
+2 -2
View File
@@ -40,8 +40,8 @@
},
"search": {
"placeholder": "Buscar…",
"provider": "Motor de búsqueda: {{name}}",
"select_provider": "Seleccionar motores de búsqueda"
"provider": "Search engine: {{name}}",
"select_provider": "Select search engine"
},
"resources": {
"cpu": "CPU",
+201 -201
View File
@@ -21,7 +21,7 @@
"seconds": "giây"
},
"auth": {
"signout": "Đăng xuất"
"signout": "Sign out"
},
"widget": {
"missing_type": "Thiếu loại Widget: {{type}}",
@@ -40,8 +40,8 @@
},
"search": {
"placeholder": "Tìm kiếm…",
"provider": "Công cụ tìm kiếm: {{name}}",
"select_provider": "Chọn công cụ tìm kiếm"
"provider": "Search engine: {{name}}",
"select_provider": "Select search engine"
},
"resources": {
"cpu": "CPU",
@@ -50,7 +50,7 @@
"free": "Dư",
"used": "Đã dùng",
"load": "\n",
"temp": "Tạm thời",
"temp": "TEMP",
"max": "Tối đa",
"uptime": "UP"
},
@@ -66,24 +66,24 @@
"wlan_devices": "Thiết bị trong mạng WLAN",
"lan_users": "Người dùng mạng LAN",
"wlan_users": "Người dùng mạng WLAN",
"up": "Hoạt động",
"down": "Không hoạt động",
"up": "UP",
"down": "DOWN",
"wait": "Vui lòng chờ",
"empty_data": "Trạng thái hệ thống phụ không xác định"
},
"unifi_drive": {
"healthy": "Bình thường",
"degraded": "Suy giảm",
"no_data": "Không có dữ liệu"
"healthy": "Healthy",
"degraded": "Degraded",
"no_data": "No storage data available"
},
"duplicati": {
"jobs": "Tác vụ",
"stored": "Đã lưu",
"lastBackup": "Lần chạy cuối",
"nextRun": "Lần chạy tiếp theo",
"running": "Đang chạy",
"warnings": "Cảnh báo",
"errors": "Lỗi"
"jobs": "Jobs",
"stored": "Stored",
"lastBackup": "Last Run",
"nextRun": "Next Run",
"running": "Running",
"warnings": "Warnings",
"errors": "Errors"
},
"docker": {
"rx": "RX",
@@ -98,8 +98,8 @@
"starting": "Đang bắt đầu",
"unhealthy": "Bất thường",
"not_found": "Không tìm thấy",
"exited": "Đã thoát",
"partial": "Một phần"
"exited": "Exited",
"partial": "Partial"
},
"ping": {
"error": "Lỗi",
@@ -120,35 +120,35 @@
"playing": "Đang chơi",
"transcoding": "Chuyển định dạng",
"bitrate": "Bitrate",
"no_active": "Không có luồng đang hoạt động",
"no_active": "No Active Streams",
"movies": "Phim ảnh",
"series": "Series",
"episodes": "Tập",
"episodes": "Episodes",
"songs": "Bài hát"
},
"jellyfin": {
"playing": "Đang phát",
"transcoding": "Đang chuyển mã",
"bitrate": "Tốc độ bit",
"no_active": "Không có luồng đang hoạt động",
"movies": "Phim",
"playing": "Playing",
"transcoding": "Transcoding",
"bitrate": "Bitrate",
"no_active": "No Active Streams",
"movies": "Movies",
"series": "Series",
"episodes": "Tập",
"songs": "Bài hát",
"albums": "Album"
"episodes": "Episodes",
"songs": "Songs",
"albums": "Albums"
},
"esphome": {
"offline": "Offline",
"offline_alt": "Offline",
"online": "Online",
"total": "Tổng cộng",
"total": "Total",
"unknown": "Không xác định"
},
"evcc": {
"pv_power": "Công suất phát",
"pv_power": "Production",
"battery_soc": "Pin",
"grid_power": "Lưới",
"home_power": "Công suất tiêu thụ",
"home_power": "Consumption",
"charge_power": "Bộ sạc",
"kilowatt": "kW"
},
@@ -156,7 +156,7 @@
"download": "Tải xuống",
"upload": "Tải lên",
"leech": "",
"seed": "Seeder"
"seed": "Seed"
},
"freshrss": {
"subscriptions": "Đăng ký",
@@ -175,115 +175,115 @@
"maxDown": "Tải xuống tối đa",
"maxUp": "Tải lên tối đa",
"down": "Down",
"up": "Tải lên",
"received": "Đã nhận",
"sent": "Đã gửi",
"externalIPAddress": "Địa chỉ IP bên ngoài",
"externalIPv6Address": "Địa chỉ IPv6 bên ngoài",
"externalIPv6Prefix": "Tiền tố IPv6 bên ngoài"
"up": "Up",
"received": "Received",
"sent": "Sent",
"externalIPAddress": "Ext. IP",
"externalIPv6Address": "Ext. IPv6",
"externalIPv6Prefix": "Ext. IPv6-Prefix"
},
"caddy": {
"upstreams": "Máy chủ backend",
"requests": "Yêu cầu hiện tại",
"requests_failed": "Yêu cầu thất bại"
"upstreams": "Upstreams",
"requests": "Current requests",
"requests_failed": "Failed requests"
},
"changedetectionio": {
"totalObserved": "Tổng số đã theo dõi",
"diffsDetected": "Số thay đổi đã phát hiện"
"totalObserved": "Total Observed",
"diffsDetected": "Diffs Detected"
},
"channelsdvrserver": {
"shows": "Chương trình",
"recordings": "Bản ghi",
"scheduled": "Đã lên lịch",
"passes": "Quy tắc ghi"
"shows": "Shows",
"recordings": "Recordings",
"scheduled": "Scheduled",
"passes": "Passes"
},
"tautulli": {
"playing": "Đang phát",
"transcoding": "Đang chuyển mã",
"bitrate": "Tốc độ bit",
"no_active": "Không có luồng đang hoạt động",
"plex_connection_error": "Kiểm tra kết nối Plex"
"playing": "Playing",
"transcoding": "Transcoding",
"bitrate": "Bitrate",
"no_active": "No Active Streams",
"plex_connection_error": "Check Plex Connection"
},
"tracearr": {
"no_active": "Không có luồng đang hoạt động",
"streams": "Luồng",
"transcodes": "Luồng chuyển mã",
"directplay": "Phát trực tiếp",
"bitrate": "Tốc độ bit"
"no_active": "No Active Streams",
"streams": "Streams",
"transcodes": "Transcodes",
"directplay": "Direct Play",
"bitrate": "Bitrate"
},
"omada": {
"connectedAp": "AP đã kết nối",
"activeUser": "Thiết bị đang hoạt động",
"alerts": "Cảnh báo",
"connectedGateways": "Gateway đã kết nối",
"connectedSwitches": "Switch đã kết nối"
"connectedAp": "Connected APs",
"activeUser": "Active devices",
"alerts": "Alerts",
"connectedGateways": "Connected gateways",
"connectedSwitches": "Connected switches"
},
"nzbget": {
"rate": "Tốc độ",
"remaining": "Còn lại",
"rate": "Rate",
"remaining": "Remaining",
"downloaded": "Đã tải"
},
"plex": {
"streams": "Luồng đang hoạt động",
"albums": "Album",
"movies": "Phim",
"tv": "Chương trình TV"
"streams": "Active Streams",
"albums": "Albums",
"movies": "Movies",
"tv": "TV Shows"
},
"sabnzbd": {
"rate": "Tốc độ",
"rate": "Rate",
"queue": "Hàng chờ",
"timeleft": "Thời gian còn lại"
},
"rutorrent": {
"active": "Hoạt động",
"upload": "Tải lên",
"download": "Tải xuống"
"upload": "Upload",
"download": "Download"
},
"transmission": {
"download": "Tải xuống",
"upload": "Tải lên",
"leech": "Leecher",
"seed": "Seeder"
"download": "Download",
"upload": "Upload",
"leech": "Leech",
"seed": "Seed"
},
"qbittorrent": {
"download": "Tải xuống",
"upload": "Tải lên",
"leech": "Leecher",
"seed": "Seeder"
"download": "Download",
"upload": "Upload",
"leech": "Leech",
"seed": "Seed"
},
"qnap": {
"cpuUsage": "Mức sử dụng CPU",
"memUsage": "Mức sử dụng bộ nhớ",
"systemTempC": "Nhiệt độ hệ thống",
"poolUsage": "Mức sử dụng pool",
"volumeUsage": "Mức sử dụng volume",
"invalid": "Không hợp lệ"
"cpuUsage": "CPU Usage",
"memUsage": "MEM Usage",
"systemTempC": "System Temp",
"poolUsage": "Pool Usage",
"volumeUsage": "Volume Usage",
"invalid": "Invalid"
},
"deluge": {
"download": "Tải xuống",
"upload": "Tải lên",
"leech": "Leecher",
"seed": "Seeder"
"download": "Download",
"upload": "Upload",
"leech": "Leech",
"seed": "Seed"
},
"develancacheui": {
"cachehitbytes": "Dung lượng cache hit",
"cachemissbytes": "Dung lượng cache miss"
"cachehitbytes": "Cache Hit Bytes",
"cachemissbytes": "Cache Miss Bytes"
},
"downloadstation": {
"download": "Tải xuống",
"upload": "Tải lên",
"leech": "Leecher",
"seed": "Seeder"
"download": "Download",
"upload": "Upload",
"leech": "Leech",
"seed": "Seed"
},
"sonarr": {
"wanted": "Cần tải",
"wanted": "Wanted",
"queued": "Queued",
"series": "Phim bộ",
"series": "Series",
"queue": "Queue",
"unknown": "Unknown"
},
"radarr": {
"wanted": "Cần tải",
"wanted": "Wanted",
"missing": "Missing",
"queued": "Queued",
"movies": "Movies",
@@ -291,12 +291,12 @@
"unknown": "Unknown"
},
"lidarr": {
"wanted": "Cần tải",
"wanted": "Wanted",
"queued": "Queued",
"artists": "Artists"
},
"readarr": {
"wanted": "Cần tải",
"wanted": "Wanted",
"queued": "Queued",
"books": "Sách"
},
@@ -336,66 +336,66 @@
"latency": "Latency"
},
"speedtest": {
"upload": "Tải lên",
"download": "Tải xuống",
"upload": "Upload",
"download": "Download",
"ping": "Ping"
},
"portainer": {
"running": "Đang chạy",
"stopped": "Đã dừng",
"total": "Tổng cộng"
"running": "Running",
"stopped": "Stopped",
"total": "Total"
},
"suwayomi": {
"download": "Đã tải xuống",
"nondownload": "Chưa tải xuống",
"read": "Đã đọc",
"unread": "Chưa đọc",
"downloadedread": "Đã tải xuống & Đã đọc",
"downloadedunread": "Đã tải xuống & Chưa đọc",
"nondownloadedread": "Chưa tải xuống & Đã đọc",
"nondownloadedunread": "Chưa tải xuống & Chưa đọc"
"download": "Downloaded",
"nondownload": "Non-Downloaded",
"read": "Read",
"unread": "Unread",
"downloadedread": "Downloaded & Read",
"downloadedunread": "Downloaded & Unread",
"nondownloadedread": "Non-Downloaded & Read",
"nondownloadedunread": "Non-Downloaded & Unread"
},
"tailscale": {
"address": "Địa chỉ",
"expires": "Hết hạn",
"never": "Không bao giờ",
"user": "Người dùng",
"hostname": "Tên máy chủ",
"name": "Tên",
"client_version": "Phiên bản máy khách",
"os": "Hệ điều hành",
"created": "Đã tạo",
"authorized": "Đã cấp quyền",
"is_external": "Là bên ngoài",
"update_available": "Có bản cập nhật",
"tags": "Thẻ",
"last_seen": "Lần cuối nhìn thấy",
"now": "Bây giờ",
"years": "{{number}} năm",
"weeks": "{{number}} tuần",
"days": "{{number}} ngày",
"hours": "{{number}} giờ",
"minutes": "{{number}} phút",
"seconds": "{{number}} giây",
"ago": "{{value}} trước",
"true": "Có",
"false": "Không"
"address": "Address",
"expires": "Expires",
"never": "Never",
"user": "User",
"hostname": "Hostname",
"name": "Name",
"client_version": "Client Version",
"os": "OS",
"created": "Created",
"authorized": "Authorized",
"is_external": "Is External",
"update_available": "Update Available",
"tags": "Tags",
"last_seen": "Last Seen",
"now": "Now",
"years": "{{number}}y",
"weeks": "{{number}}w",
"days": "{{number}}d",
"hours": "{{number}}h",
"minutes": "{{number}}m",
"seconds": "{{number}}s",
"ago": "{{value}} Ago",
"true": "Yes",
"false": "No"
},
"technitium": {
"totalQueries": "Tổng số truy vấn",
"totalNoError": "Thành công",
"totalServerFailure": "Lỗi máy chủ",
"totalNxDomain": "NX Domain",
"totalRefused": "Bị từ chối",
"totalQueries": "Queries",
"totalNoError": "Success",
"totalServerFailure": "Failures",
"totalNxDomain": "NX Domains",
"totalRefused": "Refused",
"totalAuthoritative": "Authoritative",
"totalRecursive": "Recursive",
"totalCached": "Được lưu trong bộ nhớ đệm",
"totalBlocked": "Bị chặn",
"totalDropped": "Bị loại bỏ",
"totalClients": "Số máy khách"
"totalCached": "Cached",
"totalBlocked": "Blocked",
"totalDropped": "Dropped",
"totalClients": "Clients"
},
"tdarr": {
"queue": "Hàng đợi",
"queue": "Queue",
"processed": "Processed",
"errored": "Errored",
"saved": "Saved"
@@ -412,7 +412,7 @@
"unknown": "Unknown"
},
"navidrome": {
"nothing_streaming": "Không có luồng đang hoạt động",
"nothing_streaming": "No Active Streams",
"please_wait": "Please Wait"
},
"npm": {
@@ -455,9 +455,9 @@
"domain_count": "Domains"
},
"medusa": {
"wanted": "Cần tải",
"wanted": "Wanted",
"queued": "Queued",
"series": "Phim bộ"
"series": "Series"
},
"minecraft": {
"players": "Players",
@@ -474,66 +474,66 @@
"users": "Users",
"loginsLast24H": "Logins (24h)",
"failedLoginsLast24H": "Failed Logins (24h)",
"authorizationsLast24H": "Lượt ủy quyền (24 giờ)"
"authorizationsLast24H": "Auths (24h)"
},
"proxmox": {
"mem": "Bộ nhớ",
"mem": "MEM",
"cpu": "CPU",
"lxc": "LXC",
"vms": "VM"
"vms": "VMs"
},
"pulse": {
"nodes": "Node",
"vms": "VM",
"lxcs": "LXC"
"nodes": "Nodes",
"vms": "VMs",
"lxcs": "LXCs"
},
"glances": {
"cpu": "CPU",
"load": "Tải hệ thống",
"wait": "Vui lòng đợi",
"temp": "Nhiệt độ",
"_temp": "Nhiệt độ",
"warn": "Cảnh báo",
"uptime": "Thời gian hoạt động",
"total": "Tổng cộng",
"free": "Còn trống",
"used": "Đã sử dụng",
"days": "ngày",
"hours": "giờ",
"crit": "Nghiêm trọng",
"read": "Đọc",
"write": "Ghi",
"load": "Load",
"wait": "Please wait",
"temp": "TEMP",
"_temp": "Temp",
"warn": "Warn",
"uptime": "UP",
"total": "Total",
"free": "Free",
"used": "Used",
"days": "d",
"hours": "h",
"crit": "Crit",
"read": "Read",
"write": "Write",
"gpu": "GPU",
"mem": "Bộ nhớ",
"mem": "Mem",
"swap": "Swap"
},
"quicklaunch": {
"bookmark": "Dấu trang",
"service": "Dịch vụ",
"search": "Tìm kiếm",
"custom": "Tùy chỉnh",
"visit": "Truy cập",
"bookmark": "Bookmark",
"service": "Service",
"search": "Search",
"custom": "Custom",
"visit": "Visit",
"url": "URL",
"searchsuggestion": "Gợi ý"
"searchsuggestion": "Suggestion"
},
"wmo": {
"0-day": "Trời nắng",
"0-night": "Trời quang",
"1-day": "Chủ yếu có nắng",
"1-night": "Chủ yếu trời quang",
"2-day": "Có mây từng phần",
"2-night": "Có mây từng phần",
"3-day": "Nhiều mây",
"3-night": "Nhiều mây",
"45-day": "Có sương mù",
"45-night": "Có sương mù",
"48-day": "Có sương mù",
"48-night": "Có sương mù",
"51-day": "Mưa phùn nhẹ",
"51-night": "Mưa phùn nhẹ",
"53-day": "Mưa phùn",
"53-night": "Mưa phùn",
"55-day": "Mưa phùn lớn",
"0-day": "Sunny",
"0-night": "Clear",
"1-day": "Mainly Sunny",
"1-night": "Mainly Clear",
"2-day": "Partly Cloudy",
"2-night": "Partly Cloudy",
"3-day": "Cloudy",
"3-night": "Cloudy",
"45-day": "Foggy",
"45-night": "Foggy",
"48-day": "Foggy",
"48-night": "Foggy",
"51-day": "Light Drizzle",
"51-night": "Light Drizzle",
"53-day": "Drizzle",
"53-night": "Drizzle",
"55-day": "Heavy Drizzle",
"55-night": "Heavy Drizzle",
"56-day": "Light Freezing Drizzle",
"56-night": "Light Freezing Drizzle",
@@ -741,14 +741,14 @@
"m": "m"
},
"atsumeru": {
"series": "Bộ truyện",
"series": "Series",
"archives": "Archives",
"chapters": "Chapters",
"categories": "Categories"
},
"komga": {
"libraries": "Libraries",
"series": "Bộ truyện",
"series": "Series",
"books": "Books"
},
"diskstation": {
@@ -761,9 +761,9 @@
"streams": "Streams"
},
"mylar": {
"series": "Phim bộ",
"series": "Series",
"issues": "Issues",
"wanted": "Cần tải"
"wanted": "Wanted"
},
"photoprism": {
"albums": "Albums",
@@ -846,7 +846,7 @@
"books": "Books",
"authors": "Authors",
"categories": "Categories",
"series": "Bộ sách"
"series": "Series"
},
"booklore": {
"libraries": "Libraries",
@@ -861,7 +861,7 @@
"downloadSpeed": "Speed"
},
"kavita": {
"seriesCount": "Số bộ truyện",
"seriesCount": "Series",
"totalFiles": "Files"
},
"azuredevops": {
@@ -1250,7 +1250,7 @@
"storage": "Storage"
},
"sportarr": {
"wanted": "Cần tải",
"wanted": "Wanted",
"queued": "Queued",
"leagues": "Leagues"
}
+2 -7
View File
@@ -4,19 +4,14 @@ import { useTranslation } from "next-i18next/pages";
import useWidgetAPI from "utils/proxy/use-widget-api";
const ALERTS_LIMIT = 500;
export default function Component({ service }) {
const { t } = useTranslation();
const { widget } = service;
const { data: alerts, error: alertsError } = useWidgetAPI(widget, "alerts");
const { data: alerts, error: alertsError } = useWidgetAPI(widget, !!widget.limit24h ? "alerts24h" : "alerts");
const { data: bans, error: bansError } = useWidgetAPI(widget, "bans");
const alertsCount = alerts?.length ?? 0;
const alertsValue = t("common.number", { value: alertsCount });
if (alertsError || bansError) {
return <Container service={service} error={alertsError ?? bansError} />;
}
@@ -32,7 +27,7 @@ export default function Component({ service }) {
return (
<Container service={service}>
<Block label="crowdsec.alerts" value={alertsCount >= ALERTS_LIMIT ? `${alertsValue}+` : alertsValue} />
<Block label="crowdsec.alerts" value={t("common.number", { value: alerts?.length ?? 0 })} />
<Block label="crowdsec.bans" value={t("common.number", { value: bans?.length ?? 0 })} />
</Container>
);
+3 -37
View File
@@ -17,25 +17,15 @@ describe("widgets/crowdsec/component", () => {
vi.clearAllMocks();
});
it("requests the alerts and bans endpoints", () => {
useWidgetAPI.mockImplementation(() => ({ data: undefined, error: undefined }));
renderWithProviders(<Component service={{ widget: { type: "crowdsec" } }} />, {
settings: { hideErrors: false },
});
expect(useWidgetAPI).toHaveBeenNthCalledWith(1, expect.any(Object), "alerts");
expect(useWidgetAPI).toHaveBeenNthCalledWith(2, expect.any(Object), "bans");
});
it("ignores the deprecated limit24h option", () => {
it("selects alerts24h endpoint when limit24h is enabled", () => {
useWidgetAPI.mockImplementation(() => ({ data: undefined, error: undefined }));
renderWithProviders(<Component service={{ widget: { type: "crowdsec", limit24h: true } }} />, {
settings: { hideErrors: false },
});
expect(useWidgetAPI).toHaveBeenNthCalledWith(1, expect.any(Object), "alerts");
expect(useWidgetAPI).toHaveBeenNthCalledWith(1, expect.any(Object), "alerts24h");
expect(useWidgetAPI).toHaveBeenNthCalledWith(2, expect.any(Object), "bans");
});
it("renders placeholders when both alerts and bans are missing", () => {
@@ -62,28 +52,4 @@ describe("widgets/crowdsec/component", () => {
expectBlockValue(container, "crowdsec.alerts", 0);
expectBlockValue(container, "crowdsec.bans", 0);
});
it("marks the alert count as truncated at the API limit", () => {
useWidgetAPI
.mockReturnValueOnce({ data: new Array(500).fill({}), error: undefined })
.mockReturnValueOnce({ data: [], error: undefined });
renderWithProviders(<Component service={{ widget: { type: "crowdsec" } }} />, {
settings: { hideErrors: false },
});
expect(screen.getByText("500+")).toBeInTheDocument();
});
it("does not mark the alert count below the API limit", () => {
useWidgetAPI
.mockReturnValueOnce({ data: new Array(499).fill({}), error: undefined })
.mockReturnValueOnce({ data: [], error: undefined });
const { container } = renderWithProviders(<Component service={{ widget: { type: "crowdsec" } }} />, {
settings: { hideErrors: false },
});
expectBlockValue(container, "crowdsec.alerts", 499);
});
});
+5 -2
View File
@@ -7,10 +7,13 @@ const widget = {
mappings: {
alerts: {
endpoint: "alerts?limit=500&since=24h&with_decisions=false&include_capi=false",
endpoint: "alerts",
},
alerts24h: {
endpoint: "alerts?limit=0&since=24h",
},
bans: {
endpoint: "alerts?decision_type=ban&include_capi=false&has_active_decision=1&with_decisions=false",
endpoint: "alerts?decision_type=ban&origin=crowdsec&has_active_decision=1",
},
},
};