From 73e0ed070307af0dfb9674458672dc666c898a62 Mon Sep 17 00:00:00 2001 From: nick-funk Date: Thu, 28 Nov 2024 14:05:39 -0700 Subject: [PATCH 01/14] update types across the server and client to support Bluesky something weird is still going on, the oembeds don't show up properly in preview or when embedded in the media view --- .../sections/General/MediaLinksConfig.tsx | 23 +++++++++++ .../client/framework/components/Frame.tsx | 2 +- .../stream/common/Media/BlueskyMedia.tsx | 30 ++++++++++++++ .../MediaConfirmation/MediaConfirmPrompt.tsx | 18 ++++++++ .../MediaConfirmation/MediaPreview.tsx | 3 ++ .../Stream/CommentForm/CommentForm.tsx | 10 ++++- .../Stream/CommentForm/MediaField.tsx | 2 +- .../PostCommentFormContainer.tsx | 3 ++ common/lib/helpers/findMediaLinks.ts | 7 +++- locales/en-US/stream.ftl | 2 + .../core/server/app/handlers/api/oembed.ts | 2 +- .../resolvers/BlueskyMediaConfiguration.ts | 12 ++++++ .../server/graph/resolvers/CommentMedia.ts | 2 + .../src/core/server/graph/resolvers/index.ts | 2 + .../core/server/graph/schema/schema.graphql | 41 +++++++++++++++++++ .../core/server/models/comment/revision.ts | 7 ++++ .../src/core/server/models/tenant/helpers.ts | 4 +- .../core/server/services/comments/media.ts | 32 +++++++++++---- .../src/core/server/services/oembed/oembed.ts | 8 +++- server/src/core/server/stacks/editComment.ts | 3 +- 20 files changed, 194 insertions(+), 19 deletions(-) create mode 100644 client/src/core/client/stream/common/Media/BlueskyMedia.tsx create mode 100644 server/src/core/server/graph/resolvers/BlueskyMediaConfiguration.ts diff --git a/client/src/core/client/admin/routes/Configure/sections/General/MediaLinksConfig.tsx b/client/src/core/client/admin/routes/Configure/sections/General/MediaLinksConfig.tsx index 51b7738d1e..d1d5b7d759 100644 --- a/client/src/core/client/admin/routes/Configure/sections/General/MediaLinksConfig.tsx +++ b/client/src/core/client/admin/routes/Configure/sections/General/MediaLinksConfig.tsx @@ -41,6 +41,9 @@ graphql` twitter { enabled } + bluesky { + enabled + } youtube { enabled } @@ -90,6 +93,26 @@ const MediaLinksConfig: FunctionComponent = ({ disabled }) => { /> + + + + + + Yes + + } + offLabel={ + + No + + } + /> + + diff --git a/client/src/core/client/framework/components/Frame.tsx b/client/src/core/client/framework/components/Frame.tsx index f24a4603c8..7734070389 100644 --- a/client/src/core/client/framework/components/Frame.tsx +++ b/client/src/core/client/framework/components/Frame.tsx @@ -22,7 +22,7 @@ interface Props { isToggled?: boolean; width?: string; showFullHeight?: boolean; - type?: "twitter" | "youtube" | "external_media"; + type?: "twitter" | "bsky" | "youtube" | "external_media"; mobile?: boolean; } diff --git a/client/src/core/client/stream/common/Media/BlueskyMedia.tsx b/client/src/core/client/stream/common/Media/BlueskyMedia.tsx new file mode 100644 index 0000000000..6f3d681688 --- /dev/null +++ b/client/src/core/client/stream/common/Media/BlueskyMedia.tsx @@ -0,0 +1,30 @@ +import React, { FunctionComponent } from "react"; + +import Frame from "coral-framework/components/Frame"; + +interface Props { + id?: string; + url: string; + siteID: string; + isToggled?: boolean; +} + +const BlueskyMedia: FunctionComponent = ({ + id, + url, + siteID, + isToggled, +}) => { + const component = encodeURIComponent(url); + return ( + + ); +}; + +export default BlueskyMedia; diff --git a/client/src/core/client/stream/tabs/Comments/Comment/MediaConfirmation/MediaConfirmPrompt.tsx b/client/src/core/client/stream/tabs/Comments/Comment/MediaConfirmation/MediaConfirmPrompt.tsx index e05c1df6a7..b37c156ff9 100644 --- a/client/src/core/client/stream/tabs/Comments/Comment/MediaConfirmation/MediaConfirmPrompt.tsx +++ b/client/src/core/client/stream/tabs/Comments/Comment/MediaConfirmation/MediaConfirmPrompt.tsx @@ -51,6 +51,13 @@ const MediaConfirmPrompt: FunctionComponent = ({

)} + {media.type === "bsky" && ( + +

+ Add this post to the end of your comment? +

+
+ )}

{media.url}

@@ -76,6 +83,17 @@ const MediaConfirmPrompt: FunctionComponent = ({ )} + {media.type === "bsky" && ( + + + + )} {media.type === "youtube" && ( )} - {media.type === "bsky" && ( - + {media.type === "bluesky" && ( +