From 59c050ca9440e5c58a49d12d558bfd059f9d754f Mon Sep 17 00:00:00 2001 From: nanohertz Date: Thu, 13 Oct 2022 20:14:58 +0300 Subject: [PATCH 1/5] prevent the browser from fetching favicon.ico --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index c01bc0b..3790e82 100755 --- a/index.js +++ b/index.js @@ -136,7 +136,9 @@ function handler(request, response) { 'div#autoscroll { position: fixed; bottom: 2em; right: 2em ; }' - response.write('' + + response.write('' + + '' + + '' + '' + '
Pipe from terminal to browser

started at:' + new Date() + '
' + '
Auto scroll
' + From fd5580e5209857216372fb741e8978f9a83a0d39 Mon Sep 17 00:00:00 2001 From: nanohertz Date: Thu, 13 Oct 2022 20:19:34 +0300 Subject: [PATCH 2/5] Make the UI-related text non-selectable --- index.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 3790e82..f07f398 100755 --- a/index.js +++ b/index.js @@ -133,15 +133,21 @@ function handler(request, response) { var style = 'body { background-color: ' + bg + '; color: ' + fg + '; font-family:Monaco, Menlo, monospace; padding:2em;} ' + 'div#headline { position: fixed; top: 2em; right: 2em ; text-align: right;} ' + - 'div#autoscroll { position: fixed; bottom: 2em; right: 2em ; }' - + 'div#autoscroll { position: fixed; bottom: 2em; right: 2em ; } ' + + '.noselect { ' + + '-webkit-touch-callout: none; /* iOS Safari */ ' + + '-webkit-user-select: none; /* Safari */ ' + + '-khtml-user-select: none; /* Konqueror HTML */ ' + + '-moz-user-select: none; /* Old versions of Firefox */ ' + + '-ms-user-select: none; /* Internet Explorer/Edge */ ' + + 'user-select: none; /* Non-prefixed version, currently supported by Chrome, Edge, Opera and Firefox */ }' response.write('' + '' + '' + '' + - '
Pipe from terminal to browser

started at:' + new Date() + '
' + - '
Auto scroll
' + + '
Pipe from terminal to browser

started at:' + new Date() + '
' + + '
Auto scroll
' + '
') } From 498e557bab4a1255e2a275fbf783529752d79059 Mon Sep 17 00:00:00 2001 From: nanohertz Date: Thu, 13 Oct 2022 20:24:28 +0300 Subject: [PATCH 3/5] use process.env.BROWSER ($BROWSER was not defined) --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index f07f398..9ac6519 100755 --- a/index.js +++ b/index.js @@ -87,7 +87,7 @@ function cat(port) { console.error('The environment variable $BROWSER is not set. Falling back to default opening mechanism.') opn('http://localhost:' + server.address().port, { wait: false }) } else { - console.error('The environment variable $BROWSER is set to "' + $BROWSER + '"') + console.error('The environment variable $BROWSER is set to "' + process.env.BROWSER + '"') child.spawn(process.env.BROWSER, [url], { detached: true }) } }) From 5b0283467b60fe6026b2445807db74f67921e735 Mon Sep 17 00:00:00 2001 From: nanohertz Date: Thu, 13 Oct 2022 20:28:22 +0300 Subject: [PATCH 4/5] fix indentation (back to tabs) --- index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 9ac6519..d0cf5be 100755 --- a/index.js +++ b/index.js @@ -137,10 +137,10 @@ function handler(request, response) { '.noselect { ' + '-webkit-touch-callout: none; /* iOS Safari */ ' + '-webkit-user-select: none; /* Safari */ ' + - '-khtml-user-select: none; /* Konqueror HTML */ ' + - '-moz-user-select: none; /* Old versions of Firefox */ ' + - '-ms-user-select: none; /* Internet Explorer/Edge */ ' + - 'user-select: none; /* Non-prefixed version, currently supported by Chrome, Edge, Opera and Firefox */ }' + '-khtml-user-select: none; /* Konqueror HTML */ ' + + '-moz-user-select: none; /* Old versions of Firefox */ ' + + '-ms-user-select: none; /* Internet Explorer/Edge */ ' + + 'user-select: none; /* Non-prefixed version, currently supported by Chrome, Edge, Opera and Firefox */ }' response.write('' + '' + From d87a65eb6a7bcccbc798103d0f83ea521529a81a Mon Sep 17 00:00:00 2001 From: nanohertz Date: Thu, 13 Oct 2022 20:31:23 +0300 Subject: [PATCH 5/5] 2.0.1 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 847b851..a658eaf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "bcat", - "version": "2.0.0", + "version": "2.0.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "bcat", - "version": "2.0.0", + "version": "2.0.1", "license": "MIT", "dependencies": { "ansi-html-stream": "0.0.2", diff --git a/package.json b/package.json index c8f4e64..8f4dc53 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bcat", - "version": "2.0.0", + "version": "2.0.1", "description": "A pipe to browser utility", "main": "index.js", "bin": {