diff --git a/res/static/script/Toolbar.js b/res/static/script/Toolbar.js index f6facb9..3390501 100644 --- a/res/static/script/Toolbar.js +++ b/res/static/script/Toolbar.js @@ -118,7 +118,7 @@ var Sharebar = { if (navigator.share) { navigator.share({ title: Viewer.title, - text: "Get this file from Pixeldrain!", + text: "Download " + Viewer.title + " here", url: window.location.href }); return; diff --git a/res/static/style/viewer.css b/res/static/style/viewer.css index f2406a4..e234b76 100644 --- a/res/static/style/viewer.css +++ b/res/static/style/viewer.css @@ -152,11 +152,14 @@ body{ width: 100%; padding: 5px 5px 5px 20px; box-sizing: border-box; + overflow-y: scroll; + overflow-x: hidden; } - -.pre-container{ +.text-container > pre { white-space: pre-wrap; word-wrap: break-word; + overflow: hidden; + } .pannable{ diff --git a/res/template/file_viewer.html b/res/template/file_viewer.html index af8d8b5..9503bce 100644 --- a/res/template/file_viewer.html +++ b/res/template/file_viewer.html @@ -72,7 +72,7 @@
Share on:
- @@ -80,7 +80,7 @@ Share on Reddit
Reddit - diff --git a/webcontroller/file_preview.go b/webcontroller/file_preview.go index 9d9c586..37c5fda 100644 --- a/webcontroller/file_preview.go +++ b/webcontroller/file_preview.go @@ -144,7 +144,7 @@ func (f filePreview) text() string {
%s
` - if f.FileInfo.Size > 1e6 { // Prevent out of memory errors + if f.FileInfo.Size > 1<<22 { // 4 MiB limit to prevent out of memory errors return fmt.Sprintf(htmlOut, "", "File is too large to view online.\nPlease download and view it locally.", ) @@ -176,14 +176,9 @@ func (f filePreview) text() string { ) } - result = html.EscapeString(result) + htmlOut += `` - var prettyPrint string - if f.FileInfo.MimeType != "text/plain" { - prettyPrint = "prettyprint linenums" - htmlOut += `` - } - return fmt.Sprintf(htmlOut, prettyPrint, result) + return fmt.Sprintf(htmlOut, "prettyprint linenums", html.EscapeString(result)) } func (f filePreview) markdown() string {