aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-01-27 10:47:57 -0800
committerAdam Soltys <[email protected]>2026-01-27 10:47:57 -0800
commit685d085596a1a20d2b5680cf8000313173bbe6fd (patch)
tree314e0563a932e2f15f407d125b955a6620642da5 /src
parent4a752a834b349b4aa8841cc5b3cab09854a5dca3 (diff)
downloadcoinos-ui-685d085596a1a20d2b5680cf8000313173bbe6fd.tar.gz
coinos-ui-685d085596a1a20d2b5680cf8000313173bbe6fd.zip
fix import
Diffstat (limited to 'src')
-rw-r--r--src/hooks.server.ts3
-rw-r--r--src/lib/utils.ts13
2 files changed, 9 insertions, 7 deletions
diff --git a/src/hooks.server.ts b/src/hooks.server.ts
index 3dd9913a..bd9bbc01 100644
--- a/src/hooks.server.ts
+++ b/src/hooks.server.ts
@@ -1,6 +1,9 @@
import { ipStore } from "$lib/server/ip";
+import { setIpGetter } from "$lib/utils";
import type { Handle } from "@sveltejs/kit";
+setIpGetter(() => ipStore.getStore());
+
export const handle: Handle = async ({ event, resolve }) => {
const ip =
event.request.headers.get("cf-connecting-ip") ||
diff --git a/src/lib/utils.ts b/src/lib/utils.ts
index 1b2bdfba..b981a4d4 100644
--- a/src/lib/utils.ts
+++ b/src/lib/utils.ts
@@ -21,15 +21,14 @@ export function scroll(section: any) {
const base = browser ? "" : PUBLIC_COINOS_URL;
-let ipStore: any;
-if (!browser) {
- import("$lib/server/ip").then((m) => {
- ipStore = m.ipStore;
- });
-}
+let getIp: (() => string | undefined) | undefined;
+
+export const setIpGetter = (fn: () => string | undefined) => {
+ getIp = fn;
+};
const ipHeaders = (): Record<string, string> => {
- const ip = ipStore?.getStore();
+ const ip = getIp?.();
return ip ? { "cf-connecting-ip": ip } : {};
};