pureink/inkrss

添加bark通知更多功能,提示音修改 + 显示网站ico + 删除html标签 + 重复标题删除 + 消息分组

invmy opened this issue · 0 comments

invmy commented
import { config } from '../config'
export async function reply(feed, item) {
    const url = new URL(item.link)
    await fetch(
        config.BARK_URL +
            encodeURIComponent(feed.title) + '/' +
            encodeURIComponent(item.title) + delHtmlTag(trim(item.content)).replace(/ /ig, "") +
            '?group='+ encodeURIComponent(feed.title) + '&url=' + item.link +
            '&sound=telegraph' + '&icon=' + url.origin + '/favicon.ico'
    )
}
export async function replyWhenError(feed) {
    await fetch(
        config.BARK_URL +
            feed.title +
            '/' +
            '连续多次失败,将暂停更新,请检查订阅源是否正常'
    )
}

//去掉所有的html标记
function delHtmlTag(str) {

return str.replace(/<[^>]+>/g, "");

}

//去掉所有的空格
function trim(str) {

return str.replace(/(^\s*)|(\s*$)/g, "");

}