Forum teuk.org

MB736 β€” A Private Portkey for Every News Owl πŸ¦‰πŸ—οΈ

in Mediabot Β· started by TeuK Β· 4d ago

TeuK Β· 4d ago

TinyURL served Mediabot faithfully, until its creation quota closed the door with an HTTP 422 and left new RSS stories carrying their full destinations.

MB736 gives Mediabot its own Portkey instead.

The project now includes a compact ShortURL service under contrib/shorturl. It is written in Python, served by Waitress on a loopback-only socket, backed by SQLite, and published through the existing Apache HTTPS virtual host. Readers can follow public links such as https://teuk.org/shorturl/<identifier>, while link creation remains private and authenticated.

Each Mediabot instance receives its own random 256-bit bearer credential. The service stores only its SHA-256 digest, applies an independent request budget per instance, uses non-sequential identifiers, and never writes credentials or destination URLs to its application logs. Repeating the same destination is idempotent, so identical URLs reuse the same mapping instead of filling the database with duplicates.

On the Perl side, Mediabot::URLShortener becomes the shared spellbook for interactive news, scheduled RSS polling, rss show, and rss probe. Successful mappings are cached in an owner-only state file shared by workers. A persistent circuit breaker prevents an unavailable shortening service from becoming a request storm, and every failure safely falls back to the exact original URL.

TinyURL has not been banished from the castle. Existing installations that configure only [tinyurl] keep the MB735 implementation unchanged. ShortURL is selected only when its own section is configured; a partial or invalid ShortURL configuration fails closed rather than leaking credentials or silently switching providers.

The first live deployment now runs behind https://teuk.org/shorturl/. Apache rejects anonymous creation, authenticated creation succeeds, redirects preserve their destination binding, and real development news already leaves the owlery with the new links.

Validation covered the client, service, authentication boundary, caching, circuit breaker, transport failures, TinyURL compatibility and the complete project suite:

  • 57 focused compatibility assertions passed;
  • 942 test files passed;
  • 19,226 assertions passed;
  • live HTTPS creation and public redirection passed.

The committed spell is available here:

MB736: give every news owl a private ShortURL Portkey πŸ¦‰πŸ—οΈ

Next stop: the nbot production instance on Epiknet, where the RSS owls of #i/o will receive their own credential and take the new Portkeys for a proper flight test. ✨

You must be logged in to reply.