Docker images / prepare-release (push) Successful in 11s
Docker images / backend-image (push) Successful in 56s
Docker images / frontend-image (push) Successful in 3m6s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 49s
Docker images / publish-release (push) Successful in 16s
Co-authored-by: Cursor <[email protected]>
53 lines
1.6 KiB
TypeScript
53 lines
1.6 KiB
TypeScript
import type {
|
|
FlowStatsDto,
|
|
TrafficFlowHostFile,
|
|
TrafficFlowOverlayResult,
|
|
TrafficFlowSettingsDto,
|
|
TrafficFlowSettingsPatch,
|
|
} from "@mmapp/contracts/traffic-flow"
|
|
import { requestJson } from "@/shared/api/http-client"
|
|
|
|
export type { TrafficFlowHostFile }
|
|
|
|
export async function getTrafficFlowSettings(baseUrl: string): Promise<TrafficFlowSettingsDto> {
|
|
return requestJson<TrafficFlowSettingsDto>(baseUrl, "/api/traffic/flow/settings")
|
|
}
|
|
|
|
export async function putTrafficFlowSettings(
|
|
baseUrl: string,
|
|
patch: TrafficFlowSettingsPatch,
|
|
): Promise<{ ok: boolean; settings: TrafficFlowSettingsDto }> {
|
|
return requestJson(baseUrl, "/api/traffic/flow/settings", {
|
|
method: "PUT",
|
|
body: JSON.stringify(patch),
|
|
})
|
|
}
|
|
|
|
export async function generateTrafficFlowKeys(baseUrl: string): Promise<{
|
|
ok: boolean
|
|
created: boolean
|
|
publicKey: string
|
|
settings: TrafficFlowSettingsDto
|
|
}> {
|
|
return requestJson(baseUrl, "/api/traffic/flow/settings/generate-keys", { method: "POST" })
|
|
}
|
|
|
|
export async function getTrafficFlowHostFiles(baseUrl: string): Promise<{ files: TrafficFlowHostFile[] }> {
|
|
return requestJson(baseUrl, "/api/traffic/flow/host-files")
|
|
}
|
|
|
|
export async function applyTrafficFlowOverlay(
|
|
baseUrl: string,
|
|
serverId: string | number,
|
|
publicEndpoint?: string,
|
|
): Promise<TrafficFlowOverlayResult> {
|
|
return requestJson(baseUrl, "/api/traffic/flow-overlay", {
|
|
method: "POST",
|
|
body: JSON.stringify({ serverId, publicEndpoint }),
|
|
})
|
|
}
|
|
|
|
export async function getTrafficFlows(baseUrl: string, range = "5m"): Promise<FlowStatsDto> {
|
|
return requestJson<FlowStatsDto>(baseUrl, `/api/traffic/flows?range=${encodeURIComponent(range)}`)
|
|
}
|