Stop doing special rendering for RSS items, use HTML!
I missed the part of the RSS docs that allow HTML in the description.
This commit is contained in:
@@ -107,9 +107,6 @@ exports.init = function (sbot, config) {
|
|||||||
case 'rss':
|
case 'rss':
|
||||||
return pull(
|
return pull(
|
||||||
// formatMsgs(feedId, ext, defaultOpts)
|
// formatMsgs(feedId, ext, defaultOpts)
|
||||||
pull.filter( (msg) => {
|
|
||||||
return !!renderRssContent(defaultOpts, msg.value.content || {});
|
|
||||||
}),
|
|
||||||
renderRssItem(defaultOpts), wrapRss(about.name, defaultOpts)
|
renderRssItem(defaultOpts), wrapRss(about.name, defaultOpts)
|
||||||
);
|
);
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ exports.renderThread = renderThread;
|
|||||||
exports.renderAbout = renderAbout;
|
exports.renderAbout = renderAbout;
|
||||||
exports.renderRssItem = renderRssItem;
|
exports.renderRssItem = renderRssItem;
|
||||||
exports.wrapRss = wrapRss;
|
exports.wrapRss = wrapRss;
|
||||||
exports.renderRssContent = renderRssContent;
|
|
||||||
|
|
||||||
function MdRenderer(opts) {
|
function MdRenderer(opts) {
|
||||||
marked.Renderer.call(this, {});
|
marked.Renderer.call(this, {});
|
||||||
@@ -367,73 +366,11 @@ function renderMsg(opts, msg) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderRssContent(opts, c) {
|
|
||||||
var base = opts.base;
|
|
||||||
if (c.type === "post") {
|
|
||||||
return (c.channel ? `Posted in #${c.channel}:\n\n` : '') + c.text;
|
|
||||||
} else if (c.type == "vote" && c.vote.expression == "Dig") {
|
|
||||||
var linkedText = "a post";
|
|
||||||
if (typeof c.vote.linkedText != "undefined") {
|
|
||||||
linkedText = c.vote.linkedText.substring(0, 75);
|
|
||||||
}
|
|
||||||
|
|
||||||
return `Liked ${linkedText}`;
|
|
||||||
} else if (c.type == "vote") {
|
|
||||||
var linkedText = "a post";
|
|
||||||
if (typeof c.vote.linkedText != "undefined") {
|
|
||||||
linkedText = c.vote.linkedText.substring(0, 75);
|
|
||||||
}
|
|
||||||
|
|
||||||
return `Voted ${linkedText}`;
|
|
||||||
} else if (c.type == "contact" && c.following) {
|
|
||||||
var name = c.contact;
|
|
||||||
if (typeof c.contactAbout != "undefined") {
|
|
||||||
name = c.contactAbout.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
return `Followed ${name}`;
|
|
||||||
} else if (c.type == "contact" && !c.following) {
|
|
||||||
var name = c.contact;
|
|
||||||
if (typeof c.contactAbout != "undefined") {
|
|
||||||
name = c.contactAbout.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
return `Unfollowed ${name}`;
|
|
||||||
} else if (typeof c == "string") {
|
|
||||||
// Don't show private messages in RSS.
|
|
||||||
}
|
|
||||||
else if (c.type == "about") {
|
|
||||||
// Don't show about messages in RSS.
|
|
||||||
}
|
|
||||||
else if (c.type == "issue") {
|
|
||||||
return `Created a git issue ${(c.repoName != undefined ? " in repo " + c.repoName : "")}`;
|
|
||||||
}
|
|
||||||
else if (c.type == "git-update") {
|
|
||||||
return `Did a git update ${(c.repoName != undefined ? " in repo " + c.repoName : "")}
|
|
||||||
|
|
||||||
${(c.commits != undefined ? c.commits.map(com => { return "-" +com.title; }).join("\n") : "")}
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
else if (c.type == "ssb-dns") {
|
|
||||||
// Don't show for RSS.
|
|
||||||
}
|
|
||||||
else if (c.type == "pub") {
|
|
||||||
return `Connected to the pub ${c.address.host}`;
|
|
||||||
}
|
|
||||||
else if (c.type == "channel" && c.subscribed) {
|
|
||||||
return `Subscribed to channel #${c.channel}`;
|
|
||||||
}
|
|
||||||
else if (c.type == "channel" && !c.subscribed) {
|
|
||||||
return `Unsubscribed from channel #${c.channel}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderRss(opts, msg) {
|
function renderRss(opts, msg) {
|
||||||
var c = msg.value.content || {};
|
var c = msg.value.content || {};
|
||||||
var name = encodeURIComponent(msg.key);
|
var name = encodeURIComponent(msg.key);
|
||||||
|
|
||||||
let content = renderRssContent(opts, c);
|
let content = render(opts, c);
|
||||||
|
|
||||||
if (!content) {
|
if (!content) {
|
||||||
return null;
|
return null;
|
||||||
@@ -441,7 +378,7 @@ function renderRss(opts, msg) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
'<item>' +
|
'<item>' +
|
||||||
'<title>' + msg.author.name + ' - ' + escape(content.substring(0, 25)) + '... </title>' +
|
'<title>' + msg.author.name + ' | ' + c.type + '</title>' +
|
||||||
'<description><![CDATA[' + content + ']]></description>' +
|
'<description><![CDATA[' + content + ']]></description>' +
|
||||||
'<link>' + opts.base + escape(name) + '</link>' +
|
'<link>' + opts.base + escape(name) + '</link>' +
|
||||||
'<pubDate>' + new Date(msg.value.timestamp).toUTCString() + '</pubDate>' +
|
'<pubDate>' + new Date(msg.value.timestamp).toUTCString() + '</pubDate>' +
|
||||||
|
|||||||
Reference in New Issue
Block a user