Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3513836
D13985.id46250.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D13985.id46250.diff
View Options
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
@@ -38,7 +38,7 @@
constructor(options?: FrogOptions): this;
frame(
route: string,
- callback: (c: FrameContext) => FrogResponse,
+ callback: (c: FrameContext) => Promise<FrogResponse>,
): void;
fetch: Fetch,
}
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
@@ -8,12 +8,16 @@
import { Button, Frog } from 'frog';
import { inviteLinkURL } from 'lib/facts/links.js';
+import { ignorePromiseRejections } from 'lib/utils/promises.js';
+
+import { neynarClient } from '../utils/fc-cache.js';
+import { redisCache } from '../utils/redis-cache.js';
function startFrogHonoServer() {
const frogApp = new Frog({ title: 'Comm Frame App' });
- frogApp.frame('/:inviteLink', c => {
- const { inviteLink } = c.req.param();
+ frogApp.frame('/:inviteLink/:channelID', async c => {
+ const { inviteLink, channelID } = c.req.param();
let buttonLink = 'https://comm.app';
const inviteLinkURLPrefix = inviteLinkURL('');
@@ -22,10 +26,44 @@
buttonLink = inviteLink;
}
+ let channelInfo = await redisCache.getChannelInfo(channelID);
+ if (!channelInfo) {
+ channelInfo = await neynarClient?.fetchFarcasterChannelByID(channelID);
+
+ if (channelInfo) {
+ ignorePromiseRejections(
+ redisCache.setChannelInfo(channelID, channelInfo),
+ );
+ }
+ }
+
+ let header_image_url =
+ 'https://warpcast.com/~/images/DefaultChannelCoverImage.png';
+ if (channelInfo?.header_image_url) {
+ header_image_url = channelInfo.header_image_url;
+ }
+
return c.res({
image: (
- <div style={{ color: 'white', display: 'flex', fontSize: 60 }}>
- Hello World!
+ <div
+ style={{
+ position: 'relative',
+ width: '100%',
+ height: '100%',
+ display: 'flex',
+ justifyContent: 'center',
+ alignItems: 'center',
+ }}
+ >
+ <img
+ src={header_image_url}
+ alt="frame background"
+ style={{
+ width: '100%',
+ height: '100%',
+ objectFit: 'cover',
+ }}
+ />
</div>
),
intents: [
diff --git a/lib/types/farcaster-types.js b/lib/types/farcaster-types.js
--- a/lib/types/farcaster-types.js
+++ b/lib/types/farcaster-types.js
@@ -38,6 +38,7 @@
...
},
+image_url: string,
+ +header_image_url?: string,
+description: string,
...
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 23, 2:26 AM (16 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2693205
Default Alt Text
D13985.id46250.diff (2 KB)
Attached To
Mode
D13985: [keyserver/lib] Change frame image from hello world to channel image
Attached
Detach File
Event Timeline
Log In to Comment