Skip to content

Commit

Permalink
Log to handle leaches (#12)
Browse files Browse the repository at this point in the history
Co-authored-by: Jon Breen <[email protected]>
  • Loading branch information
cultpodcasts and cultpodcasts committed Mar 29, 2024
1 parent b1da770 commit 88a0214
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ export default {
.json()
.then(async (data: any) => {
let dataPoint: AnalyticsEngineDataPoint = { indexes: [], blobs: [] };
if (request.cf) {
dataPoint.blobs!.push(request.cf.clientTrustScoretr as string);
dataPoint.blobs!.push(request.cf.asn as string);
dataPoint.blobs!.push(request.headers.get('cf-connecting-ip') as string);
if (request.cf.city) {
dataPoint.blobs!.push(request.cf.city as string);
}
if (request.cf.country) {
dataPoint.blobs!.push(request.cf.country as string);
}
}
let requestBody = JSON.stringify(data);
let index: string = "";
if (data.search) {
Expand Down Expand Up @@ -92,16 +103,6 @@ export default {
dataPoint.blobs?.push(data.skip);
dataPoint.blobs?.push(data.orderby);
}
if (dataPoint) {
if (request.cf) {
if (request.cf.city) {
dataPoint.blobs?.push(request.cf.city as string);
}
if (request.cf.country) {
dataPoint.blobs?.push(request.cf.country as string);
}
}
}
let response = await fetch(url, {
cf: {
cacheEverything: true,
Expand Down

0 comments on commit 88a0214

Please sign in to comment.