mirror of
https://github.com/DIYgod/RSSHub-Radar.git
synced 2026-08-28 17:45:13 +08:00
feat: chrome.action and chrome.notifications not exist in safari
This commit is contained in:
@@ -0,0 +1 @@
|
||||
pnpm-lock.yaml
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
"dev:firefox": "plasmo dev --target=firefox-mv3 --no-cs-reload",
|
||||
"build:firefox": "plasmo build --target=firefox-mv3",
|
||||
"build:safari": "plasmo build --target=safari-mv3",
|
||||
"safari-convert": "xcrun safari-web-extension-converter build/safari-mv3-prod --project-location build --bundle-identifier app.rsshub.RSSHub-Radar",
|
||||
"safari-convert": "xcrun safari-web-extension-converter build/safari-mv3-prod --project-location build --bundle-identifier app.rsshub.RSSHub-Radar --force",
|
||||
"safari-zip": "zip -r build/safari-mv3-prod.zip \"build/RSSHub Radar\"",
|
||||
"build:safari:zip": "npm run build:safari && npm run safari-convert && npm run safari-zip",
|
||||
"package": "plasmo package",
|
||||
|
||||
Generated
+2351
-4969
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,10 @@
|
||||
import { getConfig } from "~/lib/config"
|
||||
|
||||
chrome.action.setBadgeBackgroundColor({
|
||||
chrome.action?.setBadgeBackgroundColor?.({
|
||||
color: "#F62800",
|
||||
})
|
||||
|
||||
chrome.action.setBadgeTextColor({
|
||||
chrome.action?.setBadgeTextColor?.({
|
||||
color: "#fff",
|
||||
})
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ const storage = new Storage({
|
||||
export const initUpdateNotifications = async () => {
|
||||
const version = await storage.get("version")
|
||||
if (!version || version !== info.version) {
|
||||
chrome.notifications.create("RSSHubRadarUpdate", {
|
||||
chrome.notifications?.create("RSSHubRadarUpdate", {
|
||||
type: "basic",
|
||||
iconUrl: RSSHubIcon,
|
||||
title: version
|
||||
@@ -19,12 +19,12 @@ export const initUpdateNotifications = async () => {
|
||||
: chrome.i18n.getMessage("extensionInstallTip"),
|
||||
message: `v${info.version}, ${chrome.i18n.getMessage("clickToViewChangeLog")}`,
|
||||
})
|
||||
chrome.notifications.onClicked.addListener((id) => {
|
||||
chrome.notifications?.onClicked.addListener((id) => {
|
||||
if (id === "RSSHubRadarUpdate") {
|
||||
chrome.tabs.create({
|
||||
url: "https://github.com/DIYgod/RSSHub-Radar/releases",
|
||||
})
|
||||
chrome.notifications.clear("RSSHubRadarUpdate")
|
||||
chrome.notifications?.clear("RSSHubRadarUpdate")
|
||||
}
|
||||
})
|
||||
await storage.set("version", info.version)
|
||||
|
||||
@@ -16,6 +16,7 @@ export function removeFunctionFields(obj) {
|
||||
}
|
||||
}
|
||||
export function parseRSS(content: string) {
|
||||
content = content.replaceAll("<", "<").replaceAll(">", ">")
|
||||
if (content.includes("<rss ") || content.includes("<feed ")) {
|
||||
const titleContent = content.match(/<title>(.*)<\/title>/)?.[1]
|
||||
const title = titleContent
|
||||
|
||||
Reference in New Issue
Block a user