summaryrefslogtreecommitdiff
path: root/packages/frontend/src/plugin.ts
diff options
context:
space:
mode:
authorsyuilo <4439005+syuilo@users.noreply.github.com>2025-03-09 17:02:46 +0900
committersyuilo <4439005+syuilo@users.noreply.github.com>2025-03-09 17:02:46 +0900
commit27e8805dcbddb73571c8d7fea79c852d9697a26b (patch)
treedf15036b486e20cb40e304a667b0e8314c79b3c3 /packages/frontend/src/plugin.ts
parentBump version to 2025.3.2-alpha.1 (diff)
downloadsharkey-27e8805dcbddb73571c8d7fea79c852d9697a26b.tar.gz
sharkey-27e8805dcbddb73571c8d7fea79c852d9697a26b.tar.bz2
sharkey-27e8805dcbddb73571c8d7fea79c852d9697a26b.zip
refactor(frontend): relocate plugin consts
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 {