From bfb1abfb178ae62e501f266ff12ee204177c6481 Mon Sep 17 00:00:00 2001 From: Henri Date: Mon, 25 Feb 2019 17:40:52 +0000 Subject: [PATCH] new startup option: --title --- index.js | 6 ++++++ src/server/index.ts | 5 ++++- src/server/server.ts | 6 +++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 73489a1..526d775 100755 --- a/index.js +++ b/index.js @@ -41,6 +41,12 @@ if (require.main === module) { type: 'string', default: process.env.SSHUSER || '', }, + title: { + demand: false, + description: 'window title', + type: 'string', + default: process.env.TITLE || 'WeTTy - The Web Terminal Emulator', + }, sshauth: { demand: false, description: diff --git a/src/server/index.ts b/src/server/index.ts index 4dfbe69..2274339 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -15,6 +15,7 @@ export interface Options { base: string; host: string; port: number; + title: string; command?: string; } @@ -33,6 +34,7 @@ export default class Server { base, host, port, + title, command, sslkey, sslcert, @@ -54,10 +56,11 @@ export default class Server { host: sshhost, auth: sshauth, port: sshport, + title: title, pass: sshpass, key: sshkey, }, - { base, host, port }, + { base, host, port, title }, command, { key: sslkey, cert: sslcert } ); diff --git a/src/server/server.ts b/src/server/server.ts index 4b789da..a8a83a3 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -17,13 +17,13 @@ const distDir = path.join(__dirname, 'client'); const trim = (str: string): string => str.replace(/\/*$/, ''); export default function createServer( - { base, port, host }: Server, + { base, port, host, title }: Server, { key, cert }: SSLBuffer ): SocketIO.Server { const basePath = trim(base); events.emit( 'debug', - `key: ${key}, cert: ${cert}, port: ${port}, base: ${base}` + `key: ${key}, cert: ${cert}, port: ${port}, base: ${base}, title: ${title}` ); const html = ( @@ -36,7 +36,7 @@ export default function createServer( - WeTTy - The Web Terminal Emulator + ${title}