mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-04-27 15:17:38 +00:00
34 lines
1.1 KiB
JavaScript
34 lines
1.1 KiB
JavaScript
#!/usr/bin/env node
|
|
// Entry point for the server - imports the modular server which starts automatically
|
|
import { startVibeTunnelForward } from './server/fwd.js';
|
|
import { startVibeTunnelServer } from './server/server.js';
|
|
import { VERSION } from './server/version.js';
|
|
|
|
// Source maps are only included if built with --sourcemap flag
|
|
|
|
// Handle uncaught exceptions
|
|
process.on('uncaughtException', (error) => {
|
|
console.error('Uncaught exception:', error);
|
|
console.error('Stack trace:', error.stack);
|
|
process.exit(1);
|
|
});
|
|
|
|
process.on('unhandledRejection', (reason, promise) => {
|
|
console.error('Unhandled rejection at:', promise, 'reason:', reason);
|
|
if (reason instanceof Error) {
|
|
console.error('Stack trace:', reason.stack);
|
|
}
|
|
process.exit(1);
|
|
});
|
|
|
|
if (process.argv[2] === 'version') {
|
|
console.log(`VibeTunnel Linux v${VERSION}`);
|
|
process.exit(0);
|
|
} else if (process.argv[2] === 'fwd') {
|
|
startVibeTunnelForward(process.argv.slice(3)).catch((error) => {
|
|
console.error('Fatal error:', error);
|
|
process.exit(1);
|
|
});
|
|
} else {
|
|
startVibeTunnelServer();
|
|
}
|