clean up
This commit is contained in:
@@ -14,54 +14,6 @@ export async function postEvent(
|
|||||||
}>,
|
}>,
|
||||||
reply: FastifyReply
|
reply: FastifyReply
|
||||||
) {
|
) {
|
||||||
if (process.env.TEST_SELF_HOSTING) {
|
|
||||||
try {
|
|
||||||
const ip = getClientIp(request)!;
|
|
||||||
const headers: HeadersInit = {
|
|
||||||
origin: request.headers.origin!,
|
|
||||||
'user-agent': request.headers['user-agent']!,
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
};
|
|
||||||
|
|
||||||
if (ip) {
|
|
||||||
headers['X-Forwarded-For'] = ip;
|
|
||||||
headers['x-real-ip'] = ip;
|
|
||||||
headers['x-client-ip'] = ip;
|
|
||||||
headers['CF-Connecting-IP'] = ip;
|
|
||||||
headers.Forwarded = 'for=' + ip;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (request.headers['mixan-client-id']) {
|
|
||||||
headers['openpanel-client-id'] = request.headers[
|
|
||||||
'mixan-client-id'
|
|
||||||
] as string;
|
|
||||||
if (request.headers['mixan-client-secret']) {
|
|
||||||
headers['openpanel-client-secret'] = request.headers[
|
|
||||||
'mixan-client-secret'
|
|
||||||
] as string;
|
|
||||||
}
|
|
||||||
} else if (request.headers['openpanel-client-id']) {
|
|
||||||
headers['openpanel-client-id'] = request.headers[
|
|
||||||
'openpanel-client-id'
|
|
||||||
] as string;
|
|
||||||
if (request.headers['openpanel-client-secret']) {
|
|
||||||
headers['openpanel-client-secret'] = request.headers[
|
|
||||||
'openpanel-client-secret'
|
|
||||||
] as string;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Test batching on a different service
|
|
||||||
await fetch('https://op.coderax.se/api/event', {
|
|
||||||
headers,
|
|
||||||
method: 'POST',
|
|
||||||
body: JSON.stringify(request.body),
|
|
||||||
})
|
|
||||||
.then((res) => res.json())
|
|
||||||
.catch((res) => res);
|
|
||||||
} catch (e) {
|
|
||||||
logger.error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const ip = getClientIp(request)!;
|
const ip = getClientIp(request)!;
|
||||||
const ua = request.headers['user-agent']!;
|
const ua = request.headers['user-agent']!;
|
||||||
const projectId = request.client?.projectId;
|
const projectId = request.client?.projectId;
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ function AllProviders({ children }: { children: React.ReactNode }) {
|
|||||||
>
|
>
|
||||||
{process.env.NEXT_PUBLIC_OP_CLIENT_ID && (
|
{process.env.NEXT_PUBLIC_OP_CLIENT_ID && (
|
||||||
<OpenpanelProvider
|
<OpenpanelProvider
|
||||||
url="https://op.coderax.se/api"
|
|
||||||
clientId={process.env.NEXT_PUBLIC_OP_CLIENT_ID}
|
clientId={process.env.NEXT_PUBLIC_OP_CLIENT_ID}
|
||||||
profileId={userId || undefined}
|
profileId={userId || undefined}
|
||||||
trackScreenViews
|
trackScreenViews
|
||||||
|
|||||||
Reference in New Issue
Block a user