Skip to content
This repository was archived by the owner on Aug 21, 2024. It is now read-only.
This repository was archived by the owner on Aug 21, 2024. It is now read-only.

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

@ghost

Description

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, "");

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions