fix(frontend): 読み込み直後にプラグインによるノートの書き換えが行われない問題を修正

ブート時にプラグインがロードされるまで待機
Fix #16428
This commit is contained in:
syuilo 2025-08-20 15:57:20 +09:00
parent 4190c6cb8e
commit bdfe709319
3 changed files with 14 additions and 8 deletions

View File

@ -29,6 +29,7 @@ import { miLocalStorage } from '@/local-storage.js';
import { fetchCustomEmojis } from '@/custom-emojis.js';
import { prefer } from '@/preferences.js';
import { $i } from '@/i.js';
import { launchPlugins } from '@/plugin.js';
export async function common(createVue: () => Promise<App<Element>>) {
console.info(`Misskey v${version}`);
@ -338,6 +339,12 @@ export async function common(createVue: () => Promise<App<Element>>) {
});
}
try {
await launchPlugins();
} catch (error) {
console.error('Failed to launch plugins:', error);
}
app.mount(rootEl);
// boot.jsのやつを解除

View File

@ -26,7 +26,6 @@ import { mainRouter } from '@/router.js';
import { makeHotkey } from '@/utility/hotkey.js';
import { addCustomEmoji, removeCustomEmojis, updateCustomEmojis } from '@/custom-emojis.js';
import { prefer } from '@/preferences.js';
import { launchPlugins } from '@/plugin.js';
import { updateCurrentAccountPartial } from '@/accounts.js';
import { migrateOldSettings } from '@/pref-migrate.js';
import { unisonReload } from '@/utility/unison-reload.js';
@ -79,8 +78,6 @@ export async function mainBoot() {
}
}
launchPlugins();
try {
if (prefer.s.enableSeasonalScreenEffect) {
const month = new Date().getMonth() + 1;
@ -421,7 +418,7 @@ export async function mainBoot() {
}
},
allowRepeat: true,
}
},
} as const satisfies Keymap;
window.document.addEventListener('keydown', makeHotkey(keymap), { passive: false });

View File

@ -233,11 +233,13 @@ function addPluginHandler<K extends keyof HandlerDef>(installId: Plugin['install
}
export function launchPlugins() {
for (const plugin of prefer.s.plugins) {
return Promise.all(prefer.s.plugins.map(plugin => {
if (plugin.active) {
launchPlugin(plugin.installId);
}
return launchPlugin(plugin.installId);
} else {
return Promise.resolve();
}
}));
}
async function launchPlugin(id: Plugin['installId']): Promise<void> {
@ -292,7 +294,7 @@ async function launchPlugin(id: Plugin['installId']): Promise<void> {
pluginContexts.set(plugin.installId, aiscript);
const parser = await getParser();
aiscript.exec(parser.parse(plugin.src)).then(
await aiscript.exec(parser.parse(plugin.src)).then(
() => {
console.info('Plugin installed:', plugin.name, 'v' + plugin.version);
systemLog('Plugin started');