fix: avoid sending unused data

Massimo Melina committed Nov 2, 2023 at 14:30 UTC e746d9cb135b97d503a49c17ba3e208bbc4ca9ac
2 files changed +3 -3
src/adminApis.ts
+1 -1
@@ -102,7 +102,7 @@ export const adminApis: ApiHandlers = {
102 version: VERSION,
103 apiVersion: API_VERSION,
104 compatibleApiVersion: COMPATIBLE_API_VERSION,
105 - ...await getServerStatus(),
105 + ...await getServerStatus(false),
106 platform: process.platform,
107 urls: await getUrls(),
108 ips: await getIps(false),
src/listen.ts
+2 -2
@@ -232,7 +232,7 @@ function getCurrentPort(srv: typeof httpSrv) {
232 return (srv?.address() as any)?.port as number | undefined
233 }
234
235 -export async function getServerStatus() {
235 +export async function getServerStatus(includeSrv=true) {
236 return {
237 http: await serverStatus(httpSrv, portCfg.get()),
238 https: await serverStatus(httpsSrv, httpsPortCfg.get()),
@@ -246,7 +246,7 @@ export async function getServerStatus() {
246 busy,
247 port: getCurrentPort(srv) || configuredPort,
248 configuredPort,
249 - srv,
249 + srv: includeSrv ? srv : undefined,
250 }
251 }}
252