Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nixamp",
"version": "0.80.4",
"version": "0.80.5",
"description": "It really whips the terminal's ass. A Winamp-shaped audio player for your terminal.",
"license": "MIT",
"type": "module",
Expand Down
7 changes: 6 additions & 1 deletion test/paywall.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,12 @@ test("the crawl door is off without a key and a payee", () => {

test("the crawl door charges GPTBot with a PAYMENT-REQUIRED header", async () => {
const gate = createCrawlGate(CRAWL_ENV)!;
const answer = await gate.handle(new Request("http://localhost/", { headers: { "user-agent": GPTBOT, accept: "application/json" } }));
// x402-gateway gives a training crawler 100 free requests a minute per address to evaluate the site; past them it pays.
const ask = () => gate.handle(new Request("http://localhost/music", { headers: { "user-agent": GPTBOT, accept: "application/json", "x-real-ip": "203.0.113.7" } }));
let answer = await ask();
let free = 0;
for (; free < 200 && !answer; free++) answer = await ask();
assert.ok(free >= 1, "the first look is free");
assert.equal(answer?.status, 402);
assert.ok(answer?.headers.get("payment-required"));
});
Expand Down
Loading