fix: no chrome.i18n in sandbox

This commit is contained in:
DIYgod 2024-01-31 00:00:48 +08:00
parent 87e868e12b
commit 1d7a7d04cb
No known key found for this signature in database
2 changed files with 5 additions and 2 deletions

View File

@ -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,
});

View File

@ -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);