summaryrefslogtreecommitdiff
path: root/packages/frontend/src/plugin.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/frontend/src/plugin.ts')
-rw-r--r--packages/frontend/src/plugin.ts37
1 files changed, 36 insertions, 1 deletions
diff --git a/packages/frontend/src/plugin.ts b/packages/frontend/src/plugin.ts
index 4d56be75b9..3639d628c2 100644
--- a/packages/frontend/src/plugin.ts
+++ b/packages/frontend/src/plugin.ts
@@ -7,8 +7,9 @@ import { ref, defineAsyncComponent } from 'vue';
import { Interpreter, Parser, utils, values } from '@syuilo/aiscript';
import { compareVersions } from 'compare-versions';
import { v4 as uuid } from 'uuid';
+import * as Misskey from 'misskey-js';
import { aiScriptReadline, createAiScriptEnv } from '@/aiscript/api.js';
-import { noteActions, notePostInterruptors, noteViewInterruptors, postFormActions, userActions, pageViewInterruptors, store } from '@/store.js';
+import { store } from '@/store.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/utility/misskey-api.js';
import { i18n } from '@/i18n.js';
@@ -36,6 +37,40 @@ export type AiScriptPluginMeta = {
config?: Record<string, any>;
};
+interface PostFormAction {
+ title: string,
+ handler: <T>(form: T, update: (key: unknown, value: unknown) => void) => void;
+}
+
+interface UserAction {
+ title: string,
+ handler: (user: Misskey.entities.UserDetailed) => void;
+}
+
+interface NoteAction {
+ title: string,
+ handler: (note: Misskey.entities.Note) => void;
+}
+
+interface NoteViewInterruptor {
+ handler: (note: Misskey.entities.Note) => unknown;
+}
+
+interface NotePostInterruptor {
+ handler: (note: FIXME) => unknown;
+}
+
+interface PageViewInterruptor {
+ handler: (page: Misskey.entities.Page) => unknown;
+}
+
+export const postFormActions: PostFormAction[] = [];
+export const userActions: UserAction[] = [];
+export const noteActions: NoteAction[] = [];
+export const noteViewInterruptors: NoteViewInterruptor[] = [];
+export const notePostInterruptors: NotePostInterruptor[] = [];
+export const pageViewInterruptors: PageViewInterruptor[] = [];
+
const parser = new Parser();
export function isSupportedAiScriptVersion(version: string): boolean {