├── .prettierignore ├── assets └── icon.png ├── src ├── assets │ ├── feedly.png │ ├── icon.png │ ├── ttrss.png │ ├── miniflux.ico │ ├── freshrss.svg │ ├── inoreader.svg │ └── follow.svg ├── background │ ├── messages │ │ ├── contentReady.ts │ │ ├── responseRSS.ts │ │ ├── responseDisplayedRules.ts │ │ ├── refreshRules.ts │ │ ├── requestDisplayedRules.ts │ │ └── popupReady.ts │ ├── badge.ts │ ├── index.ts │ ├── update-notifications.ts │ ├── rules.ts │ └── rss.ts ├── options │ ├── routes │ │ ├── index.tsx │ │ ├── About.tsx │ │ ├── Rules.tsx │ │ └── General.tsx │ ├── index.tsx │ └── Siderbar.tsx ├── lib │ ├── types.ts │ ├── components │ │ ├── AppearanceSwitch.tsx │ │ ├── Label.tsx │ │ ├── Input.tsx │ │ ├── Switch.tsx │ │ ├── Button.tsx │ │ ├── Card.tsx │ │ ├── Accordion.tsx │ │ ├── Pagination.tsx │ │ └── Sheet.tsx │ ├── quick-subscriptions-logos.tsx │ ├── offscreen.ts │ ├── report.ts │ ├── utils.ts │ ├── rules.ts │ ├── style.css │ ├── config.ts │ ├── hooks │ │ └── use-dark.ts │ ├── quick-subscriptions.ts │ ├── rss.ts │ └── rsshub.ts ├── contents │ └── index.ts ├── popup │ ├── RSSList.tsx │ ├── index.tsx │ └── RSSItem.tsx ├── tabs │ ├── offscreen.tsx │ └── preview.tsx └── sandboxes │ └── index.ts ├── postcss.config.js ├── tsconfig.json ├── .github ├── dependabot.yml └── workflows │ ├── test.yml │ ├── submit.yml │ └── release.yml ├── components.json ├── .prettierrc.js ├── .gitignore ├── .prettierrc.mjs ├── LICENSE ├── package.json ├── tailwind.config.js ├── locales ├── zh_CN │ └── messages.json └── en │ └── messages.json └── README.md /.prettierignore: -------------------------------------------------------------------------------- 1 | pnpm-lock.yaml -------------------------------------------------------------------------------- /assets/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-extension-rsshub-radar/dev/assets/icon.png -------------------------------------------------------------------------------- /src/assets/feedly.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-extension-rsshub-radar/dev/src/assets/feedly.png -------------------------------------------------------------------------------- /src/assets/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-extension-rsshub-radar/dev/src/assets/icon.png -------------------------------------------------------------------------------- /src/assets/ttrss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-extension-rsshub-radar/dev/src/assets/ttrss.png -------------------------------------------------------------------------------- /src/assets/miniflux.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-extension-rsshub-radar/dev/src/assets/miniflux.ico -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @type {import('postcss').ProcessOptions} 3 | */ 4 | module.exports = { 5 | plugins: { 6 | tailwindcss: {}, 7 | autoprefixer: {}, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "plasmo/templates/tsconfig.base", 3 | "exclude": ["node_modules"], 4 | "include": [".plasmo/index.d.ts", "./**/*.ts", "./**/*.tsx"], 5 | "compilerOptions": { 6 | "paths": { 7 | "~/*": ["./src/*"], 8 | }, 9 | "baseUrl": ".", 10 | }, 11 | } 12 | -------------------------------------------------------------------------------- /src/background/messages/contentReady.ts: -------------------------------------------------------------------------------- 1 | import type { PlasmoMessaging } from "@plasmohq/messaging" 2 | 3 | import { getRSS } from "~/background/rss" 4 | 5 | const handler: PlasmoMessaging.MessageHandler = (req, res) => { 6 | getRSS(req.sender.tab.id, req.sender.tab.url) 7 | res.send("") 8 | } 9 | 10 | export default handler 11 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "npm" 4 | directory: "/" 5 | schedule: 6 | interval: "daily" 7 | open-pull-requests-limit: 20 8 | 9 | - package-ecosystem: "github-actions" 10 | directory: "/" 11 | schedule: 12 | interval: "daily" 13 | open-pull-requests-limit: 20 14 | -------------------------------------------------------------------------------- /src/background/messages/responseRSS.ts: -------------------------------------------------------------------------------- 1 | import type { PlasmoMessaging } from "@plasmohq/messaging" 2 | 3 | import { setRSS } from "~/background/rss" 4 | 5 | const handler: PlasmoMessaging.MessageHandler = async (req, res) => { 6 | setRSS(req.body.tabId || req.sender.tab.id, req.body.rss) 7 | res.send("") 8 | } 9 | 10 | export default handler 11 | -------------------------------------------------------------------------------- /src/background/messages/responseDisplayedRules.ts: -------------------------------------------------------------------------------- 1 | import type { PlasmoMessaging } from "@plasmohq/messaging" 2 | 3 | import { setDisplayedRules } from "~/background/rules" 4 | 5 | const handler: PlasmoMessaging.MessageHandler = (req, res) => { 6 | setDisplayedRules(req.body.displayedRules) 7 | res.send("") 8 | } 9 | 10 | export default handler 11 | -------------------------------------------------------------------------------- /src/background/messages/refreshRules.ts: -------------------------------------------------------------------------------- 1 | import type { PlasmoMessaging } from "@plasmohq/messaging" 2 | 3 | import { refreshRules } from "~/background/rules" 4 | 5 | const handler: PlasmoMessaging.MessageHandler = (req, res) => { 6 | refreshRules().then(() => { 7 | res.send(true) 8 | }) 9 | return true 10 | } 11 | 12 | export default handler 13 | -------------------------------------------------------------------------------- /src/background/messages/requestDisplayedRules.ts: -------------------------------------------------------------------------------- 1 | import type { PlasmoMessaging } from "@plasmohq/messaging" 2 | 3 | import { getDisplayedRules } from "~/background/rules" 4 | 5 | const handler: PlasmoMessaging.MessageHandler = (req, res) => { 6 | getDisplayedRules().then((rules) => { 7 | res.send(rules) 8 | }) 9 | return true 10 | } 11 | 12 | export default handler 13 | -------------------------------------------------------------------------------- /components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "default", 4 | "rsc": false, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "tailwind.config.js", 8 | "css": "src/lib/style.css", 9 | "baseColor": "orange", 10 | "cssVariables": true 11 | }, 12 | "aliases": { 13 | "components": "~/lib/components", 14 | "utils": "~/lib/utils" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/options/routes/index.tsx: -------------------------------------------------------------------------------- 1 | import { Route, Routes } from "react-router" 2 | 3 | import { About } from "./About" 4 | import { General } from "./General" 5 | import { Rules } from "./Rules" 6 | 7 | export const Routing = () => ( 8 | 9 | } /> 10 | } /> 11 | } /> 12 | 13 | ) 14 | -------------------------------------------------------------------------------- /src/lib/types.ts: -------------------------------------------------------------------------------- 1 | export type Rule = { 2 | title: string 3 | docs: string 4 | source: string[] 5 | target: string | ((params: any, url: string) => string) 6 | } 7 | 8 | export type Rules = { 9 | [domain: string]: { 10 | _name: string 11 | [subdomain: string]: Rule[] | string 12 | } 13 | } 14 | 15 | export type RSSData = { 16 | url: string 17 | title: string 18 | image?: string 19 | path?: string 20 | isDocs?: boolean 21 | } 22 | -------------------------------------------------------------------------------- /src/background/badge.ts: -------------------------------------------------------------------------------- 1 | import { getConfig } from "~/lib/config" 2 | 3 | chrome.action?.setBadgeBackgroundColor?.({ 4 | color: "#F62800", 5 | }) 6 | 7 | chrome.action?.setBadgeTextColor?.({ 8 | color: "#fff", 9 | }) 10 | 11 | export const setBadge = async (text: string, tabId: number) => { 12 | const config = await getConfig() 13 | 14 | if (config.notice.badge) { 15 | chrome.action.setBadgeText({ 16 | text, 17 | tabId, 18 | }) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/background/messages/popupReady.ts: -------------------------------------------------------------------------------- 1 | import type { PlasmoMessaging } from "@plasmohq/messaging" 2 | 3 | import { getCachedRSS } from "~/background/rss" 4 | 5 | const handler: PlasmoMessaging.MessageHandler = (req, res) => { 6 | chrome.tabs.query( 7 | { 8 | active: true, 9 | lastFocusedWindow: true, 10 | }, 11 | ([tab]) => { 12 | res.send(getCachedRSS(tab.id)) 13 | }, 14 | ) 15 | return true 16 | } 17 | 18 | export default handler 19 | -------------------------------------------------------------------------------- /src/assets/freshrss.svg: -------------------------------------------------------------------------------- 1 | 2 | Logo FreshRSS 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/contents/index.ts: -------------------------------------------------------------------------------- 1 | import { sendToBackground } from "@plasmohq/messaging" 2 | 3 | import { getPageRSS } from "~/lib/rss" 4 | 5 | sendToBackground({ 6 | name: "contentReady", 7 | }) 8 | 9 | chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => { 10 | if (msg.name === "requestHTML") { 11 | sendResponse(document.documentElement.outerHTML) 12 | } else if (msg.name === "requestPageRSS") { 13 | getPageRSS().then((data) => { 14 | sendResponse(data) 15 | }) 16 | return true 17 | } 18 | }) 19 | 20 | export {} 21 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | singleQuote: false, 3 | semi: false, 4 | trailingComma: "all", 5 | endOfLine: "lf", 6 | plugins: ["prettier-package-json", "@ianvs/prettier-plugin-sort-imports"], 7 | 8 | importOrderParserPlugins: [ 9 | "classProperties", 10 | "decorators-legacy", 11 | "typescript", 12 | "jsx", 13 | ], 14 | importOrder: [ 15 | "", 16 | "", 17 | "^@(.*)/(.*)$", 18 | "", 19 | "^~/(.*)$", 20 | "", 21 | "^@/(.*)$", 22 | "", 23 | "^[./]", 24 | ], 25 | } 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 3 | 4 | # dependencies 5 | /node_modules 6 | /.pnp 7 | .pnp.js 8 | 9 | # testing 10 | /coverage 11 | 12 | #cache 13 | .turbo 14 | 15 | # misc 16 | .DS_Store 17 | *.pem 18 | 19 | # debug 20 | npm-debug.log* 21 | yarn-debug.log* 22 | yarn-error.log* 23 | .pnpm-debug.log* 24 | 25 | # local env files 26 | .env* 27 | 28 | out/ 29 | build/ 30 | dist/ 31 | 32 | # plasmo - https://www.plasmo.com 33 | .plasmo 34 | 35 | # bpp - http://bpp.browser.market/ 36 | keys.json 37 | 38 | # typescript 39 | .tsbuildinfo 40 | -------------------------------------------------------------------------------- /src/popup/RSSList.tsx: -------------------------------------------------------------------------------- 1 | import type { RSSData } from "~/lib/types" 2 | 3 | import RSSItem from "./RSSItem" 4 | 5 | function RSSList({ type, list }: { type: string; list: RSSData[] }) { 6 | if (list.length === 0) { 7 | return null 8 | } 9 | return ( 10 |
11 |

