From 09e029d1368bf5d7ee682ebcbc2bccf6dc228784 Mon Sep 17 00:00:00 2001 From: unknown <1371033826@qq.com> Date: Fri, 24 Oct 2025 09:12:48 +0800 Subject: [PATCH] fix-addAccount-bug --- mixio.js | 59 ++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 47 insertions(+), 12 deletions(-) diff --git a/mixio.js b/mixio.js index 05c3b3b..a97e805 100644 --- a/mixio.js +++ b/mixio.js @@ -1,4 +1,4 @@ -var VERSION = "1.10.5.1015" +var VERSION = "1.10.5.1024" require('events').EventEmitter.defaultMaxListeners = 50; const extract = require('extract-zip') @@ -656,17 +656,52 @@ async function daemon_start() { var question = req.query.question var answer = req.query.answer if (userName && password && question && answer) { - require('http').get('http://localhost:' + configs["MIXIO_HTTP_PORT"] + "/addAccount?userName=" + userName + "&password=" + password + "&question=" + question + "&answer=" + answer, function(req, res) { - var html = ''; - req.on('data', function(data) { - html += data; - }); - req.on('end', function() { - res2.send(html) - }); - }).on('error', function() { - res2.send('3') - }) + if(configs["MIXIO_HTTP_PORT"] !=0) + { + require('http').get('http://localhost:' + configs["MIXIO_HTTP_PORT"] + "/addAccount?userName=" + userName + "&password=" + password + "&question=" + question + "&answer=" + answer, function(req, res) { + var html = ''; + req.on('data', function(data) { + html += data; + }); + req.on('end', function() { + res2.send(html) + }); + }).on('error', function() { + res2.send('3') + }) + } + else + { + const https = require('https'); + + // 对参数进行编码 + const encodedPath = "/addAccount?userName=" + encodeURIComponent(userName) + + "&password=" + encodeURIComponent(password) + + "&question=" + encodeURIComponent(question) + + "&answer=" + encodeURIComponent(answer); + + const options = { + hostname: 'localhost', + port: configs["MIXIO_HTTPS_PORT"], + path: encodedPath, + method: 'GET', + rejectUnauthorized: false, // 忽略证书验证 + agent: false + }; + + https.get(options, function(res) { + var html = ''; + res.on('data', function(data) { + html += data; + }); + res.on('end', function() { + res2.send(html); + }); + }).on('error', function(e) { + console.log(e); + res2.send('3'); + }); + } } })