Skip to content

Commit

Permalink
Remove Frames Completely
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoginth committed Dec 13, 2024
1 parent d577655 commit b1d8b78
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 133 deletions.
2 changes: 0 additions & 2 deletions apps/api/src/helpers/oembed/getMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import generateIframe from "./meta/generateIframe";
import getDescription from "./meta/getDescription";
import getEmbedUrl from "./meta/getEmbedUrl";
import getImage from "./meta/getImage";
import getNft from "./meta/getNft";
import getSite from "./meta/getSite";
import getTitle from "./meta/getTitle";

Expand All @@ -27,7 +26,6 @@ const getMetadata = async (url: string): Promise<null | OG> => {
html: generateIframe(getEmbedUrl(document), url),
image: getProxyUrl(image),
lastIndexedAt: new Date().toISOString(),
nft: getNft(document, url),
site: getSite(document),
title: getTitle(document),
url
Expand Down
69 changes: 0 additions & 69 deletions apps/api/src/helpers/oembed/meta/getNft.ts

This file was deleted.

8 changes: 3 additions & 5 deletions apps/web/src/components/Post/PostBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const PostBody: FC<PostBodyProps> = ({
const showCheckin = metadata.__typename === "CheckingInMetadata";
// Show quote
const showQuote = targetPost.quoteOf;
// Show oembed if no NFT, no attachments, no quoted post
// Hide oembed if the post has the hide_oembed attribute
const hideOembed =
getPostAttribute(metadata.attributes, KNOWN_ATTRIBUTES.HIDE_OEMBED) ===
"true";
Expand Down Expand Up @@ -141,10 +141,8 @@ const PostBody: FC<PostBodyProps> = ({
</div>
) : null}
{showCheckin ? <Checkin post={targetPost} /> : null}
{showOembed ? <Oembed post={targetPost} url={urls[0]} /> : null}
{showSharingLink ? (
<Oembed post={targetPost} url={metadata.sharingLink} />
) : null}
{showOembed ? <Oembed url={urls[0]} /> : null}
{showSharingLink ? <Oembed url={metadata.sharingLink} /> : null}
{showQuote ? <Quote post={targetPost.quoteOf as Post} /> : null}
<Metadata metadata={targetPost.metadata} />
</div>
Expand Down
15 changes: 2 additions & 13 deletions apps/web/src/components/Shared/Oembed/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { HEY_API_URL } from "@hey/data/constants";
import { ALLOWED_HTML_HOSTS } from "@hey/data/og";
import getFavicon from "@hey/helpers/getFavicon";
import type { AnyPost } from "@hey/indexer";
import type { OG } from "@hey/types/misc";
import { useQuery } from "@tanstack/react-query";
import axios from "axios";
import type { FC } from "react";
import { useEffect, useState } from "react";
import { useEffect } from "react";
import Embed from "./Embed";
import EmptyOembed from "./EmptyOembed";
import Player from "./Player";
Expand All @@ -15,11 +14,10 @@ const GET_OEMBED_QUERY_KEY = "getOembed";

interface OembedProps {
onLoad?: (og: OG) => void;
post?: AnyPost;
url: string;
}

const Oembed: FC<OembedProps> = ({ onLoad, post, url }) => {
const Oembed: FC<OembedProps> = ({ onLoad, url }) => {
const { data, error, isLoading } = useQuery({
enabled: Boolean(url),
queryFn: async () => {
Expand All @@ -32,14 +30,6 @@ const Oembed: FC<OembedProps> = ({ onLoad, post, url }) => {
refetchOnMount: false
});

const [currentPost, setCurrentPost] = useState<AnyPost>();

useEffect(() => {
if (post) {
setCurrentPost(post);
}
}, [post]);

useEffect(() => {
if (onLoad) {
onLoad(data as OG);
Expand All @@ -65,7 +55,6 @@ const Oembed: FC<OembedProps> = ({ onLoad, post, url }) => {
favicon: getFavicon(data.url),
html: data?.html,
image: data?.image,
nft: data?.nft,
site: data?.site,
title: data?.title,
url: url as string
Expand Down
28 changes: 0 additions & 28 deletions packages/helpers/getNftChainId.ts

This file was deleted.

16 changes: 0 additions & 16 deletions packages/types/misc.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,12 @@ export interface NewAttachment {
uri?: string;
}

export interface Nft {
chain: null | string;
collectionName: string;
contractAddress: `0x${string}` | null;
creatorAddress: `0x${string}`;
description: string;
endTime: null | string;
mediaUrl: string;
mintCount: null | string;
mintStatus: "closed" | "live" | null | string;
mintUrl: null | string;
schema: "erc1155" | "erc721" | string;
sourceUrl: string;
}

export interface OG {
description: null | string;
favicon: null | string;
html: null | string;
image: null | string;
lastIndexedAt?: string;
nft: Nft | null;
site: null | string;
title: null | string;
url: string;
Expand Down

0 comments on commit b1d8b78

Please sign in to comment.