From 4ed1ac8cad49203de6b97ba7d4fed703e9bd9058 Mon Sep 17 00:00:00 2001 From: Bobban Rydh Date: Tue, 15 Sep 2026 00:48:42 +0200 Subject: [PATCH] Fix Synology adapter to support plain HTTP, not just HTTPS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Found while verifying against the user's real DSM: the adapter hardcoded node:https for every request, but the user's NAS is reached over plain HTTP on port 5000 inside the LAN (HTTPS on 5001 also works, but nothing about the integration should assume one or the other). Now picks http vs https based on the configured URL's own protocol, with the right default port per protocol (5000/5001) and TLS options only applied for https. Verified against the user's real Synology (10.200.5.35): ping, login, and SYNO.Storage.CGI.Storage load_info all confirmed working end-to-end through the actual HTTP route layer — 1 volume (normal, SHR, ~11.5TB/~3.9TB used), 4 disks (all normal, 34-39°C). This is the first of the five previously- unverified integrations confirmed against real hardware. Co-Authored-By: Claude Sonnet 5 --- server/src/integrations/synology/adapter.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/server/src/integrations/synology/adapter.ts b/server/src/integrations/synology/adapter.ts index c1d6bb1..d544222 100644 --- a/server/src/integrations/synology/adapter.ts +++ b/server/src/integrations/synology/adapter.ts @@ -16,9 +16,13 @@ * * DSM ships with a self-signed certificate unless the admin configured a * real one, so (like the cPanel/Proxmox adapters) this uses node:https - * directly to support an "insecure" opt-out of certificate verification. + * directly to support an "insecure" opt-out of certificate verification — + * but DSM is just as commonly reached over plain HTTP (default port 5000) + * inside a trusted LAN, so the request helper picks http vs https from the + * configured URL's own protocol rather than assuming HTTPS. */ import * as https from "node:https"; +import * as http from "node:http"; export interface SynologyConfig { url: string; @@ -64,13 +68,17 @@ interface RawResponse { function request(url: string, insecure: boolean): Promise { return new Promise((resolve, reject) => { const parsed = new URL(url); - const req = https.request( + const isHttps = parsed.protocol === "https:"; + const lib = isHttps ? https : http; + const defaultPort = isHttps ? 5001 : 5000; + + const req = lib.request( { hostname: parsed.hostname, - port: parsed.port || 5001, + port: parsed.port || defaultPort, path: parsed.pathname + parsed.search, method: "GET", - rejectUnauthorized: !insecure, + ...(isHttps ? { rejectUnauthorized: !insecure } : {}), }, (res) => { let body = "";