1diff --git a/pkg/ext/responses.go b/pkg/ext/responses.go
2index 73543951024733b067f4349abded14992d618f34..dbad5b20204f2c8f3d665bf9a7cd7094bdddf328 100644
3--- a/pkg/ext/responses.go
4+++ b/pkg/ext/responses.go
5@@ -6,21 +6,16 @@ "fmt"
6
7 "github.com/valyala/fasthttp"
8
9- "git.sr.ht/~gabrielgio/img"
10+ "git.sr.ht/~gabrielgio/img/templates"
11 )
12
13 var (
14- ContentTypeJSON = []byte("application/json")
15- ContentTypeHTML = []byte("text/html")
16- ContentTypeMARKDOWN = []byte("text/markdown")
17- ContentTypeJPEG = []byte("image/jpeg")
18+ ContentTypeHTML = []byte("text/html")
19 )
20
21 func NotFoundHTML(ctx *fasthttp.RequestCtx) {
22- ctx.Response.Header.SetContentType("text/html")
23- //nolint:errcheck
24- img.Render(ctx, "error.html", &img.HTMLView[string]{
25- Data: "NotFound",
26+ templates.WritePageTemplate(ctx, &templates.ErrorPage{
27+ Err: "Not Found",
28 })
29 }
30
31@@ -33,16 +28,10 @@ }
32 }
33
34 func InternalServerError(ctx *fasthttp.RequestCtx, err error) {
35- ctx.Response.Header.SetContentType("text/html")
36- message := fmt.Sprintf("Internal Server Error:\n%+v", err)
37- //nolint:errcheck
38- respErr := img.Render(ctx, "error.html", &img.HTMLView[string]{
39- Data: message,
40+ ctx.Response.SetStatusCode(500)
41+ templates.WritePageTemplate(ctx, &templates.ErrorPage{
42+ Err: fmt.Sprintf("Internal Server Error:\n%s", err.Error()),
43 })
44-
45- if respErr != nil {
46- fmt.Println(respErr.Error())
47- }
48 }
49
50 func NoContent(ctx *fasthttp.RequestCtx) {
51diff --git a/templates/error.html b/templates/error.html
52deleted file mode 100644
53index cbde4001e1afa037aa2cd64d268936c882b6c1cc..0000000000000000000000000000000000000000
54--- a/templates/error.html
55+++ /dev/null
56@@ -1,5 +0,0 @@
57-{{template "layout.html" .}}
58-{{define "title"}} Not Found {{end}}
59-{{define "content"}}
60-{{.}}
61-{{end}}
62diff --git a/templates/error.qtpl b/templates/error.qtpl
63new file mode 100644
64index 0000000000000000000000000000000000000000..b71adc8794e3bfc0f43978ccb594900210cc38af
65--- /dev/null
66+++ b/templates/error.qtpl
67@@ -0,0 +1,16 @@
68+{% code
69+type ErrorPage struct {
70+ Err string
71+}
72+%}
73+
74+{% func (p *ErrorPage) Title() %}
75+Error
76+{% endfunc %}
77+
78+{% func (p *ErrorPage) Content() %}
79+{%s p.Err %}
80+{% endfunc %}
81+
82+{% func (p *ErrorPage) Script() %}
83+{% endfunc %}
84diff --git a/templates/media.html b/templates/media.html
85deleted file mode 100644
86index 188d5b4c2be930218a1ad0f7b5527c53052fc3db..0000000000000000000000000000000000000000
87--- a/templates/media.html
88+++ /dev/null
89@@ -1,24 +0,0 @@
90-{{template "layout.html" .}}
91-{{define "title"}} {{.Title}} {{end}}
92-{{define "content"}}
93-<div class="columns is-multiline">
94-{{range .Data.Medias}}
95-<div class="card">
96- <div class="card-image">
97- {{ if .IsVideo }}
98- <video controls muted="true" poster="/media/thumbnail?path_hash={{.PathHash}}" preload="none">
99- <source src="/media/image?path_hash={{.PathHash}}" type="{{.MIMEType}}">
100- </video>
101- {{ else }}
102- <figure class="image is-fit">
103- <img src="/media/thumbnail?path_hash={{.PathHash}}">
104- </figure>
105- {{ end }}
106- </div>
107-</div>
108-{{end}}
109-</div>
110-<div class="row">
111- <a href="/media?page={{.Data.Next.Page}}" class="button is-pulled-right">next</a>
112-</div>
113-{{end}}
114diff --git a/templates/media.qtpl b/templates/media.qtpl
115index 88ce5820e3813ff1962f1ab3d4d06e311cebd231..b9b3bf55abe33232484b8d4d7f4b200cf75d3699 100644
116--- a/templates/media.qtpl
117+++ b/templates/media.qtpl
118@@ -11,7 +11,6 @@ {% func (p *MediaPage) Title() %}
119 Media
120 {% endfunc %}
121
122-
123 {% func (p *MediaPage) Content() %}
124 <div class="columns is-multiline">
125 {% for _, media := range p.Medias %}