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 new file mode 100644 --- /dev/null +++ b/keyserver/flow-typed/npm/@hono/node-server_vx.x.x.js @@ -0,0 +1,13 @@ +// 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; +} diff --git a/keyserver/flow-typed/npm/frog_v0.18.x.js b/keyserver/flow-typed/npm/frog_v0.18.x.js new file mode 100644 --- /dev/null +++ b/keyserver/flow-typed/npm/frog_v0.18.x.js @@ -0,0 +1,38 @@ +// 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'; + + declare type FrameResponse = { + +image: React$Node, + +intents: $ReadOnlyArray, + }; + + declare export var Button: React$ComponentType<{ + +value: string, + +children: React$Node, + }>; + + declare opaque type FrogResponse; + + declare type FrameContext = { + +res: (response: FrameResponse) => FrogResponse, + ... + }; + + 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 new file mode 100644 --- /dev/null +++ b/keyserver/src/frog/frog.js @@ -0,0 +1,34 @@ +// @flow + +/** @jsxImportSource hono/jsx */ + +import { serve } from '@hono/node-server'; +import { Button, Frog } from 'frog'; + +function setUpFrog() { + const frogApp = new Frog({ title: 'frog app' }); + + frogApp.frame('/', c => { + /* eslint-disable react/react-in-jsx-scope */ + return c.res({ + image: ( +
+ Hello World! +
+ ), + intents: [ + , + ], + }); + /* eslint-enable react/react-in-jsx-scope */ + }); + + serve({ + fetch: frogApp.fetch, + port: parseInt(process.env.FROG_PORT, 10) || 3001, + }); +} + +export { setUpFrog }; diff --git a/keyserver/src/keyserver.js b/keyserver/src/keyserver.js --- a/keyserver/src/keyserver.js +++ b/keyserver/src/keyserver.js @@ -23,6 +23,7 @@ import { latestWrapInTransactionAndBlockRequestsVersion } from './database/migration-config.js'; import { migrate } from './database/migrations.js'; import { jsonEndpoints } from './endpoints.js'; +import { setUpFrog } from './frog/frog.js'; import { logEndpointMetrics } from './middleware/endpoint-profiling.js'; import { emailSubscriptionResponder } from './responders/comm-landing-responders.js'; import { taggedCommFarcasterResponder } from './responders/farcaster-webhook-responders.js'; @@ -343,5 +344,7 @@ res.redirect(newURL); }); } + + setUpFrog(); } })();