Skip to content

Commit

Permalink
fix(uiweb): make og:image optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddesh7 committed Apr 5, 2024
1 parent 108ad88 commit 57b9750
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ const FrameRenderer = ({
buttonIndex: Number(button.index),
inputText: inputText ?? 'undefined',
state: FrameData.frameDetails?.state ?? 'undefined',
transactionId: hash ?? 'undefined',
transactionId: hash ?? '',
address: account,
messageId: messageId,
chatId: window.location.href.split('/').pop() ?? 'null',
Expand Down Expand Up @@ -475,7 +475,7 @@ const FrameRenderer = ({
unixTimestamp: Date.now(),
buttonIndex: Number(button.index),
inputText: inputText ?? 'undefined',
state: FrameData.frameDetails?.state ?? 'undefined',
state: FrameData.frameDetails?.state ?? '',
transactionId: hash ?? 'undefined',
address: account,
messageId: messageId,
Expand Down
13 changes: 5 additions & 8 deletions packages/uiweb/src/lib/utilities/getFormattedMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export function getFormattedMetadata(URL: string, data: any) {

if (
ofTags.includes('of:version') &&
ofTags.includes('og:image') &&
ofTags.includes('of:image') &&
ofTags.includes('of:accepts:push')
) {
Expand Down Expand Up @@ -97,7 +96,7 @@ export function getFormattedMetadata(URL: string, data: any) {
index,
content: '',
action: '',
target: '',
target: undefined,
});
if (type === index) type = 'content';
frameDetails.buttons[frameDetails.buttons.length - 1][type] =
Expand All @@ -110,15 +109,13 @@ export function getFormattedMetadata(URL: string, data: any) {
}
}
});
} else if (
fcTags.includes('fc:frame') &&
fcTags.includes('fc:frame:image') &&
fcTags.includes('og:image')
) {
} else if (fcTags.includes('fc:frame') && fcTags.includes('fc:frame:image')) {
frameType = 'fc';

metaElements.forEach((element) => {
const name =
element.getAttribute('name') || element.getAttribute('property');

const content = element.getAttribute('content');
if (name === 'og:image') {
frameDetails.ogImage = content as string;
Expand Down Expand Up @@ -160,7 +157,7 @@ export function getFormattedMetadata(URL: string, data: any) {
index,
content: '',
action: '',
target: '',
target: undefined,
post_url: undefined,
});

Expand Down

0 comments on commit 57b9750

Please sign in to comment.