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 index 71c41f6d6..460b747fc 100644 --- a/keyserver/flow-typed/npm/@hono/node-server_vx.x.x.js +++ b/keyserver/flow-typed/npm/@hono/node-server_vx.x.x.js @@ -1,13 +1,17 @@ // flow-typed signature: 27d95010f07acc1758d5b0014afb152c // flow-typed version: <>/@hono/node-server_v1.13.7/flow_v0.202.1 declare module '@hono/node-server' { declare export opaque type Fetch; declare export var serve: ({ +fetch?: ?Fetch, +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 index 1c2407f47..7a0ca4770 100644 --- a/keyserver/flow-typed/npm/frog_v0.18.x.js +++ b/keyserver/flow-typed/npm/frog_v0.18.x.js @@ -1,40 +1,45 @@ // flow-typed signature: 8b45e30d3c592dc3c877fcba96c687fb // flow-typed version: <>/frog_v0.18.x/flow_v0.202.1 declare module 'frog' { - import type { Fetch } from '@hono/node-server'; + import type { Fetch, HonoRequest } from '@hono/node-server'; declare type FrameResponse = { +image: React$Node, +intents: $ReadOnlyArray, ... }; - 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, ... }; declare type FrogOptions = { +title: string, ... }; declare export class Frog { constructor(options?: FrogOptions): this; frame( route: string, callback: (c: FrameContext) => FrogResponse, ): void; fetch: Fetch, } } diff --git a/keyserver/src/frog/frog.js b/keyserver/src/frog/frog.js index 5ab6bf602..715addf42 100644 --- a/keyserver/src/frog/frog.js +++ b/keyserver/src/frog/frog.js @@ -1,34 +1,45 @@ // @flow /** @jsxImportSource hono/jsx */ /* eslint-disable react/react-in-jsx-scope */ 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: (
Hello World!
), intents: [ - , + , ], }); }); serve({ fetch: frogApp.fetch, port: parseInt(process.env.FROG_PORT, 10) || 3001, }); } export { startFrogHonoServer };