From f93aac983a651e76b83aad78bfc79a8c3c5d49a8 Mon Sep 17 00:00:00 2001 From: Manuel Date: Sun, 14 Feb 2021 20:19:19 +0000 Subject: [PATCH 1/7] Set Content-Type of raw paste to plaintext --- server.js | 1 + 1 file changed, 1 insertion(+) diff --git a/server.js b/server.js index d0ae993..2179418 100644 --- a/server.js +++ b/server.js @@ -81,6 +81,7 @@ const utils = new HasteUtils(); app.get('/raw/:id', async (req, res) => { const key = req.params.id.split('.')[0]; const skipExpire = Boolean(config.documents[key]); + res.setHeader('content-type', 'text/plain'); return await documentHandler.handleGetRaw(key, res, skipExpire); }); From c00f65a3853b9ee31ded20c974032f825c9f1373 Mon Sep 17 00:00:00 2001 From: Manuel Date: Sun, 14 Feb 2021 20:34:46 +0000 Subject: [PATCH 2/7] Improve HTML and mobile viewing slightly * Add DOCTYPE declaration * Set proper viewport scaling for mobile viewing * Remove some tag closing not needed for HTML5 --- static/index.html | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/static/index.html b/static/index.html index 6e4bed0..c67de48 100644 --- a/static/index.html +++ b/static/index.html @@ -1,16 +1,17 @@ + hastebin - - - + + + + + - - - - @@ -64,6 +63,4 @@
- - - + \ No newline at end of file From e4998cb94cab16673c15aec3642ef3a58b755ad8 Mon Sep 17 00:00:00 2001 From: Manuel Date: Sun, 14 Feb 2021 22:56:34 +0100 Subject: [PATCH 3/7] Fix textarea not resizing to 100% With declaration of doctype the textarea element did not resize to 100% height anymore due to HTML5 compliance mode changes --- static/application.css | 47 ++++++++++++++++++++++++++---------------- static/index.html | 6 ++++-- 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/static/application.css b/static/application.css index 28087e3..678faea 100644 --- a/static/application.css +++ b/static/application.css @@ -1,7 +1,18 @@ +body, html { + margin: 0; + padding: 0; + width: 100%; + height: 100%; +} + body { background: #002B36; +} + +.text-container { padding: 20px 50px; - margin: 0px; + width: calc(100% - 100px); + height: calc(100% - 40px); } /* textarea */ @@ -10,7 +21,7 @@ textarea { background: transparent; border: 0px; color: #fff; - padding: 0px; + padding: 0; width: 100%; height: 100%; font-family: monospace; @@ -22,11 +33,11 @@ textarea { /* the line numbers */ #linenos { - color: #7d7d7d; + color: #7d7d7d; z-index: -1000; position: absolute; top: 20px; - left: 0px; + left: 0; width: 30px; /* 30 to get 20 away from box */ font-size: 13px; font-family: monospace; @@ -36,17 +47,18 @@ textarea { /* code box when locked */ #box { - padding: 0px; - margin: 0px; + padding: 0; + margin: 0; width: 100%; - border: 0px; + border: 0; outline: none; font-size: 13px; - overflow: inherit; + overflow: inherit; + margin-bottom: 20px; } #box code { - padding: 0px; + padding: 0; background: transparent !important; /* don't hide hastebox */ } @@ -54,8 +66,8 @@ textarea { #key { position: fixed; - top: 0px; - right: 0px; + top: 0; + right: 0; z-index: +1000; /* watch out */ } @@ -67,8 +79,8 @@ textarea { #box2 { background: #08323c; - font-size: 0px; - padding: 0px 5px; + font-size: 0; + padding: 0 5px; } #box1 a.logo, #box1 a.logo:visited { @@ -104,11 +116,11 @@ textarea { height: 5px; width: 10px; background: url(hover-dropdown-tip.png); - bottom: 0px; + bottom: 0; position: absolute; margin: auto; - left: 0px; - right: 0px; + left: 0; + right: 0; } #box3, #messages li { @@ -152,7 +164,7 @@ textarea { #messages { position:fixed; - top:0px; + top:0; right:138px; margin:0; padding:0; @@ -168,4 +180,3 @@ textarea { #messages li.error { background:rgba(102,8,0,0.8); } - diff --git a/static/index.html b/static/index.html index c67de48..3c39123 100644 --- a/static/index.html +++ b/static/index.html @@ -62,5 +62,7 @@
- - \ No newline at end of file +
+ + +
\ No newline at end of file From 9bd1847da5ae7c62fbb294a559d1f97efb7de8d0 Mon Sep 17 00:00:00 2001 From: Manuel Date: Sun, 14 Feb 2021 23:04:56 +0100 Subject: [PATCH 4/7] Set Content-Type of raw paste in DocumentHandler --- lib/document_handler.js | 1 + server.js | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/document_handler.js b/lib/document_handler.js index 78ae674..8be4033 100644 --- a/lib/document_handler.js +++ b/lib/document_handler.js @@ -38,6 +38,7 @@ DocumentHandler.prototype.handleGetRaw = async function(key, res, skipExpire){ return; } winston.verbose('retrieved raw document', { key: key }); + res.setHeader('content-type', 'text/plain'); res.status(200).end(data); }; diff --git a/server.js b/server.js index 2179418..d0ae993 100644 --- a/server.js +++ b/server.js @@ -81,7 +81,6 @@ const utils = new HasteUtils(); app.get('/raw/:id', async (req, res) => { const key = req.params.id.split('.')[0]; const skipExpire = Boolean(config.documents[key]); - res.setHeader('content-type', 'text/plain'); return await documentHandler.handleGetRaw(key, res, skipExpire); }); From 1f6f1daeec2bbd3db30b03458c1416d665f89064 Mon Sep 17 00:00:00 2001 From: Manuel Date: Tue, 6 Apr 2021 15:23:56 +0200 Subject: [PATCH 5/7] Minor stylistic change --- static/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/index.html b/static/index.html index 3c39123..4faf3bc 100644 --- a/static/index.html +++ b/static/index.html @@ -44,7 +44,7 @@
    - +
    From 79ec30f30b6edbf286f7828b91b75e04dbdaa671 Mon Sep 17 00:00:00 2001 From: Manuel Date: Wed, 7 Apr 2021 15:28:37 +0200 Subject: [PATCH 6/7] Prevent line numbers from being selectable When selecting everything (Ctrl+A) the line numbers should not be selected --- static/application.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/static/application.css b/static/application.css index 678faea..fe7668b 100644 --- a/static/application.css +++ b/static/application.css @@ -180,3 +180,7 @@ textarea { #messages li.error { background:rgba(102,8,0,0.8); } + +#lineos { + user-select: none; +} \ No newline at end of file From fab625a4d4f3c546297cfa89728a063f75849526 Mon Sep 17 00:00:00 2001 From: Manuel Date: Wed, 7 Apr 2021 15:39:46 +0200 Subject: [PATCH 7/7] Fix typo Pepega --- static/application.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/application.css b/static/application.css index fe7668b..acb5844 100644 --- a/static/application.css +++ b/static/application.css @@ -181,6 +181,6 @@ textarea { background:rgba(102,8,0,0.8); } -#lineos { +#linenos { user-select: none; } \ No newline at end of file