Only changes besides the move: `export` on helpers another module now needs (sendError, sendJson, splitUrl, GzipCache, isNotModified, serveFile, serveMedia, noopLog, makeLogger), ROOT resolves two levels up from server/http/config.js (same path), and short headers on the new files.
15 lines
474 B
JavaScript
15 lines
474 B
JavaScript
// server/http/boot.js — what the process prints when it boots (moved from server/index.js).
|
|
|
|
import os from 'node:os';
|
|
|
|
/** Non-internal IPv4 addresses as http URLs. @param {number} port */
|
|
export function lanUrls(port) {
|
|
const out = [];
|
|
for (const addrs of Object.values(os.networkInterfaces())) {
|
|
for (const a of addrs || []) {
|
|
if ((a.family === 'IPv4' || a.family === 4) && !a.internal) out.push(`http://${a.address}:${port}`);
|
|
}
|
|
}
|
|
return out;
|
|
}
|