Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3349481
D13947.id45912.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D13947.id45912.diff
View Options
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: <<STUB>>/@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,40 @@
+// flow-typed signature: 8b45e30d3c592dc3c877fcba96c687fb
+// flow-typed version: <<STUB>>/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<React$Node>,
+ ...
+ };
+
+ 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 */
+
+/* eslint-disable react/react-in-jsx-scope */
+
+import { serve } from '@hono/node-server';
+import { Button, Frog } from 'frog';
+
+function startFrogHonoServer() {
+ const frogApp = new Frog({ title: 'frog app' });
+
+ frogApp.frame('/', c => {
+ return c.res({
+ image: (
+ <div style={{ color: 'white', display: 'flex', fontSize: 60 }}>
+ Hello World!
+ </div>
+ ),
+ intents: [
+ <Button key="invite" value="Invite Link">
+ Join chat
+ </Button>,
+ ],
+ });
+ });
+
+ serve({
+ fetch: frogApp.fetch,
+ port: parseInt(process.env.FROG_PORT, 10) || 3001,
+ });
+}
+
+export { startFrogHonoServer };
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 { startFrogHonoServer } 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);
});
}
+
+ startFrogHonoServer();
}
})();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 23, 6:06 PM (1 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2571916
Default Alt Text
D13947.id45912.diff (3 KB)
Attached To
Mode
D13947: [keyserver] frog hello world example
Attached
Detach File
Event Timeline
Log In to Comment