diff --git a/src/localization/en/translation.json b/src/localization/en/translation.json index 7e72421b..2e008116 100644 --- a/src/localization/en/translation.json +++ b/src/localization/en/translation.json @@ -253,7 +253,7 @@ "RegExpName": "Update RegExp", "RegExpDesc": "Update RegExp rules from GitHub", "MusicFreeName": "MusicFree Plugins", - "MusicFreeDesc": "Enable MusicFree plugins", + "MusicFreeDesc": "Do NOT use, uve been warned.", "MusicFreeCheckTitle": "MusicFree Plugins", "R128GainName": "Update R18Gain", "R128GainDesc": "Update R18Gain rules from GitHub", diff --git a/src/localization/zhcn/translation.json b/src/localization/zhcn/translation.json index 8f5c3a44..875c7071 100644 --- a/src/localization/zhcn/translation.json +++ b/src/localization/zhcn/translation.json @@ -267,7 +267,7 @@ "RegExpName": "更新 RegExp", "RegExpDesc": "从 Github 更新 RegExp 规则", "MusicFreeName": "MusicFree 插件", - "MusicFreeDesc": "启用 MusicFree 插件", + "MusicFreeDesc": "不要使用 后果自负", "MusicFreeCheckTitle": "MusicFree 插件", "R128GainName": "更新 R18Gain", "R128GainDesc": "从 GitHub 更新 R18Gain 规则", diff --git a/src/utils/mfsdk.ts b/src/utils/mfsdk.ts index 4d3988b4..69aba83f 100644 --- a/src/utils/mfsdk.ts +++ b/src/utils/mfsdk.ts @@ -2,7 +2,7 @@ import { saveItem, getItem } from '@utils/ChromeStorageAPI'; import { StorageKeys } from '@enums/Storage'; import { readTxtFile, rmTxtFile, writeTxtFile } from '@utils/fs'; import logger from './Logger'; -import { loadEvalPlugin } from './mediafetch/evalsdk'; +import { loadEvalPlugin, MFsdk } from './mediafetch/evalsdk'; import bFetch from './BiliFetch'; const mfsdkSubFolder = 'mfsdk'; @@ -39,17 +39,22 @@ export const initMFsdk = async () => { return mfsdks.filter(v => v !== undefined); }; -export const fetchMFsdk = async (url: string) => { +export const fetchMFsdk = async (url: string): Promise => { try { const res = await bFetch(url); const text = await res.text(); + try { + const json = JSON.parse(text) as { plugins: { url: string }[] }; + const sdks = await Promise.all(json.plugins.map(p => fetchMFsdk(p.url))); + return sdks.flat(); + } catch {} const loadedSDK = loadEvalPlugin(text, url); const sdkLocalPath = `${loadedSDK.platform}.${loadedSDK.version}.js`; loadedSDK.path = sdkLocalPath; writeTxtFile(sdkLocalPath, [text], mfsdkSubFolder); return [loadedSDK]; - } catch { - logger.warn(`[mfsdk] failed to fetch and parse ${url}`); + } catch (e) { + logger.warn(`[mfsdk] failed to fetch and parse ${url}: ${e}`); } return []; };