feat: twitter showSymbolForRetweetAndReply param

This commit is contained in:
DIYgod
2023-03-13 10:25:36 +00:00
parent c4eb096cf8
commit 12f3effc8b

View File

@@ -48,6 +48,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
showQuotedAuthorAvatarInDesc: fallback(params.showQuotedAuthorAvatarInDesc, queryToBoolean(routeParams.get('showQuotedAuthorAvatarInDesc')), false), showQuotedAuthorAvatarInDesc: fallback(params.showQuotedAuthorAvatarInDesc, queryToBoolean(routeParams.get('showQuotedAuthorAvatarInDesc')), false),
showAuthorAvatarInDesc: fallback(params.showAuthorAvatarInDesc, queryToBoolean(routeParams.get('showAuthorAvatarInDesc')), false), showAuthorAvatarInDesc: fallback(params.showAuthorAvatarInDesc, queryToBoolean(routeParams.get('showAuthorAvatarInDesc')), false),
showEmojiForRetweetAndReply: fallback(params.showEmojiForRetweetAndReply, queryToBoolean(routeParams.get('showEmojiForRetweetAndReply')), false), showEmojiForRetweetAndReply: fallback(params.showEmojiForRetweetAndReply, queryToBoolean(routeParams.get('showEmojiForRetweetAndReply')), false),
showSymbolForRetweetAndReply: fallback(params.showSymbolForRetweetAndReply, queryToBoolean(routeParams.get('showSymbolForRetweetAndReply')), true),
showRetweetTextInTitle: fallback(params.showRetweetTextInTitle, queryToBoolean(routeParams.get('showRetweetTextInTitle')), true), showRetweetTextInTitle: fallback(params.showRetweetTextInTitle, queryToBoolean(routeParams.get('showRetweetTextInTitle')), true),
addLinkForPics: fallback(params.addLinkForPics, queryToBoolean(routeParams.get('addLinkForPics')), false), addLinkForPics: fallback(params.addLinkForPics, queryToBoolean(routeParams.get('addLinkForPics')), false),
showTimestampInDescription: fallback(params.showTimestampInDescription, queryToBoolean(routeParams.get('showTimestampInDescription')), false), showTimestampInDescription: fallback(params.showTimestampInDescription, queryToBoolean(routeParams.get('showTimestampInDescription')), false),
@@ -69,6 +70,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
showQuotedAuthorAvatarInDesc, showQuotedAuthorAvatarInDesc,
showAuthorAvatarInDesc, showAuthorAvatarInDesc,
showEmojiForRetweetAndReply, showEmojiForRetweetAndReply,
showSymbolForRetweetAndReply,
showRetweetTextInTitle, showRetweetTextInTitle,
addLinkForPics, addLinkForPics,
showTimestampInDescription, showTimestampInDescription,
@@ -228,7 +230,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
} }
quote += formatMedia(quoteData); quote += formatMedia(quoteData);
picsPrefix += generatePicsPrefix(quoteData); picsPrefix += generatePicsPrefix(quoteData);
quoteInTitle += showEmojiForRetweetAndReply ? ' 💬 ' : ' RT '; quoteInTitle += showEmojiForRetweetAndReply ? ' 💬 ' : showSymbolForRetweetAndReply ? ' RT ' : '';
quoteInTitle += `${author.name}: ${formatText(quoteData.full_text, quoteData.entities.urls)}`; quoteInTitle += `${author.name}: ${formatText(quoteData.full_text, quoteData.entities.urls)}`;
if (readable) { if (readable) {
@@ -258,15 +260,15 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
const isQuote = item.is_quote_status; const isQuote = item.is_quote_status;
if (!isRetweet && (!isQuote || showRetweetTextInTitle)) { if (!isRetweet && (!isQuote || showRetweetTextInTitle)) {
if (item.in_reply_to_screen_name) { if (item.in_reply_to_screen_name) {
title += showEmojiForRetweetAndReply ? '↩️ ' : 'Re '; title += showEmojiForRetweetAndReply ? '↩️ ' : showSymbolForRetweetAndReply ? 'Re ' : '';
} }
title += replaceBreak(originalItem.full_text); title += replaceBreak(originalItem.full_text);
} }
if (isRetweet) { if (isRetweet) {
title += showEmojiForRetweetAndReply ? '🔁 ' : 'RT '; title += showEmojiForRetweetAndReply ? '🔁 ' : showSymbolForRetweetAndReply ? 'RT ' : '';
title += item.user.name + ': '; title += item.user.name + ': ';
if (item.in_reply_to_screen_name) { if (item.in_reply_to_screen_name) {
title += showEmojiForRetweetAndReply ? ' ↩️ ' : ' Re '; title += showEmojiForRetweetAndReply ? ' ↩️ ' : showSymbolForRetweetAndReply ? ' Re ' : '';
} }
title += replaceBreak(item.full_text); title += replaceBreak(item.full_text);
} }
@@ -298,7 +300,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
} }
description += ' '; description += ' ';
} }
description += showEmojiForRetweetAndReply ? '🔁' : 'RT'; description += showEmojiForRetweetAndReply ? '🔁' : showSymbolForRetweetAndReply ? 'RT' : '';
if (!showAuthorInDesc) { if (!showAuthorInDesc) {
description += ' '; description += ' ';
if (readable) { if (readable) {
@@ -341,7 +343,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
description += `: `; description += `: `;
} }
if (item.in_reply_to_screen_name) { if (item.in_reply_to_screen_name) {
description += showEmojiForRetweetAndReply ? '↩️ ' : 'Re '; description += showEmojiForRetweetAndReply ? '↩️ ' : showSymbolForRetweetAndReply ? 'Re ' : '';
} }
description += item.full_text; description += item.full_text;