What it is
The write side of discord.sh’s topsite. POST /api/v1/ballot/vote takes
{listing_id, captcha_token} from a signed-in visitor: the Bearer token is
verified against Supabase Auth through jedi::jwt_cache, the captcha against
hCaptcha, and the vote is cast as that user through
discordsh.service_cast_vote. The 12-hour cooldown per listing, the 50-a-day
cap and the listing’s status are enforced there, in Postgres, so they hold
whoever calls it.
It runs apart from the discord.sh site so the service_role key and the
hCaptcha secret live in this pod only; the page renderer reads what anon may.
A session cookie is not accepted — only a Bearer header — so another site’s
form cannot vote in a visitor’s name. A missing upstream answers 503 rather
than letting a vote through unchecked.
What else it serves
Every rule lives in a discordsh.service_* function; this service checks
shapes, takes the caller from the verified token and passes the database’s
answer back. Under /api/v1/ballot:
- Listings — search and sort, tags, a listing’s page, stats and an SVG badge; reviews and replies, reports, favorites, vote reminders, bumps.
- Servers — submitting a guild (captcha on create, not on edit), picked from the visitor’s own Discord guilds, and verifying it through the discordsh bot.
- Bots — a new bot waits on staff, since Discord tells no one who owns an application; the bot posts its own stats with its listing secret.
- Vote webhooks — a listing’s hook is called after the vote is answered, https to a public address only.
- Vanity names —
discord.sh/<name>: long names free, short ones rented, renewable and tradeable. - Staff — a review queue, listing and review status, features, and vanity grants and reclaims.
Background loops re-check the invites read longest ago, DM due vote reminders, and settle, lapse and release vanity names.
Discuss on the forum
Questions, fixes and notes on this page live in the KBVE forum.