Hotfix: twitter wrap (#1384)

Closes #1382
This commit is contained in:
凉凉
2019-01-14 00:18:58 +08:00
committed by DIYgod
parent 0bafedcd93
commit 0c02303254

View File

@@ -25,7 +25,7 @@ const ProcessFeed = ({ data = [] }) => {
} }
}; };
const formatText = (text) => text.replace(/https:\/\/t\.co(.*)/g, ''); const formatText = (text) => text.replace(/https:\/\/t\.co(.*)/g, '').replace(/\n/g, '<br>');
const formatVideo = (media) => { const formatVideo = (media) => {
let content = ''; let content = '';
const video = media.video_info.variants.reduce((video, item) => { const video = media.video_info.variants.reduce((video, item) => {
@@ -97,8 +97,8 @@ const ProcessFeed = ({ data = [] }) => {
} }
return { return {
title: `${item.in_reply_to_screen_name ? 'Re ' : ''}${item.full_text}`, title: `${item.in_reply_to_screen_name ? 'Re ' : ''}${formatText(item.full_text)}`,
description: `${item.in_reply_to_screen_name ? 'Re ' : ''}${item.full_text}${url}${img}${quote}`, description: `${item.in_reply_to_screen_name ? 'Re ' : ''}${formatText(item.full_text)}${url}${img}${quote}`,
pubDate: new Date(item.created_at).toUTCString(), pubDate: new Date(item.created_at).toUTCString(),
link: `https://twitter.com/${item.user.screen_name}/status/${item.id_str}`, link: `https://twitter.com/${item.user.screen_name}/status/${item.id_str}`,
}; };