feat(mcp): подготовить сервер и доступ к приёмке

This commit is contained in:
Denozordec committed 2026-11-03 03:12:03 +07:00
commit bf3d50e1ff
3835 files changed
+537122

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
/** Limited to API paths consumed by useDashboardLive; matches backend request gates. */
export function dashboardRequestPermission(method:string,path:string):string{
const pathname=path.split("?")[0],write=method.toUpperCase()!=="GET"
if(pathname.startsWith("/api/servers"))return write?"mm:servers:write":"mm:servers:read"
if(pathname.startsWith("/api/uptime"))return write?"mm:uptime:write":"mm:uptime:read"
if(pathname.startsWith("/api/filters"))return write?"mm:filters:write":"mm:filters:read"
if(pathname.startsWith("/api/bgp"))return write?"mm:bgp:write":"mm:bgp:read"
if(pathname.startsWith("/api/traffic"))return write?"mm:traffic:write":"mm:traffic:read"
if(pathname.startsWith("/api/internet-path")||pathname.startsWith("/api/wireguard"))return write?"mm:network:write":"mm:network:read"
if(!write&&(pathname==="/api/vxlan"||pathname.startsWith("/api/events")))return "mm:dashboard:read"
throw Error("Неизвестный источник дашборда")
}