fix(weather): handle disabled external connections (#6780)

This commit is contained in:
Thomas authored and GitHub committed 2026-09-06 15:35:06 +02:00
1 parent 50a3bcce69
commit 724dee55c5
5 files changed
+20 -6

No files matched your search

+3
View File
@@ -1,5 +1,6 @@
import { z } from "zod/v4";
import { env } from "@homarr/common/env";
import { fetchWithTrustedCertificatesAsync } from "@homarr/core/infrastructure/http";
import { withTimeoutAsync } from "@homarr/core/infrastructure/http/timeout";
@@ -37,6 +38,8 @@ export const locationRouter = createTRPCRouter({
.input(locationSearchCityInput)
.output(locationSearchCityOutput)
.query(async ({ input }) => {
if (env.NO_EXTERNAL_CONNECTION) return { results: [] };
const url = new URL("https://geocoding-api.open-meteo.com/v1/search");
url.searchParams.set("name", input.query);
const res = await withTimeoutAsync(async (signal) => {