Update Setup Process
- Added audio device to setup form - Implemented 'getDevices.py' into setup form - Now shows the user their devices to select the correct ID - Fixed bug in the op25 dir created by new setup - Finalized the '.env' file creation
This commit is contained in:
@@ -4,6 +4,7 @@ import express from 'express';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { generateUniqueID } from '../../modules/baseUtils.mjs';
|
||||
import { restartApplication } from '../../modules/selfUpdater.mjs'
|
||||
import { launchProcess } from '../../modules/subprocessHandler.mjs'
|
||||
|
||||
const router = express.Router();
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url)); // Define __dirname for ESM
|
||||
@@ -12,8 +13,10 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url)); // Define __dirn
|
||||
let systemsData = [];
|
||||
let nodeData = {};
|
||||
|
||||
router.get('/', (req, res) => {
|
||||
res.render('setup/setup');
|
||||
router.get('/', async (req, res) => {
|
||||
const output = await launchProcess('python', ['./discordAudioBot/pdab/getDevices.py'], true, true)
|
||||
console.log("Device List", output);
|
||||
res.render('setup/setup', { deviceList: output });
|
||||
});
|
||||
|
||||
// Route to serve the page for adding nearby systems
|
||||
@@ -23,13 +26,14 @@ router.get('/add-system', (req, res) => {
|
||||
|
||||
router.post('/', (req, res) => {
|
||||
// Handle form submission here
|
||||
const { clientName, clientLocation, clientCapabilities } = req.body;
|
||||
const { clientName, clientLocation, clientCapabilities, audioDeviceId } = req.body;
|
||||
|
||||
console.log(clientName, clientLocation, clientCapabilities);
|
||||
console.log(clientName, clientLocation, clientCapabilities, audioDeviceId);
|
||||
|
||||
nodeData.clientName = clientName;
|
||||
nodeData.clientLocation = clientLocation;
|
||||
nodeData.clientCapabilities = clientCapabilities;
|
||||
nodeData.audioDeviceId = audioDeviceId;
|
||||
|
||||
res.redirect('/setup/add-system');
|
||||
});
|
||||
@@ -86,8 +90,11 @@ const exportCsv = (nodeData) => {
|
||||
CLIENT_CAPABILITIES: nodeData.clientCapabilities,
|
||||
SERVER_IP: "",
|
||||
SERVER_PORT: 0,
|
||||
OP25_FULL_PATH: `${__dirname}/op25/op25/gr-op25_repeater/apps`,
|
||||
OP25_FULL_PATH: path.resolve(__dirname, '../../op25/op25/gr-op25_repeater/apps'),
|
||||
CONFIG_PATH: "./config/radioPresets.json",
|
||||
AUDIO_DEVICE_ID: nodeData.audioDeviceId,
|
||||
PDAB_PORT: 3110,
|
||||
NODE_ENV: "production",
|
||||
};
|
||||
|
||||
// Generate .env file content
|
||||
|
||||
@@ -19,7 +19,14 @@
|
||||
<label for="clientCapabilities">Client Capabilities (comma-separated):</label>
|
||||
<input type="text" id="clientCapabilities" name="clientCapabilities" required>
|
||||
<br>
|
||||
<label for="audioDeviceId">Audio Device ID (typically 'default'):</label>
|
||||
<input type="text" id="audioDeviceId" name="audioDeviceId" required>
|
||||
<br>
|
||||
<button type="submit">Next</button>
|
||||
<div>
|
||||
<h3>Audio Devices</h3>
|
||||
<p><%- deviceList.replace(/\n/g, '<br>') %> </p>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user