From 9f139e0f0377f9ae60ffddea4dd67e61126dccab Mon Sep 17 00:00:00 2001 From: DIYgod Date: Tue, 30 Jan 2024 21:14:52 +0800 Subject: [PATCH] fix: use json type rules for eval disabled browser --- src/lib/config.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/lib/config.ts b/src/lib/config.ts index 971735e..0dae784 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -4,6 +4,9 @@ import toast from "react-hot-toast" const storage = new Storage() +const enableFullRemoteRules = !(navigator.userAgent.match(/firefox/i) || (navigator.userAgent.match(/safari/i) && !navigator.userAgent.match(/chrome/i))) +const remoteRulesUrl = enableFullRemoteRules ? 'https://rsshub.js.org/build/radar-rules.js' : 'https://rsshub.js.org/build/radar-rules.json' + export const defaultConfig = { rsshubDomain: 'https://rsshub.app', rsshubAccessControl: { @@ -35,14 +38,8 @@ export const defaultConfig = { local: true, }, refreshTimeout: 2 * 60 * 60, - // typical UA: - // Firefox: Mozilla/5.0 (X11; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/99.0 - // Chromium/Chrome: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.88 Safari/537.36 - // Some Chromium: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/80.0.3987.87 Chrome/80.0.3987.87 Safari/537.36 - // Safari: Mozilla/5.0 (Macintosh; Intel Mac OS X 12_3_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.3 Safari/605.1.15 - // Edge: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 Edg/99.0.1150.36 - enableFullRemoteRules: !(navigator.userAgent.match(/firefox/i) || (navigator.userAgent.match(/safari/i) && !navigator.userAgent.match(/chrome/i))), - remoteRulesUrl: 'https://rsshub.js.org/build/radar-rules.js', + enableFullRemoteRules, + remoteRulesUrl, }; export async function getConfig() {