From 417131d593eb7cde623381d93a82c93750f2567a Mon Sep 17 00:00:00 2001 From: Eason010212 <1371033826@qq.com> Date: Tue, 18 Jul 2023 22:23:02 +0800 Subject: [PATCH] fix-restart-server-bug --- mixio.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mixio.js b/mixio.js index 758c4f2..74b5efc 100644 --- a/mixio.js +++ b/mixio.js @@ -471,7 +471,10 @@ async function daemon_start() { }) app.get('/saveAndRestart', async function(req, res) { - newConfig = req.query.configs + newConfig = JSON.parse(req.query.configs) + for(var key in newConfig) + configs[key] = newConfig[key] + newConfig = JSON.stringify(configs, null, 4) if (newConfig) { fs.writeFileSync(configPath, newConfig) configs = JSON.parse(newConfig) @@ -1906,8 +1909,8 @@ var mixioServer = function() { console.log('[INFO] WebSocket MQTT server listening on port', 8083) httpsServer.listen(8084, function() { console.log('[INFO] WebSocketS MQTT server listening on port', 8084) - - httpServer2 = app.listen(configs['MIXIO_HTTP_PORT'], function() { + httpServer2 = http.createServer(app) + httpServer2.listen(configs['MIXIO_HTTP_PORT'], function() { if(configs['MIXIO_HTTP_PORT'] != 0) console.log("[INFO] MixIO server listening on port", configs['MIXIO_HTTP_PORT']) httpsServer2 = https.createServer(credentials, app)