Skip to content

feat(podman-transmission): IP blocklist, magnet handler, awk session ID fix#80

Merged
smartwatermelon merged 6 commits intomainfrom
claude/feature-blocklist-magnet-handler-1773169260
Mar 10, 2026
Merged

feat(podman-transmission): IP blocklist, magnet handler, awk session ID fix#80
smartwatermelon merged 6 commits intomainfrom
claude/feature-blocklist-magnet-handler-1773169260

Conversation

@smartwatermelon
Copy link
Copy Markdown
Owner

Summary

  • IP blocklist: Added TRANSMISSION_BLOCKLIST_ENABLED=true + TRANSMISSION_BLOCKLIST_URL to compose.yml. haugene maps these directly to Transmission's settings.json at container start.
  • macOS magnet handler: Added Section 12 to podman-transmission-setup.sh — deploys transmission-add-magnet.sh (curl-based Transmission RPC client with session token handling), compiles TransmissionMagnetHandler.app via osacompile, injects bundle ID + URL scheme via PlistBuddy, registers with lsregister + defaults write LSHandlers.
  • awk session ID fix: The Transmission 409 response body HTML repeats the session ID in a <code> tag, causing the awk pattern to match twice and produce a two-line SESSION_ID. Fixed by anchoring to ^ and adding exit after the first match. Found during live testing — helper script exited 0 but torrent wasn't actually added.
  • Completion plan: Added docs/plans/2026-03-10-containerized-transmission-completion.md with 7 tasks covering remaining Phase 1 validation and Phase 2 cutover.

Test plan

  • shellcheck clean on podman-transmission-setup.sh
  • transmission-add-magnet.sh deployed to TILSIT and tested live — {"result":"success"} confirmed
  • Debian test torrent added via RPC and visible in web UI
  • Blocklist: apply to running container per Task 2 in completion plan
  • Magnet handler OS dispatch: complete per Task 3 in completion plan

🤖 Generated with Claude Code

Claude Code Bot and others added 3 commits March 10, 2026 12:06
Adds two features to the containerized Transmission stack that were
present in the native transmission-setup.sh but missing from the
podman setup:

1. IP blocklist (compose.yml): TRANSMISSION_BLOCKLIST_ENABLED + URL
   pointing to BT_BlockLists feed. haugene maps these directly to
   settings.json at container start.

2. macOS magnet handler (podman-transmission-setup.sh, Section 12):
   - Deploys ~/.local/bin/transmission-add-magnet.sh — a curl-based
     RPC client that fetches the CSRF session token, then POSTs the
     magnet URL to the Transmission JSON-RPC endpoint (host port
     baked in at deploy time)
   - Compiles TransmissionMagnetHandler.app via osacompile with an
     AppleScript open-URL handler that calls the shell helper
   - Injects CFBundleIdentifier + CFBundleURLTypes via PlistBuddy
   - Registers with lsregister and sets defaults LSHandlers

Both changes are idempotent; the setup script can be re-run safely.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The 409 response body HTML contains a duplicate of the session ID
in a <code> tag, causing the awk pattern to match twice and produce
a two-line SESSION_ID. Anchor to ^ (start of line) so the body line
(which starts with <code>) doesn't match, and exit after the first
match.

Found during live testing: helper script exited 0 but torrent wasn't
added because curl received a malformed X-Transmission-Session-Id header.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
7-task plan covering: PR merge, blocklist application, magnet handler
OS wiring, kill switch test, port forwarding verification, trigger-watcher
end-to-end, and Phase 2 cutover.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread app-setup/podman-transmission-setup.sh Outdated
Comment thread app-setup/podman-transmission-setup.sh Outdated
Claude Code Bot and others added 2 commits March 10, 2026 13:04
Convert all **Step N:** bold-as-heading patterns to actual h3 headings
to satisfy the CI markdownlint MD036 rule.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Check RPC response before notifying (HIGH): capture curl output into
  $RESPONSE; only show success notification if result=="success",
  otherwise show error notification and exit 1. Fixes false positive
  feedback when Transmission rejects the magnet (duplicate, invalid, etc.)

- Guard LSHandlers -array-add (MEDIUM): check if bundle ID already
  present via 'defaults read | grep -q' before -array-add. Re-runs
  no longer accumulate duplicate LSHandlers entries.

Both fixes applied to the deployed TILSIT helper script as well.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread app-setup/podman-transmission-setup.sh
…cript

${MAGNET_HELPER} is baked in at setup time but may contain spaces if
OPERATOR_USERNAME has them. Wrap with AppleScript's 'quoted form of'
so the shell receives the path single-quoted at runtime.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@smartwatermelon smartwatermelon merged commit 1801d43 into main Mar 10, 2026
20 checks passed
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