locadot 1.5.0 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +26 -12
- package/dist/lib/commands.js +2 -2
- package/dist/lib/locadot-file.js +2 -2
- package/package.json +1 -1
- package/dist/certs.js +0 -43
- package/dist/lib/cloudflared.js +0 -98
- package/dist/server.js +0 -136
- package/dist/utils/constants.js +0 -23
- package/dist/utils.js +0 -67
package/dist/index.js
CHANGED
|
@@ -21,23 +21,31 @@ program
|
|
|
21
21
|
.requiredOption("-p, --port <port>", "Local port to forward to")
|
|
22
22
|
.action(async (options) => {
|
|
23
23
|
await commands_1.default.add(options);
|
|
24
|
+
process.exit(0);
|
|
24
25
|
});
|
|
25
26
|
program
|
|
26
27
|
.command("update")
|
|
27
28
|
.requiredOption("-h, --host <host>", "Domain to map must be ends with localhost. Example: dev.localhost, localhost, test.localhost, etc.")
|
|
28
29
|
.requiredOption("-p, --port <port>", "Local port to forward to")
|
|
29
30
|
.description("Update a domain")
|
|
30
|
-
.action(async (options) =>
|
|
31
|
+
.action(async (options) => {
|
|
32
|
+
await commands_1.default.update(options);
|
|
33
|
+
process.exit(0);
|
|
34
|
+
});
|
|
31
35
|
program
|
|
32
36
|
.command("remove")
|
|
33
37
|
.requiredOption("-h, --host <host>", "Host must ends with localhost. Example: dev.localhost, localhost, test.localhost, etc.")
|
|
34
38
|
.description("Remove a domain")
|
|
35
|
-
.action(async (options) =>
|
|
39
|
+
.action(async (options) => {
|
|
40
|
+
await commands_1.default.remove(options);
|
|
41
|
+
process.exit(0);
|
|
42
|
+
});
|
|
36
43
|
program
|
|
37
44
|
.command("host")
|
|
38
45
|
.description("Show all hosts")
|
|
39
|
-
.action(() => {
|
|
40
|
-
commands_1.default.getRegistry();
|
|
46
|
+
.action(async () => {
|
|
47
|
+
await commands_1.default.getRegistry();
|
|
48
|
+
process.exit(0);
|
|
41
49
|
});
|
|
42
50
|
program
|
|
43
51
|
.command("watch:logs")
|
|
@@ -48,38 +56,44 @@ program
|
|
|
48
56
|
program
|
|
49
57
|
.command("clear:logs")
|
|
50
58
|
.description("Clear logs")
|
|
51
|
-
.action(() => {
|
|
52
|
-
commands_1.default.clearLogs();
|
|
59
|
+
.action(async () => {
|
|
60
|
+
await commands_1.default.clearLogs();
|
|
61
|
+
process.exit(0);
|
|
53
62
|
});
|
|
54
63
|
program
|
|
55
64
|
.command("clear:hosts")
|
|
56
65
|
.description("Clear all host file.")
|
|
57
|
-
.action(() => {
|
|
58
|
-
commands_1.default.clearHosts();
|
|
66
|
+
.action(async () => {
|
|
67
|
+
await commands_1.default.clearHosts();
|
|
68
|
+
process.exit(0);
|
|
59
69
|
});
|
|
60
70
|
program
|
|
61
71
|
.command("path")
|
|
62
72
|
.description("Show configuration paths.")
|
|
63
73
|
.action(() => {
|
|
64
74
|
commands_1.default.configPath();
|
|
75
|
+
process.exit(0);
|
|
65
76
|
});
|
|
66
77
|
program
|
|
67
78
|
.command("path:logs")
|
|
68
79
|
.description("Show logs path file.")
|
|
69
80
|
.action(() => {
|
|
70
81
|
commands_1.default.logPath();
|
|
82
|
+
process.exit(0);
|
|
71
83
|
});
|
|
72
84
|
program
|
|
73
85
|
.command("path:hosts")
|
|
74
86
|
.description("Show hosts path file.")
|
|
75
|
-
.action(() => {
|
|
76
|
-
commands_1.default.hostPath();
|
|
87
|
+
.action(async () => {
|
|
88
|
+
await commands_1.default.hostPath();
|
|
89
|
+
process.exit(0);
|
|
77
90
|
});
|
|
78
91
|
program
|
|
79
92
|
.command("restart")
|
|
80
93
|
.description("Restart locadot")
|
|
81
|
-
.action(() => {
|
|
82
|
-
commands_1.default.restart();
|
|
94
|
+
.action(async () => {
|
|
95
|
+
await commands_1.default.restart();
|
|
96
|
+
process.exit(0);
|
|
83
97
|
});
|
|
84
98
|
program
|
|
85
99
|
.command("stop")
|
package/dist/lib/commands.js
CHANGED
|
@@ -88,9 +88,9 @@ class Commands {
|
|
|
88
88
|
}
|
|
89
89
|
catch (error) { }
|
|
90
90
|
}
|
|
91
|
-
static clearLogs() {
|
|
91
|
+
static async clearLogs() {
|
|
92
92
|
try {
|
|
93
|
-
locadot_file_1.default.clearLogs();
|
|
93
|
+
await locadot_file_1.default.clearLogs();
|
|
94
94
|
console.log("☑️ Logs successfully cleared.");
|
|
95
95
|
}
|
|
96
96
|
catch (error) { }
|
package/dist/lib/locadot-file.js
CHANGED
|
@@ -70,13 +70,13 @@ class locadotFile {
|
|
|
70
70
|
}
|
|
71
71
|
static getStartProxyFile() {
|
|
72
72
|
if (process.env.NODE_ENV === "production") {
|
|
73
|
-
const filePath = path_1.default.join(
|
|
73
|
+
const filePath = path_1.default.join(__dirname, "..", "core.js");
|
|
74
74
|
return {
|
|
75
75
|
command: "node",
|
|
76
76
|
path: [filePath],
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
|
-
const filePath = path_1.default.join(
|
|
79
|
+
const filePath = path_1.default.join(__dirname, "../../", "dist", "core.js");
|
|
80
80
|
return {
|
|
81
81
|
command: "node",
|
|
82
82
|
path: [filePath],
|
package/package.json
CHANGED
package/dist/certs.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createSSL = createSSL;
|
|
7
|
-
const appdata_path_1 = __importDefault(require("appdata-path"));
|
|
8
|
-
const fs_1 = __importDefault(require("fs"));
|
|
9
|
-
const path_1 = __importDefault(require("path"));
|
|
10
|
-
const CERT_PATH = (0, appdata_path_1.default)("locadot");
|
|
11
|
-
const mkcert_1 = require("mkcert");
|
|
12
|
-
const logger_1 = __importDefault(require("./utils/logger"));
|
|
13
|
-
async function createSSL(domain) {
|
|
14
|
-
logger_1.default.info(`🔐 Preparing SSL cert for ${domain}`);
|
|
15
|
-
const KEY_FILE = path_1.default.join(CERT_PATH, domain + ".key");
|
|
16
|
-
const CERT_FILE = path_1.default.join(CERT_PATH, domain + ".pem");
|
|
17
|
-
if (fs_1.default.existsSync(KEY_FILE) && fs_1.default.existsSync(CERT_FILE)) {
|
|
18
|
-
logger_1.default.info(`🔄 Using existing certificate for ${domain}`);
|
|
19
|
-
const key = fs_1.default.readFileSync(KEY_FILE, "utf-8");
|
|
20
|
-
const cert = fs_1.default.readFileSync(CERT_FILE, "utf-8");
|
|
21
|
-
return { key, cert };
|
|
22
|
-
}
|
|
23
|
-
// Otherwise, generate a new one
|
|
24
|
-
logger_1.default.info(`🔐 Generating SSL cert for ${domain}`);
|
|
25
|
-
const ca = await (0, mkcert_1.createCA)({
|
|
26
|
-
organization: "Locadot",
|
|
27
|
-
countryCode: "IN",
|
|
28
|
-
state: "DevState",
|
|
29
|
-
locality: "DevTown",
|
|
30
|
-
validity: 365,
|
|
31
|
-
});
|
|
32
|
-
const cert = await (0, mkcert_1.createCert)({
|
|
33
|
-
domains: [domain],
|
|
34
|
-
ca: ca,
|
|
35
|
-
validity: 365,
|
|
36
|
-
organization: "Locadot",
|
|
37
|
-
});
|
|
38
|
-
if (!fs_1.default.existsSync(CERT_PATH))
|
|
39
|
-
fs_1.default.mkdirSync(CERT_PATH, { recursive: true });
|
|
40
|
-
fs_1.default.writeFileSync(KEY_FILE, cert.key);
|
|
41
|
-
fs_1.default.writeFileSync(CERT_FILE, cert.cert);
|
|
42
|
-
return { key: cert.key, cert: cert.cert };
|
|
43
|
-
}
|
package/dist/lib/cloudflared.js
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// import childProcess, { ChildProcessWithoutNullStreams } from "child_process";
|
|
3
|
-
// import process from "process";
|
|
4
|
-
// import { sync as commandExistsSync } from "command-exists";
|
|
5
|
-
// type ChangeCallback = (running: boolean, msg: string, code?: number) => void;
|
|
6
|
-
// type ErrorCallback = (msg: string | Error) => void;
|
|
7
|
-
// export class CloudflaredTunnel {
|
|
8
|
-
// private cloudflaredPath: string;
|
|
9
|
-
// private _token?: string;
|
|
10
|
-
// private childProcess: ChildProcessWithoutNullStreams | null = null;
|
|
11
|
-
// private running = false;
|
|
12
|
-
// public url: string;
|
|
13
|
-
// public hostname: string;
|
|
14
|
-
// public change?: ChangeCallback;
|
|
15
|
-
// public error?: ErrorCallback;
|
|
16
|
-
// constructor(cloudflaredPath: string = "cloudflared") {
|
|
17
|
-
// this.cloudflaredPath = cloudflaredPath;
|
|
18
|
-
// this.url = "http://localhost:80";
|
|
19
|
-
// this.hostname = "";
|
|
20
|
-
// }
|
|
21
|
-
// get token(): string | undefined {
|
|
22
|
-
// return this._token;
|
|
23
|
-
// }
|
|
24
|
-
// set token(token: string | undefined) {
|
|
25
|
-
// if (token && typeof token === "string") {
|
|
26
|
-
// token = token.trim();
|
|
27
|
-
// // try to strip out "cloudflared.exe service install"
|
|
28
|
-
// const array = token.split(" ");
|
|
29
|
-
// if (array.length > 1) {
|
|
30
|
-
// for (let i = 0; i < array.length - 1; i++) {
|
|
31
|
-
// if (array[i] === "install") {
|
|
32
|
-
// token = array[i + 1];
|
|
33
|
-
// }
|
|
34
|
-
// }
|
|
35
|
-
// }
|
|
36
|
-
// }
|
|
37
|
-
// this._token = token;
|
|
38
|
-
// }
|
|
39
|
-
// checkInstalled(): boolean {
|
|
40
|
-
// return commandExistsSync(this.cloudflaredPath);
|
|
41
|
-
// }
|
|
42
|
-
// private emitChange(msg: string, code?: number): void {
|
|
43
|
-
// if (this.change) {
|
|
44
|
-
// this.change(this.running, msg, code);
|
|
45
|
-
// }
|
|
46
|
-
// }
|
|
47
|
-
// private emitError(msg: string | Error): void {
|
|
48
|
-
// if (this.error) {
|
|
49
|
-
// this.error(msg);
|
|
50
|
-
// }
|
|
51
|
-
// }
|
|
52
|
-
// start(): void {
|
|
53
|
-
// if (this.childProcess) {
|
|
54
|
-
// this.emitError("Already started");
|
|
55
|
-
// return;
|
|
56
|
-
// }
|
|
57
|
-
// if (!this.checkInstalled()) {
|
|
58
|
-
// this.emitError(`Cloudflared error: ${this.cloudflaredPath} is not found`);
|
|
59
|
-
// return;
|
|
60
|
-
// }
|
|
61
|
-
// if (!this.token) {
|
|
62
|
-
// this.emitError("Cloudflared error: Token is not set");
|
|
63
|
-
// return;
|
|
64
|
-
// }
|
|
65
|
-
// const args = ["tunnel", "--no-autoupdate", "run", "--token", this.token];
|
|
66
|
-
// this.running = true;
|
|
67
|
-
// this.emitChange("Starting cloudflared");
|
|
68
|
-
// this.childProcess = childProcess.spawn(this.cloudflaredPath, args);
|
|
69
|
-
// this.childProcess.stdout.pipe(process.stdout);
|
|
70
|
-
// this.childProcess.stderr.pipe(process.stderr);
|
|
71
|
-
// this.childProcess.on("close", (code: number) => {
|
|
72
|
-
// this.running = false;
|
|
73
|
-
// this.childProcess = null;
|
|
74
|
-
// this.emitChange("Stopped cloudflared", code);
|
|
75
|
-
// });
|
|
76
|
-
// this.childProcess.on("error", (err: NodeJS.ErrnoException) => {
|
|
77
|
-
// if (err.code === "ENOENT") {
|
|
78
|
-
// this.emitError(
|
|
79
|
-
// `Cloudflared error: ${this.cloudflaredPath} is not found`
|
|
80
|
-
// );
|
|
81
|
-
// } else {
|
|
82
|
-
// this.emitError(err);
|
|
83
|
-
// }
|
|
84
|
-
// });
|
|
85
|
-
// this.childProcess.stderr.on("data", (data: Buffer) => {
|
|
86
|
-
// this.emitError(data.toString());
|
|
87
|
-
// });
|
|
88
|
-
// }
|
|
89
|
-
// stop(): void {
|
|
90
|
-
// this.emitChange("Stopping cloudflared");
|
|
91
|
-
// if (this.childProcess) {
|
|
92
|
-
// this.childProcess.kill("SIGINT");
|
|
93
|
-
// this.childProcess = null;
|
|
94
|
-
// }
|
|
95
|
-
// }
|
|
96
|
-
// }
|
|
97
|
-
// const cloudflared = new CloudflaredTunnel();
|
|
98
|
-
// export default cloudflared;
|
package/dist/server.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const http_proxy_1 = __importDefault(require("http-proxy"));
|
|
7
|
-
const certs_1 = require("./certs");
|
|
8
|
-
const https_1 = __importDefault(require("https"));
|
|
9
|
-
const http_1 = __importDefault(require("http"));
|
|
10
|
-
const fs_1 = __importDefault(require("fs"));
|
|
11
|
-
const locadot_file_1 = __importDefault(require("./lib/locadot-file"));
|
|
12
|
-
const child_process_1 = require("child_process");
|
|
13
|
-
const file_1 = __importDefault(require("./utils/file"));
|
|
14
|
-
const logger_1 = __importDefault(require("./utils/logger"));
|
|
15
|
-
const constants_1 = __importDefault(require("./constants"));
|
|
16
|
-
const http_2 = __importDefault(require("./lib/http"));
|
|
17
|
-
class ProxyHandler {
|
|
18
|
-
async startCentralProxy() {
|
|
19
|
-
try {
|
|
20
|
-
let domainMap = await locadot_file_1.default.getRegistry();
|
|
21
|
-
const proxy = http_proxy_1.default.createProxyServer({});
|
|
22
|
-
const defaultCert = await (0, certs_1.createSSL)("localhost");
|
|
23
|
-
const watcher = await locadot_file_1.default.watchRegistry(async () => {
|
|
24
|
-
logger_1.default.info("🔄 Updated domain mapping");
|
|
25
|
-
domainMap = await locadot_file_1.default.getRegistry();
|
|
26
|
-
});
|
|
27
|
-
process.on("SIGINT", async (err) => {
|
|
28
|
-
logger_1.default.error("🛑 Proxy stopped. Proxy soft destroyed as process SIGINT", err);
|
|
29
|
-
await locadot_file_1.default.softDestroy(watcher);
|
|
30
|
-
});
|
|
31
|
-
process.on("SIGTERM", async (err) => {
|
|
32
|
-
logger_1.default.error("🛑 Proxy stopped. Proxy soft destroyed as process SIGTERM", err);
|
|
33
|
-
await locadot_file_1.default.softDestroy(watcher);
|
|
34
|
-
});
|
|
35
|
-
process.on("exit", (code, signal) => {
|
|
36
|
-
logger_1.default.error(`Process exited with error ${code} and signal ${signal}`);
|
|
37
|
-
locadot_file_1.default.softDestroy(watcher);
|
|
38
|
-
});
|
|
39
|
-
const httpsServer = https_1.default.createServer(defaultCert, (req, res) => {
|
|
40
|
-
http_2.default.requestHandler(req, res, proxy, domainMap);
|
|
41
|
-
});
|
|
42
|
-
const httpServer = http_1.default.createServer((req, res) => {
|
|
43
|
-
http_2.default.requestHandler(req, res, proxy, domainMap);
|
|
44
|
-
});
|
|
45
|
-
httpsServer.listen(443, () => {
|
|
46
|
-
logger_1.default.info("🛜 HTTPS proxy running on port 443");
|
|
47
|
-
});
|
|
48
|
-
httpsServer.on("upgrade", (req, res, head) => {
|
|
49
|
-
http_2.default.requestUpgrade(req, res, head, proxy, domainMap);
|
|
50
|
-
});
|
|
51
|
-
httpServer.listen(80, () => {
|
|
52
|
-
logger_1.default.info("🛜 HTTP proxy running on port 80");
|
|
53
|
-
});
|
|
54
|
-
httpServer.on("upgrade", (req, socket, head) => {
|
|
55
|
-
http_2.default.requestUpgrade(req, socket, head, proxy, domainMap);
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
catch (error) {
|
|
59
|
-
logger_1.default.error("Failed to start central proxy", error);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
static async isProxyRunning() {
|
|
63
|
-
try {
|
|
64
|
-
const pid = Number(await locadot_file_1.default.getProcessId());
|
|
65
|
-
if (!pid || isNaN(pid)) {
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
process.kill(pid, 0);
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
async startProxy() {
|
|
76
|
-
try {
|
|
77
|
-
if (await ProxyHandler.isProxyRunning()) {
|
|
78
|
-
logger_1.default.error("Proxy is already running");
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
const command = locadot_file_1.default.getStartProxyFile();
|
|
82
|
-
const proxyProcess = (0, child_process_1.spawn)(command.command, command.path, {
|
|
83
|
-
detached: true,
|
|
84
|
-
stdio: ["ignore", "ignore", "pipe"],
|
|
85
|
-
});
|
|
86
|
-
const logStream = file_1.default.writeFileStream("LOGS", true);
|
|
87
|
-
proxyProcess.stderr.pipe(logStream);
|
|
88
|
-
proxyProcess.on("error", (err) => {
|
|
89
|
-
console.error("Failed to start child process:", err);
|
|
90
|
-
});
|
|
91
|
-
if (!proxyProcess.pid) {
|
|
92
|
-
logger_1.default.error("❌ Central proxy failed to start");
|
|
93
|
-
process.exit(1);
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
locadot_file_1.default.createLockFile(proxyProcess.pid?.toString());
|
|
97
|
-
}
|
|
98
|
-
proxyProcess.unref();
|
|
99
|
-
logger_1.default.info("🚀 Central proxy started in background.");
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
logger_1.default.error("Failed to start central proxy", error);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
async registerDomain(domain, port) {
|
|
106
|
-
if (!(await ProxyHandler.isProxyRunning())) {
|
|
107
|
-
await this.startProxy();
|
|
108
|
-
}
|
|
109
|
-
let registry = await locadot_file_1.default.getRegistry();
|
|
110
|
-
if (!fs_1.default.existsSync(constants_1.default.paths.REGISTRY_FILE)) {
|
|
111
|
-
fs_1.default.writeFileSync(constants_1.default.paths.REGISTRY_FILE, "{}");
|
|
112
|
-
}
|
|
113
|
-
if (fs_1.default.existsSync(constants_1.default.paths.REGISTRY_FILE)) {
|
|
114
|
-
registry = JSON.parse(fs_1.default.readFileSync(constants_1.default.paths.REGISTRY_FILE, "utf-8"));
|
|
115
|
-
}
|
|
116
|
-
if (registry[domain]) {
|
|
117
|
-
console.error(`❌ ${domain} already mapped to port ${registry[domain]}`);
|
|
118
|
-
process.exit(1);
|
|
119
|
-
}
|
|
120
|
-
registry[domain] = port;
|
|
121
|
-
fs_1.default.writeFileSync(constants_1.default.paths.REGISTRY_FILE, JSON.stringify(registry, null, 2));
|
|
122
|
-
logger_1.default.info(`✅ ${domain} => http://localhost:${port}`);
|
|
123
|
-
}
|
|
124
|
-
async stopProxy() {
|
|
125
|
-
await locadot_file_1.default.softDestroy();
|
|
126
|
-
}
|
|
127
|
-
async killProxy() {
|
|
128
|
-
await locadot_file_1.default.destroy();
|
|
129
|
-
}
|
|
130
|
-
async restartProxy() {
|
|
131
|
-
await locadot_file_1.default.softDestroy();
|
|
132
|
-
await this.startProxy();
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
const locadotProxy = new ProxyHandler();
|
|
136
|
-
exports.default = locadotProxy;
|
package/dist/utils/constants.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.errorConstants = exports.locadotPath = void 0;
|
|
7
|
-
const appdata_path_1 = __importDefault(require("appdata-path"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const PACKAGE_PATH = (0, appdata_path_1.default)("locadot");
|
|
10
|
-
const LOCK_FILE = path_1.default.join(PACKAGE_PATH, ".locadot.lock");
|
|
11
|
-
const REGISTRY_FILE = path_1.default.join(PACKAGE_PATH, ".locadot-registry.json");
|
|
12
|
-
const LOGS = path_1.default.join(PACKAGE_PATH, ".locadot.log");
|
|
13
|
-
exports.locadotPath = {
|
|
14
|
-
LOCK_FILE,
|
|
15
|
-
REGISTRY_FILE,
|
|
16
|
-
LOGS,
|
|
17
|
-
};
|
|
18
|
-
exports.errorConstants = {
|
|
19
|
-
invalidHost: "❌ Invalid domain. Please use a valid localhost domain like dev.localhost, localhost, test.localhost, etc.",
|
|
20
|
-
hostExist: "❌ Domain already in use. Please choose another domain or stop the existing instance.",
|
|
21
|
-
proxyClose: "☑️ Successfully stopped all locadot instances.",
|
|
22
|
-
softClose: "☑️ Successfully stopped central proxy..",
|
|
23
|
-
};
|
package/dist/utils.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.proxyNotFound = void 0;
|
|
4
|
-
const proxyNotFound = (host) => `
|
|
5
|
-
<!DOCTYPE html>
|
|
6
|
-
<html lang="en">
|
|
7
|
-
<head>
|
|
8
|
-
<meta charset="UTF-8" />
|
|
9
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
10
|
-
<title>Proxy Error</title>
|
|
11
|
-
<style>
|
|
12
|
-
body {
|
|
13
|
-
background-color: #121212;
|
|
14
|
-
color: #f8d7da;
|
|
15
|
-
font-family: 'Segoe UI', sans-serif;
|
|
16
|
-
margin: 0;
|
|
17
|
-
padding: 20px;
|
|
18
|
-
display: flex;
|
|
19
|
-
align-items: center;
|
|
20
|
-
justify-content: center;
|
|
21
|
-
min-height: 90vh;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.error-box {
|
|
25
|
-
background-color: #1e1e1e;
|
|
26
|
-
border: 1px solid #d9534f;
|
|
27
|
-
padding: 24px;
|
|
28
|
-
border-radius: 8px;
|
|
29
|
-
max-width: 600px;
|
|
30
|
-
width: 100%;
|
|
31
|
-
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.7);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.error-box code {
|
|
35
|
-
background: #2e2e2e;
|
|
36
|
-
color: #ffd5d5;
|
|
37
|
-
padding: 2px 6px;
|
|
38
|
-
border-radius: 4px;
|
|
39
|
-
font-family: monospace;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.error-box a {
|
|
43
|
-
color: #61dafb;
|
|
44
|
-
text-decoration: none;
|
|
45
|
-
font-weight: bold;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.error-box a:hover {
|
|
49
|
-
text-decoration: underline;
|
|
50
|
-
}
|
|
51
|
-
</style>
|
|
52
|
-
</head>
|
|
53
|
-
<body>
|
|
54
|
-
<div class="error-box">
|
|
55
|
-
<strong style="color: #ff6b6b;">Connection failed:</strong>
|
|
56
|
-
Proxy does not exist for
|
|
57
|
-
<code>${host}</code>.<br/><br/>
|
|
58
|
-
Please use
|
|
59
|
-
<code>npx locadot --host ${host} --port PORT</code><br/><br/>
|
|
60
|
-
<a href="https://github.com/avinashid/locadot#readme" target="_blank">
|
|
61
|
-
📘 View on GitHub
|
|
62
|
-
</a>
|
|
63
|
-
</div>
|
|
64
|
-
</body>
|
|
65
|
-
</html>
|
|
66
|
-
`;
|
|
67
|
-
exports.proxyNotFound = proxyNotFound;
|