From 1d7a7d04cb753af252e06047739a50e978bd40f2 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Wed, 31 Jan 2024 00:00:48 +0800 Subject: [PATCH] fix: no chrome.i18n in sandbox --- src/lib/rsshub.ts | 4 ++-- src/popup/RSSItem.tsx | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib/rsshub.ts b/src/lib/rsshub.ts index 392eab0..386cb4e 100644 --- a/src/lib/rsshub.ts +++ b/src/lib/rsshub.ts @@ -146,13 +146,13 @@ export function getPageRSSHub(data: { (parsed) => { if (parsed) { result.push({ - title: formatBlank(rules[domain]._name ? chrome.i18n.getMessage('current') : '', rule[recog.handler].title), + title: formatBlank(rules[domain]._name ? 'Current' : '', rule[recog.handler].title), url: '{rsshubDomain}' + parsed, path: parsed, }); } else { result.push({ - title: formatBlank(rules[domain]._name ? chrome.i18n.getMessage('current') : '', rule[recog.handler].title), + title: formatBlank(rules[domain]._name ? 'Current' : '', rule[recog.handler].title), url: rule[recog.handler].docs, isDocs: true, }); diff --git a/src/popup/RSSItem.tsx b/src/popup/RSSItem.tsx index a9f8249..38815c1 100644 --- a/src/popup/RSSItem.tsx +++ b/src/popup/RSSItem.tsx @@ -33,6 +33,9 @@ function RSSItem({ if (type === 'currentPageRSSHub' && config.rsshubAccessControl.accessKey) { url = `${url}?code=${new MD5().update(item.path + config.rsshubAccessControl.accessKey).digest('hex')}` } + if (type === 'currentPageRSSHub') { + item.title = item.title.replace(/^Current/, chrome.i18n.getMessage('current')); + } url = encodeURI(url); const encodedUrl = encodeURIComponent(url);