From 2ce31bfbaeb21e72748db37485a2ab564edf8c90 Mon Sep 17 00:00:00 2001 From: David Arutyunyan Date: Wed, 4 Mar 2026 13:51:07 +0300 Subject: [PATCH 1/2] fix(amp): show credits in overview for credits-only users --- docs/providers/amp.md | 2 +- plugins/amp/plugin.json | 2 +- plugins/amp/plugin.test.js | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/providers/amp.md b/docs/providers/amp.md index 9ce3ff56..416ce5b5 100644 --- a/docs/providers/amp.md +++ b/docs/providers/amp.md @@ -75,7 +75,7 @@ The plugin parses the display text with regex to extract: |------------|----------|-----------------------------|----------------------------------------| | Free | overview | Amp Free enabled | Dollar amount consumed as progress bar | | Bonus | detail | Amp Free + active promotion | Bonus percentage and duration | -| Credits | detail | Credits > $0 | Individual credits balance | +| Credits | overview | Credits > $0, or credits-only accounts | Individual credits balance | Progress line includes: - `resetsAt` — ISO timestamp of estimated full replenishment (null if nothing used or rate is zero) diff --git a/plugins/amp/plugin.json b/plugins/amp/plugin.json index 308a3c96..9f45f4de 100644 --- a/plugins/amp/plugin.json +++ b/plugins/amp/plugin.json @@ -9,6 +9,6 @@ "lines": [ { "type": "progress", "label": "Free", "scope": "overview", "primaryOrder": 1 }, { "type": "text", "label": "Bonus", "scope": "detail" }, - { "type": "text", "label": "Credits", "scope": "detail" } + { "type": "text", "label": "Credits", "scope": "overview" } ] } diff --git a/plugins/amp/plugin.test.js b/plugins/amp/plugin.test.js index 577b24ee..f4f8692e 100644 --- a/plugins/amp/plugin.test.js +++ b/plugins/amp/plugin.test.js @@ -305,6 +305,20 @@ describe("amp plugin", () => { expect(result.lines[0].value).toBe("$25.50") }) + it("parses credits-only text with top-up hint", async () => { + var ctx = makeCtx() + writeSecrets(ctx) + var text = "Signed in as david.arutyunyan@protonmail.com (waosdx)\n" + + "Individual credits: $5 remaining (set up automatic top-up to avoid running out) - https://ampcode.com/settings" + ctx.host.http.request.mockReturnValue(balanceResponse(text)) + var plugin = await loadPlugin() + var result = plugin.probe(ctx) + expect(result.plan).toBe("Credits") + expect(result.lines.length).toBe(1) + expect(result.lines[0].label).toBe("Credits") + expect(result.lines[0].value).toBe("$5.00") + }) + it("shows both free tier and credits when both present", async () => { var ctx = makeCtx() writeSecrets(ctx) From 0a3631bc52881c3fb83eefce1fa91b1cac709bb9 Mon Sep 17 00:00:00 2001 From: David Arutyunyan Date: Wed, 4 Mar 2026 13:57:09 +0300 Subject: [PATCH 2/2] test(amp): sanitize credits-only fixture identity --- plugins/amp/plugin.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/amp/plugin.test.js b/plugins/amp/plugin.test.js index f4f8692e..c0480fe6 100644 --- a/plugins/amp/plugin.test.js +++ b/plugins/amp/plugin.test.js @@ -308,7 +308,7 @@ describe("amp plugin", () => { it("parses credits-only text with top-up hint", async () => { var ctx = makeCtx() writeSecrets(ctx) - var text = "Signed in as david.arutyunyan@protonmail.com (waosdx)\n" + var text = "Signed in as person@example.com (exampleuser)\n" + "Individual credits: $5 remaining (set up automatic top-up to avoid running out) - https://ampcode.com/settings" ctx.host.http.request.mockReturnValue(balanceResponse(text)) var plugin = await loadPlugin()