feat(plugins): include plugin hash in sourceURL for caching

This commit is contained in:
amsyarasyiq 2024-05-10 02:18:01 +08:00
parent d6b47dee77
commit 926d875de7
2 changed files with 1 additions and 3 deletions

View file

@ -3,7 +3,6 @@ import { initFetchI18nStrings } from "@core/i18n";
import { initCorePlugins } from "@core/plugins";
import initSettings from "@core/ui/settings";
import { initVendettaObject } from "@core/vendettaObject";
import { patchAssets } from "@lib/api/assets";
import { patchCommands } from "@lib/api/commands";
import { injectFluxInterceptor } from "@lib/api/flux";
import { removeFile, writeFile } from "@lib/api/native/fs";
@ -41,7 +40,6 @@ export default async () => {
injectFluxInterceptor(),
patchSettings(),
patchLogHook(),
patchAssets(),
patchCommands(),
patchChatBackground(),
initVendettaObject(),

View file

@ -97,7 +97,7 @@ export async function evalPlugin(plugin: BunnyPlugin) {
},
logger: new logModule(`Bunny » ${plugin.manifest.name}`),
};
const pluginString = `vendetta=>{return ${plugin.js}}\n//# sourceURL=${plugin.id}`;
const pluginString = `vendetta=>{return ${plugin.js}}\n//# sourceURL=${plugin.id}?hash=${plugin.manifest.hash}`;
const raw = (0, eval)(pluginString)(vendettaForPlugins);
const ret = typeof raw === "function" ? raw() : raw;