games: the door you can see from outside, and the picture on it
We never had Open Graph on the casino, and adding meta tags would not have fixed it. Every route was behind requirePlayer, so a link pasted into a chat window got a 302 to sign-in and unfurled as whatever the auth screen said: "parodia.dev", no image, no description. Tags on a page a stranger cannot fetch are tags nobody reads. So the casino now has a front door — a real page, served to anybody, that says what the place is and offers a way in. You still can't play from it, and every table still bounces you to sign-in. The share card is drawn in Go rather than checked in as a picture, because the casino has two names on a clock and the card keeps the joke: paste the link in daylight and you get Casinopolis on green felt, paste it after six and the neon is on and it says Casino Night Zone. Same roomAt() rule as everywhere else, except the clock that decides is the server's — an unfurl bot has no evening of its own. Both cards are drawn once, at first ask, and kept. Two things worth keeping from building it. color.RGBA is alpha-premultiplied, and the lamp over the table wrote raw channels next to a low alpha, which is not a dim glow but an invalid colour: image/draw ran it past 255 and wrapped the hue, and the first card came out with a blue dome over a green stripe. If a colour here ever comes out impossible, look for a missing premultiply. And og:image has to be an absolute URL that actually resolves, which is two different addresses depending on how you arrived: /og.png on the games host (hostRouter puts the /games back on) and /games/og.png anywhere else. The dev rig advertised the first while serving only the second. The test now reads the URL off the page and goes and fetches it, on both hosts, because an og:image that 404s is worth exactly as much as no og:image. Fredoka is vendored (OFL) — the page can reach for a font over the network and a server drawing a PNG cannot. Claude-Session: https://claude.ai/code/session_013M5nD7PgUboJXoDcYHzpuJ
This commit is contained in:
@@ -5,6 +5,23 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{{block "title" .}}{{.Room.Name}}{{end}}</title>
|
||||
<meta name="robots" content="noindex">
|
||||
|
||||
{{/* What the casino looks like when somebody pastes it into a chat window.
|
||||
noindex keeps it out of a search engine and does not keep it out of a link
|
||||
preview: those are two different bots and only one of them is reading this.
|
||||
The image is drawn by games_og.go and follows the clock, so a link shared
|
||||
after six unfurls with the neon on. */}}
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:site_name" content="{{.Room.Name}}">
|
||||
<meta property="og:title" content="{{block "og_title" .}}{{.Room.Name}}{{end}}">
|
||||
<meta property="og:description" content="{{block "og_desc" .}}Blackjack, hold'em, UNO, trivia, hangman and solitaire, played for real gogobee euros. Sign in and pull up a chair.{{end}}">
|
||||
<meta property="og:url" content="{{.URL}}">
|
||||
<meta property="og:image" content="{{.OGImage}}">
|
||||
<meta property="og:image:width" content="1200">
|
||||
<meta property="og:image:height" content="630">
|
||||
<meta property="og:image:alt" content="{{.Room.Name}}: two cards and a stack of chips on the felt.">
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="description" content="Blackjack, hold'em, UNO, trivia, hangman and solitaire, played for real gogobee euros.">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Nunito:wght@400;600;700&display=swap" rel="stylesheet">
|
||||
@@ -61,6 +78,12 @@
|
||||
<span class="grid h-6 w-6 place-items-center rounded-full bg-[color:var(--accent)] text-xs font-bold text-[#20180c]">{{.User.Initial}}</span>
|
||||
<span class="hidden sm:inline max-w-[7rem] truncate">{{.User.Display}}</span>
|
||||
</a>
|
||||
{{else}}
|
||||
{{/* Nobody is signed in, which on any page but the front door can't happen. */}}
|
||||
<a href="/auth/login?next=/games"
|
||||
class="inline-flex shrink-0 items-center rounded-full bg-[color:var(--accent)] px-4 py-1.5 text-sm font-bold text-[#20180c] shadow-pete hover:-translate-y-0.5 transition">
|
||||
Sign in
|
||||
</a>
|
||||
{{end}}
|
||||
</div>
|
||||
</header>
|
||||
|
||||
Reference in New Issue
Block a user