harnery 0.15.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -47,13 +47,19 @@ const server = Bun.serve<WsData, never>({
47
47
  // Bun's max, and beyond any realistic single-turn delay.
48
48
  idleTimeout: 255,
49
49
  async fetch(req, server) {
50
+ const url = new URL(req.url);
50
51
  if (ACCESS === "cloudflare-allowlist") {
51
52
  const ip = req.headers.get("cf-connecting-ip") ?? "";
52
53
  if (!ALLOW.has(ip)) {
54
+ // Log denials so operators can whitelist a phone/laptop that just
55
+ // hit 403 without asking the human to dig up their public IP.
56
+ console.log(
57
+ // lint-ok-emission: detached worker, see file note above
58
+ `deny: ${ip || "(missing-cf-connecting-ip)"} ${req.method} ${url.pathname}`,
59
+ );
53
60
  return new Response("403 Forbidden\n", { status: 403 });
54
61
  }
55
62
  }
56
- const url = new URL(req.url);
57
63
 
58
64
  if (req.headers.get("upgrade")?.toLowerCase() === "websocket") {
59
65
  if (server.upgrade(req, { data: { path: url.pathname + url.search } })) {