diff options
| author | Feuerfuchs <git@feuerfuchs.dev> | 2020-05-18 12:12:43 +0200 |
|---|---|---|
| committer | Feuerfuchs <git@feuerfuchs.dev> | 2020-05-18 12:12:43 +0200 |
| commit | 4bf44b16562335b3d09b6df0150521bb5b5f776f (patch) | |
| tree | 576723e6dc9f9db48d0892f7ec354a11b973aef4 /internal/port/tpl | |
| parent | Added 2 more glyphs (diff) | |
| download | gopherproxy-4bf44b16562335b3d09b6df0150521bb5b5f776f.tar.gz gopherproxy-4bf44b16562335b3d09b6df0150521bb5b5f776f.tar.bz2 gopherproxy-4bf44b16562335b3d09b6df0150521bb5b5f776f.zip | |
WIP: Refactoring
Diffstat (limited to 'internal/port/tpl')
| -rw-r--r-- | internal/port/tpl/gemini.html | 0 | ||||
| -rw-r--r-- | internal/port/tpl/gopher.html | 0 | ||||
| -rw-r--r-- | internal/port/tpl/startpage.html | 120 |
3 files changed, 120 insertions, 0 deletions
diff --git a/internal/port/tpl/gemini.html b/internal/port/tpl/gemini.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/internal/port/tpl/gemini.html | |||
diff --git a/internal/port/tpl/gopher.html b/internal/port/tpl/gopher.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/internal/port/tpl/gopher.html | |||
diff --git a/internal/port/tpl/startpage.html b/internal/port/tpl/startpage.html new file mode 100644 index 0000000..8482a6f --- /dev/null +++ b/internal/port/tpl/startpage.html | |||
| @@ -0,0 +1,120 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <html> | ||
| 3 | <head> | ||
| 4 | <meta charset="utf-8"> | ||
| 5 | <meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
| 6 | <title>{{ .Title }}{{ if ne .Protocol "startpage" }} - {{ .Protocol | title }} proxy{{ end }}</title> | ||
| 7 | <link rel="stylesheet" href="{{ .Assets.Style }}" /> | ||
| 8 | <style> | ||
| 9 | @font-face { | ||
| 10 | font-family: 'Iosevka Term SS03'; | ||
| 11 | font-style: normal; | ||
| 12 | font-weight: normal; | ||
| 13 | src: url('{{ .Assets.FontW2 }}') format('woff2'), | ||
| 14 | url('{{ .Assets.FontW }}') format('woff'); | ||
| 15 | } | ||
| 16 | @font-face { | ||
| 17 | font-family: 'Iosevka Aile'; | ||
| 18 | font-style: normal; | ||
| 19 | font-weight: normal; | ||
| 20 | src: url('{{ .Assets.PropFontW2 }}') format('woff2'), | ||
| 21 | url('{{ .Assets.PropFontW }}') format('woff'); | ||
| 22 | } | ||
| 23 | </style> | ||
| 24 | </head> | ||
| 25 | <body class="{{ if not .Lines }}is-plain{{ end }}"> | ||
| 26 | <header class="header header-base"> | ||
| 27 | <div class="location"> | ||
| 28 | <a class="location__prefix">{{ .Protocol }}://</a><a class="location__prefix location__prefix--mobile">://</a> | ||
| 29 | |||
| 30 | {{- if .URI -}} | ||
| 31 | {{- $page := . -}} | ||
| 32 | {{- $href := printf "/%s" .Protocol -}} | ||
| 33 | {{- $uriParts := split .URI "/" -}} | ||
| 34 | |||
| 35 | {{- $uriLast := $uriParts | last -}} | ||
| 36 | {{- $uriParts = $uriParts | pop -}} | ||
| 37 | {{- if eq $uriLast "" -}} | ||
| 38 | {{- $uriLast = $uriParts | last -}} | ||
| 39 | {{- $uriParts = $uriParts | pop -}} | ||
| 40 | {{- end -}} | ||
| 41 | |||
| 42 | {{- range $i, $part := $uriParts -}} | ||
| 43 | {{- if and (eq $page.Protocol "gopher") (eq $i 1) -}} | ||
| 44 | {{- $href = printf "%s/1" $href -}} | ||
| 45 | {{- $part = $part | trimLeftChar -}} | ||
| 46 | {{- if not (eq $part "") -}} | ||
| 47 | {{- $href = printf "%s/%s" $href $part -}} | ||
| 48 | <span class="location__slash">/</span><a href="{{ $href }}/" class="location__uripart">{{ $part }}</a> | ||
| 49 | {{- end -}} | ||
| 50 | {{- else -}} | ||
| 51 | {{- $href = printf "%s/%s" $href . -}} | ||
| 52 | {{- if ne $i 0 -}} | ||
| 53 | <span class="location__slash">/</span> | ||
| 54 | {{- end -}} | ||
| 55 | <a href="{{ $href }}/" class="location__uripart">{{ . }}</a> | ||
| 56 | {{- end -}} | ||
| 57 | {{- end -}} | ||
| 58 | {{- if ne (len $uriParts) 0 -}} | ||
| 59 | <span class="location__slash">/</span> | ||
| 60 | {{- end -}} | ||
| 61 | {{- if and (eq $page.Protocol "gopher") (eq (len $uriParts) 1) -}} | ||
| 62 | {{- $uriLast = $uriLast | trimLeftChar -}} | ||
| 63 | {{- end -}} | ||
| 64 | <span class="location__uripart">{{ $uriLast }}</span> | ||
| 65 | {{- end -}} | ||
| 66 | </div> | ||
| 67 | <div class="actions"> | ||
| 68 | {{- if and (not .Lines) (not .Error) (eq .Protocol "gopher") -}} | ||
| 69 | <div class="action"><a href="/gopher/{{ .URI | replace "^([^/]*)/0" "$1/9" }}">View raw</a></div> | ||
| 70 | {{- end -}} | ||
| 71 | <div class="action"><button class="settings-btn">Settings</button></div> | ||
| 72 | </div> | ||
| 73 | </header> | ||
| 74 | <main class="wrap"> | ||
| 75 | <pre class="content content--has-monospace-font{{ if .Lines }} content--has-type-annotations{{ end }}"> | ||
| 76 | {{- if .Lines -}} | ||
| 77 | {{- $content := "" -}} | ||
| 78 | {{- range .Lines -}} | ||
| 79 | {{- if ne $content "" -}} | ||
| 80 | {{- $content = printf "%s\n" $content -}} | ||
| 81 | {{- end -}} | ||
| 82 | {{- if .Link -}} | ||
| 83 | {{- $content = printf "%s%s" $content (printf "<span class=\"type-annotation\">%s </span><a class=\"link link--%s\" href=\"%s\">%s</a>" .Type .Type .Link (.Text | HTMLEscape)) -}} | ||
| 84 | {{- else -}} | ||
| 85 | {{- $content = printf "%s%s" $content (printf "<span class=\"type-annotation\"> </span>%s" (.Text | HTMLEscape)) -}} | ||
| 86 | {{- end -}} | ||
| 87 | {{- end -}} | ||
| 88 | {{- $content | safeHtml -}} | ||
| 89 | {{- else -}} | ||
| 90 | {{- .RawText -}} | ||
| 91 | {{- end -}} | ||
| 92 | </pre> | ||
| 93 | </main> | ||
| 94 | <aside class="modal modal--settings"> | ||
| 95 | <div class="modal__content"> | ||
| 96 | <header class="modal__head header-base"> | ||
| 97 | <h1 class="modal__title">Settings</h1> | ||
| 98 | <button class="modal__close-btn">Close</button> | ||
| 99 | </header> | ||
| 100 | <div class="setting setting--word-wrap"> | ||
| 101 | <strong class="setting__label">Wrap wide content</strong> | ||
| 102 | <button class="setting__value">[N/A]</button> | ||
| 103 | </div> | ||
| 104 | <div class="setting setting--monospace-font"> | ||
| 105 | <strong class="setting__label">Monospace font</strong> | ||
| 106 | <button class="setting__value">[N/A]</button> | ||
| 107 | </div> | ||
| 108 | <div class="setting setting--image-previews"> | ||
| 109 | <strong class="setting__label">Image thumbnails</strong> | ||
| 110 | <button class="setting__value">[N/A]</button> | ||
| 111 | </div> | ||
| 112 | <div class="setting setting--clickable-plain-links"> | ||
| 113 | <strong class="setting__label">Clickable links in text files</strong> | ||
| 114 | <button class="setting__value">[N/A]</button> | ||
| 115 | </div> | ||
| 116 | </div> | ||
| 117 | </aside> | ||
| 118 | <script src="{{ .Assets.JS }}"></script> | ||
| 119 | </body> | ||
| 120 | </html> | ||
