From 5aaf121a1708ecf1787826c63d863b9e372c1fac Mon Sep 17 00:00:00 2001 From: Wim Brand Date: Sun, 28 Jul 2019 22:34:15 +0200 Subject: [PATCH] More styling fixes, and fix the file not found page --- res/static/script/Toolbar.js | 2 +- res/static/style/layout.css | 14 ++++---- res/static/style/viewer.css | 27 +++++++------- res/template/404.html | 24 +++++++------ res/template/500.html | 20 +++++------ res/template/file_not_found.html | 60 +++++++++++++++++++++++++++----- res/template/file_viewer.html | 4 +-- res/template/home.html | 1 + webcontroller/file_viewer.go | 8 +++-- webcontroller/list_viewer.go | 6 ++-- 10 files changed, 106 insertions(+), 60 deletions(-) diff --git a/res/static/script/Toolbar.js b/res/static/script/Toolbar.js index 56b58a4..f6facb9 100644 --- a/res/static/script/Toolbar.js +++ b/res/static/script/Toolbar.js @@ -215,7 +215,7 @@ var DetailsWindow = { $("#info_file_details").html( "" + "" - + "" + + "" + "" + "" + "" diff --git a/res/static/style/layout.css b/res/static/style/layout.css index cc0c28b..0e974fb 100644 --- a/res/static/style/layout.css +++ b/res/static/style/layout.css @@ -254,15 +254,13 @@ pre{ } .big_button{ - height: 1.3em; width: 40%; min-width: 200px; max-width: 400px; margin: 10px !important; border-radius: 5px; - font-size: 1.9em; + font-size: 1.8em; font-weight: normal; - line-height: 8px; } .progress_bar{ @@ -347,13 +345,13 @@ select{ border: none; margin: 3px; background: linear-gradient(var(--input_color), var(--input_color_dark)); - padding: 6px 8px 6px 8px; + padding: .4em .5em .4em .5em; box-shadow: 2px 2px 6px -3px var(--shadow_color); - font-weight: bold; - font-size: 0.85em; + font-size: 0.9em; + line-height: 1em; overflow: hidden; - line-height: 1; text-decoration: none; + font-family: inherit; color: #bfbfbf; /* Fallback */ color: var(--input_text_color); outline: 0; @@ -386,7 +384,7 @@ input[type="color"]:active, select:active{ background: linear-gradient(var(--input_color_dark), var(--input_color)); box-shadow: inset 4px 4px 8px var(--shadow_color); - padding: 10px 4px 2px 12px; /* Exactly 4px offset compared to the inactive padding to give a depth effect */ + padding: .6em .3em .2em .7em; /* Exactly .2em offset compared to the inactive padding to give a depth effect */ } .button_full_width {width: calc(100% - 6px);} .button_highlight {background: linear-gradient(var(--highlight_color), var(--highlight_color_dark)) !important; color: var(--highlight_text_color) !important;} diff --git a/res/static/style/viewer.css b/res/static/style/viewer.css index e36dc63..7d4e3e0 100644 --- a/res/static/style/viewer.css +++ b/res/static/style/viewer.css @@ -7,6 +7,7 @@ body{ overflow: hidden; } +/* Viewer container */ .file_viewer { position: absolute; display: flex; @@ -17,6 +18,8 @@ body{ left: 0; overflow: hidden; } + +/* Headerbar (row 1) */ .file_viewer > .highlight_headerbar { flex-grow: 0; flex-shrink: 0; @@ -25,20 +28,15 @@ body{ text-align: left; padding: 0.2em; } -.file_viewer > .highlight_headerbar > .button_group { + +/* Headerbar components */ +.file_viewer > .highlight_headerbar > * { flex-grow: 0; flex-shrink: 0; + margin-left: .4em; + margin-right: .4em; display: inline-flex; } -.file_viewer > .highlight_headerbar > .button_toggle_toolbar { - flex-grow: 0; - flex-shrink: 0; -} -.file_viewer > .highlight_headerbar > .button_home { - flex-grow: 0; - flex-shrink: 0; - margin-right: .5em; -} .file_viewer > .highlight_headerbar > .file_viewer_headerbar_title { flex-grow: 1; flex-shrink: 1; @@ -47,11 +45,8 @@ body{ line-height: 2em; text-overflow: ellipsis; } -.file_viewer > .highlight_headerbar > .button_close_file_viewer { - flex-grow: 0; - flex-shrink: 0; - margin-left: .5em; -} + +/* List Navigator (row 2) */ .file_viewer > .list_navigator { flex-grow: 0; flex-shrink: 0; @@ -71,6 +66,8 @@ body{ height: 40px !important; width: 250px !important; } + +/* File preview area (row 3) */ .file_viewer > .file_viewer_window { flex-grow: 1; flex-shrink: 1; diff --git a/res/template/404.html b/res/template/404.html index a79ced3..a246a1c 100644 --- a/res/template/404.html +++ b/res/template/404.html @@ -6,18 +6,22 @@ -
+
{{template "menu" .}} -
+

This page does not exist!

- If you came here by a link from this very same website you can tell - me about it on twitter. -

- Either way, there's nothing to see here, so you'll have to - head over to the home page. -
-
- Bye! +

+ If you came here by a link from this very same website you can + tell me about it on + twitter. +

+

+ Either way, there's nothing to see here, so you'll have to + head over to the home page. +

+

+ Bye! +

{{template "footer"}}
{{template "analytics"}} diff --git a/res/template/500.html b/res/template/500.html index 65192fd..9374acb 100644 --- a/res/template/500.html +++ b/res/template/500.html @@ -1,7 +1,7 @@ {{define "500"}} - {{template "meta_tags" "Internal Server Error"}} + {{template "meta_tags" "500, Internal Server Error"}} {{template "user_style" .}} @@ -10,15 +10,15 @@ {{template "menu" .}}

You broke pixeldrain

- Great job. -

- But not to worry, the engineering team has been pulled out of bed to - have a look at the issue. You can try again in a few minutes (maybe - hours, who knows?), or go back to the home page and - start over. -
-
- Bye! +

+ Great job. +

+

+ Just kidding, something went wrong on the pixeldrain server and + it's my fault. I'll soon be notified of the problem and will + take a look at it. You can try again in a few minutes (or + hours), or go back to the home page and start over. +

{{template "footer"}}
{{template "analytics"}} diff --git a/res/template/file_not_found.html b/res/template/file_not_found.html index 7153cc2..7c5e3fb 100644 --- a/res/template/file_not_found.html +++ b/res/template/file_not_found.html @@ -1,19 +1,61 @@ {{define "file_not_found"}} - {{template "meta_tags" "File Not Found"}} + {{template "meta_tags" "404, File Not Found"}} {{template "user_style" .}} + -
- {{template "menu"}} -

File not Found

- I'm sorry, but this file does not exist!
- It may have expired, or taken down by the owner.
- You can Visit the homepage to upload your own files. -

- It was fun having you, bye for now! +
+ {{template "menu" .}}
+

404, File Not Found!

+

+ This file does not exist, or it has been removed. Possible + reasons for this are: +

+
    +
  • The file has not been viewed for 100 days and has expired
  • +
  • Something went wrong on the pixeldrain servers causing the file to be temporarily unavailable
  • +
  • The file voilated copyright laws and has received a takedown request
  • +
  • The content was deemed illegal in some country and censorship was requested by a government organisation
  • +
+

+ I'm sorry for the inconvenience. +

+ + {{template "footer"}} +
+ {{template "analytics"}} + + +{{end}} +{{define "list_not_found"}} + + + {{template "meta_tags" "404, List Not Found"}} + {{template "user_style" .}} + + + +
+ {{template "menu" .}} +
+

404, List Not Found!

+

+ This list does not exist, or it has been removed. Possible + reasons for this are: +

+
    +
  • All files in this list have not been viewed for 100 days and have expired
  • +
  • Something went wrong on the pixeldrain servers causing the list to be temporarily unavailable
  • +
  • The files in the list voilated copyright laws and have received a takedown request
  • +
  • The files in the list were deemed illegal in some country and censorship was requested by a government organisation
  • +
+

+ I'm sorry for the inconvenience. +

+ {{template "footer"}}
{{template "analytics"}} diff --git a/res/template/file_viewer.html b/res/template/file_viewer.html index 174aab8..85aa1a7 100644 --- a/res/template/file_viewer.html +++ b/res/template/file_viewer.html @@ -52,7 +52,7 @@ {{template "advertisement" .}} diff --git a/res/template/home.html b/res/template/home.html index 0f03255..bc49e48 100644 --- a/res/template/home.html +++ b/res/template/home.html @@ -92,6 +92,7 @@ your address bar. If you don't have Brave browser yet you can download it here: Install Brave. + . Installing and using Brave with this referral link also counts as a 5$ donation. diff --git a/webcontroller/file_viewer.go b/webcontroller/file_viewer.go index 0de4518..af87767 100644 --- a/webcontroller/file_viewer.go +++ b/webcontroller/file_viewer.go @@ -42,12 +42,14 @@ func (wc *WebController) serveFileViewer(w http.ResponseWriter, r *http.Request, finfo = append(finfo, inf) } + templateData := wc.newTemplateData(w, r) + if len(finfo) == 0 { - wc.serveNotFound(w, r) + w.WriteHeader(http.StatusNotFound) + wc.templates.Get().ExecuteTemplate(w, "file_not_found", templateData) return } - templateData := wc.newTemplateData(w, r) templateData.OGData = metadataFromFile(*finfo[0]) var err error if list { @@ -58,7 +60,7 @@ func (wc *WebController) serveFileViewer(w http.ResponseWriter, r *http.Request, APIResponse: map[string]interface{}{ "data": finfo, "date_created": "now", - "title": "Concatenation of files", + "title": "Multiple files", "date_lastview": "now", "views": 0, }, diff --git a/webcontroller/list_viewer.go b/webcontroller/list_viewer.go index 9cd8d10..4e9697a 100644 --- a/webcontroller/list_viewer.go +++ b/webcontroller/list_viewer.go @@ -14,15 +14,17 @@ import ( func (wc *WebController) serveListViewer(w http.ResponseWriter, r *http.Request, p httprouter.Params) { var api = pixelapi.New(wc.conf.APIURLInternal, "") var list, err = api.GetList(p.ByName("id")) + var templateData = wc.newTemplateData(w, r) if err != nil { if err, ok := err.(pixelapi.Error); ok && err.ReqError { log.Error("API request error occurred: %s", err.Value) + } - wc.serveNotFound(w, r) + w.WriteHeader(http.StatusNotFound) + wc.templates.Get().ExecuteTemplate(w, "list_not_found", templateData) return } - var templateData = wc.newTemplateData(w, r) templateData.Title = fmt.Sprintf("%s ~ Pixeldrain list", list.Title) templateData.OGData = metadataFromList(*list) templateData.Other = viewerData{
Name" + escapeHTML(data.name) + "
Url/u/" + data.id + "
URL/u/" + data.id + "
Mime Type" + escapeHTML(data.mime_type) + "
ID" + data.id + "
Size" + data.size + "