From 3e9e0486ba6b1e1d04016fc6c2d7aa5e1497da90 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 30 Mar 2022 10:55:32 -0500 Subject: [PATCH 1/3] Preserve TruthSocial "external_video_id" in attachments --- ...ruthsocial-status-with-external-video.json | 95 ++++++++++++++++++ .../normalizers/__tests__/status-test.js | Bin 6938 -> 7220 bytes app/soapbox/normalizers/attachment.ts | 1 + 3 files changed, 96 insertions(+) create mode 100644 app/soapbox/__fixtures__/truthsocial-status-with-external-video.json diff --git a/app/soapbox/__fixtures__/truthsocial-status-with-external-video.json b/app/soapbox/__fixtures__/truthsocial-status-with-external-video.json new file mode 100644 index 0000000000..eb61501927 --- /dev/null +++ b/app/soapbox/__fixtures__/truthsocial-status-with-external-video.json @@ -0,0 +1,95 @@ +{ + "id": "108046244464677537", + "created_at": "2022-03-30T15:40:53.287Z", + "in_reply_to_id": null, + "in_reply_to_account_id": null, + "sensitive": false, + "spoiler_text": "", + "visibility": "public", + "language": null, + "uri": "https://truthsocial.com/users/alex/statuses/108046244464677537", + "url": "https://truthsocial.com/@alex/108046244464677537", + "replies_count": 0, + "reblogs_count": 0, + "favourites_count": 0, + "favourited": false, + "reblogged": false, + "muted": false, + "bookmarked": false, + "pinned": false, + "content": "", + "reblog": null, + "application": { + "name": "Soapbox FE", + "website": "https://soapbox.pub/" + }, + "account": { + "id": "107759994408336377", + "username": "alex", + "acct": "alex", + "display_name": "Alex Gleason", + "locked": false, + "bot": false, + "discoverable": null, + "group": false, + "created_at": "2022-02-08T00:00:00.000Z", + "note": "

Launching Truth Social

", + "url": "https://truthsocial.com/@alex", + "avatar": "https://static-assets.truthsocial.com/tmtg:prime-truth-social-assets/accounts/avatars/107/759/994/408/336/377/original/119cb0dd1fa615b7.png", + "avatar_static": "https://static-assets.truthsocial.com/tmtg:prime-truth-social-assets/accounts/avatars/107/759/994/408/336/377/original/119cb0dd1fa615b7.png", + "header": "https://static-assets.truthsocial.com/tmtg:prime-truth-social-assets/accounts/headers/107/759/994/408/336/377/original/31f62b0453ccf554.png", + "header_static": "https://static-assets.truthsocial.com/tmtg:prime-truth-social-assets/accounts/headers/107/759/994/408/336/377/original/31f62b0453ccf554.png", + "followers_count": 4713, + "following_count": 43, + "statuses_count": 7, + "last_status_at": "2022-03-30", + "verified": true, + "location": "Texas", + "website": "https://soapbox.pub/", + "emojis": [], + "fields": [] + }, + "media_attachments": [ + { + "id": "108046243948255335", + "type": "video", + "url": "https://static-assets.truthsocial.com/tmtg:prime-truth-social-assets/media_attachments/files/108/046/243/948/255/335/original/3b17ce701c0d6f08.mp4", + "preview_url": "https://static-assets.truthsocial.com/tmtg:prime-truth-social-assets/cache/preview_cards/images/000/543/912/original/e1fcf6ace01d9ded.jpg", + "external_video_id": "vwfnq9", + "remote_url": null, + "preview_remote_url": null, + "text_url": "https://truthsocial.com/media/SpbYvqKIT2VubC9FFn0", + "meta": { + "original": { + "width": 988, + "height": 556, + "frame_rate": "60/1", + "duration": 1.949025, + "bitrate": 402396 + } + }, + "description": null, + "blurhash": null + } + ], + "mentions": [], + "tags": [], + "emojis": [], + "card": { + "url": "https://rumble.com/vz1trd-video-upload-for-108046244464677537.html?mref=ummtf&mc=3nvg0", + "title": "Video upload for 108046244464677537", + "description": "", + "type": "video", + "author_name": "hostid1", + "author_url": "https://rumble.com/user/hostid1", + "provider_name": "Rumble.com", + "provider_url": "https://rumble.com/", + "html": "", + "width": 988, + "height": 556, + "image": "https://static-assets.truthsocial.com/tmtg:prime-truth-social-assets/cache/preview_cards/images/000/543/912/original/e1fcf6ace01d9ded.jpg", + "embed_url": "", + "blurhash": "UQH1;m~8sks,%M~9?DRk-mRnR+xs9cWVj[bH" + }, + "poll": null +} diff --git a/app/soapbox/normalizers/__tests__/status-test.js b/app/soapbox/normalizers/__tests__/status-test.js index ebfcb3eeeee46a9230b8e8bad7b277922f4f210c..ac9358f51a87d85080e912e5758f4298e2d4d04a 100644 GIT binary patch delta 167 zcmbPbw#8zDn6y5Zf5=%;pb;~nLGIU`&biq0%*Nd4>-ohs|Ifhrr nBt5l6!$4CHrUGuJrd~un~S$SGsp{2T}HPB79KoW!j$zD1j delta 12 TcmdmDG0SX&m^4eRrZpD;9E}5w diff --git a/app/soapbox/normalizers/attachment.ts b/app/soapbox/normalizers/attachment.ts index 26e6166967..de960d2580 100644 --- a/app/soapbox/normalizers/attachment.ts +++ b/app/soapbox/normalizers/attachment.ts @@ -15,6 +15,7 @@ import { mergeDefined } from 'soapbox/utils/normalizers'; export const AttachmentRecord = ImmutableRecord({ blurhash: undefined, description: '', + external_video_id: null as string | null, // TruthSocial id: '', meta: ImmutableMap(), pleroma: ImmutableMap(), From b363c203596eaab1e26f92ccaf5744349739fd71 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 30 Mar 2022 10:58:06 -0500 Subject: [PATCH 2/3] Enable Trends and Suggestions for TruthSocial --- app/soapbox/utils/features.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/soapbox/utils/features.ts b/app/soapbox/utils/features.ts index 7e5ca16ed6..c9b050f1ce 100644 --- a/app/soapbox/utils/features.ts +++ b/app/soapbox/utils/features.ts @@ -48,14 +48,19 @@ const getInstanceFeatures = (instance: Instance) => { ]), suggestions: any([ v.software === MASTODON && gte(v.compatVersion, '2.4.3'), + v.software === TRUTHSOCIAL, features.includes('v2_suggestions'), ]), suggestionsV2: any([ v.software === MASTODON && gte(v.compatVersion, '3.4.0'), + v.software === TRUTHSOCIAL, features.includes('v2_suggestions'), ]), blockersVisible: features.includes('blockers_visible'), - trends: v.software === MASTODON && gte(v.compatVersion, '3.0.0'), + trends: any([ + v.software === MASTODON && gte(v.compatVersion, '3.0.0'), + v.software === TRUTHSOCIAL, + ]), mediaV2: any([ v.software === MASTODON && gte(v.compatVersion, '3.1.3'), // Even though Pleroma supports these endpoints, it has disadvantages From ebc2bf96acdcd1b666d1f6eefa04a9082cd9d428 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 30 Mar 2022 11:03:35 -0500 Subject: [PATCH 3/3] external_video_id: render card html instead of hardcoding the provider --- app/soapbox/components/status.js | Bin 21414 -> 21119 bytes .../status/components/detailed_status.js | Bin 8974 -> 8667 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/app/soapbox/components/status.js b/app/soapbox/components/status.js index ef9aafdbeb7bda56a85f37027d56ec0805c647db..eafc14922384c00f943425d28c5b8d3233171842 100644 GIT binary patch delta 83 zcmZ3sobmq>#tr(W5}9cV8fBR&srh=T6(y-fd5JmkVD9Eh)0d2l3X^5^q-3fU;^Q+) ia&xQ{ic1npN{jW96N^&xKq3mYlO2N%Ht(}|Aq4;&<{v5m delta 312 zcmeyrgmKw&#tr(WUdj1+#U%=<6(y-fd5JmknJEgk3L0gZDXIB->8T|e>Tnsb7*Jka zQ`4GD0SYqH6f|HeHoKd?WR$dn%fZyxWTq7*=B7?=v=G)WE=snoPRJ-JDJZtm*Dor~ zP0C5tOU}>LPt8qAP0?4Wh8YI5s8&B=@b&xsyi8(p>t$pG~Xr#0N==Ls{jB1 diff --git a/app/soapbox/features/status/components/detailed_status.js b/app/soapbox/features/status/components/detailed_status.js index 0ae6451294b25036ce05e34bf2a80e46bdb13c72..5e1cb5407591b16c3926b937e0bbb0613c66d24f 100644 GIT binary patch delta 108 zcmeBkyY0MT5wApMnu11IW=d+lUTQ^2YEfQdPCS^q`3>&@MoR^Sl*GLB)S~>-;+)Fh z)Dq9UywoC(5MLkL>S~4f_>7X=94m$5lEjkIV!h^CVT delta 404 zcmccZ+~>Ao5wBNreqM2jLTW`xYEfQdPJCvHf~|r^S!POVzFvB2iH15{1}p}YSJ%|E z=2C!y%rpfJn2OE2cn>hv+ri~vYHTvoiV|~EF~k)Vii?tMs}nLxN(zdt^!1BMbCYsX z^^)^*^;2_`Qd9I*s$oV0t*zBhsKsIg*yyDEqLkDkTXh3