mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-27 18:22:41 -08:00
refactor(main): move IPC runtime deps build to shared dependency mapper
This commit is contained in:
20
src/main.ts
20
src/main.ts
@@ -149,6 +149,9 @@ import { handleMpvCommandFromIpcRuntime } from "./main/ipc-mpv-command";
|
||||
import {
|
||||
registerIpcRuntimeServices,
|
||||
} from "./main/ipc-runtime";
|
||||
import {
|
||||
createAnkiJimakuIpcRuntimeServiceDeps,
|
||||
} from "./main/dependencies";
|
||||
import {
|
||||
handleCliCommandRuntimeServiceWithContext,
|
||||
} from "./main/cli-runtime";
|
||||
@@ -1317,8 +1320,7 @@ async function runSubsyncManualFromIpc(
|
||||
return runSubsyncManualFromIpcRuntime(request, getSubsyncRuntimeServiceParams());
|
||||
}
|
||||
|
||||
function buildIpcRuntimeServicesParams() {
|
||||
return {
|
||||
registerIpcRuntimeServices({
|
||||
runtimeOptions: {
|
||||
getRuntimeOptionsManager: () => appState.runtimeOptionsManager,
|
||||
showMpvOsd: (text: string) => showMpvOsd(text),
|
||||
@@ -1334,7 +1336,7 @@ function buildIpcRuntimeServicesParams() {
|
||||
openYomitanSettings: () => openYomitanSettings(),
|
||||
quitApp: () => app.quit(),
|
||||
toggleVisibleOverlay: () => toggleVisibleOverlay(),
|
||||
tokenizeCurrentSubtitle: () => tokenizeSubtitle(appState.currentSubText),
|
||||
tokenizeCurrentSubtitle: () => tokenizeCurrentSubtitle(appState.currentSubText),
|
||||
getCurrentSubtitleAss: () => appState.currentSubAssText,
|
||||
getMpvSubtitleRenderMetrics: () => appState.mpvSubtitleRenderMetrics,
|
||||
getSubtitlePosition: () => loadSubtitlePosition(),
|
||||
@@ -1355,7 +1357,7 @@ function buildIpcRuntimeServicesParams() {
|
||||
overlayContentMeasurementStore.report(payload);
|
||||
},
|
||||
},
|
||||
ankiJimakuDeps: {
|
||||
ankiJimakuDeps: createAnkiJimakuIpcRuntimeServiceDeps({
|
||||
patchAnkiConnectEnabled: (enabled: boolean) => {
|
||||
configService.patchRawConfig({ ankiConnect: { enabled } });
|
||||
},
|
||||
@@ -1380,8 +1382,7 @@ function buildIpcRuntimeServicesParams() {
|
||||
jimakuFetchJson: <T>(
|
||||
endpoint: string,
|
||||
query?: Record<string, string | number | boolean | null | undefined>,
|
||||
): Promise<JimakuApiResponse<T>> =>
|
||||
jimakuFetchJson<T>(endpoint, query),
|
||||
): Promise<JimakuApiResponse<T>> => jimakuFetchJson<T>(endpoint, query),
|
||||
getJimakuMaxEntryResults: () => getJimakuMaxEntryResults(),
|
||||
getJimakuLanguagePreference: () => getJimakuLanguagePreference(),
|
||||
resolveJimakuApiKey: () => resolveJimakuApiKey(),
|
||||
@@ -1391,8 +1392,5 @@ function buildIpcRuntimeServicesParams() {
|
||||
destPath: string,
|
||||
headers: Record<string, string>,
|
||||
) => downloadToFile(url, destPath, headers),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
registerIpcRuntimeServices(buildIpcRuntimeServicesParams());
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user