add splitbee analytics
This commit is contained in:
parent
740b59f389
commit
c48bf58784
@ -136,6 +136,7 @@ const Document: FunctionComponent<PropsWithChildren<{}>> = ({ children }) => (
|
|||||||
<body className="h-full">
|
<body className="h-full">
|
||||||
{children}
|
{children}
|
||||||
<ScrollRestoration />
|
<ScrollRestoration />
|
||||||
|
<script async data-api="/_hive" src="/bee.js" />
|
||||||
<Scripts />
|
<Scripts />
|
||||||
<LiveReload />
|
<LiveReload />
|
||||||
</body>
|
</body>
|
||||||
|
14
app/routes/_hive.$.ts
Normal file
14
app/routes/_hive.$.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import type { ActionFunction } from "remix";
|
||||||
|
|
||||||
|
async function proxyHive(request: Request) {
|
||||||
|
const url = new URL(request.url);
|
||||||
|
const req = new Request("https://hive.splitbee.io" + url.pathname.replace("/_hive", ""), {
|
||||||
|
...request,
|
||||||
|
signal: null,
|
||||||
|
});
|
||||||
|
req.headers.set("x-country", request.headers.get("cf-ipcountry")!);
|
||||||
|
req.headers.set("x-real-ip", request.headers.get("x-real-ip")!);
|
||||||
|
return fetch(req);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const action: ActionFunction = ({ request }) => proxyHive(request);
|
3
app/routes/bee[.]js.ts
Normal file
3
app/routes/bee[.]js.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import type { LoaderFunction } from "remix";
|
||||||
|
|
||||||
|
export const loader: LoaderFunction = () => fetch("https://cdn.splitbee.io/sb.js");
|
Loading…
Reference in New Issue
Block a user