{chrome.i18n.getMessage(type)}

12 | 17 |
18 | ) 19 | } 20 | 21 | export default RSSList 22 | -------------------------------------------------------------------------------- /src/lib/components/AppearanceSwitch.tsx: -------------------------------------------------------------------------------- 1 | import { useDark } from "~/lib/hooks/use-dark" 2 | 3 | export function AppearanceSwitch({ className = "" }: { className?: string }) { 4 | const { toggleDark } = useDark() 5 | 6 | return ( 7 | 12 | ) 13 | } 14 | -------------------------------------------------------------------------------- /src/lib/quick-subscriptions-logos.tsx: -------------------------------------------------------------------------------- 1 | import FollowLogo from "data-base64:~/assets/follow.svg" 2 | import InoreaderLogo from "data-base64:~/assets/inoreader.svg" 3 | import MinifluxLogo from "data-base64:~/assets/miniflux.ico" 4 | import FreshRSSLogo from "data-base64:~/assets/freshrss.svg" 5 | import TinyTinyRSSLogo from "data-base64:~/assets/ttrss.png" 6 | import FeedlyLogo from "data-base64:~/assets/feedly.png" 7 | 8 | export const logoMap = new Map([ 9 | ["follow", FollowLogo], 10 | ["inoreader", InoreaderLogo], 11 | ["miniflux", MinifluxLogo], 12 | ["freshrss", FreshRSSLogo], 13 | ["ttrss", TinyTinyRSSLogo], 14 | ["feedly", FeedlyLogo], 15 | ]) 16 | -------------------------------------------------------------------------------- /.prettierrc.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * @type {import('prettier').Options} 3 | */ 4 | export default { 5 | printWidth: 80, 6 | tabWidth: 2, 7 | useTabs: false, 8 | semi: false, 9 | singleQuote: false, 10 | trailingComma: "none", 11 | bracketSpacing: true, 12 | bracketSameLine: true, 13 | plugins: ["@ianvs/prettier-plugin-sort-imports"], 14 | importOrder: [ 15 | "", // Node.js built-in modules 16 | "", // Imports not matched by other special words or groups. 17 | "", // Empty line 18 | "^@plasmo/(.*)$", 19 | "", 20 | "^@plasmohq/(.*)$", 21 | "", 22 | "^~(.*)$", 23 | "", 24 | "^[./]", 25 | ], 26 | } 27 | -------------------------------------------------------------------------------- /src/tabs/offscreen.tsx: -------------------------------------------------------------------------------- 1 | import { useRef } from "react" 2 | 3 | import { sendToBackground } from "@plasmohq/messaging" 4 | 5 | window.addEventListener("message", (event) => { 6 | if (event.data?.name.startsWith("response")) { 7 | chrome.runtime.sendMessage(event.data) 8 | sendToBackground(event.data) 9 | } 10 | }) 11 | 12 | function OffscreenPage() { 13 | const iframeRef = useRef(null) 14 | 15 | chrome.runtime.onMessage.addListener((msg) => { 16 | iframeRef.current?.contentWindow?.postMessage(msg.data, "*") 17 | }) 18 | 19 | return ( 20 | 21 | ) 22 | } 23 | 24 | export default OffscreenPage 25 | -------------------------------------------------------------------------------- /src/lib/components/Label.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import { cva, type VariantProps } from "class-variance-authority" 4 | import * as React from "react" 5 | 6 | import * as LabelPrimitive from "@radix-ui/react-label" 7 | 8 | import { cn } from "~/lib/utils" 9 | 10 | const labelVariants = cva( 11 | "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", 12 | ) 13 | 14 | const Label = React.forwardRef< 15 | React.ElementRef, 16 | React.ComponentPropsWithoutRef & 17 | VariantProps 18 | >(({ className, ...props }, ref) => ( 19 | 24 | )) 25 | Label.displayName = LabelPrimitive.Root.displayName 26 | 27 | export { Label } 28 | -------------------------------------------------------------------------------- /src/options/index.tsx: -------------------------------------------------------------------------------- 1 | import "~/lib/style.css" 2 | 3 | import { Toaster } from "react-hot-toast" 4 | import { MemoryRouter } from "react-router" 5 | 6 | import { useDark } from "~/lib/hooks/use-dark" 7 | import { Routing } from "~/options/routes" 8 | 9 | import Siderbar from "./Siderbar" 10 | 11 | function Options() { 12 | useDark() 13 | return ( 14 |
15 | 20 | 21 |
22 | 23 |
24 | 25 |
26 |
27 |
28 |
29 | ) 30 | } 31 | 32 | export default Options 33 | -------------------------------------------------------------------------------- /src/lib/offscreen.ts: -------------------------------------------------------------------------------- 1 | // https://developer.chrome.com/docs/extensions/reference/api/offscreen 2 | let creating 3 | async function setupOffscreenDocument(path) { 4 | const offscreenUrl = chrome.runtime.getURL(path) 5 | // @ts-ignore 6 | const existingContexts = await chrome.runtime.getContexts({ 7 | contextTypes: ["OFFSCREEN_DOCUMENT"], 8 | documentUrls: [offscreenUrl], 9 | }) 10 | 11 | if (existingContexts.length > 0) { 12 | return 13 | } 14 | 15 | if (creating) { 16 | await creating 17 | } else { 18 | creating = chrome.offscreen.createDocument({ 19 | url: chrome.runtime.getURL("tabs/offscreen.html"), 20 | reasons: [chrome.offscreen.Reason.IFRAME_SCRIPTING], 21 | justification: "Get RSS in the sandbox for enhanced security.", 22 | }) 23 | await creating 24 | creating = null 25 | } 26 | } 27 | 28 | export { setupOffscreenDocument } 29 | -------------------------------------------------------------------------------- /src/background/index.ts: -------------------------------------------------------------------------------- 1 | import { deleteCachedRSS, getRSS } from "./rss" 2 | import { initSchedule } from "./rules" 3 | import { initUpdateNotifications } from "./update-notifications" 4 | 5 | export {} 6 | 7 | chrome.tabs.onActivated.addListener((tab) => { 8 | chrome.tabs.get(tab.tabId, (info) => { 9 | if (info.url) { 10 | getRSS(tab.tabId, info.url) 11 | } 12 | }) 13 | }) 14 | 15 | chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => { 16 | if (tab.active) { 17 | if (changeInfo.url) { 18 | deleteCachedRSS(tabId) 19 | getRSS(tabId, changeInfo.url) 20 | } else if (changeInfo.status === "loading") { 21 | deleteCachedRSS(tabId) 22 | } else if (changeInfo.status === "complete") { 23 | getRSS(tabId, tab.url) 24 | } 25 | } 26 | }) 27 | 28 | chrome.tabs.onRemoved.addListener((tabId) => { 29 | deleteCachedRSS(tabId) 30 | }) 31 | 32 | initSchedule() 33 | initUpdateNotifications() 34 | -------------------------------------------------------------------------------- /src/lib/components/Input.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | 3 | import { cn } from "~/lib/utils" 4 | 5 | export interface InputProps 6 | extends React.InputHTMLAttributes {} 7 | 8 | const Input = React.forwardRef( 9 | ({ className, type, ...props }, ref) => { 10 | return ( 11 | 20 | ) 21 | }, 22 | ) 23 | Input.displayName = "Input" 24 | 25 | export { Input } 26 | -------------------------------------------------------------------------------- /src/assets/inoreader.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 180x180 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/background/update-notifications.ts: -------------------------------------------------------------------------------- 1 | import RSSHubIcon from "data-base64:~/assets/icon.png" 2 | 3 | import { Storage } from "@plasmohq/storage" 4 | 5 | import info from "../../package.json" 6 | 7 | const storage = new Storage({ 8 | area: "local", 9 | }) 10 | 11 | export const initUpdateNotifications = async () => { 12 | const version = await storage.get("version") 13 | if (version === info.version) return 14 | 15 | chrome.notifications?.create("RSSHubRadarUpdate", { 16 | type: "basic", 17 | iconUrl: RSSHubIcon, 18 | title: version 19 | ? chrome.i18n.getMessage("extensionUpdateTip") 20 | : chrome.i18n.getMessage("extensionInstallTip"), 21 | message: `v${info.version}, ${chrome.i18n.getMessage("clickToViewChangeLog")}`, 22 | }) 23 | chrome.notifications?.onClicked.addListener((id) => { 24 | if (id === "RSSHubRadarUpdate") { 25 | chrome.tabs.create({ 26 | url: "https://github.com/DIYgod/RSSHub-Radar/releases", 27 | }) 28 | chrome.notifications?.clear("RSSHubRadarUpdate") 29 | } 30 | }) 31 | await storage.set("version", info.version) 32 | } 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 DIYgod 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/lib/report.ts: -------------------------------------------------------------------------------- 1 | function isSampled(rate) { 2 | const randomNumber = Math.floor(Math.random() * 100); 3 | return randomNumber < rate * 100; 4 | } 5 | 6 | function report({ 7 | url = "https://radar.rsshub", 8 | name, 9 | }: { 10 | url?: string 11 | name?: string 12 | }) { 13 | if ( 14 | process.env.PLASMO_PUBLIC_UMAMI_ID && 15 | process.env.PLASMO_PUBLIC_UMAMI_URL && 16 | (name || isSampled(parseFloat(process.env.PLASMO_PUBLIC_UMAMI_SAMPLE_RATE) || 0.01)) 17 | ) { 18 | let hostname = "" 19 | try { 20 | hostname = new URL(url).hostname 21 | } catch (error) {} 22 | 23 | const umamiData = { 24 | payload: { 25 | hostname, 26 | language: chrome?.i18n?.getUILanguage(), 27 | referrer: hostname, 28 | url: hostname, 29 | website: process.env.PLASMO_PUBLIC_UMAMI_ID, 30 | name: name, 31 | }, 32 | type: "event", 33 | } 34 | 35 | fetch(`${process.env.PLASMO_PUBLIC_UMAMI_URL}/api/send`, { 36 | method: "POST", 37 | headers: { 38 | "content-type": "application/json", 39 | }, 40 | body: JSON.stringify(umamiData), 41 | keepalive: true, 42 | }) 43 | } 44 | } 45 | 46 | export default report 47 | -------------------------------------------------------------------------------- /src/lib/components/Switch.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import * as React from "react" 4 | 5 | import * as SwitchPrimitives from "@radix-ui/react-switch" 6 | 7 | import { cn } from "~/lib/utils" 8 | 9 | const Switch = React.forwardRef< 10 | React.ElementRef, 11 | React.ComponentPropsWithoutRef 12 | >(({ className, ...props }, ref) => ( 13 | 21 | 26 | 27 | )) 28 | Switch.displayName = SwitchPrimitives.Root.displayName 29 | 30 | export { Switch } 31 | -------------------------------------------------------------------------------- /src/lib/utils.ts: -------------------------------------------------------------------------------- 1 | import { clsx, type ClassValue } from "clsx" 2 | import he from "he" 3 | import { twMerge } from "tailwind-merge" 4 | 5 | export function cn(...inputs: ClassValue[]) { 6 | return twMerge(clsx(inputs)) 7 | } 8 | 9 | export function removeFunctionFields(obj) { 10 | for (var key in obj) { 11 | if (typeof obj[key] === "function") { 12 | delete obj[key] 13 | } else if (typeof obj[key] === "object") { 14 | removeFunctionFields(obj[key]) 15 | } 16 | } 17 | } 18 | export function parseRSS(content: string) { 19 | content = content.replaceAll("<", "<").replaceAll(">", ">") 20 | if (content.includes("(.*)<\/title>/)?.[1] 22 | const title = titleContent 23 | ? he 24 | .decode(titleContent) 25 | ?.replace(//, (match, p1) => p1) 26 | ?.trim() 27 | : "" 28 | return { 29 | title, 30 | } 31 | } else { 32 | return null 33 | } 34 | } 35 | 36 | export async function fetchRSSContent(url: string) { 37 | let content 38 | try { 39 | content = await (await fetch(url)).text() 40 | } catch (error) { 41 | // TODO 42 | } 43 | return content 44 | } 45 | 46 | export function getRadarRulesUrl(rsshubDomain: string) { 47 | return `${rsshubDomain}/api/radar/rules` 48 | } 49 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | on: 4 | push: 5 | 6 | env: 7 | PLASMO_PUBLIC_UMAMI_ID: ${{ vars.PLASMO_PUBLIC_UMAMI_ID }} 8 | PLASMO_PUBLIC_UMAMI_URL: ${{ vars.PLASMO_PUBLIC_UMAMI_URL }} 9 | 10 | jobs: 11 | build: 12 | runs-on: macos-latest 13 | name: Build assets 14 | steps: 15 | - uses: actions/checkout@v4 16 | - name: Cache pnpm modules 17 | uses: actions/cache@v4 18 | with: 19 | path: ~/.pnpm-store 20 | key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} 21 | restore-keys: | 22 | ${{ runner.os }}- 23 | - uses: pnpm/action-setup@v3.0.0 24 | with: 25 | version: latest 26 | run_install: true 27 | - name: Use Node.js 22.x 28 | uses: actions/setup-node@v4.0.2 29 | with: 30 | node-version: 22.x 31 | cache: "pnpm" 32 | - name: Package the extension for Chrome 33 | run: pnpm build --zip 34 | - name: Package the extension for Firefox 35 | run: pnpm build:firefox --zip 36 | - name: Package the extension for Safari 37 | run: pnpm build:safari:zip 38 | - name: Archive production artifacts 39 | uses: actions/upload-artifact@v4 40 | with: 41 | name: build 42 | path: | 43 | build/safari-mv3-prod.zip 44 | build/chrome-mv3-prod.zip 45 | build/firefox-mv3-prod.zip 46 | -------------------------------------------------------------------------------- /.github/workflows/submit.yml: -------------------------------------------------------------------------------- 1 | name: "Submit to Web Store" 2 | on: 3 | workflow_dispatch: 4 | 5 | env: 6 | PLASMO_PUBLIC_UMAMI_ID: ${{ vars.PLASMO_PUBLIC_UMAMI_ID }} 7 | PLASMO_PUBLIC_UMAMI_URL: ${{ vars.PLASMO_PUBLIC_UMAMI_URL }} 8 | 9 | jobs: 10 | build: 11 | runs-on: macos-latest 12 | steps: 13 | - uses: actions/checkout@v4 14 | - name: Cache pnpm modules 15 | uses: actions/cache@v4 16 | with: 17 | path: ~/.pnpm-store 18 | key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} 19 | restore-keys: | 20 | ${{ runner.os }}- 21 | - uses: pnpm/action-setup@v3.0.0 22 | with: 23 | version: latest 24 | run_install: true 25 | - name: Use Node.js 22.x 26 | uses: actions/setup-node@v4.0.2 27 | with: 28 | node-version: 22.x 29 | cache: "pnpm" 30 | - name: Package the extension for Chrome 31 | run: pnpm build --zip 32 | - name: Package the extension for Firefox 33 | run: pnpm build:firefox --zip 34 | - name: Browser Platform Publish 35 | uses: PlasmoHQ/bpp@v3 36 | with: 37 | keys: ${{ secrets.SUBMIT_KEYS }} 38 | chrome-file: build/chrome-mv3-prod.zip 39 | edge-file: build/chrome-mv3-prod.zip 40 | firefox-file: build/firefox-mv3-prod.zip 41 | notes: "RSSHub Radar is an open source project, you can find the source code at https://github.com/DIYgod/RSSHub-Radar" 42 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: release 2 | 3 | on: 4 | push: 5 | tags: 6 | - "*" 7 | 8 | env: 9 | PLASMO_PUBLIC_UMAMI_ID: ${{ vars.PLASMO_PUBLIC_UMAMI_ID }} 10 | PLASMO_PUBLIC_UMAMI_URL: ${{ vars.PLASMO_PUBLIC_UMAMI_URL }} 11 | 12 | jobs: 13 | build: 14 | runs-on: macos-latest 15 | name: Build assets 16 | steps: 17 | - uses: actions/checkout@v4 18 | - name: Cache pnpm modules 19 | uses: actions/cache@v4 20 | with: 21 | path: ~/.pnpm-store 22 | key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} 23 | restore-keys: | 24 | ${{ runner.os }}- 25 | - uses: pnpm/action-setup@v3.0.0 26 | with: 27 | version: latest 28 | run_install: true 29 | - name: Use Node.js 22.x 30 | uses: actions/setup-node@v4.0.2 31 | with: 32 | node-version: 22.x 33 | cache: "pnpm" 34 | - name: Package the extension for Chrome 35 | run: pnpm build --zip 36 | - name: Package the extension for Firefox 37 | run: pnpm build:firefox --zip 38 | - name: Package the extension for Safari 39 | run: pnpm build:safari:zip 40 | - name: Upload file 41 | uses: xresloader/upload-to-github-release@v1 42 | env: 43 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 44 | with: 45 | file: "build/chrome-mv3-prod.zip;build/firefox-mv3-prod.zip;build/safari-mv3-prod.zip" 46 | tags: true 47 | draft: false 48 | -------------------------------------------------------------------------------- /src/lib/rules.ts: -------------------------------------------------------------------------------- 1 | import _ from "lodash" 2 | 3 | import MD5 from "md5.js" 4 | import { getConfig } from "./config" 5 | import { defaultRules } from "./radar-rules" 6 | import type { Rules } from "./types" 7 | import { getRadarRulesUrl } from "./utils" 8 | 9 | export function parseRules(rules: string, forceJSON?: boolean) { 10 | let incomeRules = rules 11 | if (incomeRules) { 12 | if (typeof rules === "string") { 13 | try { 14 | incomeRules = JSON.parse(rules) 15 | } catch (error) {} 16 | } 17 | } 18 | return _.mergeWith(defaultRules, incomeRules, (objValue, srcValue) => { 19 | if (_.isFunction(srcValue)) { 20 | return srcValue 21 | } else if (_.isFunction(objValue)) { 22 | return objValue 23 | } 24 | }) as Rules 25 | } 26 | 27 | export function getRulesCount(rules: Rules) { 28 | let index = 0 29 | Object.keys(rules).map((key) => { 30 | const rule = rules[key] 31 | Object.keys(rule).map((item) => { 32 | if (Array.isArray(rule[item])) { 33 | index += rule[item].length 34 | } 35 | }) 36 | }) 37 | return index 38 | } 39 | 40 | export function getRemoteRules() { 41 | return new Promise(async (resolve, reject) => { 42 | const config = await getConfig() 43 | try { 44 | let url = getRadarRulesUrl(config.rsshubDomain) 45 | 46 | if (config.rsshubAccessControl.accessKey) { 47 | const path = new URL(url).pathname 48 | const code = new MD5().update(path + config.rsshubAccessControl.accessKey).digest("hex") 49 | url = `${url}?code=${code}` 50 | } 51 | 52 | const res = await fetch(url) 53 | resolve(res.text()) 54 | } catch (error) { 55 | reject(error) 56 | } 57 | }) 58 | } -------------------------------------------------------------------------------- /src/lib/style.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | :root { 6 | --background: 0 0% 100%; 7 | --foreground: 20 14.3% 4.1%; 8 | --card: 0 0% 100%; 9 | --card-foreground: 20 14.3% 4.1%; 10 | --popover: 0 0% 100%; 11 | --popover-foreground: 20 14.3% 4.1%; 12 | --primary: 24.6 95% 53.1%; 13 | --primary-foreground: 60 9.1% 97.8%; 14 | --secondary: 60 4.8% 95.9%; 15 | --secondary-foreground: 24 9.8% 10%; 16 | --muted: 60 4.8% 95.9%; 17 | --muted-foreground: 25 5.3% 44.7%; 18 | --accent: 60 4.8% 95.9%; 19 | --accent-foreground: 24 9.8% 10%; 20 | --destructive: 0 84.2% 60.2%; 21 | --destructive-foreground: 60 9.1% 97.8%; 22 | --border: 20 5.9% 90%; 23 | --input: 20 5.9% 90%; 24 | --ring: 24.6 95% 53.1%; 25 | --radius: 0.5rem; 26 | } 27 | 28 | .dark { 29 | --background: 20 14.3% 4.1%; 30 | --foreground: 60 9.1% 97.8%; 31 | --card: 20 14.3% 4.1%; 32 | --card-foreground: 60 9.1% 97.8%; 33 | --popover: 20 14.3% 4.1%; 34 | --popover-foreground: 60 9.1% 97.8%; 35 | --primary: 20.5 90.2% 48.2%; 36 | --primary-foreground: 60 9.1% 97.8%; 37 | --secondary: 12 6.5% 15.1%; 38 | --secondary-foreground: 60 9.1% 97.8%; 39 | --muted: 12 6.5% 15.1%; 40 | --muted-foreground: 24 5.4% 63.9%; 41 | --accent: 12 6.5% 15.1%; 42 | --accent-foreground: 60 9.1% 97.8%; 43 | --destructive: 0 72.2% 50.6%; 44 | --destructive-foreground: 60 9.1% 97.8%; 45 | --border: 12 6.5% 15.1%; 46 | --input: 12 6.5% 15.1%; 47 | --ring: 20.5 90.2% 48.2%; 48 | } 49 | 50 | .dark { 51 | color-scheme: dark; 52 | } 53 | 54 | * { 55 | @apply border-border; 56 | } 57 | body { 58 | @apply bg-background text-foreground; 59 | } 60 | 61 | .content a { 62 | @apply underline text-primary; 63 | } 64 | -------------------------------------------------------------------------------- /src/lib/config.ts: -------------------------------------------------------------------------------- 1 | import _ from "lodash" 2 | import toast from "react-hot-toast" 3 | 4 | import { Storage } from "@plasmohq/storage" 5 | 6 | const storage = new Storage() 7 | 8 | export const defaultConfig = { 9 | rsshubDomain: "https://rsshub.app", 10 | rsshubAccessControl: { 11 | accessKey: "", 12 | accessKeyType: "code", 13 | }, 14 | notice: { 15 | badge: true, 16 | }, 17 | submitto: { 18 | ttrss: false, 19 | ttrssDomain: "", 20 | checkchan: false, 21 | checkchanBase: "", 22 | miniflux: false, 23 | minifluxDomain: "", 24 | freshrss: false, 25 | freshrssDomain: "", 26 | nextcloudnews: false, 27 | nextcloudnewsDomain: "", 28 | feedly: false, 29 | inoreader: true, 30 | inoreaderDomain: "https://www.inoreader.com", 31 | feedbin: false, 32 | feedbinDomain: "https://feedbin.com", 33 | theoldreader: false, 34 | qireaderDomain: "https://www.qireader.com", 35 | feedspub: false, 36 | bazqux: false, 37 | local: false, 38 | follow: true, 39 | }, 40 | refreshTimeout: 2 * 60 * 60, 41 | } 42 | 43 | export async function getConfig() { 44 | let storagedConfig = {} 45 | try { 46 | storagedConfig = await storage.get("config") 47 | } catch (error) {} 48 | return _.merge({}, defaultConfig, storagedConfig) as typeof defaultConfig 49 | } 50 | 51 | let toastId: string | undefined 52 | export async function setConfig(config: Partial) { 53 | let storagedConfig = {} 54 | try { 55 | storagedConfig = await storage.get("config") 56 | } catch (error) {} 57 | config = _.merge({}, storagedConfig, config) 58 | await storage.set("config", config) 59 | toastId = toast.success("Saved", { 60 | id: toastId, 61 | }) 62 | return config 63 | } 64 | -------------------------------------------------------------------------------- /src/background/rules.ts: -------------------------------------------------------------------------------- 1 | import { Storage } from "@plasmohq/storage" 2 | 3 | import { getConfig } from "~/lib/config" 4 | import { setupOffscreenDocument } from "~/lib/offscreen" 5 | import { getRemoteRules } from "~/lib/rules" 6 | import { getDisplayedRules as sandboxGetDisplayedRules } from "~/sandboxes" 7 | 8 | const storage = new Storage({ 9 | area: "local", 10 | }) 11 | 12 | export const refreshRules = async () => { 13 | const rules = await getRemoteRules() 14 | await storage.set("rules", rules) 15 | if (chrome.offscreen && chrome.runtime.getContexts) { 16 | await setupOffscreenDocument("tabs/offscreen.html") 17 | chrome.runtime.sendMessage({ 18 | target: "offscreen", 19 | data: { 20 | name: "requestDisplayedRules", 21 | body: { 22 | rules, 23 | }, 24 | }, 25 | }) 26 | } else { 27 | const displayedRules = sandboxGetDisplayedRules(rules) 28 | setDisplayedRules(displayedRules) 29 | } 30 | return rules 31 | } 32 | 33 | export const getDisplayedRules = () => storage.get("displayedRules") 34 | 35 | export const setDisplayedRules = (displayedRules) => 36 | storage.set("displayedRules", displayedRules) 37 | 38 | chrome.alarms.onAlarm.addListener((alarm) => { 39 | if (alarm.name === "refreshRulesAlarm") { 40 | refreshRules() 41 | } 42 | }) 43 | 44 | export async function initSchedule() { 45 | const config = await getConfig() 46 | const rules = await storage.get("rules") 47 | if (!rules) { 48 | setTimeout(() => { 49 | refreshRules() 50 | }, 60 * 1000) 51 | } 52 | 53 | const alarm = await chrome.alarms.get("refreshRulesAlarm") 54 | if (!alarm) { 55 | chrome.alarms.create("refreshRulesAlarm", { 56 | periodInMinutes: config.refreshTimeout / 60, 57 | }) 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/lib/hooks/use-dark.ts: -------------------------------------------------------------------------------- 1 | import { useLocalStorage } from "foxact/use-local-storage" 2 | import { useEffect, useMemo, useSyncExternalStore } from "react" 3 | 4 | const query = "(prefers-color-scheme: dark)" 5 | 6 | function getSnapshot() { 7 | return window.matchMedia(query).matches 8 | } 9 | 10 | function getServerSnapshot(): undefined { 11 | return undefined 12 | } 13 | 14 | function subscribe(callback: () => void) { 15 | const matcher = window.matchMedia(query) 16 | matcher.addEventListener("change", callback) 17 | return () => { 18 | matcher.removeEventListener("change", callback) 19 | } 20 | } 21 | 22 | function useSystemDark() { 23 | return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) 24 | } 25 | 26 | const themeOptions = ["system", "light", "dark"] as const 27 | export type Theme = (typeof themeOptions)[number] 28 | 29 | function isDarkMode(setting?: Theme | null, isSystemDark?: boolean) { 30 | return setting === "dark" || (isSystemDark && setting !== "light") 31 | } 32 | 33 | export function useDark(themeKey = "use-dark") { 34 | const [theme, setTheme] = useLocalStorage(themeKey, "system") 35 | const isSystemDark = useSystemDark() 36 | 37 | const isDark = useMemo( 38 | () => isDarkMode(theme, isSystemDark), 39 | [isSystemDark, theme], 40 | ) 41 | 42 | const toggleDark = () => { 43 | if (theme === "system") { 44 | setTheme(isSystemDark ? "light" : "dark") 45 | } else { 46 | setTheme("system") 47 | } 48 | } 49 | 50 | useEffect(() => { 51 | const isDark = isDarkMode(theme, isSystemDark) 52 | if (isDark) { 53 | document.documentElement.classList.toggle("dark", true) 54 | } else { 55 | document.documentElement.classList.toggle("dark", false) 56 | } 57 | 58 | if ( 59 | (theme === "dark" && isSystemDark) || 60 | (theme === "light" && !isSystemDark) 61 | ) { 62 | setTheme("system") 63 | } 64 | }, [theme, isSystemDark, setTheme]) 65 | 66 | return { isDark, toggleDark } 67 | } 68 | -------------------------------------------------------------------------------- /src/lib/components/Button.tsx: -------------------------------------------------------------------------------- 1 | import { cva, type VariantProps } from "class-variance-authority" 2 | import * as React from "react" 3 | 4 | import { Slot } from "@radix-ui/react-slot" 5 | 6 | import { cn } from "~/lib/utils" 7 | 8 | const buttonVariants = cva( 9 | "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", 10 | { 11 | variants: { 12 | variant: { 13 | default: "bg-primary text-primary-foreground hover:bg-primary/90", 14 | destructive: 15 | "bg-destructive text-destructive-foreground hover:bg-destructive/90", 16 | outline: 17 | "border border-input bg-background hover:bg-accent hover:text-accent-foreground", 18 | secondary: 19 | "bg-secondary text-secondary-foreground hover:bg-secondary/80", 20 | ghost: "hover:bg-accent hover:text-accent-foreground", 21 | link: "text-primary underline-offset-4 hover:underline", 22 | rss: "text-white bg-primary", 23 | }, 24 | size: { 25 | default: "h-10 px-4 py-2", 26 | sm: "h-8 rounded-md px-2", 27 | lg: "h-11 rounded-md px-8", 28 | icon: "h-10 w-10", 29 | }, 30 | }, 31 | defaultVariants: { 32 | variant: "default", 33 | size: "default", 34 | }, 35 | }, 36 | ) 37 | 38 | export interface ButtonProps 39 | extends React.ButtonHTMLAttributes, 40 | VariantProps { 41 | asChild?: boolean 42 | } 43 | 44 | const Button = React.forwardRef( 45 | ({ className, variant, size, asChild = false, ...props }, ref) => { 46 | const Comp = asChild ? Slot : "button" 47 | return ( 48 | 53 | ) 54 | }, 55 | ) 56 | Button.displayName = "Button" 57 | 58 | export { Button, buttonVariants } 59 | -------------------------------------------------------------------------------- /src/lib/components/Card.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | 3 | import { cn } from "~/lib/utils" 4 | 5 | const Card = React.forwardRef< 6 | HTMLDivElement, 7 | React.HTMLAttributes 8 | >(({ className, ...props }, ref) => ( 9 |
17 | )) 18 | Card.displayName = "Card" 19 | 20 | const CardHeader = React.forwardRef< 21 | HTMLDivElement, 22 | React.HTMLAttributes 23 | >(({ className, ...props }, ref) => ( 24 |
29 | )) 30 | CardHeader.displayName = "CardHeader" 31 | 32 | const CardTitle = React.forwardRef< 33 | HTMLParagraphElement, 34 | React.HTMLAttributes 35 | >(({ className, ...props }, ref) => ( 36 |

44 | )) 45 | CardTitle.displayName = "CardTitle" 46 | 47 | const CardDescription = React.forwardRef< 48 | HTMLParagraphElement, 49 | React.HTMLAttributes 50 | >(({ className, ...props }, ref) => ( 51 |

56 | )) 57 | CardDescription.displayName = "CardDescription" 58 | 59 | const CardContent = React.forwardRef< 60 | HTMLDivElement, 61 | React.HTMLAttributes 62 | >(({ className, ...props }, ref) => ( 63 |

64 | )) 65 | CardContent.displayName = "CardContent" 66 | 67 | const CardFooter = React.forwardRef< 68 | HTMLDivElement, 69 | React.HTMLAttributes 70 | >(({ className, ...props }, ref) => ( 71 |
76 | )) 77 | CardFooter.displayName = "CardFooter" 78 | 79 | export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } 80 | -------------------------------------------------------------------------------- /src/lib/components/Accordion.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import { ChevronDown } from "lucide-react" 4 | import * as React from "react" 5 | 6 | import * as AccordionPrimitive from "@radix-ui/react-accordion" 7 | 8 | import { cn } from "~/lib/utils" 9 | 10 | const Accordion = AccordionPrimitive.Root 11 | 12 | const AccordionItem = React.forwardRef< 13 | React.ElementRef, 14 | React.ComponentPropsWithoutRef 15 | >(({ className, ...props }, ref) => ( 16 | 21 | )) 22 | AccordionItem.displayName = "AccordionItem" 23 | 24 | const AccordionTrigger = React.forwardRef< 25 | React.ElementRef, 26 | React.ComponentPropsWithoutRef 27 | >(({ className, children, ...props }, ref) => ( 28 | 29 | svg]:rotate-180", 33 | className, 34 | )} 35 | {...props} 36 | > 37 | {children} 38 | 39 | 40 | 41 | )) 42 | AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName 43 | 44 | const AccordionContent = React.forwardRef< 45 | React.ElementRef, 46 | React.ComponentPropsWithoutRef 47 | >(({ className, children, ...props }, ref) => ( 48 | 53 |
{children}
54 |
55 | )) 56 | 57 | AccordionContent.displayName = AccordionPrimitive.Content.displayName 58 | 59 | export { Accordion, AccordionItem, AccordionTrigger, AccordionContent } 60 | -------------------------------------------------------------------------------- /src/popup/index.tsx: -------------------------------------------------------------------------------- 1 | import "~/lib/style.css" 2 | 3 | import { useEffect, useState } from "react" 4 | 5 | import { sendToBackground } from "@plasmohq/messaging" 6 | 7 | import { useDark } from "~/lib/hooks/use-dark" 8 | import report from "~/lib/report" 9 | 10 | import RSSList from "./RSSList" 11 | 12 | function IndexPopup() { 13 | useDark() 14 | 15 | const [data, setData] = useState({ 16 | pageRSS: [], 17 | pageRSSHub: [], 18 | websiteRSSHub: [], 19 | }) 20 | useEffect(() => { 21 | sendToBackground({ 22 | name: "popupReady", 23 | }).then((res) => { 24 | setData( 25 | Object.assign( 26 | { 27 | pageRSS: [], 28 | pageRSSHub: [], 29 | websiteRSSHub: [], 30 | }, 31 | res, 32 | ), 33 | ) 34 | }) 35 | 36 | chrome.tabs.query( 37 | { 38 | active: true, 39 | }, 40 | ([tab]) => { 41 | report({ 42 | url: tab.url, 43 | name: "popup", 44 | }) 45 | }, 46 | ) 47 | }, []) 48 | 49 | return ( 50 |
51 | 56 | 57 | 58 | {!data.pageRSS.length && 59 | !data.pageRSSHub.length && 60 | !data.websiteRSSHub.length && ( 61 |
62 |

63 | ( ´・・)ノ(._.`) {chrome.i18n.getMessage("RSSNotFound")} 64 |

65 |

70 |
71 | )} 72 | 73 | 74 | 75 |
76 | ) 77 | } 78 | 79 | export default IndexPopup 80 | -------------------------------------------------------------------------------- /src/options/routes/About.tsx: -------------------------------------------------------------------------------- 1 | import { useEffect } from "react" 2 | 3 | import { Card, CardContent } from "~/lib/components/Card" 4 | import report from "~/lib/report" 5 | 6 | function About() { 7 | useEffect(() => { 8 | report({ 9 | name: "options-about", 10 | }) 11 | }, []) 12 | 13 | return ( 14 |
15 |

16 | {chrome.i18n.getMessage("about")} 17 |

18 |
19 | 20 | 21 |

26 |

31 |

32 | {chrome.i18n.getMessage("updateLog")}:{" "} 33 | 37 | https://github.com/DIYgod/RSSHub-Radar/releases 38 | 39 |

40 |

41 | {chrome.i18n.getMessage("questionFeedback")}:{" "} 42 | 46 | https://github.com/DIYgod/RSSHub-radar/issues 47 | 48 |

49 |

50 | 🐱 GitHub:{" "} 51 | 52 | https://github.com/DIYgod/RSSHub-Radar 53 | 54 |

55 |

60 |

 

61 |

62 | Made with by{" "} 63 | 64 | DIYgod 65 | 66 |

67 |
68 |
69 |
70 |
71 | ) 72 | } 73 | 74 | export { About } 75 | -------------------------------------------------------------------------------- /src/sandboxes/index.ts: -------------------------------------------------------------------------------- 1 | import { getPageRSSHub, getWebsiteRSSHub } from "~/lib/rsshub" 2 | import { parseRules } from "~/lib/rules" 3 | import { removeFunctionFields } from "~/lib/utils" 4 | 5 | export {} 6 | 7 | export const getRSSHub = ({ 8 | html, 9 | url, 10 | rules, 11 | }: { 12 | html: string 13 | url: string 14 | rules: string 15 | }) => { 16 | const pageRSSHub = getPageRSSHub({ 17 | html, 18 | url, 19 | rules, 20 | }) 21 | const websiteRSSHub = getWebsiteRSSHub({ 22 | url, 23 | rules, 24 | }) 25 | return { 26 | pageRSSHub, 27 | websiteRSSHub, 28 | } 29 | } 30 | 31 | export const getDisplayedRules = (rules: string) => { 32 | const displayedRules = parseRules(rules) 33 | removeFunctionFields(displayedRules) 34 | return displayedRules 35 | } 36 | 37 | if (typeof window !== "undefined") { 38 | window.addEventListener( 39 | "message", 40 | ( 41 | event: MessageEvent< 42 | | { 43 | name: "requestRSSHub" 44 | body: { 45 | html: string 46 | url: string 47 | rules: string 48 | tabId: number 49 | } 50 | } 51 | | { 52 | name: "requestDisplayedRules" 53 | body: { 54 | rules: string 55 | } 56 | } 57 | >, 58 | ) => { 59 | switch (event.data?.name) { 60 | case "requestRSSHub": { 61 | const rsshub = getRSSHub({ 62 | html: event.data.body.html, 63 | url: event.data.body.url, 64 | rules: event.data.body.rules, 65 | }) 66 | event.source.postMessage( 67 | { 68 | name: "responseRSS", 69 | body: { 70 | url: "url" in event.data.body && event.data.body.url, 71 | tabId: "tabId" in event.data.body && event.data.body.tabId, 72 | rss: rsshub, 73 | }, 74 | }, 75 | event.origin as any, 76 | ) 77 | break 78 | } 79 | case "requestDisplayedRules": { 80 | const displayedRules = getDisplayedRules(event.data.body.rules) 81 | event.source.postMessage( 82 | { 83 | name: "responseDisplayedRules", 84 | body: { 85 | displayedRules, 86 | }, 87 | }, 88 | event.origin as any, 89 | ) 90 | break 91 | } 92 | } 93 | }, 94 | ) 95 | } 96 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rsshub-radar", 3 | "displayName": "RSSHub Radar", 4 | "version": "2.1.1", 5 | "description": "__MSG_extensionDescription__", 6 | "author": "DIYgod", 7 | "packageManager": "pnpm@9.12.3", 8 | "scripts": { 9 | "dev": "plasmo dev --no-cs-reload", 10 | "build": "plasmo build", 11 | "dev:firefox": "plasmo dev --target=firefox-mv3 --no-cs-reload", 12 | "build:firefox": "plasmo build --target=firefox-mv3", 13 | "build:safari": "plasmo build --target=safari-mv3", 14 | "safari-convert": "xcrun safari-web-extension-converter build/safari-mv3-prod --project-location build --bundle-identifier app.rsshub.RSSHub-Radar --force", 15 | "safari-zip": "zip -r build/safari-mv3-prod.zip \"build/RSSHub Radar\"", 16 | "build:safari:zip": "npm run build:safari && npm run safari-convert && npm run safari-zip", 17 | "package": "plasmo package", 18 | "prepare": "husky install" 19 | }, 20 | "dependencies": { 21 | "@iconify-json/mingcute": "^1.2.3", 22 | "@plasmohq/messaging": "^0.6.2", 23 | "@plasmohq/storage": "^1.13.0", 24 | "@radix-ui/react-accordion": "^1.2.3", 25 | "@radix-ui/react-dialog": "1.1.6", 26 | "@radix-ui/react-label": "^2.1.2", 27 | "@radix-ui/react-slot": "^1.1.2", 28 | "@radix-ui/react-switch": "^1.1.3", 29 | "async-lock": "^1.4.1", 30 | "class-variance-authority": "^0.7.1", 31 | "clsx": "^2.1.1", 32 | "foxact": "^0.2.44", 33 | "he": "1.2.0", 34 | "lodash": "^4.17.21", 35 | "lucide-react": "^0.475.0", 36 | "md5.js": "^1.3.5", 37 | "plasmo": "0.89.4", 38 | "react": "18.3.1", 39 | "react-dom": "18.3.1", 40 | "react-hot-toast": "^2.5.1", 41 | "react-router": "^7.1.5", 42 | "route-recognizer": "^0.3.4", 43 | "rss-parser": "3.13.0", 44 | "tailwind-merge": "^2.5.3", 45 | "tailwindcss-animate": "^1.0.7", 46 | "tldts": "^6.1.76", 47 | "usehooks-ts": "^3.1.1", 48 | "xss": "1.0.15" 49 | }, 50 | "devDependencies": { 51 | "@egoist/tailwindcss-icons": "^1.9.0", 52 | "@ianvs/prettier-plugin-sort-imports": "4.4.1", 53 | "@types/chrome": "^0.0.303", 54 | "@types/node": "22.13.1", 55 | "@types/react": "18.3.11", 56 | "@types/react-dom": "18.3.1", 57 | "autoprefixer": "^10.4.20", 58 | "husky": "9.1.7", 59 | "lint-staged": "15.4.3", 60 | "postcss": "^8.4.47", 61 | "prettier": "3.4.2", 62 | "prettier-package-json": "2.8.0", 63 | "shadcn-ui": "^0.9.4", 64 | "tailwindcss": "^3.4.13", 65 | "typescript": "5.7.3" 66 | }, 67 | "lint-staged": { 68 | "**/*": "prettier --write --ignore-unknown" 69 | }, 70 | "manifest": { 71 | "default_locale": "en", 72 | "host_permissions": [ 73 | "https://*/*" 74 | ], 75 | "permissions": [ 76 | "tabs", 77 | "offscreen", 78 | "storage", 79 | "alarms" 80 | ], 81 | "optional_permissions": [ 82 | "notifications" 83 | ], 84 | "browser_specific_settings": { 85 | "gecko": { 86 | "id": "i@diygod.me" 87 | } 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /src/lib/components/Pagination.tsx: -------------------------------------------------------------------------------- 1 | import { ChevronLeft, ChevronRight, MoreHorizontal } from "lucide-react" 2 | import * as React from "react" 3 | 4 | import { Button, type ButtonProps } from "~/lib/components/Button" 5 | import { cn } from "~/lib/utils" 6 | 7 | const Pagination = ({ className, ...props }: React.ComponentProps<"nav">) => ( 8 |