mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-11-10 04:46:07 -08:00
feat(plugins): add JavaScript plugin system with overlay panel (#303)
This commit is contained in:
1 parent
90fc7cf940
commit
a9a4c4f083
110 files changed
+5897
-344
No files matched your search
@@ -18,6 +18,7 @@ export const OVERLAY_HOSTED_MODALS = [
|
||||
'session-help',
|
||||
'character-dictionary',
|
||||
'changelog',
|
||||
'plugin-panel',
|
||||
] as const;
|
||||
export type OverlayHostedModal = (typeof OVERLAY_HOSTED_MODALS)[number];
|
||||
|
||||
@@ -160,6 +161,9 @@ export const IPC_CHANNELS = {
|
||||
lookupWindowToggleRequested: 'lookup-window-toggle:requested',
|
||||
sessionHelpOpen: 'session-help:open',
|
||||
changelogOpen: 'changelog:open',
|
||||
pluginPanelOpen: 'plugin-panel:open',
|
||||
pluginPanelUpdate: 'plugin-panel:update',
|
||||
pluginPanelClose: 'plugin-panel:close',
|
||||
characterDictionaryManagerOpen: 'character-dictionary:manager-open',
|
||||
controllerSelectOpen: 'controller-select:open',
|
||||
controllerDebugOpen: 'controller-debug:open',
|
||||
|
||||
@@ -50,6 +50,7 @@ const SESSION_ACTION_IDS: SessionActionId[] = [
|
||||
'replayCurrentSubtitle',
|
||||
'playNextSubtitle',
|
||||
'cycleRuntimeOption',
|
||||
'runPluginAction',
|
||||
];
|
||||
|
||||
const RUNTIME_OPTION_IDS: RuntimeOptionId[] = [
|
||||
@@ -111,6 +112,15 @@ function parseSessionActionPayload(
|
||||
};
|
||||
}
|
||||
|
||||
if (actionId === 'runPluginAction') {
|
||||
if (!isObject(value)) return null;
|
||||
if (Object.keys(value).some((key) => key !== 'pluginActionId')) return null;
|
||||
if (typeof value.pluginActionId !== 'string' || !value.pluginActionId.includes('/')) {
|
||||
return null;
|
||||
}
|
||||
return { pluginActionId: value.pluginActionId };
|
||||
}
|
||||
|
||||
return value === undefined ? undefined : null;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user