feat(http): add proxy support (#4721)

This commit is contained in:
Meier Lukas
2025-12-25 11:32:14 +01:00
committed by GitHub
parent 707a4dad83
commit 5a57115ca0
10 changed files with 52 additions and 30 deletions

View File

@@ -1,6 +1,7 @@
import { z } from "zod/v4";
import { fetchWithTimeoutAsync } from "@homarr/core/infrastructure/http/timeout";
import { fetchWithTrustedCertificatesAsync } from "@homarr/core/infrastructure/http";
import { withTimeoutAsync } from "@homarr/core/infrastructure/http/timeout";
import { createTRPCRouter, publicProcedure } from "../trpc";
@@ -36,7 +37,12 @@ export const locationRouter = createTRPCRouter({
.input(locationSearchCityInput)
.output(locationSearchCityOutput)
.query(async ({ input }) => {
const res = await fetchWithTimeoutAsync(`https://geocoding-api.open-meteo.com/v1/search?name=${input.query}`);
const res = await withTimeoutAsync(async (signal) => {
return await fetchWithTrustedCertificatesAsync(
`https://geocoding-api.open-meteo.com/v1/search?name=${input.query}`,
{ signal },
);
});
return (await res.json()) as z.infer<typeof locationSearchCityOutput>;
}),
});