feat: 浏览器扩展完全支持热更新

This commit is contained in:
2026-08-16 20:46:07 +08:00
parent 481518500e
commit 9568e7ac08
21 changed files with 558 additions and 94 deletions
+2 -2
View File
@@ -125,9 +125,9 @@ async function handleOpenFeature(item: ExtensionFeatureItem) {
? `远程脚本已校验(${item.version})`
: `已下载远程脚本(未配置 sha256)`;
await mountFeatureOnPage(item.id);
await mountFeatureOnPage(item.id, remote.code);
activeFeatureId.value = item.id;
statusText.value = `已打开:${item.name}`;
statusText.value = `已打开:${item.name}(远程脚本)`;
} catch (error) {
errorText.value = toUserMessage(error);
} finally {
+5 -2
View File
@@ -49,10 +49,13 @@ export async function getFloatingPanelState(): Promise<{ visible: boolean }> {
return sendToActiveTab<{ visible: boolean }>({ type: 'GET_FLOATING_PANEL_STATE' });
}
export async function mountFeatureOnPage(featureId: string): Promise<{ featureId: string | null }> {
export async function mountFeatureOnPage(
featureId: string,
code: string,
): Promise<{ featureId: string | null }> {
return sendToActiveTab<{ featureId: string | null }>({
type: 'MOUNT_FEATURE',
payload: { featureId },
payload: { featureId, code },
});
}