Merge branch 'next-truthsocial-fixes' into 'next'

Next: TruthSocial fixes

See merge request soapbox-pub/soapbox-fe!1166
virtualized-window
Alex Gleason 3 years ago
commit 9fb3439cda

@ -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": "<p>Launching Truth Social</p>",
"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": "<iframe src=\"https://rumble.com/embed/vwfnq9/\" width=\"988\" height=\"556\" frameborder=\"0\" title=\"Video upload for 108046244464677537\" allowfullscreen=\"\"></iframe>",
"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
}

@ -439,8 +439,7 @@ class Status extends ImmutablePureComponent {
} else if (size === 1 && status.getIn(['media_attachments', 0, 'type']) === 'video') { } else if (size === 1 && status.getIn(['media_attachments', 0, 'type']) === 'video') {
const video = status.getIn(['media_attachments', 0]); const video = status.getIn(['media_attachments', 0]);
const external_id = (video.get('external_video_id')); if (video.external_video_id) {
if (external_id) {
const { mediaWrapperWidth } = this.state; const { mediaWrapperWidth } = this.state;
const height = mediaWrapperWidth / (video.getIn(['meta', 'original', 'width']) / video.getIn(['meta', 'original', 'height'])); const height = mediaWrapperWidth / (video.getIn(['meta', 'original', 'width']) / video.getIn(['meta', 'original', 'height']));
media = ( media = (
@ -449,16 +448,8 @@ class Status extends ImmutablePureComponent {
ref={this.setRef} ref={this.setRef}
className='status-card__image status-card-video' className='status-card__image status-card-video'
style={height ? { height } : {}} style={height ? { height } : {}}
> dangerouslySetInnerHTML={{ __html: status.card.html }}
<iframe />
src={`https://rumble.com/embed/${external_id}/`}
frameBorder='0'
allowFullScreen
webkitallowfullscreen='true'
mozallowfullscreen='true'
title=''
/>
</div>
</div> </div>
); );
} else { } else {

@ -110,8 +110,7 @@ class DetailedStatus extends ImmutablePureComponent {
if (size > 0) { if (size > 0) {
if (size === 1 && status.getIn(['media_attachments', 0, 'type']) === 'video') { if (size === 1 && status.getIn(['media_attachments', 0, 'type']) === 'video') {
const video = status.getIn(['media_attachments', 0]); const video = status.getIn(['media_attachments', 0]);
const external_id = (video.get('external_video_id')); if (video.external_video_id) {
if (external_id) {
const { mediaWrapperWidth } = this.state; const { mediaWrapperWidth } = this.state;
const height = mediaWrapperWidth / (video.getIn(['meta', 'original', 'width']) / video.getIn(['meta', 'original', 'height'])); const height = mediaWrapperWidth / (video.getIn(['meta', 'original', 'width']) / video.getIn(['meta', 'original', 'height']));
media = ( media = (
@ -120,16 +119,8 @@ class DetailedStatus extends ImmutablePureComponent {
ref={this.setRef} ref={this.setRef}
className='status-card-video' className='status-card-video'
style={{ height }} style={{ height }}
> dangerouslySetInnerHTML={{ __html: status.card.html }}
<iframe />
src={`https://rumble.com/embed/${external_id}/`}
frameborder='0'
allowFullScreen='true'
webkitallowfullscreen='true'
mozallowfullscreen='true'
title='Video'
/>
</div>
</div> </div>
); );
} else { } else {

@ -195,4 +195,10 @@ describe('normalizeStatus()', () => {
expect(result.card.type).toEqual('link'); expect(result.card.type).toEqual('link');
expect(result.card.provider_url).toEqual('https://soapbox.pub'); expect(result.card.provider_url).toEqual('https://soapbox.pub');
}); });
it('preserves Truth Social external_video_id', () => {
const status = require('soapbox/__fixtures__/truthsocial-status-with-external-video.json');
const result = normalizeStatus(status);
expect(result.media_attachments.get(0).external_video_id).toBe('vwfnq9');
});
}); });

@ -15,6 +15,7 @@ import { mergeDefined } from 'soapbox/utils/normalizers';
export const AttachmentRecord = ImmutableRecord({ export const AttachmentRecord = ImmutableRecord({
blurhash: undefined, blurhash: undefined,
description: '', description: '',
external_video_id: null as string | null, // TruthSocial
id: '', id: '',
meta: ImmutableMap(), meta: ImmutableMap(),
pleroma: ImmutableMap(), pleroma: ImmutableMap(),

@ -48,14 +48,19 @@ const getInstanceFeatures = (instance: Instance) => {
]), ]),
suggestions: any([ suggestions: any([
v.software === MASTODON && gte(v.compatVersion, '2.4.3'), v.software === MASTODON && gte(v.compatVersion, '2.4.3'),
v.software === TRUTHSOCIAL,
features.includes('v2_suggestions'), features.includes('v2_suggestions'),
]), ]),
suggestionsV2: any([ suggestionsV2: any([
v.software === MASTODON && gte(v.compatVersion, '3.4.0'), v.software === MASTODON && gte(v.compatVersion, '3.4.0'),
v.software === TRUTHSOCIAL,
features.includes('v2_suggestions'), features.includes('v2_suggestions'),
]), ]),
blockersVisible: features.includes('blockers_visible'), 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([ mediaV2: any([
v.software === MASTODON && gte(v.compatVersion, '3.1.3'), v.software === MASTODON && gte(v.compatVersion, '3.1.3'),
// Even though Pleroma supports these endpoints, it has disadvantages // Even though Pleroma supports these endpoints, it has disadvantages

Loading…
Cancel
Save