From 5a3ece0784dba17712999d1f29eb0c28f2ded0e4 Mon Sep 17 00:00:00 2001 From: Robin Davies Date: Thu, 10 Mar 2022 12:02:41 -0500 Subject: [PATCH 1/2] Select first plugin if no selection. Fixes #22 --- react/public/var/config.json | 2 +- react/src/MainPage.tsx | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/react/public/var/config.json b/react/public/var/config.json index 93f81dd..60e144f 100644 --- a/react/public/var/config.json +++ b/react/public/var/config.json @@ -1,5 +1,5 @@ { - "socket_server_port": 8080, + "socket_server_port": 80, "socket_server_address": "*", "max_upload_size": 1048576, diff --git a/react/src/MainPage.tsx b/react/src/MainPage.tsx index 36af67d..486e798 100644 --- a/react/src/MainPage.tsx +++ b/react/src/MainPage.tsx @@ -114,11 +114,17 @@ export const MainPage = constructor(props: MainProps) { super(props); this.model = PiPedalModelFactory.getInstance(); + let pedalboard = this.model.pedalBoard.get(); + let selectedPedal = -1; + if (pedalboard.items.length !== 0) + { + selectedPedal = pedalboard.items[0].instanceId; + } this.state = { - selectedPedal: -1, + selectedPedal: selectedPedal, loadDialogOpen: false, - pedalBoard: this.model.pedalBoard.get(), + pedalBoard: pedalboard, addMenuAnchorEl: null, splitControlBar: this.windowSize.width < SPLIT_CONTROLBAR_THRESHHOLD, horizontalScrollLayout: this.windowSize.height < HORIZONTAL_CONTROL_SCROLL_HEIGHT_BREAK, @@ -188,7 +194,15 @@ export const MainPage = this.model.loadPluginPreset(instanceId, presetInstanceId); } onPedalBoardChanged(value: PedalBoard) { - this.setState({ pedalBoard: value }); + let selectedItem = -1; + if (value.items.length !== 0) + { + selectedItem = value.items[0].instanceId; + } + this.setState({ + pedalBoard: value, + selectedPedal: selectedItem + }); } onDeletePedal(instanceId: number): void { let result = this.model.deletePedalBoardPedal(instanceId); From 3299c6b29ba11c1478964e042d15e2a2bdb90017 Mon Sep 17 00:00:00 2001 From: Robin Davies Date: Thu, 10 Mar 2022 12:30:09 -0500 Subject: [PATCH 2/2] Home directory for pipedal_d required. Fixes #19 --- src/ConfigMain.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/ConfigMain.cpp b/src/ConfigMain.cpp index ae413e2..58183e1 100644 --- a/src/ConfigMain.cpp +++ b/src/ConfigMain.cpp @@ -350,8 +350,7 @@ void InstallJackService() } // lock account for login. silentSysExec("passwd -l " JACK_SERVICE_ACCOUNT_NAME); - } - + } // Add to audio groups. // sysExec(USERMOD_BIN " -a -G " JACK_SERVICE_GROUP_NAME " " JACK_SERVICE_ACCOUNT_NAME); sysExec(USERMOD_BIN " -a -G" AUDIO_SERVICE_GROUP_NAME " " JACK_SERVICE_ACCOUNT_NAME); @@ -449,13 +448,13 @@ void Install(const std::filesystem::path &programPrefix, const std::string endpo if (!userExists(SERVICE_ACCOUNT_NAME)) { - if (sysExec(USERADD_BIN " " SERVICE_ACCOUNT_NAME " -g " SERVICE_GROUP_NAME " -M -N -r") != EXIT_SUCCESS) + if (sysExec(USERADD_BIN " " SERVICE_ACCOUNT_NAME " -g " SERVICE_GROUP_NAME " -m --home /var/pipedal/home -N -r") != EXIT_SUCCESS) { // throw PiPedalException("Failed to create service account."); } // lock account for login. silentSysExec("passwd -l " SERVICE_ACCOUNT_NAME); - } + } // Add to audio groups. sysExec(USERMOD_BIN " -a -G " AUDIO_SERVICE_GROUP_NAME " " SERVICE_ACCOUNT_NAME);