diff --git a/keyserver/flow-typed/npm/@hono/node-server_vx.x.x.js b/keyserver/flow-typed/npm/@hono/node-server_vx.x.x.js --- a/keyserver/flow-typed/npm/@hono/node-server_vx.x.x.js +++ b/keyserver/flow-typed/npm/@hono/node-server_vx.x.x.js @@ -10,4 +10,8 @@ +port?: ?number, ... }) => mixed; + + declare export class HonoRequest { + param(): { +[key: string]: string }; + } } diff --git a/keyserver/flow-typed/npm/frog_v0.18.x.js b/keyserver/flow-typed/npm/frog_v0.18.x.js --- a/keyserver/flow-typed/npm/frog_v0.18.x.js +++ b/keyserver/flow-typed/npm/frog_v0.18.x.js @@ -3,7 +3,7 @@ declare module 'frog' { - import type { Fetch } from '@hono/node-server'; + import type { Fetch, HonoRequest } from '@hono/node-server'; declare type FrameResponse = { +image: React$Node, @@ -11,16 +11,21 @@ ... }; - declare export var Button: React$ComponentType<{ - +value: string, - +children: React$Node, + declare export var Button: { + Link: React$ComponentType<{ + +children: React$Node, + +href: string, + ... + }>, ... - }>; + }; declare opaque type FrogResponse; + declare opaque type FrogRequest; declare type FrameContext = { +res: (response: FrameResponse) => FrogResponse, + +req: HonoRequest, ... }; diff --git a/keyserver/src/frog/frog.js b/keyserver/src/frog/frog.js --- a/keyserver/src/frog/frog.js +++ b/keyserver/src/frog/frog.js @@ -7,10 +7,21 @@ import { serve } from '@hono/node-server'; import { Button, Frog } from 'frog'; +import { inviteLinkURL } from 'lib/facts/links.js'; + function startFrogHonoServer() { const frogApp = new Frog({ title: 'Comm' }); - frogApp.frame('/', c => { + frogApp.frame('/:inviteLink', c => { + const { inviteLink } = c.req.param(); + + let buttonLink = 'https://comm.app'; + const inviteLinkURLPrefix = inviteLinkURL(''); + + if (inviteLink.startsWith(inviteLinkURLPrefix)) { + buttonLink = inviteLink; + } + return c.res({ image: (