- Fix integration data cache: check pending promise before TTL to prevent returning undefined on concurrent cold-cache access - Add concurrent-miss test (two parallel callers, one fetch) - SVG sanitizer: extract <svg> from DOMPurify output to strip residual HTML wrapper - Narrow safeRevalidateTag catch: log unexpected errors, silence only known "outside request scope" messages - Run oxfmt across all packages (206 files formatted)
27 lines
1.0 KiB
TypeScript
27 lines
1.0 KiB
TypeScript
import { tracearrRequestHandler } from "@homarr/request-handler/tracearr";
|
|
|
|
import { createManyIntegrationMiddleware } from "../../middlewares/integration";
|
|
import { integrationQueryKey, settleIntegrationQueries } from "../../settle-integrations";
|
|
import { createTRPCRouter, publicProcedure } from "../../trpc";
|
|
|
|
export const tracearrRouter = createTRPCRouter({
|
|
getDashboard: publicProcedure.concat(createManyIntegrationMiddleware("query", "tracearr")).query(async ({ ctx }) => {
|
|
return await settleIntegrationQueries(
|
|
ctx.integrations,
|
|
async (integration) => {
|
|
const innerHandler = tracearrRequestHandler.handler(integration, {});
|
|
const { data, timestamp } = await innerHandler.getDataAsync();
|
|
|
|
return {
|
|
integrationId: integration.id,
|
|
integrationName: integration.name,
|
|
integrationUrl: integration.url,
|
|
dashboard: data,
|
|
updatedAt: timestamp,
|
|
};
|
|
},
|
|
{ queryKey: integrationQueryKey("tracearr", "getDashboard") },
|
|
);
|
|
}),
|
|
});
|