aboutsummaryrefslogtreecommitdiffstats
path: root/internal/port/tpl
diff options
context:
space:
mode:
Diffstat (limited to 'internal/port/tpl')
-rw-r--r--internal/port/tpl/_fonts.html16
-rw-r--r--internal/port/tpl/_header.html48
-rw-r--r--internal/port/tpl/_modals.html24
-rw-r--r--internal/port/tpl/gemini.html38
-rw-r--r--internal/port/tpl/gopher.html59
-rw-r--r--internal/port/tpl/startpage.html120
6 files changed, 200 insertions, 105 deletions
diff --git a/internal/port/tpl/_fonts.html b/internal/port/tpl/_fonts.html
new file mode 100644
index 0000000..b56aa22
--- /dev/null
+++ b/internal/port/tpl/_fonts.html
@@ -0,0 +1,16 @@
1<style>
2 @font-face {
3 font-family: 'Iosevka Term SS03';
4 font-style: normal;
5 font-weight: normal;
6 src: url('{{ .Assets.FontW2 }}') format('woff2'),
7 url('{{ .Assets.FontW }}') format('woff');
8 }
9 @font-face {
10 font-family: 'Iosevka Aile';
11 font-style: normal;
12 font-weight: normal;
13 src: url('{{ .Assets.PropFontW2 }}') format('woff2'),
14 url('{{ .Assets.PropFontW }}') format('woff');
15 }
16</style>
diff --git a/internal/port/tpl/_header.html b/internal/port/tpl/_header.html
new file mode 100644
index 0000000..5bcd254
--- /dev/null
+++ b/internal/port/tpl/_header.html
@@ -0,0 +1,48 @@
1<header class="header header-base">
2 <div class="location">
3 <a class="location__prefix">{{ .Protocol }}://</a><a class="location__prefix location__prefix--mobile">://</a>
4
5 {{- if .URL -}}
6 {{- $page := . -}}
7 {{- $href := printf "/%s" .Protocol -}}
8 {{- $uriParts := split .URL "/" -}}
9
10 {{- $uriLast := $uriParts | last -}}
11 {{- $uriParts = $uriParts | pop -}}
12 {{- if eq $uriLast "" -}}
13 {{- $uriLast = $uriParts | last -}}
14 {{- $uriParts = $uriParts | pop -}}
15 {{- end -}}
16
17 {{- range $i, $part := $uriParts -}}
18 {{- if and (eq $page.Protocol "gopher") (eq $i 1) -}}
19 {{- $href = printf "%s/1" $href -}}
20 {{- $part = $part | trimLeftChar -}}
21 {{- if not (eq $part "") -}}
22 {{- $href = printf "%s/%s" $href $part -}}
23 <span class="location__slash">/</span><a href="{{ $href }}/" class="location__uripart">{{ $part }}</a>
24 {{- end -}}
25 {{- else -}}
26 {{- $href = printf "%s/%s" $href . -}}
27 {{- if ne $i 0 -}}
28 <span class="location__slash">/</span>
29 {{- end -}}
30 <a href="{{ $href }}/" class="location__uripart">{{ . }}</a>
31 {{- end -}}
32 {{- end -}}
33 {{- if ne (len $uriParts) 0 -}}
34 <span class="location__slash">/</span>
35 {{- end -}}
36 {{- if and (eq $page.Protocol "gopher") (eq (len $uriParts) 1) -}}
37 {{- $uriLast = $uriLast | trimLeftChar -}}
38 {{- end -}}
39 <span class="location__uripart">{{ $uriLast }}</span>
40 {{- end -}}
41 </div>
42 <div class="actions">
43 {{- if and (not .Lines) (not .Error) (eq .Protocol "gopher") -}}
44 <div class="action"><a href="/gopher/{{ .URL | replace "^([^/]*)/0" "$1/9" }}">View raw</a></div>
45 {{- end -}}
46 <div class="action"><button class="settings-btn">Settings</button></div>
47 </div>
48</header>
diff --git a/internal/port/tpl/_modals.html b/internal/port/tpl/_modals.html
new file mode 100644
index 0000000..3c08d9a
--- /dev/null
+++ b/internal/port/tpl/_modals.html
@@ -0,0 +1,24 @@
1<aside class="modal modal--settings">
2 <div class="modal__content">
3 <header class="modal__head header-base">
4 <h1 class="modal__title">Settings</h1>
5 <button class="modal__close-btn">Close</button>
6 </header>
7 <div class="setting setting--word-wrap">
8 <strong class="setting__label">Wrap wide content</strong>
9 <button class="setting__value">[N/A]</button>
10 </div>
11 <div class="setting setting--monospace-font">
12 <strong class="setting__label">Monospace font</strong>
13 <button class="setting__value">[N/A]</button>
14 </div>
15 <div class="setting setting--image-previews">
16 <strong class="setting__label">Image thumbnails</strong>
17 <button class="setting__value">[N/A]</button>
18 </div>
19 <div class="setting setting--clickable-plain-links">
20 <strong class="setting__label">Clickable links in text files</strong>
21 <button class="setting__value">[N/A]</button>
22 </div>
23 </div>
24</aside>
diff --git a/internal/port/tpl/gemini.html b/internal/port/tpl/gemini.html
index e69de29..08f1b8e 100644
--- a/internal/port/tpl/gemini.html
+++ b/internal/port/tpl/gemini.html
@@ -0,0 +1,38 @@
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 }} - Gemini proxy</title>
7 <link rel="stylesheet" href="{{ .Assets.Style }}" />
8 {{- template "_fonts.html" . -}}
9 </head>
10 <body class="{{ if not .Lines }}is-plain{{ end }}">
11 {{- template "_header.html" . -}}
12
13 <main class="wrap">
14 <pre class="content content--has-monospace-font{{ if .Lines }} content--has-type-annotations{{ end }}">
15 {{- if .Lines -}}
16 {{- $content := "" -}}
17 {{- range .Lines -}}
18 {{- if ne $content "" -}}
19 {{- $content = printf "%s\n" $content -}}
20 {{- end -}}
21 {{- if .Link -}}
22 {{- $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)) -}}
23 {{- else -}}
24 {{- $content = printf "%s%s" $content (printf "<span class=\"type-annotation\"> </span>%s" (.Text | HTMLEscape)) -}}
25 {{- end -}}
26 {{- end -}}
27 {{- $content | safeHtml -}}
28 {{- else -}}
29 {{- .RawText -}}
30 {{- end -}}
31 </pre>
32 </main>
33
34 {{- template "_modals.html" . -}}
35
36 <script src="{{ .Assets.JS }}"></script>
37 </body>
38</html>
diff --git a/internal/port/tpl/gopher.html b/internal/port/tpl/gopher.html
index e69de29..c971847 100644
--- a/internal/port/tpl/gopher.html
+++ b/internal/port/tpl/gopher.html
@@ -0,0 +1,59 @@
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 }} - Gopher proxy</title>
7 <link rel="stylesheet" href="{{ .Assets.Style }}" />
8 {{- template "_fonts.html" . -}}
9 </head>
10 <body class="{{ if .IsPlain }}is-plain{{ end }}">
11 <header class="header header-base">
12 <div class="location">
13 <a class="location__prefix">gopher://</a><a class="location__prefix location__prefix--mobile">://</a>
14 {{- range $i, $item := .Nav -}}
15 {{- if ne $i 0 -}}
16 <span class="location__slash">/</span>
17 {{- end -}}
18 {{- if .Current -}}
19 <span class="location__uripart">{{ .Label }}</span>
20 {{- else -}}
21 <a href="{{ .URL }}/" class="location__uripart">{{ .Label }}</a>
22 {{- end -}}
23 {{- end -}}
24 </div>
25 <div class="actions">
26 {{- if .IsPlain -}}
27 <div class="action"><a href="/gopher/{{ .URL | replace "^([^/]*)/0" "$1/9" }}">View raw</a></div>
28 {{- end -}}
29 <div class="action"><button class="settings-btn">Settings</button></div>
30 </div>
31 </header>
32
33 <main class="wrap">
34 <pre class="content content--has-monospace-font{{ if not .IsPlain }} content--has-type-annotations{{ end }}">
35 {{- $content := "" -}}
36 {{- $page := . -}}
37 {{- range .Lines -}}
38 {{- if ne $content "" -}}
39 {{- $content = printf "%s\n" $content -}}
40 {{- end -}}
41 {{- if $page.IsPlain -}}
42 {{- $content = printf "%s%s" $content (.Text | HTMLEscape) -}}
43 {{- else -}}
44 {{- if .Link -}}
45 {{- $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)) -}}
46 {{- else -}}
47 {{- $content = printf "%s%s" $content (printf "<span class=\"type-annotation\"> </span>%s" (.Text | HTMLEscape)) -}}
48 {{- end -}}
49 {{- end -}}
50 {{- end -}}
51 {{- $content | safeHtml -}}
52 </pre>
53 </main>
54
55 {{- template "_modals.html" . -}}
56
57 <script src="{{ .Assets.JS }}"></script>
58 </body>
59</html>
diff --git a/internal/port/tpl/startpage.html b/internal/port/tpl/startpage.html
index 8482a6f..cfe519d 100644
--- a/internal/port/tpl/startpage.html
+++ b/internal/port/tpl/startpage.html
@@ -3,118 +3,28 @@
3 <head> 3 <head>
4 <meta charset="utf-8"> 4 <meta charset="utf-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1" /> 5 <meta name="viewport" content="width=device-width, initial-scale=1" />
6 <title>{{ .Title }}{{ if ne .Protocol "startpage" }} - {{ .Protocol | title }} proxy{{ end }}</title> 6 <title>{{ .Title }}</title>
7 <link rel="stylesheet" href="{{ .Assets.Style }}" /> 7 <link rel="stylesheet" href="{{ .Assets.Style }}" />
8 <style> 8 {{- template "_fonts.html" . -}}
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> 9 </head>
25 <body class="{{ if not .Lines }}is-plain{{ end }}"> 10 <body class="is-plain">
26 <header class="header header-base"> 11 <header class="header header-base">
27 <div class="location"> 12 <div class="location">
28 <a class="location__prefix">{{ .Protocol }}://</a><a class="location__prefix location__prefix--mobile">://</a> 13 <a class="location__prefix">start://</a><a class="location__prefix location__prefix--mobile">://</a>
29 14 </div>
30 {{- if .URI -}} 15 <div class="actions">
31 {{- $page := . -}} 16 <div class="action"><button class="settings-btn">Settings</button></div>
32 {{- $href := printf "/%s" .Protocol -}} 17 </div>
33 {{- $uriParts := split .URI "/" -}} 18 </header>
34
35 {{- $uriLast := $uriParts | last -}}
36 {{- $uriParts = $uriParts | pop -}}
37 {{- if eq $uriLast "" -}}
38 {{- $uriLast = $uriParts | last -}}
39 {{- $uriParts = $uriParts | pop -}}
40 {{- end -}}
41 19
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"> 20 <main class="wrap">
75 <pre class="content content--has-monospace-font{{ if .Lines }} content--has-type-annotations{{ end }}"> 21 <pre class="content content--has-monospace-font">
76 {{- if .Lines -}} 22 {{- .Content -}}
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> 23 </pre>
93 </main> 24 </main>
94 <aside class="modal modal--settings"> 25
95 <div class="modal__content"> 26 {{- template "_modals.html" . -}}
96 <header class="modal__head header-base"> 27
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> 28 <script src="{{ .Assets.JS }}"></script>
119 </body> 29 </body>
120</html> 30</html>