UNPKG

3xworkaround

Version:

This is an interface for 3x-ui panel. It will help developers to create, edit and delete inbounds and clients in a simple way.

29 lines (28 loc) 947 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.decodeUri = void 0; const url_join_1 = __importDefault(require("url-join")); const decodeUri = (uri) => { const url = new URL(encodeURI(uri)); const protocol = url.protocol.slice(0, -1); const host = url.hostname; const defaultPort = protocol === "https" ? 443 : 80; const port = url.port.length ? Number(url.port) : defaultPort; const path = url.pathname; const username = decodeURIComponent(url.username); const password = decodeURIComponent(url.password); const endpoint = (0, url_join_1.default)(url.origin, path); return { protocol, host, port, path, username, password, endpoint, }; }; exports.decodeUri = decodeUri;