fix(mikrotikApplyService, ServerModal): update default port for MikroTik connections to 80 and ensure proper number conversion for port input
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 2m41s
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 2m41s
This commit is contained in:
@@ -15,7 +15,10 @@ const https = require('https');
|
||||
*/
|
||||
function createRosClient(opts) {
|
||||
const { host, port = 80, user, password, secure = false } = opts;
|
||||
const useHttp = port === 80;
|
||||
// Порт может прийти строкой из JSON — приводим к числу
|
||||
const portNumber = Number(port) || 80;
|
||||
// REST API по умолчанию висит на HTTP:80, HTTPS обычно на 443/8443
|
||||
const useHttp = portNumber === 80;
|
||||
const protocol = useHttp ? http : https;
|
||||
|
||||
const makeRequest = (method, urlPath, body = null) => {
|
||||
@@ -32,7 +35,7 @@ function createRosClient(opts) {
|
||||
if (bodyStr) headers['Content-Length'] = Buffer.byteLength(bodyStr, 'utf8');
|
||||
const options = {
|
||||
hostname: host,
|
||||
port,
|
||||
port: portNumber,
|
||||
path: pathStr,
|
||||
method,
|
||||
headers,
|
||||
|
||||
Reference in New Issue
Block a user