Skip to content

fix(paste): switch from dpaste to rentry.co#253

Merged
spalen0 merged 1 commit into
mainfrom
fix/paste-use-rentry
May 29, 2026
Merged

fix(paste): switch from dpaste to rentry.co#253
spalen0 merged 1 commit into
mainfrom
fix/paste-use-rentry

Conversation

@spalen0
Copy link
Copy Markdown
Collaborator

@spalen0 spalen0 commented May 29, 2026

Problem

dpaste.com started returning 400 Bad Request:

WARNING utils.paste: Failed to upload to paste service: 400 Client Error: Bad Request for url: https://dpaste.com/api/

That paste link carries the AI explanation's full detail from Telegram alerts, so it needs a reliable, markdown-rendering host.

Change

  • utils/paste.py now uploads to rentry.co (markdown paste service). The flow: prime the csrftoken cookie with a GET, then POST text + matching csrfmiddlewaretoken with a Referer header; the URL comes back in the JSON body.
    • title is prepended as a top-level markdown heading (rentry has no separate title field).
    • Dropped the unused expiry_days param (the only caller never passed it; rentry has no anonymous-API expiry control).
  • ai_explainer.format_explanation_line: on upload failure, append ⚠️ Couldn't post full report instead of silently dropping the link.

Verified live

Real upload succeeded and the rendered page returns 200 with our markdown:

  • POST → https://rentry.co/<id>
  • GET of that page contains the heading + body (markdown rendered)

(Note: rentry's /raw endpoint now requires an access code, but we link the normal rendered page, which is unaffected.)

Testing

  • tests/test_paste.py rewritten for the CSRF flow: success, no-title, missing-csrftoken, non-200 status, request failure.
  • tests/test_ai_explainer.py: updated paste URL + asserts the failure notice.
  • 72 passed. ruff clean.

🤖 Generated with Claude Code

dpaste.com started returning 400s. Move upload_to_paste to rentry.co, a
markdown-rendering paste service: prime the csrftoken cookie, then POST the
content with the matching csrfmiddlewaretoken and a Referer header. Title is
prepended as a markdown heading; the dropped expiry_days param wasn't used
by the only caller.

When the upload fails, the AI explanation now appends "⚠️ Couldn't post
full report" instead of silently omitting the link.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@spalen0 spalen0 marked this pull request as ready for review May 29, 2026 10:47
@spalen0 spalen0 merged commit e4dfba0 into main May 29, 2026
2 checks passed
@spalen0 spalen0 deleted the fix/paste-use-rentry branch May 29, 2026 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant