dipper README.md
8.1 kB 175 lines
Markdown
at main

dipper #

A self-hosted, single static binary for reading (and later publishing) Lance's cross-protocol social presence: ActivityPub, AT Protocol, RSS/Atom, and GitHub, normalized into one feed you can browse in a terminal, query from an agent over MCP, and sync headlessly in the background.

Three surfaces, one core:

  • dipper interactive TUI (Bubble Tea) — browse by All/Posts/Blogs/Images/Videos/Code
  • dipper mcp Model Context Protocol stdio server — let any agent read/manage the perch
  • dipper daemon background sync loop (systemd-user friendly) — keeps the store fresh

Read/browse is fully working end-to-end. Publishing and replies are planned and deliberately deferred (see PLAN.md).

Quick start #

make                       # build ./dipper
./dipper sources add rss "Lobsters" '{"url":"https://lobste.rs/rss"}'
./dipper sources add rss "HN"       '{"url":"https://hnrss.org/frontpage"}'
./dipper sources add github "gh"    '{"owner":"lrvick"}'
./dipper sources add atproto "at"   '{"actor":"lance.dev"}'
./dipper sources add ap "lance"     '{"actor":"@lance@lance.dev"}'
./dipper sync                # ingest once
./dipper feed -n 20          # browse in your shell
./dipper                     # browse in the TUI

Data lives in SQLite at ~/.local/share/dipper/dipper.db (override with DIPPER_DB=/path/to.db). Connectors are pluggable; each source stores a small JSON config object validated against its connector type at add time.

Commands #

dipper                        open the TUI
dipper sync                   ingest new items from all enabled sources
dipper feed [-kind K] [-source ID] [-q QUERY] [-n N] [-json]
dipper item <id>              show one item (full body + media)
dipper sources [add|list|rm]  manage sources
dipper import <kind>          bulk-add sources from another tool: freetube | twitter | mastodon | follows
dipper daemon [-interval D]   background sync loop (or -once for cron)
dipper mcp                    run MCP stdio server
dipper version

Import your follow graph #

dipper import follows registers every account you follow on Bluesky (AT) and/or Mastodon (ActivityPub) as a source, so sync/daemon and the TUI ingest and display their posts alongside YouTube and RSS automatically.

dipper login ap lance   https://ap.lance.dev   # once, to read your Mastodon follows
dipper login at lance.dev                      # once (or rely on public graph reads)
dipper import follows -dry-run                # preview the plan, write nothing
dipper import follows                          # Bluesky + Mastodon follows -> sources
dipper import follows -proto at -limit 50      # Bluesky only, cap this run
dipper import follows -prune                   # also drop follows you unfollowed
dipper sync                                    # ingest them
dipper feed -q follows                         # or filter by the 'follows' tag in the TUI

Notes: source ids are deterministic (follows:atproto:<did>, follows:ap:<@user@host>) so re-running is idempotent and only picks up newly-followed accounts. Bluesky follow lists are read from a public appview (no token). The Mastodon account token is used only to enumerate your following list once; the stored sources are plain public per-actor reads that carry no secret, so unattended daemon sync needs no credentials.

TUI keys #

tab / l / right     next tab        shift+tab / h / left   prev tab
j / down  k / up    move            g / G                  top / bottom
r                   sync now        /                      search (enter=apply, esc=cancel)
t                   categories      c                      clear category filter
i                   invidious mirrors (add/delete/test)   P                  probe mirrors
enter               open detail     esc                    back / quit

On the Videos tab the list becomes a thumbnail card grid (2D hjkl/arrow navigation). Enter opens a full-width detail; there:

p                   play video in-terminal (yt-dlp + ffmpeg)
o                   open in browser   esc / back    back to grid

Media (thumbnails + in-terminal video) #

dipper draws images through the best backend the terminal supports, detected once at startup:

  1. Kitty graphics protocol — truecolor images, GPU-composited. Used by ghostty, kitty, wezterm, contour, konsole. (Your terminal: better than sixel.)
  2. Sixel — 24-bit DEC raster for foot, mlterm, xterm-sixel, mintty.
  3. Unicode half-blocks — truecolor ▀ cells; the universal fallback.

Video playback resolves a streamable URL with yt-dlp, decodes low-fps frames with ffmpeg, and paints each frame over the detail view. If ffmpeg is missing, p and o simply open the browser.

Getting past the "Sign in to confirm you're not a bot" gate #

YouTube bot-gates datacenter IPs (and yt-dlp can't get past it without a logged-in session). dipper has two independent workarounds:

1. Invidious mirrors (default, no account). When yt-dlp can't fetch a YouTube stream, dipper falls back to public Invidious instances: the mirror fetches the video with its own (residential) IP and proxies the bytes back, so your blocked IP never touches googlevideo. Instances are tried in order until one yields a playable stream. A curated list ships in the binary. Manage it either in-terminal (i on the Videos tab → add/delete/test mirrors) or on the CLI:

dipper invidious list
dipper invidious add https://invidious.example.org   # or https://user:pass@host
dipper invidious rm invidious.example.org
dipper invidious test        # probe each: status + latency

test reports three states, because "the mirror refused me" and "the mirror is gone" are different problems: live (usable from this machine), gated (the host is up and serving other users but blocks this IP/client — the same datacenter-IP gate YouTube uses, e.g. inv.nadeko.net disables its JSON API for server IPs while working fine from home), and down (nothing answered). Gated mirrors stay in the list on purpose: they may serve you from a different network, and a node can flip back to live at any time.

The list persists in the DB, so your edits survive upgrades. Private mirrors that require a login are entered with embedded Basic auth (https://user:pass@host); the password is never printed.

2. Browser cookies. To make direct yt-dlp work instead, reuse a logged-in browser session:

export DIPPER_YTDLP_COOKIES=~/.config/dipper/cookies.txt
export DIPPER_YTDLP_COOKIES_BROWSER=firefox   # or chrome/safari/edge

(~/.config/dipper/cookies.txt is picked up automatically if present.)

Connectors (read) #

type config notes
rss {"url":"https://..."} RSS/Atom/JSON via gofeed
github {"owner":"user","token":"optional","org":false} /events/public; normalizes push/PR/issue/release
atproto {"actor":"handle or did:plc:..","appview":".."} public appview (default https://public.api.bsky.app)
ap {"actor":"@user@host or url","limit":40} WebFinger → actor → outbox

Per-source failures are recorded and reported, never fatal to the whole sync. Note: secure-mode ActivityPub servers (including GoToSocial with authorized fetch) return 401 to unsigned outbox reads; the AP connector surfaces this as a non-fatal per-source error. Real fediverse servers sign their requests.

MCP tools #

dipper_list_sources, dipper_add_source, dipper_remove_source, dipper_sync, dipper_feed, dipper_get_item, dipper_search. Register dipper mcp with any MCP client; it shares the same SQLite store as the TUI/CLI.

Build #

Pure-Go SQLite (modernc.org/sqlite) so a fully static binary is possible:

make static      # CGO_ENABLED=0, trimpath, stripped, ~22MB self-contained

Some Charm deps pin a newer Go toolchain; the Makefile uses GOTOOLCHAIN=auto.