@fdm-monster/server
Version:
FDM Monster is a bulk OctoPrint, Klipper, PrusaLink and BambuLab manager to set up, configure and monitor 3D printers. Our aim is to provide neat overview over your farm.
14 lines (13 loc) • 516 B
JavaScript
import { normalizeUrl } from "./normalize-url.js";
import { z } from "zod";
//#region src/utils/url.utils.ts
const defaultHttpProtocol = "https";
function httpToWsUrl(url) {
const protocolNormalizedAddress = normalizeUrl(z.string().parse(url), { defaultProtocol: defaultHttpProtocol });
const wsUrl = new URL(protocolNormalizedAddress);
wsUrl.protocol = wsUrl.protocol === "https:" ? "wss:" : "ws:";
return wsUrl;
}
//#endregion
export { defaultHttpProtocol, httpToWsUrl };
//# sourceMappingURL=url.utils.js.map