Skip to content

Commit

Permalink
api: gate: add playurl to logs (#2133)
Browse files Browse the repository at this point in the history
  • Loading branch information
gioelecerati authored Apr 16, 2024
1 parent 0ed60af commit a9aca49
Showing 1 changed file with 33 additions and 15 deletions.
48 changes: 33 additions & 15 deletions packages/api/src/controllers/access-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,22 +116,40 @@ async function fireGateWebhook(
);
}
if ("pull" in content && content.pull) {
let referer: string, origin: string;
if (payload?.webhookPayload?.headers) {
referer = payload?.webhookPayload?.headers["Referer"];
origin = payload?.webhookPayload?.headers["Origin"];
try {
let referer: string, origin: string;
if (payload?.webhookPayload?.headers) {
referer = payload?.webhookPayload?.headers["Referer"];
origin = payload?.webhookPayload?.headers["Origin"];
}
let playURL = payload?.webhookPayload?.playURL;
let playDomain = payload?.webhookPayload?.playDomain;
console.log(
`access-control: gate: webhook=${
webhook.id
} statusCode=${statusCode} respSpanId=${resp?.headers.get(
"X-Tlive-Spanid"
)} respBody=${Buffer.from(respBody).toString("base64")} duration=${
process.hrtime(startTime)[1] / 1e6
}ms accessKey=${payload.accessKey} playbackId=${
content.playbackId
} webhook=${
webhook.id
} referer=${referer} origin=${origin} playURL=${playURL} playDomain=${playDomain}`
);
} catch (e) {
console.log(
`access-control: gate: webhook=${
webhook.id
} statusCode=${statusCode} respSpanId=${resp?.headers.get(
"X-Tlive-Spanid"
)} respBody=${Buffer.from(respBody).toString("base64")} duration=${
process.hrtime(startTime)[1] / 1e6
}ms accessKey=${payload.accessKey} playbackId=${
content.playbackId
} webhook=${webhook.id}`
);
}
console.log(
`access-control: gate: webhook=${
webhook.id
} statusCode=${statusCode} respSpanId=${resp?.headers.get(
"X-Tlive-Spanid"
)} respBody=${Buffer.from(respBody).toString("base64")} duration=${
process.hrtime(startTime)[1] / 1e6
}ms accessKey=${payload.accessKey} playbackId=${
content.playbackId
} webhook=${webhook.id} referer=${referer} origin=${origin}`
);
} else {
console.log(
`access-control: gate: webhook=${
Expand Down

0 comments on commit a9aca49

Please sign in to comment.