fix(frontend): 読み込み直後にプラグインによるノートの書き換えが行われない問題を修正
ブート時にプラグインがロードされるまで待機 Fix #16428
This commit is contained in:
parent
4190c6cb8e
commit
bdfe709319
|
@ -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のやつを解除
|
||||
|
|
|
@ -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 });
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Reference in New Issue