Merge branch 'develop' into schedule-note
This commit is contained in:
commit
31d811f145
11
CHANGELOG.md
11
CHANGELOG.md
|
@ -12,6 +12,17 @@
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
## 2023.x.x (unreleased)
|
||||||
|
|
||||||
|
### General
|
||||||
|
-
|
||||||
|
|
||||||
|
### Client
|
||||||
|
-
|
||||||
|
|
||||||
|
### Server
|
||||||
|
- Fix: トークンのないプラグインをアンインストールするときにエラーが出ないように
|
||||||
|
|
||||||
## 2023.11.0
|
## 2023.11.0
|
||||||
|
|
||||||
### Note
|
### Note
|
||||||
|
|
|
@ -18,7 +18,7 @@ export const paramDef = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
tokenId: { type: 'string', format: 'misskey:id' },
|
tokenId: { type: 'string', format: 'misskey:id' },
|
||||||
token: { type: 'string' },
|
token: { type: 'string', nullable: true },
|
||||||
},
|
},
|
||||||
anyOf: [
|
anyOf: [
|
||||||
{ required: ['tokenId'] },
|
{ required: ['tokenId'] },
|
||||||
|
|
|
@ -58,7 +58,7 @@ export async function mainBoot() {
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const plugin of ColdDeviceStorage.get('plugins').filter(p => p.active)) {
|
for (const plugin of ColdDeviceStorage.get('plugins').filter(p => p.active)) {
|
||||||
import('../plugin').then(async ({ install }) => {
|
import('@/plugin.js').then(async ({ install }) => {
|
||||||
// Workaround for https://bugs.webkit.org/show_bug.cgi?id=242740
|
// Workaround for https://bugs.webkit.org/show_bug.cgi?id=242740
|
||||||
await new Promise(r => setTimeout(r, 0));
|
await new Promise(r => setTimeout(r, 0));
|
||||||
install(plugin);
|
install(plugin);
|
||||||
|
|
|
@ -202,11 +202,17 @@ let note = $ref(deepClone(props.note));
|
||||||
// plugin
|
// plugin
|
||||||
if (noteViewInterruptors.length > 0) {
|
if (noteViewInterruptors.length > 0) {
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
let result:Misskey.entities.Note | null = deepClone(note);
|
let result: Misskey.entities.Note | null = deepClone(note);
|
||||||
for (const interruptor of noteViewInterruptors) {
|
for (const interruptor of noteViewInterruptors) {
|
||||||
|
try {
|
||||||
result = await interruptor.handler(result);
|
result = await interruptor.handler(result);
|
||||||
|
if (result === null) {
|
||||||
if (result === null) return isDeleted.value = true;
|
isDeleted.value = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
note = result;
|
note = result;
|
||||||
});
|
});
|
||||||
|
@ -298,7 +304,7 @@ function renote(viaKeyboard = false) {
|
||||||
const { menu } = getRenoteMenu({ note: note, renoteButton, mock: props.mock });
|
const { menu } = getRenoteMenu({ note: note, renoteButton, mock: props.mock });
|
||||||
os.popupMenu(menu, renoteButton.value, {
|
os.popupMenu(menu, renoteButton.value, {
|
||||||
viaKeyboard,
|
viaKeyboard,
|
||||||
}).then(focus);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function reply(viaKeyboard = false): void {
|
function reply(viaKeyboard = false): void {
|
||||||
|
|
|
@ -239,11 +239,17 @@ let note = $ref(deepClone(props.note));
|
||||||
// plugin
|
// plugin
|
||||||
if (noteViewInterruptors.length > 0) {
|
if (noteViewInterruptors.length > 0) {
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
let result:Misskey.entities.Note | null = deepClone(note);
|
let result: Misskey.entities.Note | null = deepClone(note);
|
||||||
for (const interruptor of noteViewInterruptors) {
|
for (const interruptor of noteViewInterruptors) {
|
||||||
|
try {
|
||||||
result = await interruptor.handler(result);
|
result = await interruptor.handler(result);
|
||||||
|
if (result === null) {
|
||||||
if (result === null) return isDeleted.value = true;
|
isDeleted.value = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
note = result;
|
note = result;
|
||||||
});
|
});
|
||||||
|
@ -344,7 +350,7 @@ function renote(viaKeyboard = false) {
|
||||||
const { menu } = getRenoteMenu({ note: note, renoteButton });
|
const { menu } = getRenoteMenu({ note: note, renoteButton });
|
||||||
os.popupMenu(menu, renoteButton.value, {
|
os.popupMenu(menu, renoteButton.value, {
|
||||||
viaKeyboard,
|
viaKeyboard,
|
||||||
}).then(focus);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function reply(viaKeyboard = false): void {
|
function reply(viaKeyboard = false): void {
|
||||||
|
|
|
@ -769,7 +769,11 @@ async function post(ev?: MouseEvent) {
|
||||||
// plugin
|
// plugin
|
||||||
if (notePostInterruptors.length > 0) {
|
if (notePostInterruptors.length > 0) {
|
||||||
for (const interruptor of notePostInterruptors) {
|
for (const interruptor of notePostInterruptors) {
|
||||||
|
try {
|
||||||
postData = await interruptor.handler(deepClone(postData));
|
postData = await interruptor.handler(deepClone(postData));
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,10 +11,9 @@ import { Plugin, noteActions, notePostInterruptors, noteViewInterruptors, postFo
|
||||||
const parser = new Parser();
|
const parser = new Parser();
|
||||||
const pluginContexts = new Map<string, Interpreter>();
|
const pluginContexts = new Map<string, Interpreter>();
|
||||||
|
|
||||||
export function install(plugin: Plugin): void {
|
export async function install(plugin: Plugin): Promise<void> {
|
||||||
// 後方互換性のため
|
// 後方互換性のため
|
||||||
if (plugin.src == null) return;
|
if (plugin.src == null) return;
|
||||||
console.info('Plugin installed:', plugin.name, 'v' + plugin.version);
|
|
||||||
|
|
||||||
const aiscript = new Interpreter(createPluginEnv({
|
const aiscript = new Interpreter(createPluginEnv({
|
||||||
plugin: plugin,
|
plugin: plugin,
|
||||||
|
@ -42,7 +41,14 @@ export function install(plugin: Plugin): void {
|
||||||
|
|
||||||
initPlugin({ plugin, aiscript });
|
initPlugin({ plugin, aiscript });
|
||||||
|
|
||||||
aiscript.exec(parser.parse(plugin.src));
|
try {
|
||||||
|
await aiscript.exec(parser.parse(plugin.src));
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Plugin install failed:', plugin.name, 'v' + plugin.version);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.info('Plugin installed:', plugin.name, 'v' + plugin.version);
|
||||||
}
|
}
|
||||||
|
|
||||||
function createPluginEnv(opts: { plugin: Plugin; storageKey: string }): Record<string, values.Value> {
|
function createPluginEnv(opts: { plugin: Plugin; storageKey: string }): Record<string, values.Value> {
|
||||||
|
|
Loading…
Reference in New Issue