Merge branch 'feature/output-colorization'

This commit is contained in:
Robbie Cahill
2025-02-07 21:29:02 +11:00
4 changed files with 14 additions and 8 deletions
+1
View File
@@ -64,6 +64,7 @@
"@types/ws": "^7.2.4",
"axios": "^1.3.5",
"commander": "^5.1.0",
"chalk": "4.1.2",
"deep-equal": "^2.0.3",
"deepmerge": "^4.2.2",
"detect-port": "^2.1.0",
+10 -4
View File
@@ -2,6 +2,7 @@ import HostnameAssignedMessage from '../messages/hostname-assigned-message.js';
import HostipWebSocket from '../websocket/host-ip-websocket.js';
import { Options } from '../options.js';
import { eventHandler, URL_ASSIGNED } from '../events/event-handler.js';
import chalk from 'chalk';
export default async function hostnameAssigned(message: HostnameAssignedMessage, websocket: HostipWebSocket, options: Options) {
const port = options.port;
@@ -10,13 +11,18 @@ export default async function hostnameAssigned(message: HostnameAssignedMessage,
console.error('Please specify a port e.g. run "tmole 80"');
}
const httpUrl = `http://${message.hostname}`;
const httpsUrl = `https://${message.hostname}`;
const httpsUrl = `https://${message.hostname}`;
const httpUrl = `http://${message.hostname}`;
const destinationUrl = `http://localhost:${port}`;
if (process.env.TUNNELMOLE_QUIET_MODE !== '1') {
console.info(`${httpUrl} is forwarding to localhost:${port}`);
console.info(`${httpsUrl} is forwarding to localhost:${port}`);
console.info('='.repeat(process.stdout.columns));
console.info('Your URLs are below. Always use HTTPs for the best security');
console.info('');
console.info(`${chalk.greenBright.bold(httpsUrl)}${chalk.bold(destinationUrl)}`);
console.info(`${chalk.greenBright.bold(httpUrl)}${chalk.bold(destinationUrl)}`);
console.info('='.repeat(process.stdout.columns));
}
eventHandler.emit(URL_ASSIGNED, httpsUrl);
+2 -3
View File
@@ -6,6 +6,7 @@ import { setUpAutoReconnect } from './websocket/setup-auto-reconnect.js';
import { connect } from './websocket/connect.js';
import { setIsCli } from './websocket/connection-info-service.js';
import detectPort from 'detect-port';
import chalk from 'chalk';
export default async function tunnelmole(
options: Options,
@@ -30,9 +31,7 @@ export default async function tunnelmole(
if (availablePort == options.port) {
console.warn(
`
Warning: You currently don't have anything running on port ${port}, which means you might get the standard 503 gateway timeout error when you make a request, since your service is not reachable.
Please start your service on port ${port} so that requests can reach your service.
${chalk.yellow.bold(`You currently don't have anything running on port ${port}`)}. Please start your service on port ${chalk.bold(port)} so that requests can reach your service. You may have also chosen the wrong port, in which case, find out what port your service is actually running on.
`
);
+1 -1
View File
@@ -1,2 +1,2 @@
const version = '2.3.4';
const version = '2.3.5';
export { version }