From f229d9ec95abb8073bb556c762d7b680450a81b5 Mon Sep 17 00:00:00 2001
From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com>
Date: Tue, 10 Jun 2025 20:36:16 +0900
Subject: [PATCH 1/4] [Refactor] Organize files.
---
src-ui/app/App.jsx | 21 ++++++++++++-------
.../setting_box/_components/index.js | 3 +--
.../setting_box/plugins/Plugins.jsx | 2 +-
.../PluginsControlComponent.jsx | 5 ++---
.../PluginsControlComponent.module.scss | 0
.../error_boundary/AppErrorBoundary.jsx | 0
.../AppErrorBoundary.module.scss | 0
.../contacts_container/ContactsContainer.jsx | 0
.../ContactsContainer.module.scss | 0
src-ui/app/others/index.js | 6 ++++++
.../modal_controller/ModalController.jsx | 0
.../ModalController.module.scss | 0
.../update_modal/UpdateModal.jsx | 0
.../update_modal/UpdateModal.module.scss | 0
.../PluginCompatibilityList.jsx | 0
.../PluginCompatibilityList.module.scss | 0
.../ReactToastifyOverrideClass.scss | 0
.../SnackbarController.jsx | 0
.../SnackbarController.module.scss | 0
.../splash_component/SplashComponent.jsx | 4 ++--
.../SplashComponent.module.scss | 0
.../DownloadModelsContainer.jsx | 0
.../DownloadModelsContainer.module.scss | 0
.../StartUpProgressContainer.jsx | 0
.../StartUpProgressContainer.module.scss | 0
.../updating_component/UpdatingComponent.jsx | 0
.../UpdatingComponent.module.scss | 0
.../window_title_bar/WindowTitleBar.jsx | 0
.../WindowTitleBar.module.scss | 0
29 files changed, 25 insertions(+), 16 deletions(-)
rename src-ui/app/config_page/setting_section/setting_box/{_components => plugins}/plugins_control_component/PluginsControlComponent.jsx (94%)
rename src-ui/app/config_page/setting_section/setting_box/{_components => plugins}/plugins_control_component/PluginsControlComponent.module.scss (100%)
rename src-ui/app/{ => others}/error_boundary/AppErrorBoundary.jsx (100%)
rename src-ui/app/{ => others}/error_boundary/AppErrorBoundary.module.scss (100%)
rename src-ui/app/{ => others}/error_boundary/contacts_container/ContactsContainer.jsx (100%)
rename src-ui/app/{ => others}/error_boundary/contacts_container/ContactsContainer.module.scss (100%)
create mode 100644 src-ui/app/others/index.js
rename src-ui/app/{ => others}/modal_controller/ModalController.jsx (100%)
rename src-ui/app/{ => others}/modal_controller/ModalController.module.scss (100%)
rename src-ui/app/{ => others}/modal_controller/update_modal/UpdateModal.jsx (100%)
rename src-ui/app/{ => others}/modal_controller/update_modal/UpdateModal.module.scss (100%)
rename src-ui/app/{ => others}/modal_controller/update_modal/plugins_compatibility_list/PluginCompatibilityList.jsx (100%)
rename src-ui/app/{ => others}/modal_controller/update_modal/plugins_compatibility_list/PluginCompatibilityList.module.scss (100%)
rename src-ui/app/{ => others}/snackbar_controller/ReactToastifyOverrideClass.scss (100%)
rename src-ui/app/{ => others}/snackbar_controller/SnackbarController.jsx (100%)
rename src-ui/app/{ => others}/snackbar_controller/SnackbarController.module.scss (100%)
rename src-ui/app/{ => others}/splash_component/SplashComponent.jsx (94%)
rename src-ui/app/{ => others}/splash_component/SplashComponent.module.scss (100%)
rename src-ui/app/{ => others}/splash_component/download_models_container/DownloadModelsContainer.jsx (100%)
rename src-ui/app/{ => others}/splash_component/download_models_container/DownloadModelsContainer.module.scss (100%)
rename src-ui/app/{ => others}/splash_component/start_up_progress_container/StartUpProgressContainer.jsx (100%)
rename src-ui/app/{ => others}/splash_component/start_up_progress_container/StartUpProgressContainer.module.scss (100%)
rename src-ui/app/{ => others}/updating_component/UpdatingComponent.jsx (100%)
rename src-ui/app/{ => others}/updating_component/UpdatingComponent.module.scss (100%)
rename src-ui/app/{ => others}/window_title_bar/WindowTitleBar.jsx (100%)
rename src-ui/app/{ => others}/window_title_bar/WindowTitleBar.module.scss (100%)
diff --git a/src-ui/app/App.jsx b/src-ui/app/App.jsx
index 7dc99689..ac9159e1 100644
--- a/src-ui/app/App.jsx
+++ b/src-ui/app/App.jsx
@@ -11,18 +11,23 @@ import {
TransparencyController,
CornerRadiusController,
PluginsController,
-} from "./_app_controllers/index.js";
+} from "./_app_controllers";
+
+import styles from "./App.module.scss";
-import { WindowTitleBar } from "./window_title_bar/WindowTitleBar";
import { MainPage } from "./main_page/MainPage";
import { ConfigPage } from "./config_page/ConfigPage";
-import { SplashComponent } from "./splash_component/SplashComponent";
-import { UpdatingComponent } from "./updating_component/UpdatingComponent";
-import { ModalController } from "./modal_controller/ModalController";
-import { SnackbarController } from "./snackbar_controller/SnackbarController";
-import styles from "./App.module.scss";
+
+import {
+ WindowTitleBar,
+ SplashComponent,
+ UpdatingComponent,
+ ModalController,
+ SnackbarController,
+ AppErrorBoundary,
+} from "./others";
+
import { useIsBackendReady, useIsSoftwareUpdating, useIsVrctAvailable, useWindow } from "@logics_common";
-import { AppErrorBoundary } from "./error_boundary/AppErrorBoundary";
export const App = () => {
const { currentIsVrctAvailable } = useIsVrctAvailable();
diff --git a/src-ui/app/config_page/setting_section/setting_box/_components/index.js b/src-ui/app/config_page/setting_section/setting_box/_components/index.js
index 178dbcec..7b695b35 100644
--- a/src-ui/app/config_page/setting_section/setting_box/_components/index.js
+++ b/src-ui/app/config_page/setting_section/setting_box/_components/index.js
@@ -12,5 +12,4 @@ export { Slider } from "./slider/Slider";
export { SwitchBox } from "./switch_box/SwitchBox";
export { ThresholdComponent } from "./threshold_component/ThresholdComponent";
export { WordFilter, WordFilterListToggleComponent } from "./word_filter/WordFilter";
-export { DownloadModels } from "./download_models/DownloadModels";
-export { PluginsControlComponent } from "./plugins_control_component/PluginsControlComponent";
\ No newline at end of file
+export { DownloadModels } from "./download_models/DownloadModels";
\ No newline at end of file
diff --git a/src-ui/app/config_page/setting_section/setting_box/plugins/Plugins.jsx b/src-ui/app/config_page/setting_section/setting_box/plugins/Plugins.jsx
index 0d7f8693..9928fad1 100644
--- a/src-ui/app/config_page/setting_section/setting_box/plugins/Plugins.jsx
+++ b/src-ui/app/config_page/setting_section/setting_box/plugins/Plugins.jsx
@@ -2,7 +2,7 @@ import { useEffect, useRef, useState, useCallback } from "react";
import { useTranslation } from "react-i18next";
import { usePlugins } from "@logics_configs";
import styles from "./Plugins.module.scss";
-import { PluginsControlComponent } from "../_components/plugins_control_component/PluginsControlComponent";
+import { PluginsControlComponent } from "./plugins_control_component/PluginsControlComponent";
import { useNotificationStatus } from "@logics_common";
import ExternalLink from "@images/external_link.svg?react";
diff --git a/src-ui/app/config_page/setting_section/setting_box/_components/plugins_control_component/PluginsControlComponent.jsx b/src-ui/app/config_page/setting_section/setting_box/plugins/plugins_control_component/PluginsControlComponent.jsx
similarity index 94%
rename from src-ui/app/config_page/setting_section/setting_box/_components/plugins_control_component/PluginsControlComponent.jsx
rename to src-ui/app/config_page/setting_section/setting_box/plugins/plugins_control_component/PluginsControlComponent.jsx
index c7c6ace0..94a90b50 100644
--- a/src-ui/app/config_page/setting_section/setting_box/_components/plugins_control_component/PluginsControlComponent.jsx
+++ b/src-ui/app/config_page/setting_section/setting_box/plugins/plugins_control_component/PluginsControlComponent.jsx
@@ -1,6 +1,5 @@
-import React from "react";
-import { SwitchBox } from "../index";
-import { _DownloadButton } from "../_atoms/_download_button/_DownloadButton";
+import { SwitchBox } from "../../_components";
+import { _DownloadButton } from "../../_components/_atoms/_download_button/_DownloadButton";
import styles from "./PluginsControlComponent.module.scss";
import { useTranslation } from "react-i18next";
diff --git a/src-ui/app/config_page/setting_section/setting_box/_components/plugins_control_component/PluginsControlComponent.module.scss b/src-ui/app/config_page/setting_section/setting_box/plugins/plugins_control_component/PluginsControlComponent.module.scss
similarity index 100%
rename from src-ui/app/config_page/setting_section/setting_box/_components/plugins_control_component/PluginsControlComponent.module.scss
rename to src-ui/app/config_page/setting_section/setting_box/plugins/plugins_control_component/PluginsControlComponent.module.scss
diff --git a/src-ui/app/error_boundary/AppErrorBoundary.jsx b/src-ui/app/others/error_boundary/AppErrorBoundary.jsx
similarity index 100%
rename from src-ui/app/error_boundary/AppErrorBoundary.jsx
rename to src-ui/app/others/error_boundary/AppErrorBoundary.jsx
diff --git a/src-ui/app/error_boundary/AppErrorBoundary.module.scss b/src-ui/app/others/error_boundary/AppErrorBoundary.module.scss
similarity index 100%
rename from src-ui/app/error_boundary/AppErrorBoundary.module.scss
rename to src-ui/app/others/error_boundary/AppErrorBoundary.module.scss
diff --git a/src-ui/app/error_boundary/contacts_container/ContactsContainer.jsx b/src-ui/app/others/error_boundary/contacts_container/ContactsContainer.jsx
similarity index 100%
rename from src-ui/app/error_boundary/contacts_container/ContactsContainer.jsx
rename to src-ui/app/others/error_boundary/contacts_container/ContactsContainer.jsx
diff --git a/src-ui/app/error_boundary/contacts_container/ContactsContainer.module.scss b/src-ui/app/others/error_boundary/contacts_container/ContactsContainer.module.scss
similarity index 100%
rename from src-ui/app/error_boundary/contacts_container/ContactsContainer.module.scss
rename to src-ui/app/others/error_boundary/contacts_container/ContactsContainer.module.scss
diff --git a/src-ui/app/others/index.js b/src-ui/app/others/index.js
new file mode 100644
index 00000000..80d702e7
--- /dev/null
+++ b/src-ui/app/others/index.js
@@ -0,0 +1,6 @@
+export { WindowTitleBar } from "./window_title_bar/WindowTitleBar.jsx";
+export { SplashComponent } from "./splash_component/SplashComponent.jsx";
+export { UpdatingComponent } from "./updating_component/UpdatingComponent.jsx";
+export { ModalController } from "./modal_controller/ModalController.jsx";
+export { SnackbarController } from "./snackbar_controller/SnackbarController.jsx";
+export { AppErrorBoundary } from "./error_boundary/AppErrorBoundary.jsx";
\ No newline at end of file
diff --git a/src-ui/app/modal_controller/ModalController.jsx b/src-ui/app/others/modal_controller/ModalController.jsx
similarity index 100%
rename from src-ui/app/modal_controller/ModalController.jsx
rename to src-ui/app/others/modal_controller/ModalController.jsx
diff --git a/src-ui/app/modal_controller/ModalController.module.scss b/src-ui/app/others/modal_controller/ModalController.module.scss
similarity index 100%
rename from src-ui/app/modal_controller/ModalController.module.scss
rename to src-ui/app/others/modal_controller/ModalController.module.scss
diff --git a/src-ui/app/modal_controller/update_modal/UpdateModal.jsx b/src-ui/app/others/modal_controller/update_modal/UpdateModal.jsx
similarity index 100%
rename from src-ui/app/modal_controller/update_modal/UpdateModal.jsx
rename to src-ui/app/others/modal_controller/update_modal/UpdateModal.jsx
diff --git a/src-ui/app/modal_controller/update_modal/UpdateModal.module.scss b/src-ui/app/others/modal_controller/update_modal/UpdateModal.module.scss
similarity index 100%
rename from src-ui/app/modal_controller/update_modal/UpdateModal.module.scss
rename to src-ui/app/others/modal_controller/update_modal/UpdateModal.module.scss
diff --git a/src-ui/app/modal_controller/update_modal/plugins_compatibility_list/PluginCompatibilityList.jsx b/src-ui/app/others/modal_controller/update_modal/plugins_compatibility_list/PluginCompatibilityList.jsx
similarity index 100%
rename from src-ui/app/modal_controller/update_modal/plugins_compatibility_list/PluginCompatibilityList.jsx
rename to src-ui/app/others/modal_controller/update_modal/plugins_compatibility_list/PluginCompatibilityList.jsx
diff --git a/src-ui/app/modal_controller/update_modal/plugins_compatibility_list/PluginCompatibilityList.module.scss b/src-ui/app/others/modal_controller/update_modal/plugins_compatibility_list/PluginCompatibilityList.module.scss
similarity index 100%
rename from src-ui/app/modal_controller/update_modal/plugins_compatibility_list/PluginCompatibilityList.module.scss
rename to src-ui/app/others/modal_controller/update_modal/plugins_compatibility_list/PluginCompatibilityList.module.scss
diff --git a/src-ui/app/snackbar_controller/ReactToastifyOverrideClass.scss b/src-ui/app/others/snackbar_controller/ReactToastifyOverrideClass.scss
similarity index 100%
rename from src-ui/app/snackbar_controller/ReactToastifyOverrideClass.scss
rename to src-ui/app/others/snackbar_controller/ReactToastifyOverrideClass.scss
diff --git a/src-ui/app/snackbar_controller/SnackbarController.jsx b/src-ui/app/others/snackbar_controller/SnackbarController.jsx
similarity index 100%
rename from src-ui/app/snackbar_controller/SnackbarController.jsx
rename to src-ui/app/others/snackbar_controller/SnackbarController.jsx
diff --git a/src-ui/app/snackbar_controller/SnackbarController.module.scss b/src-ui/app/others/snackbar_controller/SnackbarController.module.scss
similarity index 100%
rename from src-ui/app/snackbar_controller/SnackbarController.module.scss
rename to src-ui/app/others/snackbar_controller/SnackbarController.module.scss
diff --git a/src-ui/app/splash_component/SplashComponent.jsx b/src-ui/app/others/splash_component/SplashComponent.jsx
similarity index 94%
rename from src-ui/app/splash_component/SplashComponent.jsx
rename to src-ui/app/others/splash_component/SplashComponent.jsx
index 809f917c..a9ac4aeb 100644
--- a/src-ui/app/splash_component/SplashComponent.jsx
+++ b/src-ui/app/others/splash_component/SplashComponent.jsx
@@ -1,7 +1,7 @@
import { useState, useEffect } from "react";
import styles from "./SplashComponent.module.scss";
-import { StartUpProgressContainer } from "./start_up_progress_container/StartUpProgressContainer/";
-import { DownloadModelsContainer } from "./download_models_container/DownloadModelsContainer/";
+import { StartUpProgressContainer } from "./start_up_progress_container/StartUpProgressContainer";
+import { DownloadModelsContainer } from "./download_models_container/DownloadModelsContainer";
import MegaphoneSvg from "@images/megaphone.svg?react";
import XMarkSvg from "@images/cancel.svg?react";
import { useWindow } from "@logics_common";
diff --git a/src-ui/app/splash_component/SplashComponent.module.scss b/src-ui/app/others/splash_component/SplashComponent.module.scss
similarity index 100%
rename from src-ui/app/splash_component/SplashComponent.module.scss
rename to src-ui/app/others/splash_component/SplashComponent.module.scss
diff --git a/src-ui/app/splash_component/download_models_container/DownloadModelsContainer.jsx b/src-ui/app/others/splash_component/download_models_container/DownloadModelsContainer.jsx
similarity index 100%
rename from src-ui/app/splash_component/download_models_container/DownloadModelsContainer.jsx
rename to src-ui/app/others/splash_component/download_models_container/DownloadModelsContainer.jsx
diff --git a/src-ui/app/splash_component/download_models_container/DownloadModelsContainer.module.scss b/src-ui/app/others/splash_component/download_models_container/DownloadModelsContainer.module.scss
similarity index 100%
rename from src-ui/app/splash_component/download_models_container/DownloadModelsContainer.module.scss
rename to src-ui/app/others/splash_component/download_models_container/DownloadModelsContainer.module.scss
diff --git a/src-ui/app/splash_component/start_up_progress_container/StartUpProgressContainer.jsx b/src-ui/app/others/splash_component/start_up_progress_container/StartUpProgressContainer.jsx
similarity index 100%
rename from src-ui/app/splash_component/start_up_progress_container/StartUpProgressContainer.jsx
rename to src-ui/app/others/splash_component/start_up_progress_container/StartUpProgressContainer.jsx
diff --git a/src-ui/app/splash_component/start_up_progress_container/StartUpProgressContainer.module.scss b/src-ui/app/others/splash_component/start_up_progress_container/StartUpProgressContainer.module.scss
similarity index 100%
rename from src-ui/app/splash_component/start_up_progress_container/StartUpProgressContainer.module.scss
rename to src-ui/app/others/splash_component/start_up_progress_container/StartUpProgressContainer.module.scss
diff --git a/src-ui/app/updating_component/UpdatingComponent.jsx b/src-ui/app/others/updating_component/UpdatingComponent.jsx
similarity index 100%
rename from src-ui/app/updating_component/UpdatingComponent.jsx
rename to src-ui/app/others/updating_component/UpdatingComponent.jsx
diff --git a/src-ui/app/updating_component/UpdatingComponent.module.scss b/src-ui/app/others/updating_component/UpdatingComponent.module.scss
similarity index 100%
rename from src-ui/app/updating_component/UpdatingComponent.module.scss
rename to src-ui/app/others/updating_component/UpdatingComponent.module.scss
diff --git a/src-ui/app/window_title_bar/WindowTitleBar.jsx b/src-ui/app/others/window_title_bar/WindowTitleBar.jsx
similarity index 100%
rename from src-ui/app/window_title_bar/WindowTitleBar.jsx
rename to src-ui/app/others/window_title_bar/WindowTitleBar.jsx
diff --git a/src-ui/app/window_title_bar/WindowTitleBar.module.scss b/src-ui/app/others/window_title_bar/WindowTitleBar.module.scss
similarity index 100%
rename from src-ui/app/window_title_bar/WindowTitleBar.module.scss
rename to src-ui/app/others/window_title_bar/WindowTitleBar.module.scss
From 1fcb765ca06bac67a6af6cbd91996e92ca99c633 Mon Sep 17 00:00:00 2001
From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com>
Date: Wed, 11 Jun 2025 18:34:13 +0900
Subject: [PATCH 2/4] [Refactor] Change aliases and move test_data.js.
---
test_data.js => src-ui/_test_data.js | 2 +-
.../StartPythonController.jsx | 39 +++++++++++++++++--
src-ui/logics/common/useMessage.js | 2 +-
src-ui/logics/common/useOpenFolder.js | 2 +-
src-ui/logics/common/useSoftwareVersion.js | 2 +-
src-ui/logics/common/useUpdateSoftware.js | 2 +-
src-ui/logics/common/useVolume.js | 2 +-
src-ui/logics/common/useWindow.js | 2 +-
.../advanced_settings/useOscIpAddress.js | 2 +-
.../configs/advanced_settings/useOscPort.js | 2 +-
.../configs/advanced_settings/useWebsocket.js | 2 +-
.../appearance/useMessageLogUiScaling.js | 2 +-
.../appearance/useRestoreWindowGeometry.js | 2 +-
.../appearance/useSelectedFontFamily.js | 2 +-
.../appearance/useSendMessageButtonType.js | 2 +-
.../configs/appearance/useTransparency.js | 2 +-
.../configs/appearance/useUiLanguage.js | 2 +-
.../logics/configs/appearance/useUiScaling.js | 2 +-
.../configs/device/useEnableAutoMicSelect.js | 2 +-
.../device/useEnableAutoSpeakerSelect.js | 2 +-
.../logics/configs/device/useMicDeviceList.js | 2 +-
.../logics/configs/device/useMicHostList.js | 2 +-
.../logics/configs/device/useMicThreshold.js | 2 +-
.../configs/device/useSelectedMicDevice.js | 2 +-
.../configs/device/useSelectedMicHost.js | 2 +-
.../device/useSelectedSpeakerDevice.js | 2 +-
.../configs/device/useSpeakerDeviceList.js | 2 +-
.../configs/device/useSpeakerThreshold.js | 2 +-
src-ui/logics/configs/hotkeys/useHotkeys.js | 2 +-
.../useEnableAutoClearMessageInputBox.js | 2 +-
.../others/useEnableAutoExportMessageLogs.js | 2 +-
.../others/useEnableNotificationVrcSfx.js | 2 +-
.../others/useEnableSendMessageToVrc.js | 2 +-
.../useEnableSendOnlyTranslatedMessages.js | 2 +-
.../useEnableSendReceivedMessageToVrc.js | 2 +-
.../configs/others/useEnableVrcMicMuteSync.js | 2 +-
.../others/useSendMessageButtonType.js | 2 +-
src-ui/logics/configs/plugins/usePlugins.js | 2 +-
.../configs/transcription/useMicMaxWords.js | 2 +-
.../transcription/useMicPhraseTimeout.js | 2 +-
.../transcription/useMicRecordTimeout.js | 2 +-
.../transcription/useMicWordFilterList.js | 2 +-
.../useSelectableWhisperComputeDeviceList.js | 2 +-
.../useSelectedTranscriptionEngine.js | 2 +-
.../useSelectedWhisperComputeDevice.js | 2 +-
.../useSelectedWhisperWeightType.js | 2 +-
.../transcription/useSpeakerMaxWords.js | 2 +-
.../transcription/useSpeakerPhraseTimeout.js | 2 +-
.../transcription/useSpeakerRecordTimeout.js | 2 +-
.../useWhisperWeightTypeStatus.js | 2 +-
.../useCTranslate2WeightTypeStatus.js | 2 +-
.../configs/translation/useDeepLAuthKey.js | 2 +-
...eSelectableCTranslate2ComputeDeviceList.js | 2 +-
.../useSelectedCTranslate2ComputeDevice.js | 2 +-
.../useSelectedCTranslate2WeightType.js | 2 +-
.../configs/vr/useIsEnabledOverlayLargeLog.js | 2 +-
.../configs/vr/useIsEnabledOverlaySmallLog.js | 2 +-
.../configs/vr/useOverlayLargeLogSettings.js | 2 +-
.../useOverlayShowOnlyTranslatedMessages.js | 2 +-
.../configs/vr/useOverlaySmallLogSettings.js | 2 +-
.../logics/configs/vr/useSendTextToOverlay.js | 2 +-
.../logics/main/useIsMainPageCompactMode.js | 2 +-
src-ui/logics/main/useLanguageSettings.js | 2 +-
src-ui/logics/main/useMainFunction.js | 2 +-
src-ui/logics/main/useMessageInputBoxRatio.js | 2 +-
.../logics/main/useSelectableLanguageList.js | 2 +-
src-ui/logics/useStartPython.js | 34 ----------------
src-ui/store.js | 7 ++--
vite.config.js | 4 +-
69 files changed, 108 insertions(+), 106 deletions(-)
rename test_data.js => src-ui/_test_data.js (95%)
delete mode 100644 src-ui/logics/useStartPython.js
diff --git a/test_data.js b/src-ui/_test_data.js
similarity index 95%
rename from test_data.js
rename to src-ui/_test_data.js
index ba53cb7e..d2e1723c 100644
--- a/test_data.js
+++ b/src-ui/_test_data.js
@@ -1,4 +1,4 @@
-export const generateTestData = (num) => {
+export const generateTestConversationData = (num) => {
const testDataArray = [];
const messagesJa = [
"今日はとてもいい天気ですね。",
diff --git a/src-ui/app/_app_controllers/StartPythonController.jsx b/src-ui/app/_app_controllers/StartPythonController.jsx
index c351120c..55824bc8 100644
--- a/src-ui/app/_app_controllers/StartPythonController.jsx
+++ b/src-ui/app/_app_controllers/StartPythonController.jsx
@@ -1,11 +1,16 @@
import { invoke } from "@tauri-apps/api/core";
+import { Command } from "@tauri-apps/plugin-shell";
import { useEffect, useRef } from "react";
-import { useStartPython } from "@logics/useStartPython";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
-import { useStore_SelectableFontFamilyList } from "@store";
+import { useStdoutToPython } from "@useStdoutToPython";
+import { useReceiveRoutes } from "@useReceiveRoutes";
+import { store, useStore_SelectableFontFamilyList } from "@store";
import { arrayToObject } from "@utils";
+import {
+ useNotificationStatus,
+} from "@logics_common";
+
export const StartPythonController = () => {
const { asyncStartPython } = useStartPython();
const hasRunRef = useRef(false);
@@ -26,6 +31,34 @@ export const StartPythonController = () => {
return null;
};
+const useStartPython = () => {
+ const { receiveRoutes } = useReceiveRoutes();
+ const { showNotification_Success, showNotification_Error } = useNotificationStatus();
+
+ const asyncStartPython = async () => {
+ const command = Command.sidecar("bin/VRCT-sidecar");
+ command.on("error", error => console.error(`error: "${error}"`));
+ command.stdout.on("data", (line) => {
+ let parsed_data = "";
+ try {
+ parsed_data = JSON.parse(line);
+ receiveRoutes(parsed_data);
+ } catch (error) {
+ console.log(error, line);
+ }
+ });
+ command.stderr.on("data", line => {
+ showNotification_Error(
+ `An error occurred. Please restart VRCT or contact the developers. The last line:${JSON.stringify(line)}`, { hide_duration: null });
+ console.error("stderr", line);
+ });
+ const backend_subprocess = await command.spawn();
+ store.backend_subprocess = backend_subprocess;
+ };
+
+ return { asyncStartPython };
+};
+
const useAsyncFetchFonts = () => {
const { updateSelectableFontFamilyList } = useStore_SelectableFontFamilyList();
const asyncFetchFonts = async () => {
diff --git a/src-ui/logics/common/useMessage.js b/src-ui/logics/common/useMessage.js
index 416555a6..841c90dc 100644
--- a/src-ui/logics/common/useMessage.js
+++ b/src-ui/logics/common/useMessage.js
@@ -3,7 +3,7 @@ import {
useStore_MessageInputValue,
} from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useMessage = () => {
const { currentMessageLogs, addMessageLogs, updateMessageLogs } = useStore_MessageLogs();
diff --git a/src-ui/logics/common/useOpenFolder.js b/src-ui/logics/common/useOpenFolder.js
index 202ef5ad..fa991f03 100644
--- a/src-ui/logics/common/useOpenFolder.js
+++ b/src-ui/logics/common/useOpenFolder.js
@@ -1,4 +1,4 @@
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useOpenFolder = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/common/useSoftwareVersion.js b/src-ui/logics/common/useSoftwareVersion.js
index 18f24a7f..25c257d5 100644
--- a/src-ui/logics/common/useSoftwareVersion.js
+++ b/src-ui/logics/common/useSoftwareVersion.js
@@ -1,7 +1,7 @@
import semver from "semver";
import { useStore_SoftwareVersion, useStore_LatestSoftwareVersionInfo } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useSoftwareVersion = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/common/useUpdateSoftware.js b/src-ui/logics/common/useUpdateSoftware.js
index f3d2f1cf..208cbf30 100644
--- a/src-ui/logics/common/useUpdateSoftware.js
+++ b/src-ui/logics/common/useUpdateSoftware.js
@@ -1,4 +1,4 @@
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useUpdateSoftware = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/common/useVolume.js b/src-ui/logics/common/useVolume.js
index b3e2165b..ce94a391 100644
--- a/src-ui/logics/common/useVolume.js
+++ b/src-ui/logics/common/useVolume.js
@@ -5,7 +5,7 @@ import {
useStore_SpeakerThresholdCheckStatus,
} from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useVolume = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/common/useWindow.js b/src-ui/logics/common/useWindow.js
index 88182dd6..9585d0df 100644
--- a/src-ui/logics/common/useWindow.js
+++ b/src-ui/logics/common/useWindow.js
@@ -1,6 +1,6 @@
import { useEffect, useRef } from "react";
import { currentMonitor, availableMonitors, PhysicalPosition, PhysicalSize } from "@tauri-apps/api/window";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
import { useStore_IsBreakPoint } from "@store";
import { useUiScaling } from "@logics_configs";
import { store } from "@store";
diff --git a/src-ui/logics/configs/advanced_settings/useOscIpAddress.js b/src-ui/logics/configs/advanced_settings/useOscIpAddress.js
index 702a6d98..8fe1ae06 100644
--- a/src-ui/logics/configs/advanced_settings/useOscIpAddress.js
+++ b/src-ui/logics/configs/advanced_settings/useOscIpAddress.js
@@ -1,5 +1,5 @@
import { useStore_OscIpAddress } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useOscIpAddress = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/advanced_settings/useOscPort.js b/src-ui/logics/configs/advanced_settings/useOscPort.js
index d3e28557..0710021c 100644
--- a/src-ui/logics/configs/advanced_settings/useOscPort.js
+++ b/src-ui/logics/configs/advanced_settings/useOscPort.js
@@ -1,5 +1,5 @@
import { useStore_OscPort } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
import { useNotificationStatus } from "@logics_common";
export const useOscPort = () => {
diff --git a/src-ui/logics/configs/advanced_settings/useWebsocket.js b/src-ui/logics/configs/advanced_settings/useWebsocket.js
index 51361489..2002b78d 100644
--- a/src-ui/logics/configs/advanced_settings/useWebsocket.js
+++ b/src-ui/logics/configs/advanced_settings/useWebsocket.js
@@ -3,7 +3,7 @@ import {
useStore_WebsocketHost,
useStore_WebsocketPort,
} from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useWebsocket = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/appearance/useMessageLogUiScaling.js b/src-ui/logics/configs/appearance/useMessageLogUiScaling.js
index 625f6263..2833774f 100644
--- a/src-ui/logics/configs/appearance/useMessageLogUiScaling.js
+++ b/src-ui/logics/configs/appearance/useMessageLogUiScaling.js
@@ -1,5 +1,5 @@
import { useStore_MessageLogUiScaling } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useMessageLogUiScaling = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/appearance/useRestoreWindowGeometry.js b/src-ui/logics/configs/appearance/useRestoreWindowGeometry.js
index 2cc618be..76a01a4b 100644
--- a/src-ui/logics/configs/appearance/useRestoreWindowGeometry.js
+++ b/src-ui/logics/configs/appearance/useRestoreWindowGeometry.js
@@ -1,5 +1,5 @@
// import { useStore_RestoreWindowGeometry } from "@store";
-// import { useStdoutToPython } from "@logics/useStdoutToPython";
+// import { useStdoutToPython } from "@useStdoutToPython";
// export const useRestoreWindowGeometry = () => {
// const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/appearance/useSelectedFontFamily.js b/src-ui/logics/configs/appearance/useSelectedFontFamily.js
index bfb43029..538ef462 100644
--- a/src-ui/logics/configs/appearance/useSelectedFontFamily.js
+++ b/src-ui/logics/configs/appearance/useSelectedFontFamily.js
@@ -1,5 +1,5 @@
import { useStore_SelectedFontFamily } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useSelectedFontFamily = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/appearance/useSendMessageButtonType.js b/src-ui/logics/configs/appearance/useSendMessageButtonType.js
index f69a51f2..e92c9b21 100644
--- a/src-ui/logics/configs/appearance/useSendMessageButtonType.js
+++ b/src-ui/logics/configs/appearance/useSendMessageButtonType.js
@@ -1,5 +1,5 @@
import { useStore_SendMessageButtonType } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useSendMessageButtonType = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/appearance/useTransparency.js b/src-ui/logics/configs/appearance/useTransparency.js
index 9ab7429f..4c719503 100644
--- a/src-ui/logics/configs/appearance/useTransparency.js
+++ b/src-ui/logics/configs/appearance/useTransparency.js
@@ -1,5 +1,5 @@
import { useStore_Transparency } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useTransparency = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/appearance/useUiLanguage.js b/src-ui/logics/configs/appearance/useUiLanguage.js
index 149a8fb3..bb3a5b39 100644
--- a/src-ui/logics/configs/appearance/useUiLanguage.js
+++ b/src-ui/logics/configs/appearance/useUiLanguage.js
@@ -1,5 +1,5 @@
import { useStore_UiLanguage } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useUiLanguage = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/appearance/useUiScaling.js b/src-ui/logics/configs/appearance/useUiScaling.js
index 501118f1..e5d75e1d 100644
--- a/src-ui/logics/configs/appearance/useUiScaling.js
+++ b/src-ui/logics/configs/appearance/useUiScaling.js
@@ -1,5 +1,5 @@
import { useStore_UiScaling } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useUiScaling = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/device/useEnableAutoMicSelect.js b/src-ui/logics/configs/device/useEnableAutoMicSelect.js
index 1370d055..c9f7e5d6 100644
--- a/src-ui/logics/configs/device/useEnableAutoMicSelect.js
+++ b/src-ui/logics/configs/device/useEnableAutoMicSelect.js
@@ -1,5 +1,5 @@
import { useStore_EnableAutoMicSelect } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useEnableAutoMicSelect = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/device/useEnableAutoSpeakerSelect.js b/src-ui/logics/configs/device/useEnableAutoSpeakerSelect.js
index d43184de..406cbf25 100644
--- a/src-ui/logics/configs/device/useEnableAutoSpeakerSelect.js
+++ b/src-ui/logics/configs/device/useEnableAutoSpeakerSelect.js
@@ -1,5 +1,5 @@
import { useStore_EnableAutoSpeakerSelect } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useEnableAutoSpeakerSelect = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/device/useMicDeviceList.js b/src-ui/logics/configs/device/useMicDeviceList.js
index 196b32cf..486c3f58 100644
--- a/src-ui/logics/configs/device/useMicDeviceList.js
+++ b/src-ui/logics/configs/device/useMicDeviceList.js
@@ -1,5 +1,5 @@
import { useStore_MicDeviceList } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useMicDeviceList = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/device/useMicHostList.js b/src-ui/logics/configs/device/useMicHostList.js
index ed61f80a..39d34097 100644
--- a/src-ui/logics/configs/device/useMicHostList.js
+++ b/src-ui/logics/configs/device/useMicHostList.js
@@ -1,5 +1,5 @@
import { useStore_MicHostList } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useMicHostList = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/device/useMicThreshold.js b/src-ui/logics/configs/device/useMicThreshold.js
index ab6bda6c..a6224c38 100644
--- a/src-ui/logics/configs/device/useMicThreshold.js
+++ b/src-ui/logics/configs/device/useMicThreshold.js
@@ -1,5 +1,5 @@
import { useStore_MicThreshold, useStore_EnableAutomaticMicThreshold } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useMicThreshold = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/device/useSelectedMicDevice.js b/src-ui/logics/configs/device/useSelectedMicDevice.js
index 798eae5a..6bd7d11a 100644
--- a/src-ui/logics/configs/device/useSelectedMicDevice.js
+++ b/src-ui/logics/configs/device/useSelectedMicDevice.js
@@ -1,5 +1,5 @@
import { useStore_SelectedMicDevice } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useSelectedMicDevice = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/device/useSelectedMicHost.js b/src-ui/logics/configs/device/useSelectedMicHost.js
index 0ef9c882..f1c1c147 100644
--- a/src-ui/logics/configs/device/useSelectedMicHost.js
+++ b/src-ui/logics/configs/device/useSelectedMicHost.js
@@ -1,5 +1,5 @@
import { useStore_SelectedMicHost } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useSelectedMicHost = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/device/useSelectedSpeakerDevice.js b/src-ui/logics/configs/device/useSelectedSpeakerDevice.js
index b8d85693..672a9267 100644
--- a/src-ui/logics/configs/device/useSelectedSpeakerDevice.js
+++ b/src-ui/logics/configs/device/useSelectedSpeakerDevice.js
@@ -1,5 +1,5 @@
import { useStore_SelectedSpeakerDevice } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useSelectedSpeakerDevice = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/device/useSpeakerDeviceList.js b/src-ui/logics/configs/device/useSpeakerDeviceList.js
index 2848111c..b0385cf8 100644
--- a/src-ui/logics/configs/device/useSpeakerDeviceList.js
+++ b/src-ui/logics/configs/device/useSpeakerDeviceList.js
@@ -1,5 +1,5 @@
import { useStore_SpeakerDeviceList } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useSpeakerDeviceList = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/device/useSpeakerThreshold.js b/src-ui/logics/configs/device/useSpeakerThreshold.js
index 29824b01..c21fe2ef 100644
--- a/src-ui/logics/configs/device/useSpeakerThreshold.js
+++ b/src-ui/logics/configs/device/useSpeakerThreshold.js
@@ -1,5 +1,5 @@
import { useStore_SpeakerThreshold, useStore_EnableAutomaticSpeakerThreshold } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useSpeakerThreshold = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/hotkeys/useHotkeys.js b/src-ui/logics/configs/hotkeys/useHotkeys.js
index a2bbe35d..20b18732 100644
--- a/src-ui/logics/configs/hotkeys/useHotkeys.js
+++ b/src-ui/logics/configs/hotkeys/useHotkeys.js
@@ -1,5 +1,5 @@
import { store, useStore_Hotkeys } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
import { useNotificationStatus } from "@logics_common";
import { useMainFunction } from "@logics_main";
import { register, unregisterAll, isRegistered } from "@tauri-apps/plugin-global-shortcut";
diff --git a/src-ui/logics/configs/others/useEnableAutoClearMessageInputBox.js b/src-ui/logics/configs/others/useEnableAutoClearMessageInputBox.js
index d04c6094..6508990c 100644
--- a/src-ui/logics/configs/others/useEnableAutoClearMessageInputBox.js
+++ b/src-ui/logics/configs/others/useEnableAutoClearMessageInputBox.js
@@ -1,5 +1,5 @@
import { useStore_EnableAutoClearMessageInputBox } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useEnableAutoClearMessageInputBox = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/others/useEnableAutoExportMessageLogs.js b/src-ui/logics/configs/others/useEnableAutoExportMessageLogs.js
index 8249a83a..e9faab35 100644
--- a/src-ui/logics/configs/others/useEnableAutoExportMessageLogs.js
+++ b/src-ui/logics/configs/others/useEnableAutoExportMessageLogs.js
@@ -1,5 +1,5 @@
import { useStore_EnableAutoExportMessageLogs } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useEnableAutoExportMessageLogs = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/others/useEnableNotificationVrcSfx.js b/src-ui/logics/configs/others/useEnableNotificationVrcSfx.js
index 24e1096a..9a001114 100644
--- a/src-ui/logics/configs/others/useEnableNotificationVrcSfx.js
+++ b/src-ui/logics/configs/others/useEnableNotificationVrcSfx.js
@@ -1,5 +1,5 @@
import { useStore_EnableNotificationVrcSfx } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useEnableNotificationVrcSfx = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/others/useEnableSendMessageToVrc.js b/src-ui/logics/configs/others/useEnableSendMessageToVrc.js
index 10ef4b0c..6284dd17 100644
--- a/src-ui/logics/configs/others/useEnableSendMessageToVrc.js
+++ b/src-ui/logics/configs/others/useEnableSendMessageToVrc.js
@@ -1,5 +1,5 @@
import { useStore_EnableSendMessageToVrc } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useEnableSendMessageToVrc = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/others/useEnableSendOnlyTranslatedMessages.js b/src-ui/logics/configs/others/useEnableSendOnlyTranslatedMessages.js
index 7e9abefb..4ba9d4af 100644
--- a/src-ui/logics/configs/others/useEnableSendOnlyTranslatedMessages.js
+++ b/src-ui/logics/configs/others/useEnableSendOnlyTranslatedMessages.js
@@ -1,5 +1,5 @@
import { useStore_EnableSendOnlyTranslatedMessages } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useEnableSendOnlyTranslatedMessages = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/others/useEnableSendReceivedMessageToVrc.js b/src-ui/logics/configs/others/useEnableSendReceivedMessageToVrc.js
index 5eeeb102..bfc550a1 100644
--- a/src-ui/logics/configs/others/useEnableSendReceivedMessageToVrc.js
+++ b/src-ui/logics/configs/others/useEnableSendReceivedMessageToVrc.js
@@ -1,5 +1,5 @@
import { useStore_EnableSendReceivedMessageToVrc } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useEnableSendReceivedMessageToVrc = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/others/useEnableVrcMicMuteSync.js b/src-ui/logics/configs/others/useEnableVrcMicMuteSync.js
index 6515ffc2..f8711d81 100644
--- a/src-ui/logics/configs/others/useEnableVrcMicMuteSync.js
+++ b/src-ui/logics/configs/others/useEnableVrcMicMuteSync.js
@@ -1,5 +1,5 @@
import { useStore_EnableVrcMicMuteSync } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useEnableVrcMicMuteSync = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/others/useSendMessageButtonType.js b/src-ui/logics/configs/others/useSendMessageButtonType.js
index a6a22add..621c7dbc 100644
--- a/src-ui/logics/configs/others/useSendMessageButtonType.js
+++ b/src-ui/logics/configs/others/useSendMessageButtonType.js
@@ -1,5 +1,5 @@
import { useStore_SendMessageButtonType } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useSendMessageButtonType = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/plugins/usePlugins.js b/src-ui/logics/configs/plugins/usePlugins.js
index d4d398fa..50a9fe41 100644
--- a/src-ui/logics/configs/plugins/usePlugins.js
+++ b/src-ui/logics/configs/plugins/usePlugins.js
@@ -11,7 +11,7 @@ import {
useStore_FetchedPluginsInfo,
useStore_LoadedPlugins,
} from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
import { transform } from "@babel/standalone";
import { writeFile, mkdir, exists, remove, readDir, BaseDirectory, readTextFile } from "@tauri-apps/plugin-fs";
diff --git a/src-ui/logics/configs/transcription/useMicMaxWords.js b/src-ui/logics/configs/transcription/useMicMaxWords.js
index 7415d655..72abd77b 100644
--- a/src-ui/logics/configs/transcription/useMicMaxWords.js
+++ b/src-ui/logics/configs/transcription/useMicMaxWords.js
@@ -1,5 +1,5 @@
import { useStore_MicMaxWords } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useMicMaxWords = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/transcription/useMicPhraseTimeout.js b/src-ui/logics/configs/transcription/useMicPhraseTimeout.js
index 02601b0c..6f66abf8 100644
--- a/src-ui/logics/configs/transcription/useMicPhraseTimeout.js
+++ b/src-ui/logics/configs/transcription/useMicPhraseTimeout.js
@@ -1,5 +1,5 @@
import { useStore_MicPhraseTimeout } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useMicPhraseTimeout = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/transcription/useMicRecordTimeout.js b/src-ui/logics/configs/transcription/useMicRecordTimeout.js
index 27798804..cfeab807 100644
--- a/src-ui/logics/configs/transcription/useMicRecordTimeout.js
+++ b/src-ui/logics/configs/transcription/useMicRecordTimeout.js
@@ -1,5 +1,5 @@
import { useStore_MicRecordTimeout } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useMicRecordTimeout = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/transcription/useMicWordFilterList.js b/src-ui/logics/configs/transcription/useMicWordFilterList.js
index cca40b0a..a0ac5b09 100644
--- a/src-ui/logics/configs/transcription/useMicWordFilterList.js
+++ b/src-ui/logics/configs/transcription/useMicWordFilterList.js
@@ -1,5 +1,5 @@
import { useStore_MicWordFilterList } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useMicWordFilterList = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/transcription/useSelectableWhisperComputeDeviceList.js b/src-ui/logics/configs/transcription/useSelectableWhisperComputeDeviceList.js
index 94ae24f6..2c732651 100644
--- a/src-ui/logics/configs/transcription/useSelectableWhisperComputeDeviceList.js
+++ b/src-ui/logics/configs/transcription/useSelectableWhisperComputeDeviceList.js
@@ -1,5 +1,5 @@
import { useStore_SelectableWhisperComputeDeviceList } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useSelectableWhisperComputeDeviceList = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/transcription/useSelectedTranscriptionEngine.js b/src-ui/logics/configs/transcription/useSelectedTranscriptionEngine.js
index 43f0b6ab..9c7758f7 100644
--- a/src-ui/logics/configs/transcription/useSelectedTranscriptionEngine.js
+++ b/src-ui/logics/configs/transcription/useSelectedTranscriptionEngine.js
@@ -1,5 +1,5 @@
import { useStore_SelectedTranscriptionEngine } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useSelectedTranscriptionEngine = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/transcription/useSelectedWhisperComputeDevice.js b/src-ui/logics/configs/transcription/useSelectedWhisperComputeDevice.js
index f2d34af1..517dde00 100644
--- a/src-ui/logics/configs/transcription/useSelectedWhisperComputeDevice.js
+++ b/src-ui/logics/configs/transcription/useSelectedWhisperComputeDevice.js
@@ -1,5 +1,5 @@
import { useStore_SelectedWhisperComputeDevice } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useSelectedWhisperComputeDevice = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/transcription/useSelectedWhisperWeightType.js b/src-ui/logics/configs/transcription/useSelectedWhisperWeightType.js
index 02993646..220921ae 100644
--- a/src-ui/logics/configs/transcription/useSelectedWhisperWeightType.js
+++ b/src-ui/logics/configs/transcription/useSelectedWhisperWeightType.js
@@ -1,5 +1,5 @@
import { useStore_SelectedWhisperWeightType } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useSelectedWhisperWeightType = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/transcription/useSpeakerMaxWords.js b/src-ui/logics/configs/transcription/useSpeakerMaxWords.js
index 8678ceb2..4907ab09 100644
--- a/src-ui/logics/configs/transcription/useSpeakerMaxWords.js
+++ b/src-ui/logics/configs/transcription/useSpeakerMaxWords.js
@@ -1,5 +1,5 @@
import { useStore_SpeakerMaxWords } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useSpeakerMaxWords = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/transcription/useSpeakerPhraseTimeout.js b/src-ui/logics/configs/transcription/useSpeakerPhraseTimeout.js
index af9e8fba..4f9ac1c9 100644
--- a/src-ui/logics/configs/transcription/useSpeakerPhraseTimeout.js
+++ b/src-ui/logics/configs/transcription/useSpeakerPhraseTimeout.js
@@ -1,5 +1,5 @@
import { useStore_SpeakerPhraseTimeout } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useSpeakerPhraseTimeout = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/transcription/useSpeakerRecordTimeout.js b/src-ui/logics/configs/transcription/useSpeakerRecordTimeout.js
index 5d17754c..123ad89b 100644
--- a/src-ui/logics/configs/transcription/useSpeakerRecordTimeout.js
+++ b/src-ui/logics/configs/transcription/useSpeakerRecordTimeout.js
@@ -1,5 +1,5 @@
import { useStore_SpeakerRecordTimeout } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useSpeakerRecordTimeout = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/transcription/useWhisperWeightTypeStatus.js b/src-ui/logics/configs/transcription/useWhisperWeightTypeStatus.js
index 482273d2..1d8a96c3 100644
--- a/src-ui/logics/configs/transcription/useWhisperWeightTypeStatus.js
+++ b/src-ui/logics/configs/transcription/useWhisperWeightTypeStatus.js
@@ -1,5 +1,5 @@
import { useStore_WhisperWeightTypeStatus } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useWhisperWeightTypeStatus = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/translation/useCTranslate2WeightTypeStatus.js b/src-ui/logics/configs/translation/useCTranslate2WeightTypeStatus.js
index 4f840765..fa28404e 100644
--- a/src-ui/logics/configs/translation/useCTranslate2WeightTypeStatus.js
+++ b/src-ui/logics/configs/translation/useCTranslate2WeightTypeStatus.js
@@ -1,5 +1,5 @@
import { useStore_CTranslate2WeightTypeStatus } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useCTranslate2WeightTypeStatus = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/translation/useDeepLAuthKey.js b/src-ui/logics/configs/translation/useDeepLAuthKey.js
index a568dfe9..bff8163b 100644
--- a/src-ui/logics/configs/translation/useDeepLAuthKey.js
+++ b/src-ui/logics/configs/translation/useDeepLAuthKey.js
@@ -1,5 +1,5 @@
import { useStore_DeepLAuthKey } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
import { useTranslation } from "react-i18next";
import { useNotificationStatus } from "@logics_common";
diff --git a/src-ui/logics/configs/translation/useSelectableCTranslate2ComputeDeviceList.js b/src-ui/logics/configs/translation/useSelectableCTranslate2ComputeDeviceList.js
index e2ca89ca..db576d9c 100644
--- a/src-ui/logics/configs/translation/useSelectableCTranslate2ComputeDeviceList.js
+++ b/src-ui/logics/configs/translation/useSelectableCTranslate2ComputeDeviceList.js
@@ -1,5 +1,5 @@
import { useStore_SelectableCTranslate2ComputeDeviceList } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useSelectableCTranslate2ComputeDeviceList = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/translation/useSelectedCTranslate2ComputeDevice.js b/src-ui/logics/configs/translation/useSelectedCTranslate2ComputeDevice.js
index 37f6623d..0887364d 100644
--- a/src-ui/logics/configs/translation/useSelectedCTranslate2ComputeDevice.js
+++ b/src-ui/logics/configs/translation/useSelectedCTranslate2ComputeDevice.js
@@ -1,5 +1,5 @@
import { useStore_SelectedCTranslate2ComputeDevice } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useSelectedCTranslate2ComputeDevice = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/translation/useSelectedCTranslate2WeightType.js b/src-ui/logics/configs/translation/useSelectedCTranslate2WeightType.js
index 8641a2ac..9b6197dc 100644
--- a/src-ui/logics/configs/translation/useSelectedCTranslate2WeightType.js
+++ b/src-ui/logics/configs/translation/useSelectedCTranslate2WeightType.js
@@ -1,5 +1,5 @@
import { useStore_SelectedCTranslate2WeightType } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useSelectedCTranslate2WeightType = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/vr/useIsEnabledOverlayLargeLog.js b/src-ui/logics/configs/vr/useIsEnabledOverlayLargeLog.js
index 0e1f8881..c66e865f 100644
--- a/src-ui/logics/configs/vr/useIsEnabledOverlayLargeLog.js
+++ b/src-ui/logics/configs/vr/useIsEnabledOverlayLargeLog.js
@@ -1,5 +1,5 @@
import { useStore_IsEnabledOverlayLargeLog } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useIsEnabledOverlayLargeLog = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/vr/useIsEnabledOverlaySmallLog.js b/src-ui/logics/configs/vr/useIsEnabledOverlaySmallLog.js
index e51a34c3..dbdf0247 100644
--- a/src-ui/logics/configs/vr/useIsEnabledOverlaySmallLog.js
+++ b/src-ui/logics/configs/vr/useIsEnabledOverlaySmallLog.js
@@ -1,5 +1,5 @@
import { useStore_IsEnabledOverlaySmallLog } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useIsEnabledOverlaySmallLog = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/vr/useOverlayLargeLogSettings.js b/src-ui/logics/configs/vr/useOverlayLargeLogSettings.js
index 548189e3..f7a1a577 100644
--- a/src-ui/logics/configs/vr/useOverlayLargeLogSettings.js
+++ b/src-ui/logics/configs/vr/useOverlayLargeLogSettings.js
@@ -1,5 +1,5 @@
import { useStore_OverlayLargeLogSettings } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useOverlayLargeLogSettings = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/vr/useOverlayShowOnlyTranslatedMessages.js b/src-ui/logics/configs/vr/useOverlayShowOnlyTranslatedMessages.js
index 895581ae..40e3fc87 100644
--- a/src-ui/logics/configs/vr/useOverlayShowOnlyTranslatedMessages.js
+++ b/src-ui/logics/configs/vr/useOverlayShowOnlyTranslatedMessages.js
@@ -1,5 +1,5 @@
import { useStore_OverlayShowOnlyTranslatedMessages } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useOverlayShowOnlyTranslatedMessages = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/vr/useOverlaySmallLogSettings.js b/src-ui/logics/configs/vr/useOverlaySmallLogSettings.js
index 03b61393..7979f5c1 100644
--- a/src-ui/logics/configs/vr/useOverlaySmallLogSettings.js
+++ b/src-ui/logics/configs/vr/useOverlaySmallLogSettings.js
@@ -1,5 +1,5 @@
import { useStore_OverlaySmallLogSettings } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useOverlaySmallLogSettings = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/configs/vr/useSendTextToOverlay.js b/src-ui/logics/configs/vr/useSendTextToOverlay.js
index 268881ec..f109e3ad 100644
--- a/src-ui/logics/configs/vr/useSendTextToOverlay.js
+++ b/src-ui/logics/configs/vr/useSendTextToOverlay.js
@@ -1,4 +1,4 @@
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useSendTextToOverlay = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/main/useIsMainPageCompactMode.js b/src-ui/logics/main/useIsMainPageCompactMode.js
index 9a883c51..a1c7110f 100644
--- a/src-ui/logics/main/useIsMainPageCompactMode.js
+++ b/src-ui/logics/main/useIsMainPageCompactMode.js
@@ -1,5 +1,5 @@
import { useStore_IsMainPageCompactMode } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useIsMainPageCompactMode = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/main/useLanguageSettings.js b/src-ui/logics/main/useLanguageSettings.js
index 163f9f37..dcee9bcf 100644
--- a/src-ui/logics/main/useLanguageSettings.js
+++ b/src-ui/logics/main/useLanguageSettings.js
@@ -1,5 +1,5 @@
import { useStore_SelectedPresetTabNumber, useStore_EnableMultiTranslation, useStore_SelectedYourLanguages, useStore_SelectedTargetLanguages, useStore_TranslationEngines, useStore_SelectedTranslationEngines } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useLanguageSettings = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/main/useMainFunction.js b/src-ui/logics/main/useMainFunction.js
index 05be0662..334ef643 100644
--- a/src-ui/logics/main/useMainFunction.js
+++ b/src-ui/logics/main/useMainFunction.js
@@ -6,7 +6,7 @@ import {
useStore_TranscriptionReceiveStatus,
useStore_ForegroundStatus,
} from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useMainFunction = () => {
const appWindow = store.appWindow;
diff --git a/src-ui/logics/main/useMessageInputBoxRatio.js b/src-ui/logics/main/useMessageInputBoxRatio.js
index b8f8430c..173219d6 100644
--- a/src-ui/logics/main/useMessageInputBoxRatio.js
+++ b/src-ui/logics/main/useMessageInputBoxRatio.js
@@ -1,6 +1,6 @@
import { store } from "@store";
import { useStore_MessageInputBoxRatio } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
import { clampMinMax } from "@utils";
export const useMessageInputBoxRatio = () => {
const appWindow = store.appWindow;
diff --git a/src-ui/logics/main/useSelectableLanguageList.js b/src-ui/logics/main/useSelectableLanguageList.js
index ef771d7f..094530c8 100644
--- a/src-ui/logics/main/useSelectableLanguageList.js
+++ b/src-ui/logics/main/useSelectableLanguageList.js
@@ -1,5 +1,5 @@
import { useStore_SelectableLanguageList } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+import { useStdoutToPython } from "@useStdoutToPython";
export const useSelectableLanguageList = () => {
const { asyncStdoutToPython } = useStdoutToPython();
diff --git a/src-ui/logics/useStartPython.js b/src-ui/logics/useStartPython.js
deleted file mode 100644
index c8aaf2f5..00000000
--- a/src-ui/logics/useStartPython.js
+++ /dev/null
@@ -1,34 +0,0 @@
-import { Command } from "@tauri-apps/plugin-shell";
-import { store } from "@store";
-import { useReceiveRoutes } from "./useReceiveRoutes";
-import {
- useNotificationStatus,
-} from "@logics_common";
-
-export const useStartPython = () => {
- const { receiveRoutes } = useReceiveRoutes();
- const { showNotification_Success, showNotification_Error } = useNotificationStatus();
-
- const asyncStartPython = async () => {
- const command = Command.sidecar("bin/VRCT-sidecar");
- command.on("error", error => console.error(`error: "${error}"`));
- command.stdout.on("data", (line) => {
- let parsed_data = "";
- try {
- parsed_data = JSON.parse(line);
- receiveRoutes(parsed_data);
- } catch (error) {
- console.log(error, line);
- }
- });
- command.stderr.on("data", line => {
- showNotification_Error(
- `An error occurred. Please restart VRCT or contact the developers. The last line:${JSON.stringify(line)}`, { hide_duration: null });
- console.error("stderr", line)
- });
- const backend_subprocess = await command.spawn();
- store.backend_subprocess = backend_subprocess;
- };
-
- return { asyncStartPython };
-};
\ No newline at end of file
diff --git a/src-ui/store.js b/src-ui/store.js
index 06fc859a..fcd4c0fd 100644
--- a/src-ui/store.js
+++ b/src-ui/store.js
@@ -5,8 +5,9 @@ import {
} from "jotai";
import {
- generateTestData,
-} from "@test_data";
+ generateTestConversationData,
+} from "./_test_data.js"
+
import {
translator_status,
ctranslate2_weight_type_status,
@@ -169,7 +170,7 @@ export const { atomInstance: Atom_SelectableLanguageList, useHook: useStore_Sele
// Message Container
export const { atomInstance: Atom_MessageLogs, useHook: useStore_MessageLogs } = createAtomWithHook([], "MessageLogs");
-// export const { atomInstance: Atom_MessageLogs, useHook: useStore_MessageLogs } = createAtomWithHook(generateTestData(20), "MessageLogs"); // For testing
+// export const { atomInstance: Atom_MessageLogs, useHook: useStore_MessageLogs } = createAtomWithHook(generateTestConversationData(20), "MessageLogs"); // For testing
export const { atomInstance: Atom_MessageInputBoxRatio, useHook: useStore_MessageInputBoxRatio } = createAtomWithHook(20, "MessageInputBoxRatio");
export const { atomInstance: Atom_MessageInputValue, useHook: useStore_MessageInputValue } = createAtomWithHook("", "MessageInputValue");
export const { atomInstance: Atom_IsVisibleResendButton, useHook: useStore_IsVisibleResendButton } = createAtomWithHook(false, "IsVisibleResendButton", {is_state_ok: true});
diff --git a/vite.config.js b/vite.config.js
index 092db909..32bd2c51 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -56,7 +56,9 @@ export default defineConfig(async () => {
resolve: {
alias: {
"@root": path.resolve(__dirname),
- "@test_data": path.resolve(__dirname, "./test_data.js"),
+
+ "@useReceiveRoutes": path.resolve(__dirname, "src-ui/logics/useReceiveRoutes.js"),
+ "@useStdoutToPython": path.resolve(__dirname, "src-ui/logics/useStdoutToPython.js"),
"@ui_configs": path.resolve(__dirname, "src-ui/ui_configs.js"),
"@scss_mixins": path.resolve(__dirname, "src-ui/common_css/mixins.scss"),
From fb2b2242310021a5e5869950c0c977b437e0b51f Mon Sep 17 00:00:00 2001
From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com>
Date: Sat, 14 Jun 2025 01:07:12 +0900
Subject: [PATCH 3/4] [Refactor] (Huge Refactoring) ReceiveRoutes: change the
way define endpoints, hooks and methods. Remove 'multi language translation
enable/disable' related methods that is no longer in use from quite ago.
---
.../language_selector/LanguageSelector.jsx | 4 +-
.../LanguageSwapButton.jsx | 4 +-
src-ui/logics/common/useHandleOscQuery.js | 5 +-
src-ui/logics/common/useIsVrctAvailable.js | 11 +
src-ui/logics/common/useMessage.js | 4 +
src-ui/logics/common/useOpenFolder.js | 10 +
src-ui/logics/common/useSoftwareVersion.js | 8 +
.../logics/configs/device/useMicDeviceList.js | 9 +
.../logics/configs/device/useMicHostList.js | 7 +
.../configs/device/useSelectedMicHost.js | 13 +
.../configs/device/useSpeakerDeviceList.js | 8 +
.../configs/others/useEnableVrcMicMuteSync.js | 8 +
.../transcription/useMicWordFilterList.js | 17 +
.../useSelectableWhisperComputeDeviceList.js | 7 +
.../configs/translation/useDeepLAuthKey.js | 4 +
...eSelectableCTranslate2ComputeDeviceList.js | 7 +
src-ui/logics/main/index.js | 3 +-
src-ui/logics/main/useLanguageSettings.js | 53 +-
.../logics/main/useSelectableLanguageList.js | 17 -
src-ui/logics/useReceiveRoutes.js | 911 +++++++-----------
src-ui/store.js | 1 -
src-ui/utils.js | 8 +
22 files changed, 510 insertions(+), 609 deletions(-)
delete mode 100644 src-ui/logics/main/useSelectableLanguageList.js
diff --git a/src-ui/app/main_page/main_section/language_selector/LanguageSelector.jsx b/src-ui/app/main_page/main_section/language_selector/LanguageSelector.jsx
index 8fce4e2d..3665df67 100644
--- a/src-ui/app/main_page/main_section/language_selector/LanguageSelector.jsx
+++ b/src-ui/app/main_page/main_section/language_selector/LanguageSelector.jsx
@@ -1,12 +1,12 @@
import { useTranslation } from "react-i18next";
-import { useSelectableLanguageList } from "@logics_main";
+import { useLanguageSettings } from "@logics_main";
import styles from "./LanguageSelector.module.scss";
import { LanguageSelectorTopBar } from "./language_selector_top_bar/LanguageSelectorTopBar";
export const LanguageSelector = ({ title, onClickFunction }) => {
const { t } = useTranslation();
- const { currentSelectableLanguageList } = useSelectableLanguageList();
+ const { currentSelectableLanguageList } = useLanguageSettings();
const groupLanguagesByFirstLetter = (languages) => {
return languages.reduce((acc, { language, country }) => {
diff --git a/src-ui/app/main_page/sidebar_section/language_settings/language_swap_button/LanguageSwapButton.jsx b/src-ui/app/main_page/sidebar_section/language_settings/language_swap_button/LanguageSwapButton.jsx
index dd479a65..ef8d7c0b 100644
--- a/src-ui/app/main_page/sidebar_section/language_settings/language_swap_button/LanguageSwapButton.jsx
+++ b/src-ui/app/main_page/sidebar_section/language_settings/language_swap_button/LanguageSwapButton.jsx
@@ -10,7 +10,7 @@ import { useLanguageSettings } from "@logics_main";
export const LanguageSwapButton = () => {
const [isHovered, setIsHovered] = useState(false);
const { t } = useTranslation();
- const { runLanguageSwap } = useLanguageSettings();
+ const { swapSelectedLanguages } = useLanguageSettings();
const label = isHovered
? t("main_page.swap_button_label")
@@ -29,7 +29,7 @@ export const LanguageSwapButton = () => {
className={styles.swap_button_wrapper}
onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseLeave}
- onClick={runLanguageSwap}
+ onClick={swapSelectedLanguages}
>
{label}
diff --git a/src-ui/logics/common/useHandleOscQuery.js b/src-ui/logics/common/useHandleOscQuery.js index 61c2ba59..dace04d5 100644 --- a/src-ui/logics/common/useHandleOscQuery.js +++ b/src-ui/logics/common/useHandleOscQuery.js @@ -7,7 +7,10 @@ export const useHandleOscQuery = () => { const { showNotification_Warning } = useNotificationStatus(); const { updateEnableVrcMicMuteSync } = useEnableVrcMicMuteSync(); - const handleOscQuery = ({ is_osc_query_enabled, disabled_functions }) => { + const handleOscQuery = (payload) => { + const is_osc_query_enabled = payload.data; + const disabled_functions = payload.disabled_functions; + if (is_osc_query_enabled) { updateEnableVrcMicMuteSync(prev => ({ ...prev.data, diff --git a/src-ui/logics/common/useIsVrctAvailable.js b/src-ui/logics/common/useIsVrctAvailable.js index dae8911e..569a0210 100644 --- a/src-ui/logics/common/useIsVrctAvailable.js +++ b/src-ui/logics/common/useIsVrctAvailable.js @@ -1,10 +1,21 @@ import { useStore_IsVrctAvailable } from "@store"; +import { useNotificationStatus } from "@logics_common"; export const useIsVrctAvailable = () => { const { currentIsVrctAvailable, updateIsVrctAvailable } = useStore_IsVrctAvailable(); + const { showNotification_Success, showNotification_Error } = useNotificationStatus(); + + const handleAiModelsAvailability = (is_ai_models_available) => { + if (is_ai_models_available === false) { + updateIsVrctAvailable(false); + showNotification_Error("AI models have not been detected. Check the network connection and restart VRCT (it will download automatically, normally).", { hide_duration: null }); + } + }; return { currentIsVrctAvailable, updateIsVrctAvailable, + + handleAiModelsAvailability, }; }; \ No newline at end of file diff --git a/src-ui/logics/common/useMessage.js b/src-ui/logics/common/useMessage.js index 841c90dc..78986b55 100644 --- a/src-ui/logics/common/useMessage.js +++ b/src-ui/logics/common/useMessage.js @@ -42,6 +42,9 @@ export const useMessage = () => { messages: {message: message}, }); }; + const addSystemMessageLog_FromBackend = (payload) => { + addSystemMessageLog(payload.message); + }; const updateSentMessageLogById = (payload) => { updateMessageLogs(updateItemById(payload.id, payload.translation)); @@ -66,6 +69,7 @@ export const useMessage = () => { currentMessageLogs, sendMessage, addSystemMessageLog, + addSystemMessageLog_FromBackend, updateSentMessageLogById, addSentMessageLog, addReceivedMessageLog, diff --git a/src-ui/logics/common/useOpenFolder.js b/src-ui/logics/common/useOpenFolder.js index fa991f03..6ecfd6bd 100644 --- a/src-ui/logics/common/useOpenFolder.js +++ b/src-ui/logics/common/useOpenFolder.js @@ -2,16 +2,26 @@ import { useStdoutToPython } from "@useStdoutToPython"; export const useOpenFolder = () => { const { asyncStdoutToPython } = useStdoutToPython(); + const openFolder_MessageLogs = () => { asyncStdoutToPython("/run/open_filepath_logs"); }; + const openedFolder_MessageLogs = () => { + console.log("Opened Directory, Message Logs"); + }; const openFolder_ConfigFile = () => { asyncStdoutToPython("/run/open_filepath_config_file"); }; + const openedFolder_ConfigFile = () => { + console.log("Opened Directory, Config File"); + }; return { openFolder_MessageLogs, openFolder_ConfigFile, + + openedFolder_MessageLogs, + openedFolder_ConfigFile, }; }; \ No newline at end of file diff --git a/src-ui/logics/common/useSoftwareVersion.js b/src-ui/logics/common/useSoftwareVersion.js index 25c257d5..ea6e99ad 100644 --- a/src-ui/logics/common/useSoftwareVersion.js +++ b/src-ui/logics/common/useSoftwareVersion.js @@ -13,6 +13,13 @@ export const useSoftwareVersion = () => { asyncStdoutToPython("/get/data/version"); }; + const updateSoftwareVersionInfo = (payload) => { + updateLatestSoftwareVersionInfo(prev => ({ + is_update_available: payload.is_update_available, + new_version: payload.new_version || prev.data.new_version, + })); + }; + const isPluginCompatible = (main_version, lower_version, upper_version) => { // lower_version 以上かつ upper_version 以下なら互換性ありと判定 return semver.gte(main_version, lower_version) && semver.lte(main_version, upper_version); @@ -32,6 +39,7 @@ export const useSoftwareVersion = () => { getSoftwareVersion, updateSoftwareVersion, + updateSoftwareVersionInfo, currentLatestSoftwareVersionInfo, updateLatestSoftwareVersionInfo, diff --git a/src-ui/logics/configs/device/useMicDeviceList.js b/src-ui/logics/configs/device/useMicDeviceList.js index 486c3f58..d145a890 100644 --- a/src-ui/logics/configs/device/useMicDeviceList.js +++ b/src-ui/logics/configs/device/useMicDeviceList.js @@ -1,5 +1,6 @@ import { useStore_MicDeviceList } from "@store"; import { useStdoutToPython } from "@useStdoutToPython"; +import { arrayToObject } from "@utils"; export const useMicDeviceList = () => { const { asyncStdoutToPython } = useStdoutToPython(); @@ -10,9 +11,17 @@ export const useMicDeviceList = () => { asyncStdoutToPython("/get/data/mic_device_list"); }; + + const updateMicDeviceList_FromBackend = (payload) => { + updateMicDeviceList(arrayToObject(payload)); + }; + + return { currentMicDeviceList, getMicDeviceList, updateMicDeviceList, + + updateMicDeviceList_FromBackend, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useMicHostList.js b/src-ui/logics/configs/device/useMicHostList.js index 39d34097..898f348c 100644 --- a/src-ui/logics/configs/device/useMicHostList.js +++ b/src-ui/logics/configs/device/useMicHostList.js @@ -1,5 +1,6 @@ import { useStore_MicHostList } from "@store"; import { useStdoutToPython } from "@useStdoutToPython"; +import { arrayToObject } from "@utils"; export const useMicHostList = () => { const { asyncStdoutToPython } = useStdoutToPython(); @@ -10,9 +11,15 @@ export const useMicHostList = () => { asyncStdoutToPython("/get/data/mic_host_list"); }; + const updateMicHostList_FromBackend = (payload) => { + updateMicHostList(arrayToObject(payload)); + }; + return { currentMicHostList, getMicHostList, updateMicHostList, + + updateMicHostList_FromBackend, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useSelectedMicHost.js b/src-ui/logics/configs/device/useSelectedMicHost.js index f1c1c147..0197cfc8 100644 --- a/src-ui/logics/configs/device/useSelectedMicHost.js +++ b/src-ui/logics/configs/device/useSelectedMicHost.js @@ -1,10 +1,13 @@ import { useStore_SelectedMicHost } from "@store"; import { useStdoutToPython } from "@useStdoutToPython"; +import { useSelectedMicDevice } from "@logics_configs"; export const useSelectedMicHost = () => { const { asyncStdoutToPython } = useStdoutToPython(); const { currentSelectedMicHost, updateSelectedMicHost, pendingSelectedMicHost } = useStore_SelectedMicHost(); + const { updateSelectedMicDevice } = useSelectedMicDevice(); + const getSelectedMicHost = () => { pendingSelectedMicHost(); asyncStdoutToPython("/get/data/selected_mic_host"); @@ -15,10 +18,20 @@ export const useSelectedMicHost = () => { asyncStdoutToPython("/set/data/selected_mic_host", selected_mic_host); }; + + // Need refactoring (Duplicated, Host, Device) + const updateSelectedMicHostAndDevice = (payload) => { + updateSelectedMicHost(payload.host); + updateSelectedMicDevice(payload.device); + }; + + return { currentSelectedMicHost, getSelectedMicHost, updateSelectedMicHost, setSelectedMicHost, + + updateSelectedMicHostAndDevice, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useSpeakerDeviceList.js b/src-ui/logics/configs/device/useSpeakerDeviceList.js index b0385cf8..b88ed285 100644 --- a/src-ui/logics/configs/device/useSpeakerDeviceList.js +++ b/src-ui/logics/configs/device/useSpeakerDeviceList.js @@ -1,5 +1,6 @@ import { useStore_SpeakerDeviceList } from "@store"; import { useStdoutToPython } from "@useStdoutToPython"; +import { arrayToObject } from "@utils"; export const useSpeakerDeviceList = () => { const { asyncStdoutToPython } = useStdoutToPython(); @@ -10,9 +11,16 @@ export const useSpeakerDeviceList = () => { asyncStdoutToPython("/get/data/speaker_device_list"); }; + const updateSpeakerDeviceList_FromBackend = (payload) => { + updateSpeakerDeviceList(arrayToObject(payload)); + }; + + return { currentSpeakerDeviceList, getSpeakerDeviceList, updateSpeakerDeviceList, + + updateSpeakerDeviceList_FromBackend, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/others/useEnableVrcMicMuteSync.js b/src-ui/logics/configs/others/useEnableVrcMicMuteSync.js index f8711d81..df79fd54 100644 --- a/src-ui/logics/configs/others/useEnableVrcMicMuteSync.js +++ b/src-ui/logics/configs/others/useEnableVrcMicMuteSync.js @@ -19,10 +19,18 @@ export const useEnableVrcMicMuteSync = () => { } }; + const updateEnableVrcMicMuteSync_FromBackend = (payload) => { + updateEnableVrcMicMuteSync((old_value) => { + return {...old_value.data, is_enabled: payload}; + }); + }; + return { currentEnableVrcMicMuteSync, getEnableVrcMicMuteSync, toggleEnableVrcMicMuteSync, updateEnableVrcMicMuteSync, + + updateEnableVrcMicMuteSync_FromBackend, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/transcription/useMicWordFilterList.js b/src-ui/logics/configs/transcription/useMicWordFilterList.js index a0ac5b09..1901e286 100644 --- a/src-ui/logics/configs/transcription/useMicWordFilterList.js +++ b/src-ui/logics/configs/transcription/useMicWordFilterList.js @@ -15,10 +15,27 @@ export const useMicWordFilterList = () => { asyncStdoutToPython("/set/data/mic_word_filter", selected_mic_word_filter); }; + const updateMicWordFilterList_FromBackend = (payload) => { + updateMicWordFilterList((prev_list) => { + const updated_list = [...prev_list.data]; + for (const value of payload) { + const existing_item = updated_list.find(item => item.value === value); + if (existing_item) { + existing_item.is_redoable = false; + } else { + updated_list.push({ value, is_redoable: false }); + } + } + return updated_list; + }); + }; + return { currentMicWordFilterList, getMicWordFilterList, updateMicWordFilterList, setMicWordFilterList, + + updateMicWordFilterList_FromBackend, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/transcription/useSelectableWhisperComputeDeviceList.js b/src-ui/logics/configs/transcription/useSelectableWhisperComputeDeviceList.js index 2c732651..a5528937 100644 --- a/src-ui/logics/configs/transcription/useSelectableWhisperComputeDeviceList.js +++ b/src-ui/logics/configs/transcription/useSelectableWhisperComputeDeviceList.js @@ -1,5 +1,6 @@ import { useStore_SelectableWhisperComputeDeviceList } from "@store"; import { useStdoutToPython } from "@useStdoutToPython"; +import { transformToIndexedArray } from "@utils"; export const useSelectableWhisperComputeDeviceList = () => { const { asyncStdoutToPython } = useStdoutToPython(); @@ -10,9 +11,15 @@ export const useSelectableWhisperComputeDeviceList = () => { asyncStdoutToPython("/get/data/transcription_compute_device_list"); }; + const updateSelectableWhisperComputeDeviceList_FromBackend = (payload) => { + updateSelectableWhisperComputeDeviceList(transformToIndexedArray(payload)); + }; + return { currentSelectableWhisperComputeDeviceList, getSelectableWhisperComputeDeviceList, updateSelectableWhisperComputeDeviceList, + + updateSelectableWhisperComputeDeviceList_FromBackend, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/translation/useDeepLAuthKey.js b/src-ui/logics/configs/translation/useDeepLAuthKey.js index bff8163b..89661ad1 100644 --- a/src-ui/logics/configs/translation/useDeepLAuthKey.js +++ b/src-ui/logics/configs/translation/useDeepLAuthKey.js @@ -23,6 +23,9 @@ export const useDeepLAuthKey = () => { pendingDeepLAuthKey(); asyncStdoutToPython("/delete/data/deepl_auth_key"); }; + const deletedDeepLAuthKey = () => { + updateDeepLAuthKey(""); + }; const savedDeepLAuthKey = (data) => { updateDeepLAuthKey(data); @@ -36,6 +39,7 @@ export const useDeepLAuthKey = () => { setDeepLAuthKey, deleteDeepLAuthKey, + deletedDeepLAuthKey, savedDeepLAuthKey, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/translation/useSelectableCTranslate2ComputeDeviceList.js b/src-ui/logics/configs/translation/useSelectableCTranslate2ComputeDeviceList.js index db576d9c..4ae60c1f 100644 --- a/src-ui/logics/configs/translation/useSelectableCTranslate2ComputeDeviceList.js +++ b/src-ui/logics/configs/translation/useSelectableCTranslate2ComputeDeviceList.js @@ -1,5 +1,6 @@ import { useStore_SelectableCTranslate2ComputeDeviceList } from "@store"; import { useStdoutToPython } from "@useStdoutToPython"; +import { transformToIndexedArray } from "@utils"; export const useSelectableCTranslate2ComputeDeviceList = () => { const { asyncStdoutToPython } = useStdoutToPython(); @@ -10,9 +11,15 @@ export const useSelectableCTranslate2ComputeDeviceList = () => { asyncStdoutToPython("/get/data/translation_compute_device_list"); }; + const updateSelectableCTranslate2ComputeDeviceList_FromBackend = (payload) => { + updateSelectableCTranslate2ComputeDeviceList(transformToIndexedArray(payload)); + }; + return { currentSelectableCTranslate2ComputeDeviceList, getSelectableCTranslate2ComputeDeviceList, updateSelectableCTranslate2ComputeDeviceList, + + updateSelectableCTranslate2ComputeDeviceList_FromBackend, }; }; \ No newline at end of file diff --git a/src-ui/logics/main/index.js b/src-ui/logics/main/index.js index 7cd492d6..14e817dc 100644 --- a/src-ui/logics/main/index.js +++ b/src-ui/logics/main/index.js @@ -3,5 +3,4 @@ export { useIsMainPageCompactMode } from "./useIsMainPageCompactMode"; export { useLanguageSettings } from "./useLanguageSettings"; export { useMainFunction } from "./useMainFunction"; export { useMessageLogScroll } from "./useMessageLogScroll"; -export { useMessageInputBoxRatio } from "./useMessageInputBoxRatio"; -export { useSelectableLanguageList } from "./useSelectableLanguageList"; \ No newline at end of file +export { useMessageInputBoxRatio } from "./useMessageInputBoxRatio"; \ No newline at end of file diff --git a/src-ui/logics/main/useLanguageSettings.js b/src-ui/logics/main/useLanguageSettings.js index dcee9bcf..aad7ae15 100644 --- a/src-ui/logics/main/useLanguageSettings.js +++ b/src-ui/logics/main/useLanguageSettings.js @@ -1,13 +1,10 @@ -import { useStore_SelectedPresetTabNumber, useStore_EnableMultiTranslation, useStore_SelectedYourLanguages, useStore_SelectedTargetLanguages, useStore_TranslationEngines, useStore_SelectedTranslationEngines } from "@store"; +import { useStore_SelectedPresetTabNumber, useStore_SelectedYourLanguages, useStore_SelectedTargetLanguages, useStore_TranslationEngines, useStore_SelectedTranslationEngines, useStore_SelectableLanguageList } from "@store"; import { useStdoutToPython } from "@useStdoutToPython"; +import { translator_status } from "@ui_configs"; export const useLanguageSettings = () => { const { asyncStdoutToPython } = useStdoutToPython(); - const { - currentEnableMultiTranslation, - updateEnableMultiTranslation, - pendingEnableMultiTranslation, - } = useStore_EnableMultiTranslation(); + const { currentSelectedYourLanguages, updateSelectedYourLanguages, @@ -34,10 +31,11 @@ export const useLanguageSettings = () => { pendingSelectedTranslationEngines, } = useStore_SelectedTranslationEngines(); - const getEnableMultiTranslation = () => { - pendingEnableMultiTranslation(); - asyncStdoutToPython("/get/data/multi_language_translation"); - }; + const { + currentSelectableLanguageList, + updateSelectableLanguageList, + } = useStore_SelectableLanguageList(); + const getSelectedPresetTabNumber = () => { pendingSelectedPresetTabNumber(); @@ -112,6 +110,16 @@ export const useLanguageSettings = () => { asyncStdoutToPython("/get/data/translation_engines"); }; + const updateTranslatorAvailability = (payload) => { + const keys = payload; + const updated_list = translator_status.map(translator => ({ + ...translator, + is_available: keys.includes(translator.id), + })); + updateTranslationEngines(updated_list); + }; + + const getSelectedTranslationEngines = () => { pendingSelectedTranslationEngines(); asyncStdoutToPython("/get/data/selected_translation_engines"); @@ -124,12 +132,22 @@ export const useLanguageSettings = () => { asyncStdoutToPython("/set/data/selected_translation_engines", send_obj); }; - const runLanguageSwap = () => { + const swapSelectedLanguages = () => { pendingSelectedYourLanguages(); pendingSelectedTargetLanguages(); asyncStdoutToPython("/run/swap_your_language_and_target_language"); }; + const updateBothSelectedLanguages = (payload) => { + updateSelectedYourLanguages(payload.your); + updateSelectedTargetLanguages(payload.target); + }; + + + const getSelectableLanguageList = () => { + asyncStdoutToPython("/get/data/selectable_language_list"); + }; + return { currentSelectedPresetTabNumber, @@ -137,11 +155,6 @@ export const useLanguageSettings = () => { updateSelectedPresetTabNumber, setSelectedPresetTabNumber, - currentEnableMultiTranslation, - getEnableMultiTranslation, - updateEnableMultiTranslation, - // setEnableMultiTranslation, - currentSelectedYourLanguages, getSelectedYourLanguages, updateSelectedYourLanguages, @@ -158,12 +171,18 @@ export const useLanguageSettings = () => { currentTranslationEngines, getTranslationEngines, updateTranslationEngines, + updateTranslatorAvailability, currentSelectedTranslationEngines, getSelectedTranslationEngines, updateSelectedTranslationEngines, setSelectedTranslationEngines, - runLanguageSwap, + swapSelectedLanguages, + updateBothSelectedLanguages, + + currentSelectableLanguageList, + getSelectableLanguageList, + updateSelectableLanguageList, }; }; \ No newline at end of file diff --git a/src-ui/logics/main/useSelectableLanguageList.js b/src-ui/logics/main/useSelectableLanguageList.js deleted file mode 100644 index 094530c8..00000000 --- a/src-ui/logics/main/useSelectableLanguageList.js +++ /dev/null @@ -1,17 +0,0 @@ -import { useStore_SelectableLanguageList } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useSelectableLanguageList = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentSelectableLanguageList, updateSelectableLanguageList } = useStore_SelectableLanguageList(); - - const getSelectableLanguageList = () => { - asyncStdoutToPython("/get/data/selectable_language_list"); - }; - - return { - currentSelectableLanguageList, - getSelectableLanguageList, - updateSelectableLanguageList, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/useReceiveRoutes.js b/src-ui/logics/useReceiveRoutes.js index b1d3421b..54f49203 100644 --- a/src-ui/logics/useReceiveRoutes.js +++ b/src-ui/logics/useReceiveRoutes.js @@ -1,572 +1,356 @@ -import { translator_status } from "@ui_configs"; -import { arrayToObject } from "@utils"; - +import * as common from "@logics_common"; +import * as main from "@logics_main"; +import * as configs from "@logics_configs"; import { _useBackendErrorHandling } from "./_useBackendErrorHandling"; -import { - useIsVrctAvailable, - useNotificationStatus, - useHandleNetworkConnection, - useHandleOscQuery, +export const ROUTE_META_LIST = [ + // Common + { endpoint: "/run/feed_watchdog", ns: null, hook_name: null, method_name: null }, + { endpoint: "/run/initialization_progress", ns: common, hook_name: "useInitProgress", method_name: "updateInitProgress" }, + { endpoint: "/run/enable_ai_models", ns: common, hook_name: "useIsVrctAvailable", method_name: "handleAiModelsAvailability" }, + { endpoint: "/get/data/compute_mode", ns: common, hook_name: "useComputeMode", method_name: "updateComputeMode" }, - useSoftwareVersion, - useComputeMode, - useInitProgress, - useIsBackendReady, - useWindow, - useMessage, - useVolume, -} from "@logics_common"; + { endpoint: "/get/data/main_window_geometry", ns: common, hook_name: "useWindow", method_name: "restoreWindowGeometry" }, + { endpoint: "/set/data/main_window_geometry", ns: null, hook_name: null, method_name: null }, -import { - useMainFunction, - useSelectableLanguageList, - useLanguageSettings, - useIsMainPageCompactMode, - useMessageInputBoxRatio, -} from "@logics_main"; + { endpoint: "/run/open_filepath_logs", ns: common, hook_name: "useOpenFolder", method_name: "openedFolder_MessageLogs" }, + { endpoint: "/run/open_filepath_config_file", ns: common, hook_name: "useOpenFolder", method_name: "openedFolder_ConfigFile" }, -import { - useEnableAutoMicSelect, - useEnableAutoSpeakerSelect, - useMicHostList, - useSelectedMicHost, - useMicDeviceList, - useSelectedMicDevice, - useSpeakerDeviceList, - useSelectedSpeakerDevice, - useMicThreshold, - useSpeakerThreshold, - useEnableAutoClearMessageInputBox, - useEnableSendOnlyTranslatedMessages, - useEnableAutoExportMessageLogs, - useEnableVrcMicMuteSync, - useEnableSendMessageToVrc, - useEnableSendReceivedMessageToVrc, - useSelectedFontFamily, - useUiLanguage, - useUiScaling, - useMessageLogUiScaling, - useSendMessageButtonType, - useTransparency, - useMicRecordTimeout, - useMicPhraseTimeout, - useMicMaxWords, - useMicWordFilterList, - useSpeakerRecordTimeout, - useSpeakerPhraseTimeout, - useSpeakerMaxWords, - useDeepLAuthKey, - useCTranslate2WeightTypeStatus, - useSelectableCTranslate2ComputeDeviceList, - useSelectedCTranslate2ComputeDevice, - useSelectableWhisperComputeDeviceList, - useSelectedWhisperComputeDevice, - useSelectedCTranslate2WeightType, - useSelectedTranscriptionEngine, - useSelectedWhisperWeightType, - useWhisperWeightTypeStatus, - useIsEnabledOverlaySmallLog, - useOverlaySmallLogSettings, - useIsEnabledOverlayLargeLog, - useOverlayLargeLogSettings, - useOverlayShowOnlyTranslatedMessages, - useEnableNotificationVrcSfx, - useHotkeys, - usePlugins, - useOscIpAddress, - useOscPort, - useWebsocket, -} from "@logics_configs"; + // Software Version + { endpoint: "/get/data/version", ns: common, hook_name: "useSoftwareVersion", method_name: "updateSoftwareVersion" }, + // Latest Software Version Info + { endpoint: "/run/software_update_info", ns: common, hook_name: "useSoftwareVersion", method_name: "updateLatestSoftwareVersionInfo" }, + + { endpoint: "/run/connected_network", ns: common, hook_name: "useHandleNetworkConnection", method_name: "handleNetworkConnection" }, + { endpoint: "/run/enable_osc_query", ns: common, hook_name: "useHandleOscQuery", method_name: "handleOscQuery" }, + + // Message (By typing) + { endpoint: "/run/send_message_box", ns: common, hook_name: "useMessage", method_name: "updateSentMessageLogById" }, + { endpoint: "/run/typing_message_box", ns: null, hook_name: null, method_name: null }, + { endpoint: "/run/stop_typing_message_box", ns: null, hook_name: null, method_name: null }, + // Message Transcription + { endpoint: "/run/transcription_send_mic_message", ns: common, hook_name: "useMessage", method_name: "addSentMessageLog" }, + { endpoint: "/run/transcription_receive_speaker_message", ns: common, hook_name: "useMessage", method_name: "addReceivedMessageLog" }, + + // System Messages + { endpoint: "/run/word_filter", ns: common, hook_name: "useMessage", method_name: "addSystemMessageLog_FromBackend" }, + + + // Volume + { endpoint: "/run/check_mic_volume", ns: common, hook_name: "useVolume", method_name: "updateVolumeVariable_Mic" }, + { endpoint: "/run/check_speaker_volume", ns: common, hook_name: "useVolume", method_name: "updateVolumeVariable_Speaker" }, + { endpoint: "/set/enable/check_mic_threshold", ns: common, hook_name: "useVolume", method_name: "updateMicThresholdCheckStatus" }, + { endpoint: "/set/disable/check_mic_threshold", ns: common, hook_name: "useVolume", method_name: "updateMicThresholdCheckStatus" }, + { endpoint: "/set/enable/check_speaker_threshold", ns: common, hook_name: "useVolume", method_name: "updateSpeakerThresholdCheckStatus" }, + { endpoint: "/set/disable/check_speaker_threshold", ns: common, hook_name: "useVolume", method_name: "updateSpeakerThresholdCheckStatus" }, + + + + + // Main Page + // Page Controls + { endpoint: "/get/data/main_window_sidebar_compact_mode", ns: main, hook_name: "useIsMainPageCompactMode", method_name: "updateIsMainPageCompactMode" }, + { endpoint: "/set/enable/main_window_sidebar_compact_mode", ns: main, hook_name: "useIsMainPageCompactMode", method_name: "updateIsMainPageCompactMode" }, + { endpoint: "/set/disable/main_window_sidebar_compact_mode", ns: main, hook_name: "useIsMainPageCompactMode", method_name: "updateIsMainPageCompactMode" }, + + // Main Functions + { endpoint: "/set/enable/translation", ns: main, hook_name: "useMainFunction", method_name: "updateTranslationStatus" }, + { endpoint: "/set/disable/translation", ns: main, hook_name: "useMainFunction", method_name: "updateTranslationStatus" }, + { endpoint: "/set/enable/transcription_send", ns: main, hook_name: "useMainFunction", method_name: "updateTranscriptionSendStatus" }, + { endpoint: "/set/disable/transcription_send", ns: main, hook_name: "useMainFunction", method_name: "updateTranscriptionSendStatus" }, + { endpoint: "/set/enable/transcription_receive", ns: main, hook_name: "useMainFunction", method_name: "updateTranscriptionReceiveStatus" }, + { endpoint: "/set/disable/transcription_receive", ns: main, hook_name: "useMainFunction", method_name: "updateTranscriptionReceiveStatus" }, + + // Language Settings + { endpoint: "/get/data/selected_tab_no", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedPresetTabNumber" }, + { endpoint: "/set/data/selected_tab_no", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedPresetTabNumber" }, + + { endpoint: "/get/data/selected_your_languages", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedYourLanguages" }, + { endpoint: "/set/data/selected_your_languages", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedYourLanguages" }, + { endpoint: "/get/data/selected_target_languages", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedTargetLanguages" }, + { endpoint: "/set/data/selected_target_languages", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedTargetLanguages" }, + + { endpoint: "/get/data/translation_engines", ns: main, hook_name: "useLanguageSettings", method_name: "updateTranslatorAvailability" }, + { endpoint: "/run/translation_engines", ns: main, hook_name: "useLanguageSettings", method_name: "updateTranslatorAvailability" }, + + { endpoint: "/get/data/selected_translation_engines", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedTranslationEngines" }, + { endpoint: "/set/data/selected_translation_engines", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedTranslationEngines" }, + { endpoint: "/run/selected_translation_engines", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedTranslationEngines" }, + + { endpoint: "/run/swap_your_language_and_target_language", ns: main, hook_name: "useLanguageSettings", method_name: "updateBothSelectedLanguages" }, + + // Language Selector + { endpoint: "/get/data/selectable_language_list", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectableLanguageList" }, + + + // Message Input Box + { endpoint: "/get/data/message_box_ratio", ns: main, hook_name: "useMessageInputBoxRatio", method_name: "updateMessageInputBoxRatio" }, + { endpoint: "/set/data/message_box_ratio", ns: main, hook_name: "useMessageInputBoxRatio", method_name: "updateMessageInputBoxRatio" }, + + + + // Config Page + // Device + { endpoint: "/get/data/auto_mic_select", ns: configs, hook_name: "useEnableAutoMicSelect", method_name: "updateEnableAutoMicSelect" }, + { endpoint: "/set/enable/auto_mic_select", ns: configs, hook_name: "useEnableAutoMicSelect", method_name: "updateEnableAutoMicSelect" }, + { endpoint: "/set/disable/auto_mic_select", ns: configs, hook_name: "useEnableAutoMicSelect", method_name: "updateEnableAutoMicSelect" }, + { endpoint: "/get/data/auto_speaker_select", ns: configs, hook_name: "useEnableAutoSpeakerSelect", method_name: "updateEnableAutoSpeakerSelect" }, + { endpoint: "/set/enable/auto_speaker_select", ns: configs, hook_name: "useEnableAutoSpeakerSelect", method_name: "updateEnableAutoSpeakerSelect" }, + { endpoint: "/set/disable/auto_speaker_select", ns: configs, hook_name: "useEnableAutoSpeakerSelect", method_name: "updateEnableAutoSpeakerSelect" }, + + // Device (Mic) + { endpoint: "/get/data/mic_host_list", ns: configs, hook_name: "useMicHostList", method_name: "updateMicHostList_FromBackend" }, + { endpoint: "/run/mic_host_list", ns: configs, hook_name: "useMicHostList", method_name: "updateMicHostList_FromBackend" }, + + { endpoint: "/get/data/selected_mic_host", ns: configs, hook_name: "useSelectedMicHost", method_name: "updateSelectedMicHost" }, + { endpoint: "/set/data/selected_mic_host", ns: configs, hook_name: "useSelectedMicHost", method_name: "updateSelectedMicHostAndDevice" }, // Need refactoring (Duplicated, Host, Device) + + + { endpoint: "/get/data/mic_device_list", ns: configs, hook_name: "useMicDeviceList", method_name: "updateMicDeviceList_FromBackend" }, + { endpoint: "/run/mic_device_list", ns: configs, hook_name: "useMicDeviceList", method_name: "updateMicDeviceList_FromBackend" }, + + { endpoint: "/get/data/selected_mic_device", ns: configs, hook_name: "useSelectedMicDevice", method_name: "updateSelectedMicDevice" }, + { endpoint: "/set/data/selected_mic_device", ns: configs, hook_name: "useSelectedMicDevice", method_name: "updateSelectedMicDevice" }, + + { endpoint: "/run/selected_mic_device", ns: configs, hook_name: "useSelectedMicHost", method_name: "updateSelectedMicHostAndDevice" }, // Need refactoring (Duplicated, Host, Device) + + // Device (Speaker) + { endpoint: "/get/data/speaker_device_list", ns: configs, hook_name: "useSpeakerDeviceList", method_name: "updateSpeakerDeviceList_FromBackend" }, + { endpoint: "/run/speaker_device_list", ns: configs, hook_name: "useSpeakerDeviceList", method_name: "updateSpeakerDeviceList_FromBackend" }, + + { endpoint: "/get/data/selected_speaker_device", ns: configs, hook_name: "useSelectedSpeakerDevice", method_name: "updateSelectedSpeakerDevice" }, + { endpoint: "/set/data/selected_speaker_device", ns: configs, hook_name: "useSelectedSpeakerDevice", method_name: "updateSelectedSpeakerDevice" }, + { endpoint: "/run/selected_speaker_device", ns: configs, hook_name: "useSelectedSpeakerDevice", method_name: "updateSelectedSpeakerDevice" }, + + // Device (Threshold) + { endpoint: "/get/data/mic_threshold", ns: configs, hook_name: "useMicThreshold", method_name: "updateMicThreshold" }, + { endpoint: "/set/data/mic_threshold", ns: configs, hook_name: "useMicThreshold", method_name: "updateMicThreshold" }, + { endpoint: "/get/data/speaker_threshold", ns: configs, hook_name: "useSpeakerThreshold", method_name: "updateSpeakerThreshold" }, + { endpoint: "/set/data/speaker_threshold", ns: configs, hook_name: "useSpeakerThreshold", method_name: "updateSpeakerThreshold" }, + + { endpoint: "/get/data/mic_automatic_threshold", ns: configs, hook_name: "useMicThreshold", method_name: "updateEnableAutomaticMicThreshold" }, + { endpoint: "/set/enable/mic_automatic_threshold", ns: configs, hook_name: "useMicThreshold", method_name: "updateEnableAutomaticMicThreshold" }, + { endpoint: "/set/disable/mic_automatic_threshold", ns: configs, hook_name: "useMicThreshold", method_name: "updateEnableAutomaticMicThreshold" }, + { endpoint: "/get/data/speaker_automatic_threshold", ns: configs, hook_name: "useSpeakerThreshold", method_name: "updateEnableAutomaticSpeakerThreshold" }, + { endpoint: "/set/enable/speaker_automatic_threshold", ns: configs, hook_name: "useSpeakerThreshold", method_name: "updateEnableAutomaticSpeakerThreshold" }, + { endpoint: "/set/disable/speaker_automatic_threshold", ns: configs, hook_name: "useSpeakerThreshold", method_name: "updateEnableAutomaticSpeakerThreshold" }, + + + // Appearance + { endpoint: "/get/data/ui_language", ns: configs, hook_name: "useUiLanguage", method_name: "updateUiLanguage" }, + { endpoint: "/set/data/ui_language", ns: configs, hook_name: "useUiLanguage", method_name: "updateUiLanguage" }, + + { endpoint: "/get/data/ui_scaling", ns: configs, hook_name: "useUiScaling", method_name: "updateUiScaling" }, + { endpoint: "/set/data/ui_scaling", ns: configs, hook_name: "useUiScaling", method_name: "updateUiScaling" }, + + { endpoint: "/get/data/textbox_ui_scaling", ns: configs, hook_name: "useMessageLogUiScaling", method_name: "updateMessageLogUiScaling" }, + { endpoint: "/set/data/textbox_ui_scaling", ns: configs, hook_name: "useMessageLogUiScaling", method_name: "updateMessageLogUiScaling" }, + + { endpoint: "/get/data/send_message_button_type", ns: configs, hook_name: "useSendMessageButtonType", method_name: "updateSendMessageButtonType" }, + { endpoint: "/set/data/send_message_button_type", ns: configs, hook_name: "useSendMessageButtonType", method_name: "updateSendMessageButtonType" }, + + { endpoint: "/get/data/font_family", ns: configs, hook_name: "useSelectedFontFamily", method_name: "updateSelectedFontFamily" }, + { endpoint: "/set/data/font_family", ns: configs, hook_name: "useSelectedFontFamily", method_name: "updateSelectedFontFamily" }, + + { endpoint: "/get/data/transparency", ns: configs, hook_name: "useTransparency", method_name: "updateTransparency" }, + { endpoint: "/set/data/transparency", ns: configs, hook_name: "useTransparency", method_name: "updateTransparency" }, + + // Translation + { endpoint: "/get/data/deepl_auth_key", ns: configs, hook_name: "useDeepLAuthKey", method_name: "updateDeepLAuthKey" }, + { endpoint: "/set/data/deepl_auth_key", ns: configs, hook_name: "useDeepLAuthKey", method_name: "savedDeepLAuthKey" }, + { endpoint: "/delete/data/deepl_auth_key", ns: configs, hook_name: "useDeepLAuthKey", method_name: "deletedDeepLAuthKey" }, + + // Translation (AI Models) + { endpoint: "/get/data/ctranslate2_weight_type", ns: configs, hook_name: "useSelectedCTranslate2WeightType", method_name: "updateSelectedCTranslate2WeightType" }, + { endpoint: "/set/data/ctranslate2_weight_type", ns: configs, hook_name: "useSelectedCTranslate2WeightType", method_name: "updateSelectedCTranslate2WeightType" }, + + { endpoint: "/get/data/selectable_ctranslate2_weight_type_dict", ns: configs, hook_name: "useCTranslate2WeightTypeStatus", method_name: "updateDownloadedCTranslate2WeightTypeStatus" }, + + { endpoint: "/get/data/translation_compute_device_list", ns: configs, hook_name: "useSelectableCTranslate2ComputeDeviceList", method_name: "updateSelectableCTranslate2ComputeDeviceList_FromBackend" }, + + { endpoint: "/get/data/selected_translation_compute_device", ns: configs, hook_name: "useSelectedCTranslate2ComputeDevice", method_name: "updateSelectedCTranslate2ComputeDevice" }, + { endpoint: "/set/data/selected_translation_compute_device", ns: configs, hook_name: "useSelectedCTranslate2ComputeDevice", method_name: "updateSelectedCTranslate2ComputeDevice" }, + + { endpoint: "/run/downloaded_ctranslate2_weight", ns: configs, hook_name: "useCTranslate2WeightTypeStatus", method_name: "downloadedCTranslate2WeightType" }, + { endpoint: "/run/download_ctranslate2_weight", ns: null, hook_name: null, method_name: null }, + { endpoint: "/run/download_progress_ctranslate2_weight", ns: configs, hook_name: "useCTranslate2WeightTypeStatus", method_name: "updateDownloadProgressCTranslate2WeightTypeStatus" }, + + // Transcription + // Transcription (Mic) + { endpoint: "/get/data/mic_record_timeout", ns: configs, hook_name: "useMicRecordTimeout", method_name: "updateMicRecordTimeout" }, + { endpoint: "/set/data/mic_record_timeout", ns: configs, hook_name: "useMicRecordTimeout", method_name: "updateMicRecordTimeout" }, + + { endpoint: "/get/data/mic_phrase_timeout", ns: configs, hook_name: "useMicPhraseTimeout", method_name: "updateMicPhraseTimeout" }, + { endpoint: "/set/data/mic_phrase_timeout", ns: configs, hook_name: "useMicPhraseTimeout", method_name: "updateMicPhraseTimeout" }, + + { endpoint: "/get/data/mic_max_phrases", ns: configs, hook_name: "useMicMaxWords", method_name: "updateMicMaxWords" }, + { endpoint: "/set/data/mic_max_phrases", ns: configs, hook_name: "useMicMaxWords", method_name: "updateMicMaxWords" }, + + { endpoint: "/get/data/mic_word_filter", ns: configs, hook_name: "useMicWordFilterList", method_name: "updateMicWordFilterList_FromBackend" }, + { endpoint: "/set/data/mic_word_filter", ns: configs, hook_name: "useMicWordFilterList", method_name: "updateMicWordFilterList_FromBackend" }, + + // Transcription (Speaker) + { endpoint: "/get/data/speaker_record_timeout", ns: configs, hook_name: "useSpeakerRecordTimeout", method_name: "updateSpeakerRecordTimeout" }, + { endpoint: "/set/data/speaker_record_timeout", ns: configs, hook_name: "useSpeakerRecordTimeout", method_name: "updateSpeakerRecordTimeout" }, + + { endpoint: "/get/data/speaker_phrase_timeout", ns: configs, hook_name: "useSpeakerPhraseTimeout", method_name: "updateSpeakerPhraseTimeout" }, + { endpoint: "/set/data/speaker_phrase_timeout", ns: configs, hook_name: "useSpeakerPhraseTimeout", method_name: "updateSpeakerPhraseTimeout" }, + + { endpoint: "/get/data/speaker_max_phrases", ns: configs, hook_name: "useSpeakerMaxWords", method_name: "updateSpeakerMaxWords" }, + { endpoint: "/set/data/speaker_max_phrases", ns: configs, hook_name: "useSpeakerMaxWords", method_name: "updateSpeakerMaxWords" }, + + // Transcription (AI Models) + { endpoint: "/get/data/selected_transcription_engine", ns: configs, hook_name: "useSelectedTranscriptionEngine", method_name: "updateSelectedTranscriptionEngine" }, + { endpoint: "/set/data/selected_transcription_engine", ns: configs, hook_name: "useSelectedTranscriptionEngine", method_name: "updateSelectedTranscriptionEngine" }, + + { endpoint: "/get/data/whisper_weight_type", ns: configs, hook_name: "useSelectedWhisperWeightType", method_name: "updateSelectedWhisperWeightType" }, + { endpoint: "/set/data/whisper_weight_type", ns: configs, hook_name: "useSelectedWhisperWeightType", method_name: "updateSelectedWhisperWeightType" }, + + { endpoint: "/get/data/selectable_whisper_weight_type_dict", ns: configs, hook_name: "useWhisperWeightTypeStatus", method_name: "updateDownloadedWhisperWeightTypeStatus" }, + + { endpoint: "/run/downloaded_whisper_weight", ns: configs, hook_name: "useWhisperWeightTypeStatus", method_name: "downloadedWhisperWeightType" }, + { endpoint: "/run/download_whisper_weight", ns: null, hook_name: null, method_name: null }, + { endpoint: "/run/download_progress_whisper_weight", ns: configs, hook_name: "useWhisperWeightTypeStatus", method_name: "updateDownloadProgressWhisperWeightTypeStatus" }, + + { endpoint: "/get/data/transcription_compute_device_list", ns: configs, hook_name: "useSelectableWhisperComputeDeviceList", method_name: "updateSelectableWhisperComputeDeviceList_FromBackend" }, + { endpoint: "/get/data/selected_transcription_compute_device", ns: configs, hook_name: "useSelectedWhisperComputeDevice", method_name: "updateSelectedWhisperComputeDevice" }, + { endpoint: "/set/data/selected_transcription_compute_device", ns: configs, hook_name: "useSelectedWhisperComputeDevice", method_name: "updateSelectedWhisperComputeDevice" }, + + // VR + { endpoint: "/get/data/overlay_small_log", ns: configs, hook_name: "useIsEnabledOverlaySmallLog", method_name: "updateIsEnabledOverlaySmallLog" }, + { endpoint: "/set/enable/overlay_small_log", ns: configs, hook_name: "useIsEnabledOverlaySmallLog", method_name: "updateIsEnabledOverlaySmallLog" }, + { endpoint: "/set/disable/overlay_small_log", ns: configs, hook_name: "useIsEnabledOverlaySmallLog", method_name: "updateIsEnabledOverlaySmallLog" }, + + { endpoint: "/get/data/overlay_small_log_settings", ns: configs, hook_name: "useOverlaySmallLogSettings", method_name: "updateOverlaySmallLogSettings" }, + { endpoint: "/set/data/overlay_small_log_settings", ns: configs, hook_name: "useOverlaySmallLogSettings", method_name: "updateOverlaySmallLogSettings" }, + + { endpoint: "/get/data/overlay_large_log", ns: configs, hook_name: "useIsEnabledOverlayLargeLog", method_name: "updateIsEnabledOverlayLargeLog" }, + { endpoint: "/set/enable/overlay_large_log", ns: configs, hook_name: "useIsEnabledOverlayLargeLog", method_name: "updateIsEnabledOverlayLargeLog" }, + { endpoint: "/set/disable/overlay_large_log", ns: configs, hook_name: "useIsEnabledOverlayLargeLog", method_name: "updateIsEnabledOverlayLargeLog" }, + + { endpoint: "/get/data/overlay_large_log_settings", ns: configs, hook_name: "useOverlayLargeLogSettings", method_name: "updateOverlayLargeLogSettings" }, + { endpoint: "/set/data/overlay_large_log_settings", ns: configs, hook_name: "useOverlayLargeLogSettings", method_name: "updateOverlayLargeLogSettings" }, + + { endpoint: "/get/data/overlay_show_only_translated_messages", ns: configs, hook_name: "useOverlayShowOnlyTranslatedMessages", method_name: "updateOverlayShowOnlyTranslatedMessages" }, + { endpoint: "/set/enable/overlay_show_only_translated_messages", ns: configs, hook_name: "useOverlayShowOnlyTranslatedMessages", method_name: "updateOverlayShowOnlyTranslatedMessages" }, + { endpoint: "/set/disable/overlay_show_only_translated_messages", ns: configs, hook_name: "useOverlayShowOnlyTranslatedMessages", method_name: "updateOverlayShowOnlyTranslatedMessages" }, + + { endpoint: "/run/send_text_overlay", ns: null, hook_name: null, method_name: null }, + + + // Others + { endpoint: "/get/data/auto_clear_message_box", ns: configs, hook_name: "useEnableAutoClearMessageInputBox", method_name: "updateEnableAutoClearMessageInputBox" }, + { endpoint: "/set/enable/auto_clear_message_box", ns: configs, hook_name: "useEnableAutoClearMessageInputBox", method_name: "updateEnableAutoClearMessageInputBox" }, + { endpoint: "/set/disable/auto_clear_message_box", ns: configs, hook_name: "useEnableAutoClearMessageInputBox", method_name: "updateEnableAutoClearMessageInputBox" }, + + { endpoint: "/get/data/send_only_translated_messages", ns: configs, hook_name: "useEnableSendOnlyTranslatedMessages", method_name: "updateEnableSendOnlyTranslatedMessages" }, + { endpoint: "/set/enable/send_only_translated_messages", ns: configs, hook_name: "useEnableSendOnlyTranslatedMessages", method_name: "updateEnableSendOnlyTranslatedMessages" }, + { endpoint: "/set/disable/send_only_translated_messages", ns: configs, hook_name: "useEnableSendOnlyTranslatedMessages", method_name: "updateEnableSendOnlyTranslatedMessages" }, + + { endpoint: "/get/data/logger_feature", ns: configs, hook_name: "useEnableAutoExportMessageLogs", method_name: "updateEnableAutoExportMessageLogs" }, + { endpoint: "/set/enable/logger_feature", ns: configs, hook_name: "useEnableAutoExportMessageLogs", method_name: "updateEnableAutoExportMessageLogs" }, + { endpoint: "/set/disable/logger_feature", ns: configs, hook_name: "useEnableAutoExportMessageLogs", method_name: "updateEnableAutoExportMessageLogs" }, + + { endpoint: "/get/data/vrc_mic_mute_sync", ns: configs, hook_name: "useEnableVrcMicMuteSync", method_name: "updateEnableVrcMicMuteSync_FromBackend" }, + { endpoint: "/set/enable/vrc_mic_mute_sync", ns: configs, hook_name: "useEnableVrcMicMuteSync", method_name: "updateEnableVrcMicMuteSync_FromBackend" }, + { endpoint: "/set/disable/vrc_mic_mute_sync", ns: configs, hook_name: "useEnableVrcMicMuteSync", method_name: "updateEnableVrcMicMuteSync_FromBackend" }, + + + { endpoint: "/get/data/send_message_to_vrc", ns: configs, hook_name: "useEnableSendMessageToVrc", method_name: "updateEnableSendMessageToVrc" }, + { endpoint: "/set/enable/send_message_to_vrc", ns: configs, hook_name: "useEnableSendMessageToVrc", method_name: "updateEnableSendMessageToVrc" }, + { endpoint: "/set/disable/send_message_to_vrc", ns: configs, hook_name: "useEnableSendMessageToVrc", method_name: "updateEnableSendMessageToVrc" }, + + { endpoint: "/get/data/send_received_message_to_vrc", ns: configs, hook_name: "useEnableSendReceivedMessageToVrc", method_name: "updateEnableSendReceivedMessageToVrc" }, + { endpoint: "/set/enable/send_received_message_to_vrc", ns: configs, hook_name: "useEnableSendReceivedMessageToVrc", method_name: "updateEnableSendReceivedMessageToVrc" }, + { endpoint: "/set/disable/send_received_message_to_vrc", ns: configs, hook_name: "useEnableSendReceivedMessageToVrc", method_name: "updateEnableSendReceivedMessageToVrc" }, + + { endpoint: "/get/data/notification_vrc_sfx", ns: configs, hook_name: "useEnableNotificationVrcSfx", method_name: "updateEnableNotificationVrcSfx" }, + { endpoint: "/set/enable/notification_vrc_sfx", ns: configs, hook_name: "useEnableNotificationVrcSfx", method_name: "updateEnableNotificationVrcSfx" }, + { endpoint: "/set/disable/notification_vrc_sfx", ns: configs, hook_name: "useEnableNotificationVrcSfx", method_name: "updateEnableNotificationVrcSfx" }, + + // Hotkeys + { endpoint: "/get/data/hotkeys", ns: configs, hook_name: "useHotkeys", method_name: "updateHotkeys" }, + { endpoint: "/set/data/hotkeys", ns: configs, hook_name: "useHotkeys", method_name: "updateHotkeys" }, + + // Plugins + { endpoint: "/get/data/plugins_status", ns: configs, hook_name: "usePlugins", method_name: "updateSavedPluginsStatus" }, + { endpoint: "/set/data/plugins_status", ns: configs, hook_name: "usePlugins", method_name: "updateSavedPluginsStatus" }, + + // Advanced Settings + { endpoint: "/get/data/osc_ip_address", ns: configs, hook_name: "useOscIpAddress", method_name: "updateOscIpAddress" }, + { endpoint: "/set/data/osc_ip_address", ns: configs, hook_name: "useOscIpAddress", method_name: "updateOscIpAddress" }, + + { endpoint: "/get/data/osc_port", ns: configs, hook_name: "useOscPort", method_name: "updateOscPort" }, + { endpoint: "/set/data/osc_port", ns: configs, hook_name: "useOscPort", method_name: "updateOscPort" }, + + { endpoint: "/get/data/websocket_server", ns: configs, hook_name: "useWebsocket", method_name: "updateEnableWebsocket" }, + { endpoint: "/set/enable/websocket_server", ns: configs, hook_name: "useWebsocket", method_name: "updateEnableWebsocket" }, + { endpoint: "/set/disable/websocket_server", ns: configs, hook_name: "useWebsocket", method_name: "updateEnableWebsocket" }, + + { endpoint: "/get/data/websocket_host", ns: configs, hook_name: "useWebsocket", method_name: "updateWebsocketHost" }, + { endpoint: "/set/data/websocket_host", ns: configs, hook_name: "useWebsocket", method_name: "updateWebsocketHost" }, + + { endpoint: "/get/data/websocket_port", ns: configs, hook_name: "useWebsocket", method_name: "updateWebsocketPort" }, + { endpoint: "/set/data/websocket_port", ns: configs, hook_name: "useWebsocket", method_name: "updateWebsocketPort" }, + + + // Not Implemented Yet... + { endpoint: "/get/data/mic_avg_logprob", ns: null, hook_name: null, method_name: null }, // Not implemented on UI yet + { endpoint: "/get/data/mic_no_speech_prob", ns: null, hook_name: null, method_name: null }, // Not implemented on UI yet + { endpoint: "/get/data/speaker_avg_logprob", ns: null, hook_name: null, method_name: null }, // Not implemented on UI yet + { endpoint: "/get/data/speaker_no_speech_prob", ns: null, hook_name: null, method_name: null }, // Not implemented on UI yet + { endpoint: "/get/data/convert_message_to_romaji", ns: null, hook_name: null, method_name: null }, // Not implemented on UI yet + { endpoint: "/get/data/convert_message_to_hiragana", ns: null, hook_name: null, method_name: null }, // Not implemented on UI yet + { endpoint: "/get/data/transcription_engines", ns: null, hook_name: null, method_name: null }, // Not implemented on UI yet. (if ai_models has not been detected, this will be blank array[]. if the ai_models are ok but just network has not connected, it'l be only ["Whisper"]) +]; export const useReceiveRoutes = () => { - const { updateIsVrctAvailable } = useIsVrctAvailable(); - const { updateComputeMode } = useComputeMode(); - const { updateInitProgress } = useInitProgress(); - const { updateIsBackendReady } = useIsBackendReady(); - const { handleOscQuery } = useHandleOscQuery(); - const { restoreWindowGeometry } = useWindow(); - const { updateIsMainPageCompactMode } = useIsMainPageCompactMode(); - const { - updateTranslationStatus, - updateTranscriptionSendStatus, - updateTranscriptionReceiveStatus, - } = useMainFunction(); - const { - updateSelectedPresetTabNumber, - updateEnableMultiTranslation, - updateSelectedYourLanguages, - updateSelectedTargetLanguages, - updateTranslationEngines, - updateSelectedTranslationEngines, - } = useLanguageSettings(); - const { updateSelectableLanguageList } = useSelectableLanguageList(); - const { - addSystemMessageLog, - updateSentMessageLogById, - addSentMessageLog, - addReceivedMessageLog, - } = useMessage(); - const { updateLatestSoftwareVersionInfo } = useSoftwareVersion(); - const { updateSoftwareVersion } = useSoftwareVersion(); - const { updateEnableAutoMicSelect } = useEnableAutoMicSelect(); - const { updateEnableAutoSpeakerSelect } = useEnableAutoSpeakerSelect(); - const { updateMicHostList } = useMicHostList(); - const { updateSelectedMicHost } = useSelectedMicHost(); - const { updateMicDeviceList } = useMicDeviceList(); - const { updateSelectedMicDevice } = useSelectedMicDevice(); - const { updateSpeakerDeviceList } = useSpeakerDeviceList(); - const { updateSelectedSpeakerDevice } = useSelectedSpeakerDevice(); - const { updateMicThreshold, updateEnableAutomaticMicThreshold } = useMicThreshold(); - const { updateSpeakerThreshold, updateEnableAutomaticSpeakerThreshold } = useSpeakerThreshold(); + const { showNotification_Error } = common.useNotificationStatus(); + const { errorHandling_Backend } = _useBackendErrorHandling(); + const { updateIsBackendReady } = common.useIsBackendReady(); - const { updateEnableAutoClearMessageInputBox } = useEnableAutoClearMessageInputBox(); - const { updateEnableSendOnlyTranslatedMessages } = useEnableSendOnlyTranslatedMessages(); - const { updateEnableAutoExportMessageLogs } = useEnableAutoExportMessageLogs(); - const { updateEnableVrcMicMuteSync } = useEnableVrcMicMuteSync(); - const { updateEnableSendMessageToVrc } = useEnableSendMessageToVrc(); - const { updateEnableSendReceivedMessageToVrc } = useEnableSendReceivedMessageToVrc(); - - const { updateSendMessageButtonType } = useSendMessageButtonType(); - const { updateUiLanguage } = useUiLanguage(); - const { updateUiScaling } = useUiScaling(); - const { updateMessageLogUiScaling } = useMessageLogUiScaling(); - const { - updateVolumeVariable_Mic, - updateVolumeVariable_Speaker, - updateMicThresholdCheckStatus, - updateSpeakerThresholdCheckStatus, - } = useVolume(); - - const { updateMessageInputBoxRatio } = useMessageInputBoxRatio(); - const { updateSelectedFontFamily } = useSelectedFontFamily(); - const { updateTransparency } = useTransparency(); - - const { updateMicRecordTimeout } = useMicRecordTimeout(); - const { updateMicPhraseTimeout } = useMicPhraseTimeout(); - const { updateMicMaxWords } = useMicMaxWords(); - const { updateMicWordFilterList } = useMicWordFilterList(); - - const { updateSpeakerRecordTimeout } = useSpeakerRecordTimeout(); - const { updateSpeakerPhraseTimeout } = useSpeakerPhraseTimeout(); - const { updateSpeakerMaxWords } = useSpeakerMaxWords(); - - const { updateDeepLAuthKey, savedDeepLAuthKey } = useDeepLAuthKey(); - const { updateSelectedCTranslate2WeightType } = useSelectedCTranslate2WeightType(); - const { - updateDownloadedCTranslate2WeightTypeStatus, - updateDownloadProgressCTranslate2WeightTypeStatus, - downloadedCTranslate2WeightType, - } = useCTranslate2WeightTypeStatus(); - const { updateSelectableCTranslate2ComputeDeviceList } = useSelectableCTranslate2ComputeDeviceList(); - const { updateSelectedCTranslate2ComputeDevice } = useSelectedCTranslate2ComputeDevice(); - const { updateSelectableWhisperComputeDeviceList } = useSelectableWhisperComputeDeviceList(); - const { updateSelectedWhisperComputeDevice } = useSelectedWhisperComputeDevice(); - - const { updateSelectedTranscriptionEngine } = useSelectedTranscriptionEngine(); - const { updateSelectedWhisperWeightType } = useSelectedWhisperWeightType(); - const { - updateDownloadedWhisperWeightTypeStatus, - updateDownloadProgressWhisperWeightTypeStatus, - downloadedWhisperWeightType, - } = useWhisperWeightTypeStatus(); - - const { updateOverlaySmallLogSettings } = useOverlaySmallLogSettings(); - const { updateIsEnabledOverlaySmallLog } = useIsEnabledOverlaySmallLog(); - const { updateOverlayLargeLogSettings } = useOverlayLargeLogSettings(); - const { updateIsEnabledOverlayLargeLog } = useIsEnabledOverlayLargeLog(); - const { updateOverlayShowOnlyTranslatedMessages } = useOverlayShowOnlyTranslatedMessages(); - const { updateEnableNotificationVrcSfx } = useEnableNotificationVrcSfx(); - - const { updateHotkeys } = useHotkeys(); - const { updateSavedPluginsStatus } = usePlugins(); - - const { updateOscIpAddress } = useOscIpAddress(); - const { updateOscPort } = useOscPort(); - const { - updateEnableWebsocket, - updateWebsocketHost, - updateWebsocketPort, - } = useWebsocket(); - - - - const { showNotification_Success, showNotification_Error } = useNotificationStatus(); - - const { handleNetworkConnection } = useHandleNetworkConnection(); - - const { - errorHandling_Backend, - } = _useBackendErrorHandling(); - - const routes = { - // Common - "/run/feed_watchdog": () => {}, - "/run/initialization_progress": updateInitProgress, - "/run/enable_ai_models": (is_ai_models_available) => { - if (is_ai_models_available === false) { - updateIsVrctAvailable(false); - showNotification_Error("AI models have not been detected. Check the network connection and restart VRCT (it will download automatically, normally).", { hide_duration: null }); - } - }, - "/get/data/compute_mode": updateComputeMode, - "/get/data/main_window_geometry": restoreWindowGeometry, - "/set/data/main_window_geometry": () => {}, - "/run/open_filepath_logs": () => console.log("Opened Directory, Message Logs"), - "/run/open_filepath_config_file": () => console.log("Opened Directory, Config File"), - "/run/software_update_info": (payload) => { - updateLatestSoftwareVersionInfo(prev => ({ - is_update_available: payload.is_update_available, - new_version: payload.new_version || prev.data.new_version, - })); - }, - "/run/connected_network": handleNetworkConnection, - "/run/enable_osc_query": ({data, disabled_functions}) => { - handleOscQuery({ - is_osc_query_enabled: data, - disabled_functions: disabled_functions, - }); - }, - - // Main Page - // Page Controls - "/get/data/main_window_sidebar_compact_mode": updateIsMainPageCompactMode, - "/set/enable/main_window_sidebar_compact_mode": updateIsMainPageCompactMode, - "/set/disable/main_window_sidebar_compact_mode": updateIsMainPageCompactMode, - // Main Functions - "/set/enable/translation": updateTranslationStatus, - "/set/disable/translation": updateTranslationStatus, - "/set/enable/transcription_send": updateTranscriptionSendStatus, - "/set/disable/transcription_send": updateTranscriptionSendStatus, - "/set/enable/transcription_receive": updateTranscriptionReceiveStatus, - "/set/disable/transcription_receive": updateTranscriptionReceiveStatus, - - // Language Settings - "/get/data/selected_tab_no": updateSelectedPresetTabNumber, - "/set/data/selected_tab_no": updateSelectedPresetTabNumber, - "/get/data/multi_language_translation": updateEnableMultiTranslation, - "/get/data/selected_your_languages": updateSelectedYourLanguages, - "/set/data/selected_your_languages": updateSelectedYourLanguages, - "/get/data/selected_target_languages": updateSelectedTargetLanguages, - "/set/data/selected_target_languages": updateSelectedTargetLanguages, - - "/get/data/translation_engines": (payload) => { - const updateTranslatorAvailability = (keys) => { - return translator_status.map(translator => ({ - ...translator, - is_available: keys.includes(translator.id), - })); - }; - const updated_list = updateTranslatorAvailability(payload); - updateTranslationEngines(updated_list); - }, - "/run/translation_engines": (payload) => { - const updateTranslatorAvailability = (keys) => { - return translator_status.map(translator => ({ - ...translator, - is_available: keys.includes(translator.id), - })); - }; - const updated_list = updateTranslatorAvailability(payload); - updateTranslationEngines(updated_list); - }, - "/get/data/selected_translation_engines": updateSelectedTranslationEngines, - "/set/data/selected_translation_engines": updateSelectedTranslationEngines, - "/run/selected_translation_engines": updateSelectedTranslationEngines, - - "/run/swap_your_language_and_target_language": (payload) => { - updateSelectedYourLanguages(payload.your); - updateSelectedTargetLanguages(payload.target); - }, - - - // Language Selector - "/get/data/selectable_language_list": updateSelectableLanguageList, - - // Message - "/run/send_message_box": updateSentMessageLogById, - "/run/typing_message_box": ()=>{}, - "/run/stop_typing_message_box": ()=>{}, - "/run/transcription_send_mic_message": addSentMessageLog, - "/run/transcription_receive_speaker_message": addReceivedMessageLog, - - // Message Box - "/get/data/message_box_ratio": updateMessageInputBoxRatio, - "/set/data/message_box_ratio": updateMessageInputBoxRatio, - - - // Config Page - // Common - "/get/data/version": updateSoftwareVersion, - - // Device Tab - "/get/data/auto_mic_select": updateEnableAutoMicSelect, - "/set/enable/auto_mic_select": updateEnableAutoMicSelect, - "/set/disable/auto_mic_select": updateEnableAutoMicSelect, - "/get/data/auto_speaker_select": updateEnableAutoSpeakerSelect, - "/set/enable/auto_speaker_select": updateEnableAutoSpeakerSelect, - "/set/disable/auto_speaker_select": updateEnableAutoSpeakerSelect, - - "/get/data/mic_host_list": (payload) => updateMicHostList(arrayToObject(payload)), - "/run/mic_host_list": (payload) => updateMicHostList(arrayToObject(payload)), - "/get/data/selected_mic_host": updateSelectedMicHost, - "/set/data/selected_mic_host": (payload) => { - updateSelectedMicHost(payload.host); - updateSelectedMicDevice(payload.device); - }, - - "/get/data/mic_device_list": (payload) => updateMicDeviceList(arrayToObject(payload)), - "/run/mic_device_list": (payload) => updateMicDeviceList(arrayToObject(payload)), - "/get/data/selected_mic_device": updateSelectedMicDevice, - "/set/data/selected_mic_device": updateSelectedMicDevice, - - "/run/selected_mic_device": (payload) => { - - updateSelectedMicHost(payload.host); - updateSelectedMicDevice(payload.device); - }, - - "/get/data/speaker_device_list": (payload) => updateSpeakerDeviceList(arrayToObject(payload)), - "/run/speaker_device_list": (payload) => updateSpeakerDeviceList(arrayToObject(payload)), - "/get/data/selected_speaker_device": updateSelectedSpeakerDevice, - "/set/data/selected_speaker_device": updateSelectedSpeakerDevice, - "/run/selected_speaker_device": updateSelectedSpeakerDevice, - - "/run/check_mic_volume": updateVolumeVariable_Mic, - "/run/check_speaker_volume": updateVolumeVariable_Speaker, - "/set/enable/check_mic_threshold": updateMicThresholdCheckStatus, - "/set/disable/check_mic_threshold": updateMicThresholdCheckStatus, - "/set/enable/check_speaker_threshold": updateSpeakerThresholdCheckStatus, - "/set/disable/check_speaker_threshold": updateSpeakerThresholdCheckStatus, - - "/get/data/mic_threshold": updateMicThreshold, - "/set/data/mic_threshold": updateMicThreshold, - "/get/data/speaker_threshold": updateSpeakerThreshold, - "/set/data/speaker_threshold": updateSpeakerThreshold, - - "/get/data/mic_automatic_threshold": updateEnableAutomaticMicThreshold, - "/set/enable/mic_automatic_threshold": updateEnableAutomaticMicThreshold, - "/set/disable/mic_automatic_threshold": updateEnableAutomaticMicThreshold, - "/get/data/speaker_automatic_threshold": updateEnableAutomaticSpeakerThreshold, - "/set/enable/speaker_automatic_threshold": updateEnableAutomaticSpeakerThreshold, - "/set/disable/speaker_automatic_threshold": updateEnableAutomaticSpeakerThreshold, - - // Appearance - "/get/data/ui_language": updateUiLanguage, - "/set/data/ui_language": updateUiLanguage, - - "/get/data/ui_scaling": updateUiScaling, - "/set/data/ui_scaling": updateUiScaling, - - "/get/data/textbox_ui_scaling": updateMessageLogUiScaling, - "/set/data/textbox_ui_scaling": updateMessageLogUiScaling, - - "/get/data/send_message_button_type": updateSendMessageButtonType, - "/set/data/send_message_button_type": updateSendMessageButtonType, - - "/get/data/font_family": updateSelectedFontFamily, - "/set/data/font_family": updateSelectedFontFamily, - - "/get/data/transparency": updateTransparency, - "/set/data/transparency": updateTransparency, - - // Translation - "/get/data/deepl_auth_key": updateDeepLAuthKey, - "/set/data/deepl_auth_key": savedDeepLAuthKey, - "/delete/data/deepl_auth_key": () => updateDeepLAuthKey(""), - - "/get/data/ctranslate2_weight_type": updateSelectedCTranslate2WeightType, - "/set/data/ctranslate2_weight_type": updateSelectedCTranslate2WeightType, - - "/get/data/selectable_ctranslate2_weight_type_dict": updateDownloadedCTranslate2WeightTypeStatus, - - "/get/data/translation_compute_device_list": (payload) => updateSelectableCTranslate2ComputeDeviceList(transformToIndexedArray(payload)), - "/get/data/selected_translation_compute_device": updateSelectedCTranslate2ComputeDevice, - "/set/data/selected_translation_compute_device": updateSelectedCTranslate2ComputeDevice, - - "/run/downloaded_ctranslate2_weight": downloadedCTranslate2WeightType, - "/run/download_ctranslate2_weight": () => {}, - "/run/download_progress_ctranslate2_weight": updateDownloadProgressCTranslate2WeightTypeStatus, - - // Transcription - "/get/data/mic_record_timeout": updateMicRecordTimeout, - "/set/data/mic_record_timeout": updateMicRecordTimeout, - - "/get/data/mic_phrase_timeout": updateMicPhraseTimeout, - "/set/data/mic_phrase_timeout": updateMicPhraseTimeout, - - "/get/data/mic_max_phrases": updateMicMaxWords, - "/set/data/mic_max_phrases": updateMicMaxWords, - - "/get/data/mic_word_filter": (payload) => { - updateMicWordFilterList((prev_list) => { - const updated_list = [...prev_list.data]; - for (const value of payload) { - const existing_item = updated_list.find(item => item.value === value); - if (existing_item) { - existing_item.is_redoable = false; - } else { - updated_list.push({ value, is_redoable: false }); - } - } - return updated_list; - }); - }, - "/set/data/mic_word_filter": (payload) => { - updateMicWordFilterList((prev_list) => { - const updated_list = [...prev_list.data]; - for (const value of payload) { - const existing_item = updated_list.find(item => item.value === value); - if (existing_item) { - existing_item.is_redoable = false; - } else { - updated_list.push({ value, is_redoable: false }); - } - } - return updated_list; - }); - }, - "/run/word_filter": (payload) => addSystemMessageLog(payload.message), - - - "/get/data/speaker_record_timeout": updateSpeakerRecordTimeout, - "/set/data/speaker_record_timeout": updateSpeakerRecordTimeout, - - "/get/data/speaker_phrase_timeout": updateSpeakerPhraseTimeout, - "/set/data/speaker_phrase_timeout": updateSpeakerPhraseTimeout, - - "/get/data/speaker_max_phrases": updateSpeakerMaxWords, - "/set/data/speaker_max_phrases": updateSpeakerMaxWords, - - "/get/data/selected_transcription_engine": updateSelectedTranscriptionEngine, - "/set/data/selected_transcription_engine": updateSelectedTranscriptionEngine, - - "/get/data/whisper_weight_type": updateSelectedWhisperWeightType, - "/set/data/whisper_weight_type": updateSelectedWhisperWeightType, - - "/get/data/selectable_whisper_weight_type_dict": updateDownloadedWhisperWeightTypeStatus, - - "/run/downloaded_whisper_weight": downloadedWhisperWeightType, - "/run/download_whisper_weight": () => {}, - "/run/download_progress_whisper_weight": updateDownloadProgressWhisperWeightTypeStatus, - - "/get/data/transcription_compute_device_list": (payload) => updateSelectableWhisperComputeDeviceList(transformToIndexedArray(payload)), - "/get/data/selected_transcription_compute_device": updateSelectedWhisperComputeDevice, - "/set/data/selected_transcription_compute_device": updateSelectedWhisperComputeDevice, - - // VR - "/get/data/overlay_small_log": updateIsEnabledOverlaySmallLog, - "/set/enable/overlay_small_log": updateIsEnabledOverlaySmallLog, - "/set/disable/overlay_small_log": updateIsEnabledOverlaySmallLog, - - "/get/data/overlay_small_log_settings": updateOverlaySmallLogSettings, - "/set/data/overlay_small_log_settings": updateOverlaySmallLogSettings, - - "/get/data/overlay_large_log": updateIsEnabledOverlayLargeLog, - "/set/enable/overlay_large_log": updateIsEnabledOverlayLargeLog, - "/set/disable/overlay_large_log": updateIsEnabledOverlayLargeLog, - - "/get/data/overlay_large_log_settings": updateOverlayLargeLogSettings, - "/set/data/overlay_large_log_settings": updateOverlayLargeLogSettings, - - "/get/data/overlay_show_only_translated_messages": updateOverlayShowOnlyTranslatedMessages, - "/set/enable/overlay_show_only_translated_messages": updateOverlayShowOnlyTranslatedMessages, - "/set/disable/overlay_show_only_translated_messages": updateOverlayShowOnlyTranslatedMessages, - - "/run/send_text_overlay": () => {}, - - // Others Tab - "/get/data/auto_clear_message_box": updateEnableAutoClearMessageInputBox, - "/set/enable/auto_clear_message_box": updateEnableAutoClearMessageInputBox, - "/set/disable/auto_clear_message_box": updateEnableAutoClearMessageInputBox, - - "/get/data/send_only_translated_messages": updateEnableSendOnlyTranslatedMessages, - "/set/enable/send_only_translated_messages": updateEnableSendOnlyTranslatedMessages, - "/set/disable/send_only_translated_messages": updateEnableSendOnlyTranslatedMessages, - - "/get/data/logger_feature": updateEnableAutoExportMessageLogs, - "/set/enable/logger_feature": updateEnableAutoExportMessageLogs, - "/set/disable/logger_feature": updateEnableAutoExportMessageLogs, - - "/get/data/vrc_mic_mute_sync": (payload) => updateEnableVrcMicMuteSync((old_value) => { - return {...old_value.data, is_enabled: payload}; - }), - "/set/enable/vrc_mic_mute_sync": (payload) => updateEnableVrcMicMuteSync((old_value) => { - return {...old_value.data, is_enabled: payload}; - }), - "/set/disable/vrc_mic_mute_sync": (payload) => updateEnableVrcMicMuteSync((old_value) => { - return {...old_value.data, is_enabled: payload}; - }), - - "/get/data/send_message_to_vrc": updateEnableSendMessageToVrc, - "/set/enable/send_message_to_vrc": updateEnableSendMessageToVrc, - "/set/disable/send_message_to_vrc": updateEnableSendMessageToVrc, - - "/get/data/send_received_message_to_vrc": updateEnableSendReceivedMessageToVrc, - "/set/enable/send_received_message_to_vrc": updateEnableSendReceivedMessageToVrc, - "/set/disable/send_received_message_to_vrc": updateEnableSendReceivedMessageToVrc, - - "/get/data/notification_vrc_sfx": updateEnableNotificationVrcSfx, - "/set/enable/notification_vrc_sfx": updateEnableNotificationVrcSfx, - "/set/disable/notification_vrc_sfx": updateEnableNotificationVrcSfx, - - // Hotkeys - "/get/data/hotkeys": updateHotkeys, - "/set/data/hotkeys": updateHotkeys, - - // Plugins - "/get/data/plugins_status": updateSavedPluginsStatus, - "/set/data/plugins_status": updateSavedPluginsStatus, - - // Advanced Settings - "/get/data/osc_ip_address": updateOscIpAddress, - "/set/data/osc_ip_address": updateOscIpAddress, - - "/get/data/osc_port": updateOscPort, - "/set/data/osc_port": updateOscPort, - - "/get/data/websocket_server": updateEnableWebsocket, - "/set/enable/websocket_server": updateEnableWebsocket, - "/set/disable/websocket_server": updateEnableWebsocket, - - "/get/data/websocket_host": updateWebsocketHost, - "/set/data/websocket_host": updateWebsocketHost, - - "/get/data/websocket_port": updateWebsocketPort, - "/set/data/websocket_port": updateWebsocketPort, - - "/get/data/mic_avg_logprob": ()=>{}, // Not implemented on UI yet - "/get/data/mic_no_speech_prob": ()=>{}, // Not implemented on UI yet - "/get/data/speaker_avg_logprob": ()=>{}, // Not implemented on UI yet - "/get/data/speaker_no_speech_prob": ()=>{}, // Not implemented on UI yet - "/get/data/convert_message_to_romaji": ()=>{}, // Not implemented on UI yet - "/get/data/convert_message_to_hiragana": ()=>{}, // Not implemented on UI yet - "/get/data/transcription_engines": ()=>{}, // Not implemented on UI yet. (if ai_models has not been detected, this will be blank array[]. if the ai_models are ok but just network has not connected, it'l be only ["Whisper"]) + const handleInvalidEndpoint = (parsed_data) => { + console.error(`Invalid endpoint: ${parsed_data.endpoint}\nresult: ${JSON.stringify(parsed_data.result)}`); }; + const hook_results = {}; + ROUTE_META_LIST.forEach(({ ns, hook_name }) => { + if (ns && hook_name && !(hook_name in hook_results)) { + hook_results[hook_name] = ns[hook_name](); + } + }); + + const noop = () => {}; + + const routes = Object.fromEntries( + ROUTE_META_LIST.map(({ endpoint, hook_name, method_name }) => { + const result_obj = hook_results[hook_name] || {}; + const fn = result_obj[method_name]; + return [endpoint, typeof fn === "function" ? fn : noop]; + }) + ); + + const receiveRoutes = (parsed_data) => { - const initDataSyncProcess = (payload) => { - for (const [endpoint, value] of Object.entries(payload)) { - const route = routes[endpoint]; - (route) ? route(value) : console.error(`Invalid endpoint: ${endpoint}\nvalue: ${JSON.stringify(value)}`); - } - }; + const { endpoint, status, result } = parsed_data; - const handleInvalidEndpoint = (parsed_data) => { - console.error(`Invalid endpoint: ${parsed_data.endpoint}\nresult: ${JSON.stringify(parsed_data.result)}`); - }; - - if (parsed_data.endpoint === "/run/initialization_complete") { - initDataSyncProcess(parsed_data.result); + if (endpoint === "/run/initialization_complete") { + Object.entries(result).forEach(([ep, value]) => { + if (ep in routes) { + routes[ep](value); + } else { + handleInvalidEndpoint({ endpoint: ep, result: value }); + } + }); updateIsBackendReady(true); return; - }; + } - switch (parsed_data.status) { + + switch (status) { case 200: - const route = routes[parsed_data.endpoint]; - if (route) { - route(parsed_data.result); + if (endpoint in routes) { + routes[endpoint](result); } else { handleInvalidEndpoint(parsed_data); } @@ -580,31 +364,24 @@ export const useReceiveRoutes = () => { result: parsed_data.result, }); break; - case 500: - showNotification_Error( - `An error occurred. Please restart VRCT or contact the developers. ${JSON.stringify(parsed_data.result)}`, { hide_duration: null }); - break; case 348: // console.log(`from backend: %c ${JSON.stringify(parsed_data)}`, style_348); break; + case 500: + showNotification_Error( + `An error occurred. Please restart VRCT or contact the developers. ${JSON.stringify(parsed_data.result)}`, { hide_duration: null }); + break; + default: console.log("Received data status does not match.", parsed_data); - break; } - }; + return { receiveRoutes }; }; const style_348 = [ "color: gray", -].join(";"); - -const transformToIndexedArray = (devices) => { - return devices.reduce((result, device, index) => { - result[index] = device; - return result; - }, {}); -}; \ No newline at end of file +].join(";"); \ No newline at end of file diff --git a/src-ui/store.js b/src-ui/store.js index fcd4c0fd..159385ae 100644 --- a/src-ui/store.js +++ b/src-ui/store.js @@ -153,7 +153,6 @@ export const { atomInstance: Atom_TranscriptionReceiveStatus, useHook: useStore_ export const { atomInstance: Atom_ForegroundStatus, useHook: useStore_ForegroundStatus } = createAtomWithHook(false, "ForegroundStatus", {is_state_ok: true}); export const { atomInstance: Atom_SelectedPresetTabNumber, useHook: useStore_SelectedPresetTabNumber } = createAtomWithHook("1", "SelectedPresetTabNumber"); -export const { atomInstance: Atom_EnableMultiTranslation, useHook: useStore_EnableMultiTranslation } = createAtomWithHook(false, "EnableMultiTranslation"); export const { atomInstance: Atom_SelectedYourLanguages, useHook: useStore_SelectedYourLanguages } = createAtomWithHook({}, "SelectedYourLanguages"); export const { atomInstance: Atom_SelectedTargetLanguages, useHook: useStore_SelectedTargetLanguages } = createAtomWithHook({}, "SelectedTargetLanguages"); diff --git a/src-ui/utils.js b/src-ui/utils.js index 96a87c75..2f5f8bdc 100644 --- a/src-ui/utils.js +++ b/src-ui/utils.js @@ -57,4 +57,12 @@ export const genNumArray = (count, start_from = 0) => { export const genNumObjArray = (count, start_from = 0) => { return arrayToObject(genNumArray(count, start_from)); +}; + +// This is using for only AI models compute device list, currently. (CTranslate2, Whisper) +export const transformToIndexedArray = (devices) => { + return devices.reduce((result, device, index) => { + result[index] = device; + return result; + }, {}); }; \ No newline at end of file From 488655263919d85e41d98b7923f91bae4198fee9 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 14 Jun 2025 03:24:39 +0900 Subject: [PATCH 4/4] [Refactor] Put together device-related logic into useDevice. --- .../ThresholdComponent.jsx | 7 +- .../slider_and_meter/SliderAndMeter.jsx | 7 +- .../setting_box/device/Device.jsx | 44 +-- src-ui/logics/configs/device/useDevice.js | 257 ++++++++++++++++++ .../configs/device/useEnableAutoMicSelect.js | 28 -- .../device/useEnableAutoSpeakerSelect.js | 28 -- .../logics/configs/device/useMicDeviceList.js | 27 -- .../logics/configs/device/useMicHostList.js | 25 -- .../logics/configs/device/useMicThreshold.js | 42 --- .../configs/device/useSelectedMicDevice.js | 24 -- .../configs/device/useSelectedMicHost.js | 37 --- .../device/useSelectedSpeakerDevice.js | 24 -- .../configs/device/useSpeakerDeviceList.js | 26 -- .../configs/device/useSpeakerThreshold.js | 42 --- src-ui/logics/configs/index.js | 11 +- src-ui/logics/useReceiveRoutes.js | 60 ++-- 16 files changed, 318 insertions(+), 371 deletions(-) create mode 100644 src-ui/logics/configs/device/useDevice.js delete mode 100644 src-ui/logics/configs/device/useEnableAutoMicSelect.js delete mode 100644 src-ui/logics/configs/device/useEnableAutoSpeakerSelect.js delete mode 100644 src-ui/logics/configs/device/useMicDeviceList.js delete mode 100644 src-ui/logics/configs/device/useMicHostList.js delete mode 100644 src-ui/logics/configs/device/useMicThreshold.js delete mode 100644 src-ui/logics/configs/device/useSelectedMicDevice.js delete mode 100644 src-ui/logics/configs/device/useSelectedMicHost.js delete mode 100644 src-ui/logics/configs/device/useSelectedSpeakerDevice.js delete mode 100644 src-ui/logics/configs/device/useSpeakerDeviceList.js delete mode 100644 src-ui/logics/configs/device/useSpeakerThreshold.js diff --git a/src-ui/app/config_page/setting_section/setting_box/_components/threshold_component/ThresholdComponent.jsx b/src-ui/app/config_page/setting_section/setting_box/_components/threshold_component/ThresholdComponent.jsx index 018f3845..e9fb29fb 100644 --- a/src-ui/app/config_page/setting_section/setting_box/_components/threshold_component/ThresholdComponent.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/_components/threshold_component/ThresholdComponent.jsx @@ -7,8 +7,7 @@ import { useVolume } from "@logics_common"; import MicSvg from "@images/mic.svg?react"; import HeadphonesSvg from "@images/headphones.svg?react"; import { - useMicThreshold, - useSpeakerThreshold, + useDevice, } from "@logics_configs"; export const ThresholdComponent = (props) => { @@ -27,7 +26,7 @@ const MicComponent = (props) => { currentMicThreshold, setMicThreshold, currentEnableAutomaticMicThreshold, - } = useMicThreshold(); + } = useDevice(); const [ui_threshold, setUiThreshold] = useState(currentMicThreshold.data); const { volumeCheckStart_Mic, @@ -84,7 +83,7 @@ const SpeakerComponent = (props) => { currentSpeakerThreshold, setSpeakerThreshold, currentEnableAutomaticSpeakerThreshold, - } = useSpeakerThreshold(); + } = useDevice(); const [ui_threshold, setUiThreshold] = useState(currentSpeakerThreshold.data); const { volumeCheckStart_Speaker, diff --git a/src-ui/app/config_page/setting_section/setting_box/_components/threshold_component/slider_and_meter/SliderAndMeter.jsx b/src-ui/app/config_page/setting_section/setting_box/_components/threshold_component/slider_and_meter/SliderAndMeter.jsx index 8c67637c..475f2410 100644 --- a/src-ui/app/config_page/setting_section/setting_box/_components/threshold_component/slider_and_meter/SliderAndMeter.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/_components/threshold_component/slider_and_meter/SliderAndMeter.jsx @@ -4,8 +4,7 @@ import { useStore_SpeakerVolume, } from "@store"; import { - useMicThreshold, - useSpeakerThreshold, + useDevice, } from "@logics_configs"; export const SliderAndMeter = (props) => { @@ -24,7 +23,7 @@ export const SliderAndMeter = (props) => { const ThresholdVolumeMeter_Mic = (props) => { const { currentMicVolume } = useStore_MicVolume(); - const { currentEnableAutomaticMicThreshold } = useMicThreshold(); + const { currentEnableAutomaticMicThreshold } = useDevice(); const currentVolumeVariable = Math.min(currentMicVolume.data, props.max); const volume_width_percentage = (currentVolumeVariable / props.max) * 100; @@ -50,7 +49,7 @@ const ThresholdVolumeMeter_Mic = (props) => { const ThresholdVolumeMeter_Speaker = (props) => { const { currentSpeakerVolume } = useStore_SpeakerVolume(); - const { currentEnableAutomaticSpeakerThreshold } = useSpeakerThreshold(); + const { currentEnableAutomaticSpeakerThreshold } = useDevice(); const currentVolumeVariable = Math.min(currentSpeakerVolume.data, props.max); const volume_width_percentage = (currentVolumeVariable / props.max) * 100; diff --git a/src-ui/app/config_page/setting_section/setting_box/device/Device.jsx b/src-ui/app/config_page/setting_section/setting_box/device/Device.jsx index 56b11398..d3f20645 100644 --- a/src-ui/app/config_page/setting_section/setting_box/device/Device.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/device/Device.jsx @@ -4,16 +4,7 @@ import clsx from "clsx"; import { useStore_IsBreakPoint } from "@store"; import { ui_configs } from "@ui_configs"; import { - useEnableAutoMicSelect, - useMicHostList, - useSelectedMicHost, - useMicDeviceList, - useSelectedMicDevice, - useMicThreshold, - useEnableAutoSpeakerSelect, - useSpeakerDeviceList, - useSelectedSpeakerDevice, - useSpeakerThreshold, + useDevice, } from "@logics_configs"; import { @@ -38,13 +29,21 @@ export const Device = () => { const Mic_Container = () => { const { t } = useTranslation(); - const { currentEnableAutoMicSelect, toggleEnableAutoMicSelect } = useEnableAutoMicSelect(); - const { currentSelectedMicHost, setSelectedMicHost } = useSelectedMicHost(); - const { currentMicHostList } = useMicHostList(); - const { currentSelectedMicDevice, setSelectedMicDevice } = useSelectedMicDevice(); - const { currentMicDeviceList } = useMicDeviceList(); + const { + currentEnableAutoMicSelect, + toggleEnableAutoMicSelect, + currentMicDeviceList, + currentMicHostList, + + currentSelectedMicHost, + setSelectedMicHost, + currentSelectedMicDevice, + setSelectedMicDevice, + + currentEnableAutomaticMicThreshold, + toggleEnableAutomaticMicThreshold, + } = useDevice(); const { onMouseLeaveFunction } = useOnMouseLeaveDropdownMenu(); - const { currentEnableAutomaticMicThreshold, toggleEnableAutomaticMicThreshold } = useMicThreshold(); const selectFunction_host = (selected_data) => { setSelectedMicHost(selected_data.selected_id); @@ -139,11 +138,16 @@ const Mic_Container = () => { const Speaker_Container = () => { const { t } = useTranslation(); - const { currentEnableAutoSpeakerSelect, toggleEnableAutoSpeakerSelect } = useEnableAutoSpeakerSelect(); - const { currentSelectedSpeakerDevice, setSelectedSpeakerDevice } = useSelectedSpeakerDevice(); - const { currentSpeakerDeviceList } = useSpeakerDeviceList(); + const { + currentEnableAutoSpeakerSelect, + toggleEnableAutoSpeakerSelect, + currentSpeakerDeviceList, + currentSelectedSpeakerDevice, + setSelectedSpeakerDevice, + currentEnableAutomaticSpeakerThreshold, + toggleEnableAutomaticSpeakerThreshold, + } = useDevice(); const { onMouseLeaveFunction } = useOnMouseLeaveDropdownMenu(); - const { currentEnableAutomaticSpeakerThreshold, toggleEnableAutomaticSpeakerThreshold } = useSpeakerThreshold(); const selectFunction = (selected_data) => { setSelectedSpeakerDevice(selected_data.selected_id); diff --git a/src-ui/logics/configs/device/useDevice.js b/src-ui/logics/configs/device/useDevice.js new file mode 100644 index 00000000..25a05f1c --- /dev/null +++ b/src-ui/logics/configs/device/useDevice.js @@ -0,0 +1,257 @@ +import { + useStore_EnableAutoMicSelect, + useStore_EnableAutoSpeakerSelect, + + useStore_MicDeviceList, + useStore_MicHostList, + useStore_SpeakerDeviceList, + + useStore_SelectedMicHost, + useStore_SelectedMicDevice, + + useStore_SelectedSpeakerDevice, + + useStore_MicThreshold, + useStore_EnableAutomaticMicThreshold, + useStore_SpeakerThreshold, + useStore_EnableAutomaticSpeakerThreshold, +} from "@store"; +import { useStdoutToPython } from "@useStdoutToPython"; +import { arrayToObject } from "@utils"; + +export const useDevice = () => { + const { asyncStdoutToPython } = useStdoutToPython(); + + const { currentEnableAutoMicSelect, updateEnableAutoMicSelect, pendingEnableAutoMicSelect } = useStore_EnableAutoMicSelect(); + const { currentEnableAutoSpeakerSelect, updateEnableAutoSpeakerSelect, pendingEnableAutoSpeakerSelect } = useStore_EnableAutoSpeakerSelect(); + + const { currentMicDeviceList, updateMicDeviceList, pendingMicDeviceList } = useStore_MicDeviceList(); + const { currentMicHostList, updateMicHostList, pendingMicHostList } = useStore_MicHostList(); + const { currentSpeakerDeviceList, updateSpeakerDeviceList, pendingSpeakerDeviceList } = useStore_SpeakerDeviceList(); + + const { currentSelectedMicHost, updateSelectedMicHost, pendingSelectedMicHost } = useStore_SelectedMicHost(); + const { currentSelectedMicDevice, updateSelectedMicDevice, pendingSelectedMicDevice } = useStore_SelectedMicDevice(); + + const { currentSelectedSpeakerDevice, updateSelectedSpeakerDevice, pendingSelectedSpeakerDevice } = useStore_SelectedSpeakerDevice(); + + const { updateMicThreshold, currentMicThreshold } = useStore_MicThreshold(); + const { updateEnableAutomaticMicThreshold, currentEnableAutomaticMicThreshold, pendingEnableAutomaticMicThreshold } = useStore_EnableAutomaticMicThreshold(); + + const { updateSpeakerThreshold, currentSpeakerThreshold } = useStore_SpeakerThreshold(); + const { updateEnableAutomaticSpeakerThreshold, currentEnableAutomaticSpeakerThreshold, pendingEnableAutomaticSpeakerThreshold } = useStore_EnableAutomaticSpeakerThreshold(); + + // Auto Select (Mic) + const getEnableAutoMicSelect = () => { + pendingEnableAutoMicSelect(); + asyncStdoutToPython("/get/data/auto_mic_select"); + }; + + const toggleEnableAutoMicSelect = () => { + pendingEnableAutoMicSelect(); + if (currentEnableAutoMicSelect.data) { + asyncStdoutToPython("/set/disable/auto_mic_select"); + } else { + asyncStdoutToPython("/set/enable/auto_mic_select"); + } + }; + // Auto Select (Speaker) + const getEnableAutoSpeakerSelect = () => { + pendingEnableAutoSpeakerSelect(); + asyncStdoutToPython("/get/data/auto_speaker_select"); + }; + + const toggleEnableAutoSpeakerSelect = () => { + pendingEnableAutoSpeakerSelect(); + if (currentEnableAutoSpeakerSelect.data) { + asyncStdoutToPython("/set/disable/auto_speaker_select"); + } else { + asyncStdoutToPython("/set/enable/auto_speaker_select"); + } + }; + + + // List (Mic device) + const getMicDeviceList = () => { + pendingMicDeviceList(); + asyncStdoutToPython("/get/data/mic_device_list"); + }; + + const updateMicDeviceList_FromBackend = (payload) => { + updateMicDeviceList(arrayToObject(payload)); + }; + // List (Mic host) + const getMicHostList = () => { + pendingMicHostList(); + asyncStdoutToPython("/get/data/mic_host_list"); + }; + + const updateMicHostList_FromBackend = (payload) => { + updateMicHostList(arrayToObject(payload)); + }; + // List (Speaker device) + const getSpeakerDeviceList = () => { + pendingSpeakerDeviceList(); + asyncStdoutToPython("/get/data/speaker_device_list"); + }; + + const updateSpeakerDeviceList_FromBackend = (payload) => { + updateSpeakerDeviceList(arrayToObject(payload)); + }; + + + // Selected (Mic host) + const getSelectedMicHost = () => { + pendingSelectedMicHost(); + asyncStdoutToPython("/get/data/selected_mic_host"); + }; + + const setSelectedMicHost = (selected_mic_host) => { + pendingSelectedMicHost(); + asyncStdoutToPython("/set/data/selected_mic_host", selected_mic_host); + }; + // Selected (Mic device) + const getSelectedMicDevice = () => { + pendingSelectedMicDevice(); + asyncStdoutToPython("/get/data/selected_mic_device"); + }; + + const setSelectedMicDevice = (selected_mic_device) => { + pendingSelectedMicDevice(); + asyncStdoutToPython("/set/data/selected_mic_device", selected_mic_device); + }; + + // Selected (Mic and Host) + const updateSelectedMicHostAndDevice = (payload) => { + updateSelectedMicHost(payload.host); + updateSelectedMicDevice(payload.device); + }; + + // Selected (Speaker device) + const getSelectedSpeakerDevice = () => { + pendingSelectedSpeakerDevice(); + asyncStdoutToPython("/get/data/selected_speaker_device"); + }; + + const setSelectedSpeakerDevice = (selected_speaker_device) => { + pendingSelectedSpeakerDevice(); + asyncStdoutToPython("/set/data/selected_speaker_device", selected_speaker_device); + }; + + + // Threshold (Mic) + const getMicThreshold = () => { + asyncStdoutToPython("/get/data/mic_threshold"); + }; + + const setMicThreshold = (mic_threshold) => { + asyncStdoutToPython("/set/data/mic_threshold", mic_threshold); + }; + + const getEnableAutomaticMicThreshold = () => { + pendingEnableAutomaticMicThreshold(); + asyncStdoutToPython("/get/data/mic_automatic_threshold"); + }; + + const toggleEnableAutomaticMicThreshold = () => { + pendingEnableAutomaticMicThreshold(); + if (currentEnableAutomaticMicThreshold.data) { + asyncStdoutToPython("/set/disable/mic_automatic_threshold"); + } else { + asyncStdoutToPython("/set/enable/mic_automatic_threshold"); + } + }; + // Threshold (Speaker) + const getSpeakerThreshold = () => { + asyncStdoutToPython("/get/data/speaker_threshold"); + }; + + const setSpeakerThreshold = (speaker_threshold) => { + asyncStdoutToPython("/set/data/speaker_threshold", speaker_threshold); + }; + + const getEnableAutomaticSpeakerThreshold = () => { + pendingEnableAutomaticSpeakerThreshold(); + asyncStdoutToPython("/get/data/speaker_automatic_threshold"); + }; + + const toggleEnableAutomaticSpeakerThreshold = () => { + pendingEnableAutomaticSpeakerThreshold(); + if (currentEnableAutomaticSpeakerThreshold.data) { + asyncStdoutToPython("/set/disable/speaker_automatic_threshold"); + } else { + asyncStdoutToPython("/set/enable/speaker_automatic_threshold"); + } + }; + + + + return { + currentEnableAutoMicSelect, + getEnableAutoMicSelect, + updateEnableAutoMicSelect, + toggleEnableAutoMicSelect, + + currentEnableAutoSpeakerSelect, + getEnableAutoSpeakerSelect, + updateEnableAutoSpeakerSelect, + toggleEnableAutoSpeakerSelect, + + + currentMicDeviceList, + getMicDeviceList, + updateMicDeviceList, + updateMicDeviceList_FromBackend, + + currentMicHostList, + getMicHostList, + updateMicHostList, + updateMicHostList_FromBackend, + + currentSpeakerDeviceList, + getSpeakerDeviceList, + updateSpeakerDeviceList, + updateSpeakerDeviceList_FromBackend, + + + currentSelectedMicHost, + getSelectedMicHost, + updateSelectedMicHost, + setSelectedMicHost, + + currentSelectedMicDevice, + getSelectedMicDevice, + updateSelectedMicDevice, + setSelectedMicDevice, + + updateSelectedMicHostAndDevice, + + + currentSelectedSpeakerDevice, + getSelectedSpeakerDevice, + updateSelectedSpeakerDevice, + setSelectedSpeakerDevice, + + + currentMicThreshold, + getMicThreshold, + setMicThreshold, + updateMicThreshold, + + currentEnableAutomaticMicThreshold, + getEnableAutomaticMicThreshold, + toggleEnableAutomaticMicThreshold, + updateEnableAutomaticMicThreshold, + + currentSpeakerThreshold, + getSpeakerThreshold, + setSpeakerThreshold, + updateSpeakerThreshold, + + currentEnableAutomaticSpeakerThreshold, + getEnableAutomaticSpeakerThreshold, + toggleEnableAutomaticSpeakerThreshold, + updateEnableAutomaticSpeakerThreshold, + + + }; +}; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useEnableAutoMicSelect.js b/src-ui/logics/configs/device/useEnableAutoMicSelect.js deleted file mode 100644 index c9f7e5d6..00000000 --- a/src-ui/logics/configs/device/useEnableAutoMicSelect.js +++ /dev/null @@ -1,28 +0,0 @@ -import { useStore_EnableAutoMicSelect } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useEnableAutoMicSelect = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentEnableAutoMicSelect, updateEnableAutoMicSelect, pendingEnableAutoMicSelect } = useStore_EnableAutoMicSelect(); - - const getEnableAutoMicSelect = () => { - pendingEnableAutoMicSelect(); - asyncStdoutToPython("/get/data/auto_mic_select"); - }; - - const toggleEnableAutoMicSelect = () => { - pendingEnableAutoMicSelect(); - if (currentEnableAutoMicSelect.data) { - asyncStdoutToPython("/set/disable/auto_mic_select"); - } else { - asyncStdoutToPython("/set/enable/auto_mic_select"); - } - }; - - return { - currentEnableAutoMicSelect, - getEnableAutoMicSelect, - updateEnableAutoMicSelect, - toggleEnableAutoMicSelect, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useEnableAutoSpeakerSelect.js b/src-ui/logics/configs/device/useEnableAutoSpeakerSelect.js deleted file mode 100644 index 406cbf25..00000000 --- a/src-ui/logics/configs/device/useEnableAutoSpeakerSelect.js +++ /dev/null @@ -1,28 +0,0 @@ -import { useStore_EnableAutoSpeakerSelect } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useEnableAutoSpeakerSelect = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentEnableAutoSpeakerSelect, updateEnableAutoSpeakerSelect, pendingEnableAutoSpeakerSelect } = useStore_EnableAutoSpeakerSelect(); - - const getEnableAutoSpeakerSelect = () => { - pendingEnableAutoSpeakerSelect(); - asyncStdoutToPython("/get/data/auto_speaker_select"); - }; - - const toggleEnableAutoSpeakerSelect = () => { - pendingEnableAutoSpeakerSelect(); - if (currentEnableAutoSpeakerSelect.data) { - asyncStdoutToPython("/set/disable/auto_speaker_select"); - } else { - asyncStdoutToPython("/set/enable/auto_speaker_select"); - } - }; - - return { - currentEnableAutoSpeakerSelect, - getEnableAutoSpeakerSelect, - updateEnableAutoSpeakerSelect, - toggleEnableAutoSpeakerSelect, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useMicDeviceList.js b/src-ui/logics/configs/device/useMicDeviceList.js deleted file mode 100644 index d145a890..00000000 --- a/src-ui/logics/configs/device/useMicDeviceList.js +++ /dev/null @@ -1,27 +0,0 @@ -import { useStore_MicDeviceList } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; -import { arrayToObject } from "@utils"; - -export const useMicDeviceList = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentMicDeviceList, updateMicDeviceList, pendingMicDeviceList } = useStore_MicDeviceList(); - - const getMicDeviceList = () => { - pendingMicDeviceList(); - asyncStdoutToPython("/get/data/mic_device_list"); - }; - - - const updateMicDeviceList_FromBackend = (payload) => { - updateMicDeviceList(arrayToObject(payload)); - }; - - - return { - currentMicDeviceList, - getMicDeviceList, - updateMicDeviceList, - - updateMicDeviceList_FromBackend, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useMicHostList.js b/src-ui/logics/configs/device/useMicHostList.js deleted file mode 100644 index 898f348c..00000000 --- a/src-ui/logics/configs/device/useMicHostList.js +++ /dev/null @@ -1,25 +0,0 @@ -import { useStore_MicHostList } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; -import { arrayToObject } from "@utils"; - -export const useMicHostList = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentMicHostList, updateMicHostList, pendingMicHostList } = useStore_MicHostList(); - - const getMicHostList = () => { - pendingMicHostList(); - asyncStdoutToPython("/get/data/mic_host_list"); - }; - - const updateMicHostList_FromBackend = (payload) => { - updateMicHostList(arrayToObject(payload)); - }; - - return { - currentMicHostList, - getMicHostList, - updateMicHostList, - - updateMicHostList_FromBackend, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useMicThreshold.js b/src-ui/logics/configs/device/useMicThreshold.js deleted file mode 100644 index a6224c38..00000000 --- a/src-ui/logics/configs/device/useMicThreshold.js +++ /dev/null @@ -1,42 +0,0 @@ -import { useStore_MicThreshold, useStore_EnableAutomaticMicThreshold } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useMicThreshold = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { updateMicThreshold, currentMicThreshold } = useStore_MicThreshold(); - const { updateEnableAutomaticMicThreshold, currentEnableAutomaticMicThreshold, pendingEnableAutomaticMicThreshold } = useStore_EnableAutomaticMicThreshold(); - - const getMicThreshold = () => { - asyncStdoutToPython("/get/data/mic_threshold"); - }; - - const setMicThreshold = (mic_threshold) => { - asyncStdoutToPython("/set/data/mic_threshold", mic_threshold); - }; - - const getEnableAutomaticMicThreshold = () => { - pendingEnableAutomaticMicThreshold(); - asyncStdoutToPython("/get/data/mic_automatic_threshold"); - }; - - const toggleEnableAutomaticMicThreshold = () => { - pendingEnableAutomaticMicThreshold(); - if (currentEnableAutomaticMicThreshold.data) { - asyncStdoutToPython("/set/disable/mic_automatic_threshold"); - } else { - asyncStdoutToPython("/set/enable/mic_automatic_threshold"); - } - }; - - return { - currentMicThreshold, - getMicThreshold, - setMicThreshold, - updateMicThreshold, - - currentEnableAutomaticMicThreshold, - getEnableAutomaticMicThreshold, - toggleEnableAutomaticMicThreshold, - updateEnableAutomaticMicThreshold, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useSelectedMicDevice.js b/src-ui/logics/configs/device/useSelectedMicDevice.js deleted file mode 100644 index 6bd7d11a..00000000 --- a/src-ui/logics/configs/device/useSelectedMicDevice.js +++ /dev/null @@ -1,24 +0,0 @@ -import { useStore_SelectedMicDevice } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useSelectedMicDevice = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentSelectedMicDevice, updateSelectedMicDevice, pendingSelectedMicDevice } = useStore_SelectedMicDevice(); - - const getSelectedMicDevice = () => { - pendingSelectedMicDevice(); - asyncStdoutToPython("/get/data/selected_mic_device"); - }; - - const setSelectedMicDevice = (selected_mic_device) => { - pendingSelectedMicDevice(); - asyncStdoutToPython("/set/data/selected_mic_device", selected_mic_device); - }; - - return { - currentSelectedMicDevice, - getSelectedMicDevice, - updateSelectedMicDevice, - setSelectedMicDevice, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useSelectedMicHost.js b/src-ui/logics/configs/device/useSelectedMicHost.js deleted file mode 100644 index 0197cfc8..00000000 --- a/src-ui/logics/configs/device/useSelectedMicHost.js +++ /dev/null @@ -1,37 +0,0 @@ -import { useStore_SelectedMicHost } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; -import { useSelectedMicDevice } from "@logics_configs"; - -export const useSelectedMicHost = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentSelectedMicHost, updateSelectedMicHost, pendingSelectedMicHost } = useStore_SelectedMicHost(); - - const { updateSelectedMicDevice } = useSelectedMicDevice(); - - const getSelectedMicHost = () => { - pendingSelectedMicHost(); - asyncStdoutToPython("/get/data/selected_mic_host"); - }; - - const setSelectedMicHost = (selected_mic_host) => { - pendingSelectedMicHost(); - asyncStdoutToPython("/set/data/selected_mic_host", selected_mic_host); - }; - - - // Need refactoring (Duplicated, Host, Device) - const updateSelectedMicHostAndDevice = (payload) => { - updateSelectedMicHost(payload.host); - updateSelectedMicDevice(payload.device); - }; - - - return { - currentSelectedMicHost, - getSelectedMicHost, - updateSelectedMicHost, - setSelectedMicHost, - - updateSelectedMicHostAndDevice, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useSelectedSpeakerDevice.js b/src-ui/logics/configs/device/useSelectedSpeakerDevice.js deleted file mode 100644 index 672a9267..00000000 --- a/src-ui/logics/configs/device/useSelectedSpeakerDevice.js +++ /dev/null @@ -1,24 +0,0 @@ -import { useStore_SelectedSpeakerDevice } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useSelectedSpeakerDevice = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentSelectedSpeakerDevice, updateSelectedSpeakerDevice, pendingSelectedSpeakerDevice } = useStore_SelectedSpeakerDevice(); - - const getSelectedSpeakerDevice = () => { - pendingSelectedSpeakerDevice(); - asyncStdoutToPython("/get/data/selected_speaker_device"); - }; - - const setSelectedSpeakerDevice = (selected_speaker_device) => { - pendingSelectedSpeakerDevice(); - asyncStdoutToPython("/set/data/selected_speaker_device", selected_speaker_device); - }; - - return { - currentSelectedSpeakerDevice, - getSelectedSpeakerDevice, - updateSelectedSpeakerDevice, - setSelectedSpeakerDevice, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useSpeakerDeviceList.js b/src-ui/logics/configs/device/useSpeakerDeviceList.js deleted file mode 100644 index b88ed285..00000000 --- a/src-ui/logics/configs/device/useSpeakerDeviceList.js +++ /dev/null @@ -1,26 +0,0 @@ -import { useStore_SpeakerDeviceList } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; -import { arrayToObject } from "@utils"; - -export const useSpeakerDeviceList = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentSpeakerDeviceList, updateSpeakerDeviceList, pendingSpeakerDeviceList } = useStore_SpeakerDeviceList(); - - const getSpeakerDeviceList = () => { - pendingSpeakerDeviceList(); - asyncStdoutToPython("/get/data/speaker_device_list"); - }; - - const updateSpeakerDeviceList_FromBackend = (payload) => { - updateSpeakerDeviceList(arrayToObject(payload)); - }; - - - return { - currentSpeakerDeviceList, - getSpeakerDeviceList, - updateSpeakerDeviceList, - - updateSpeakerDeviceList_FromBackend, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useSpeakerThreshold.js b/src-ui/logics/configs/device/useSpeakerThreshold.js deleted file mode 100644 index c21fe2ef..00000000 --- a/src-ui/logics/configs/device/useSpeakerThreshold.js +++ /dev/null @@ -1,42 +0,0 @@ -import { useStore_SpeakerThreshold, useStore_EnableAutomaticSpeakerThreshold } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useSpeakerThreshold = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { updateSpeakerThreshold, currentSpeakerThreshold } = useStore_SpeakerThreshold(); - const { updateEnableAutomaticSpeakerThreshold, currentEnableAutomaticSpeakerThreshold, pendingEnableAutomaticSpeakerThreshold } = useStore_EnableAutomaticSpeakerThreshold(); - - const getSpeakerThreshold = () => { - asyncStdoutToPython("/get/data/speaker_threshold"); - }; - - const setSpeakerThreshold = (speaker_threshold) => { - asyncStdoutToPython("/set/data/speaker_threshold", speaker_threshold); - }; - - const getEnableAutomaticSpeakerThreshold = () => { - pendingEnableAutomaticSpeakerThreshold(); - asyncStdoutToPython("/get/data/speaker_automatic_threshold"); - }; - - const toggleEnableAutomaticSpeakerThreshold = () => { - pendingEnableAutomaticSpeakerThreshold(); - if (currentEnableAutomaticSpeakerThreshold.data) { - asyncStdoutToPython("/set/disable/speaker_automatic_threshold"); - } else { - asyncStdoutToPython("/set/enable/speaker_automatic_threshold"); - } - }; - - return { - currentSpeakerThreshold, - getSpeakerThreshold, - setSpeakerThreshold, - updateSpeakerThreshold, - - currentEnableAutomaticSpeakerThreshold, - getEnableAutomaticSpeakerThreshold, - toggleEnableAutomaticSpeakerThreshold, - updateEnableAutomaticSpeakerThreshold, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/index.js b/src-ui/logics/configs/index.js index 03214771..aadb1519 100644 --- a/src-ui/logics/configs/index.js +++ b/src-ui/logics/configs/index.js @@ -1,13 +1,4 @@ -export { useEnableAutoMicSelect } from "./device/useEnableAutoMicSelect"; -export { useEnableAutoSpeakerSelect } from "./device/useEnableAutoSpeakerSelect"; -export { useMicDeviceList } from "./device/useMicDeviceList"; -export { useMicHostList } from "./device/useMicHostList"; -export { useMicThreshold } from "./device/useMicThreshold"; -export { useSelectedMicDevice } from "./device/useSelectedMicDevice"; -export { useSelectedMicHost } from "./device/useSelectedMicHost"; -export { useSelectedSpeakerDevice } from "./device/useSelectedSpeakerDevice"; -export { useSpeakerDeviceList } from "./device/useSpeakerDeviceList"; -export { useSpeakerThreshold } from "./device/useSpeakerThreshold"; +export { useDevice } from "./device/useDevice"; export { useMessageLogUiScaling } from "./appearance/useMessageLogUiScaling"; export { useSelectedFontFamily } from "./appearance/useSelectedFontFamily"; diff --git a/src-ui/logics/useReceiveRoutes.js b/src-ui/logics/useReceiveRoutes.js index 54f49203..8961c2cf 100644 --- a/src-ui/logics/useReceiveRoutes.js +++ b/src-ui/logics/useReceiveRoutes.js @@ -91,49 +91,49 @@ export const ROUTE_META_LIST = [ // Config Page // Device - { endpoint: "/get/data/auto_mic_select", ns: configs, hook_name: "useEnableAutoMicSelect", method_name: "updateEnableAutoMicSelect" }, - { endpoint: "/set/enable/auto_mic_select", ns: configs, hook_name: "useEnableAutoMicSelect", method_name: "updateEnableAutoMicSelect" }, - { endpoint: "/set/disable/auto_mic_select", ns: configs, hook_name: "useEnableAutoMicSelect", method_name: "updateEnableAutoMicSelect" }, - { endpoint: "/get/data/auto_speaker_select", ns: configs, hook_name: "useEnableAutoSpeakerSelect", method_name: "updateEnableAutoSpeakerSelect" }, - { endpoint: "/set/enable/auto_speaker_select", ns: configs, hook_name: "useEnableAutoSpeakerSelect", method_name: "updateEnableAutoSpeakerSelect" }, - { endpoint: "/set/disable/auto_speaker_select", ns: configs, hook_name: "useEnableAutoSpeakerSelect", method_name: "updateEnableAutoSpeakerSelect" }, + { endpoint: "/get/data/auto_mic_select", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutoMicSelect" }, + { endpoint: "/set/enable/auto_mic_select", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutoMicSelect" }, + { endpoint: "/set/disable/auto_mic_select", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutoMicSelect" }, + { endpoint: "/get/data/auto_speaker_select", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutoSpeakerSelect" }, + { endpoint: "/set/enable/auto_speaker_select", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutoSpeakerSelect" }, + { endpoint: "/set/disable/auto_speaker_select", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutoSpeakerSelect" }, // Device (Mic) - { endpoint: "/get/data/mic_host_list", ns: configs, hook_name: "useMicHostList", method_name: "updateMicHostList_FromBackend" }, - { endpoint: "/run/mic_host_list", ns: configs, hook_name: "useMicHostList", method_name: "updateMicHostList_FromBackend" }, + { endpoint: "/get/data/mic_host_list", ns: configs, hook_name: "useDevice", method_name: "updateMicHostList_FromBackend" }, + { endpoint: "/run/mic_host_list", ns: configs, hook_name: "useDevice", method_name: "updateMicHostList_FromBackend" }, - { endpoint: "/get/data/selected_mic_host", ns: configs, hook_name: "useSelectedMicHost", method_name: "updateSelectedMicHost" }, - { endpoint: "/set/data/selected_mic_host", ns: configs, hook_name: "useSelectedMicHost", method_name: "updateSelectedMicHostAndDevice" }, // Need refactoring (Duplicated, Host, Device) + { endpoint: "/get/data/selected_mic_host", ns: configs, hook_name: "useDevice", method_name: "updateSelectedMicHost" }, + { endpoint: "/set/data/selected_mic_host", ns: configs, hook_name: "useDevice", method_name: "updateSelectedMicHostAndDevice" }, - { endpoint: "/get/data/mic_device_list", ns: configs, hook_name: "useMicDeviceList", method_name: "updateMicDeviceList_FromBackend" }, - { endpoint: "/run/mic_device_list", ns: configs, hook_name: "useMicDeviceList", method_name: "updateMicDeviceList_FromBackend" }, + { endpoint: "/get/data/mic_device_list", ns: configs, hook_name: "useDevice", method_name: "updateMicDeviceList_FromBackend" }, + { endpoint: "/run/mic_device_list", ns: configs, hook_name: "useDevice", method_name: "updateMicDeviceList_FromBackend" }, - { endpoint: "/get/data/selected_mic_device", ns: configs, hook_name: "useSelectedMicDevice", method_name: "updateSelectedMicDevice" }, - { endpoint: "/set/data/selected_mic_device", ns: configs, hook_name: "useSelectedMicDevice", method_name: "updateSelectedMicDevice" }, + { endpoint: "/get/data/selected_mic_device", ns: configs, hook_name: "useDevice", method_name: "updateSelectedMicDevice" }, + { endpoint: "/set/data/selected_mic_device", ns: configs, hook_name: "useDevice", method_name: "updateSelectedMicDevice" }, - { endpoint: "/run/selected_mic_device", ns: configs, hook_name: "useSelectedMicHost", method_name: "updateSelectedMicHostAndDevice" }, // Need refactoring (Duplicated, Host, Device) + { endpoint: "/run/selected_mic_device", ns: configs, hook_name: "useDevice", method_name: "updateSelectedMicHostAndDevice" }, // Device (Speaker) - { endpoint: "/get/data/speaker_device_list", ns: configs, hook_name: "useSpeakerDeviceList", method_name: "updateSpeakerDeviceList_FromBackend" }, - { endpoint: "/run/speaker_device_list", ns: configs, hook_name: "useSpeakerDeviceList", method_name: "updateSpeakerDeviceList_FromBackend" }, + { endpoint: "/get/data/speaker_device_list", ns: configs, hook_name: "useDevice", method_name: "updateSpeakerDeviceList_FromBackend" }, + { endpoint: "/run/speaker_device_list", ns: configs, hook_name: "useDevice", method_name: "updateSpeakerDeviceList_FromBackend" }, - { endpoint: "/get/data/selected_speaker_device", ns: configs, hook_name: "useSelectedSpeakerDevice", method_name: "updateSelectedSpeakerDevice" }, - { endpoint: "/set/data/selected_speaker_device", ns: configs, hook_name: "useSelectedSpeakerDevice", method_name: "updateSelectedSpeakerDevice" }, - { endpoint: "/run/selected_speaker_device", ns: configs, hook_name: "useSelectedSpeakerDevice", method_name: "updateSelectedSpeakerDevice" }, + { endpoint: "/get/data/selected_speaker_device", ns: configs, hook_name: "useDevice", method_name: "updateSelectedSpeakerDevice" }, + { endpoint: "/set/data/selected_speaker_device", ns: configs, hook_name: "useDevice", method_name: "updateSelectedSpeakerDevice" }, + { endpoint: "/run/selected_speaker_device", ns: configs, hook_name: "useDevice", method_name: "updateSelectedSpeakerDevice" }, // Device (Threshold) - { endpoint: "/get/data/mic_threshold", ns: configs, hook_name: "useMicThreshold", method_name: "updateMicThreshold" }, - { endpoint: "/set/data/mic_threshold", ns: configs, hook_name: "useMicThreshold", method_name: "updateMicThreshold" }, - { endpoint: "/get/data/speaker_threshold", ns: configs, hook_name: "useSpeakerThreshold", method_name: "updateSpeakerThreshold" }, - { endpoint: "/set/data/speaker_threshold", ns: configs, hook_name: "useSpeakerThreshold", method_name: "updateSpeakerThreshold" }, + { endpoint: "/get/data/mic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateMicThreshold" }, + { endpoint: "/set/data/mic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateMicThreshold" }, + { endpoint: "/get/data/speaker_threshold", ns: configs, hook_name: "useDevice", method_name: "updateSpeakerThreshold" }, + { endpoint: "/set/data/speaker_threshold", ns: configs, hook_name: "useDevice", method_name: "updateSpeakerThreshold" }, - { endpoint: "/get/data/mic_automatic_threshold", ns: configs, hook_name: "useMicThreshold", method_name: "updateEnableAutomaticMicThreshold" }, - { endpoint: "/set/enable/mic_automatic_threshold", ns: configs, hook_name: "useMicThreshold", method_name: "updateEnableAutomaticMicThreshold" }, - { endpoint: "/set/disable/mic_automatic_threshold", ns: configs, hook_name: "useMicThreshold", method_name: "updateEnableAutomaticMicThreshold" }, - { endpoint: "/get/data/speaker_automatic_threshold", ns: configs, hook_name: "useSpeakerThreshold", method_name: "updateEnableAutomaticSpeakerThreshold" }, - { endpoint: "/set/enable/speaker_automatic_threshold", ns: configs, hook_name: "useSpeakerThreshold", method_name: "updateEnableAutomaticSpeakerThreshold" }, - { endpoint: "/set/disable/speaker_automatic_threshold", ns: configs, hook_name: "useSpeakerThreshold", method_name: "updateEnableAutomaticSpeakerThreshold" }, + { endpoint: "/get/data/mic_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutomaticMicThreshold" }, + { endpoint: "/set/enable/mic_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutomaticMicThreshold" }, + { endpoint: "/set/disable/mic_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutomaticMicThreshold" }, + { endpoint: "/get/data/speaker_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutomaticSpeakerThreshold" }, + { endpoint: "/set/enable/speaker_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutomaticSpeakerThreshold" }, + { endpoint: "/set/disable/speaker_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutomaticSpeakerThreshold" }, // Appearance