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

This commit is contained in:
2026-02-04 15:07:13 +07:00
parent 21d2707a1b
commit 3d9394e27d
2 changed files with 8 additions and 5 deletions
+5 -2
View File
@@ -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,