add enclosure elements to user rss feeds
This commit is contained in:
parent
d2769937ac
commit
f8fbb566e7
|
@ -42,14 +42,24 @@ module.exports = function() {
|
||||||
if(kind === 't3') {
|
if(kind === 't3') {
|
||||||
let s = await downloadAndSave(post.thumbnail, 'thumb_')
|
let s = await downloadAndSave(post.thumbnail, 'thumb_')
|
||||||
let thumbnail = ''
|
let thumbnail = ''
|
||||||
if(s !== 'self') {
|
let enclosure = ''
|
||||||
|
if(s !== 'self' && s != '') {
|
||||||
let img = `${protocol}://${config.domain}${s}`
|
let img = `${protocol}://${config.domain}${s}`
|
||||||
thumbnail = `<thumbnail>${img}</thumbnail>`
|
thumbnail = `<thumbnail>${img}</thumbnail>`
|
||||||
|
|
||||||
|
let mime = ''
|
||||||
|
let ext = s.split('.').pop()
|
||||||
|
if(ext === 'png')
|
||||||
|
mime = 'image/png'
|
||||||
|
else
|
||||||
|
mime = 'image/jpeg'
|
||||||
|
enclosure = `<enclosure length="0" type="${mime}" url="${img}" />`
|
||||||
}
|
}
|
||||||
let append_desc_html = `<br/><a href="${permalink}">[comments]</a>`
|
let append_desc_html = `<br/><a href="${permalink}">[comments]</a>`
|
||||||
t3_elements = `
|
t3_elements = `
|
||||||
<description><![CDATA[${unescape(post.selftext_html)}${append_desc_html}]]></description>
|
<description><![CDATA[${unescape(post.selftext_html)}${append_desc_html}]]></description>
|
||||||
${thumbnail}
|
${thumbnail}
|
||||||
|
${enclosure}
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue