cerrado @ 6e5062488fc3ecbf37c11e7d111bfe6ea3b5284d

feat: Remove config page

That page was created as playground and had some debug purpose. Now
that is not longer used and with introduction of sensible information
(hash and aes-key) that has to go.
  1diff --git a/pkg/handler/config/handler.go b/pkg/handler/config/handler.go
  2deleted file mode 100644
  3index c43b54d621d0aed6441a8f2ba85564c0be3da6fe..0000000000000000000000000000000000000000
  4--- a/pkg/handler/config/handler.go
  5+++ /dev/null
  6@@ -1,63 +0,0 @@
  7-package config
  8-
  9-import (
 10-	"bytes"
 11-	"encoding/json"
 12-	"net/http"
 13-
 14-	"github.com/alecthomas/chroma/v2/formatters/html"
 15-	"github.com/alecthomas/chroma/v2/lexers"
 16-	"github.com/alecthomas/chroma/v2/styles"
 17-
 18-	"git.gabrielgio.me/cerrado/pkg/config"
 19-	"git.gabrielgio.me/cerrado/pkg/ext"
 20-	"git.gabrielgio.me/cerrado/templates"
 21-)
 22-
 23-type (
 24-	configurationRepository interface {
 25-		GetRootReadme() string
 26-		List() []*config.GitRepositoryConfiguration
 27-	}
 28-)
 29-
 30-func ConfigFile(configRepo configurationRepository) ext.ErrorRequestHandler {
 31-	return func(w http.ResponseWriter, _ *http.Request) error {
 32-
 33-		config := struct {
 34-			RootReadme   string
 35-			Repositories []*config.GitRepositoryConfiguration
 36-		}{
 37-			RootReadme:   configRepo.GetRootReadme(),
 38-			Repositories: configRepo.List(),
 39-		}
 40-
 41-		b, err := json.MarshalIndent(config, "", "  ")
 42-		if err != nil {
 43-			return err
 44-		}
 45-
 46-		lexer := lexers.Get("json")
 47-		style := styles.Get("monokailight")
 48-		formatter := html.New(
 49-			html.WithLineNumbers(true),
 50-		)
 51-		iterator, err := lexer.Tokenise(nil, string(b))
 52-		if err != nil {
 53-			return err
 54-		}
 55-
 56-		var code bytes.Buffer
 57-		err = formatter.Format(&code, style, iterator)
 58-		if err != nil {
 59-			return err
 60-		}
 61-
 62-		hello := &templates.ConfigPage{
 63-			Body: code.Bytes(),
 64-		}
 65-
 66-		templates.WritePageTemplate(w, hello)
 67-		return nil
 68-	}
 69-}
 70diff --git a/pkg/handler/router.go b/pkg/handler/router.go
 71index f464ac28e50750b95b3447333f7362f3c31e3c5a..a2ac98a151f99376795efb2ad8a5b2268f35e578 100644
 72--- a/pkg/handler/router.go
 73+++ b/pkg/handler/router.go
 74@@ -6,7 +6,6 @@
 75 	serverconfig "git.gabrielgio.me/cerrado/pkg/config"
 76 	"git.gabrielgio.me/cerrado/pkg/ext"
 77 	"git.gabrielgio.me/cerrado/pkg/handler/about"
 78-	"git.gabrielgio.me/cerrado/pkg/handler/config"
 79 	"git.gabrielgio.me/cerrado/pkg/handler/git"
 80 	"git.gabrielgio.me/cerrado/pkg/handler/static"
 81 	"git.gabrielgio.me/cerrado/pkg/service"
 82@@ -20,9 +19,8 @@ 	gitService *service.GitService,
 83 	configRepo *serverconfig.ConfigurationRepository,
 84 ) (http.Handler, error) {
 85 	var (
 86-		gitHandler    = git.NewGitHandler(gitService, configRepo)
 87-		aboutHandler  = about.NewAboutHandler(configRepo)
 88-		configHandler = config.ConfigFile(configRepo)
 89+		gitHandler   = git.NewGitHandler(gitService, configRepo)
 90+		aboutHandler = about.NewAboutHandler(configRepo)
 91 	)
 92 
 93 	staticHandler, err := static.ServeStaticHandler()
 94@@ -43,7 +41,6 @@ 	mux.HandleFunc("/{name}/blob/{ref}/{rest...}", gitHandler.Blob)
 95 	mux.HandleFunc("/{name}/log/{ref}/", gitHandler.Log)
 96 	mux.HandleFunc("/{name}/commit/{ref}/", gitHandler.Commit)
 97 	mux.HandleFunc("/{name}/archive/{file}", gitHandler.Archive)
 98-	mux.HandleFunc("/config", configHandler)
 99 	mux.HandleFunc("/about", aboutHandler.About)
100 	mux.HandleFunc("/", gitHandler.List)
101 	return mux.Handler(), nil
102diff --git a/templates/config.qtpl b/templates/config.qtpl
103deleted file mode 100644
104index b3df50eccb2571a37adfd630c7437caebdf1eb5e..0000000000000000000000000000000000000000
105--- a/templates/config.qtpl
106+++ /dev/null
107@@ -1,19 +0,0 @@
108-{% code
109-type ConfigPage struct {
110-    Body []byte
111-}
112-%}
113-
114-{% func (p *ConfigPage) Title() %}Hello{% endfunc %}
115-
116-{% func (p *ConfigPage) Navbar() %}{%= Navbar(Config) %}{% endfunc %}
117-
118-{% func (p *ConfigPage) Content() %}
119-<p>This is the configuration that is currently loaded</p>
120-<div class="code-view">
121-{%z= p.Body %}
122-</div>
123-{% endfunc %}
124-
125-{% func (p *ConfigPage) Script() %}
126-{% endfunc %}
127diff --git a/templates/config.qtpl.go b/templates/config.qtpl.go
128deleted file mode 100644
129index 975fea3e6c0c0108638792a2f2d42a8fced14631..0000000000000000000000000000000000000000
130--- a/templates/config.qtpl.go
131+++ /dev/null
132@@ -1,165 +0,0 @@
133-// Code generated by qtc from "config.qtpl". DO NOT EDIT.
134-// See https://github.com/valyala/quicktemplate for details.
135-
136-//line templates/config.qtpl:1
137-package templates
138-
139-//line templates/config.qtpl:1
140-import (
141-	qtio422016 "io"
142-
143-	qt422016 "github.com/valyala/quicktemplate"
144-)
145-
146-//line templates/config.qtpl:1
147-var (
148-	_ = qtio422016.Copy
149-	_ = qt422016.AcquireByteBuffer
150-)
151-
152-//line templates/config.qtpl:2
153-type ConfigPage struct {
154-	Body []byte
155-}
156-
157-//line templates/config.qtpl:7
158-func (p *ConfigPage) StreamTitle(qw422016 *qt422016.Writer) {
159-//line templates/config.qtpl:7
160-	qw422016.N().S(`Hello`)
161-//line templates/config.qtpl:7
162-}
163-
164-//line templates/config.qtpl:7
165-func (p *ConfigPage) WriteTitle(qq422016 qtio422016.Writer) {
166-//line templates/config.qtpl:7
167-	qw422016 := qt422016.AcquireWriter(qq422016)
168-//line templates/config.qtpl:7
169-	p.StreamTitle(qw422016)
170-//line templates/config.qtpl:7
171-	qt422016.ReleaseWriter(qw422016)
172-//line templates/config.qtpl:7
173-}
174-
175-//line templates/config.qtpl:7
176-func (p *ConfigPage) Title() string {
177-//line templates/config.qtpl:7
178-	qb422016 := qt422016.AcquireByteBuffer()
179-//line templates/config.qtpl:7
180-	p.WriteTitle(qb422016)
181-//line templates/config.qtpl:7
182-	qs422016 := string(qb422016.B)
183-//line templates/config.qtpl:7
184-	qt422016.ReleaseByteBuffer(qb422016)
185-//line templates/config.qtpl:7
186-	return qs422016
187-//line templates/config.qtpl:7
188-}
189-
190-//line templates/config.qtpl:9
191-func (p *ConfigPage) StreamNavbar(qw422016 *qt422016.Writer) {
192-//line templates/config.qtpl:9
193-	StreamNavbar(qw422016, Config)
194-//line templates/config.qtpl:9
195-}
196-
197-//line templates/config.qtpl:9
198-func (p *ConfigPage) WriteNavbar(qq422016 qtio422016.Writer) {
199-//line templates/config.qtpl:9
200-	qw422016 := qt422016.AcquireWriter(qq422016)
201-//line templates/config.qtpl:9
202-	p.StreamNavbar(qw422016)
203-//line templates/config.qtpl:9
204-	qt422016.ReleaseWriter(qw422016)
205-//line templates/config.qtpl:9
206-}
207-
208-//line templates/config.qtpl:9
209-func (p *ConfigPage) Navbar() string {
210-//line templates/config.qtpl:9
211-	qb422016 := qt422016.AcquireByteBuffer()
212-//line templates/config.qtpl:9
213-	p.WriteNavbar(qb422016)
214-//line templates/config.qtpl:9
215-	qs422016 := string(qb422016.B)
216-//line templates/config.qtpl:9
217-	qt422016.ReleaseByteBuffer(qb422016)
218-//line templates/config.qtpl:9
219-	return qs422016
220-//line templates/config.qtpl:9
221-}
222-
223-//line templates/config.qtpl:11
224-func (p *ConfigPage) StreamContent(qw422016 *qt422016.Writer) {
225-//line templates/config.qtpl:11
226-	qw422016.N().S(`
227-<p>This is the configuration that is currently loaded</p>
228-<div class="code-view">
229-`)
230-//line templates/config.qtpl:14
231-	qw422016.N().Z(p.Body)
232-//line templates/config.qtpl:14
233-	qw422016.N().S(`
234-</div>
235-`)
236-//line templates/config.qtpl:16
237-}
238-
239-//line templates/config.qtpl:16
240-func (p *ConfigPage) WriteContent(qq422016 qtio422016.Writer) {
241-//line templates/config.qtpl:16
242-	qw422016 := qt422016.AcquireWriter(qq422016)
243-//line templates/config.qtpl:16
244-	p.StreamContent(qw422016)
245-//line templates/config.qtpl:16
246-	qt422016.ReleaseWriter(qw422016)
247-//line templates/config.qtpl:16
248-}
249-
250-//line templates/config.qtpl:16
251-func (p *ConfigPage) Content() string {
252-//line templates/config.qtpl:16
253-	qb422016 := qt422016.AcquireByteBuffer()
254-//line templates/config.qtpl:16
255-	p.WriteContent(qb422016)
256-//line templates/config.qtpl:16
257-	qs422016 := string(qb422016.B)
258-//line templates/config.qtpl:16
259-	qt422016.ReleaseByteBuffer(qb422016)
260-//line templates/config.qtpl:16
261-	return qs422016
262-//line templates/config.qtpl:16
263-}
264-
265-//line templates/config.qtpl:18
266-func (p *ConfigPage) StreamScript(qw422016 *qt422016.Writer) {
267-//line templates/config.qtpl:18
268-	qw422016.N().S(`
269-`)
270-//line templates/config.qtpl:19
271-}
272-
273-//line templates/config.qtpl:19
274-func (p *ConfigPage) WriteScript(qq422016 qtio422016.Writer) {
275-//line templates/config.qtpl:19
276-	qw422016 := qt422016.AcquireWriter(qq422016)
277-//line templates/config.qtpl:19
278-	p.StreamScript(qw422016)
279-//line templates/config.qtpl:19
280-	qt422016.ReleaseWriter(qw422016)
281-//line templates/config.qtpl:19
282-}
283-
284-//line templates/config.qtpl:19
285-func (p *ConfigPage) Script() string {
286-//line templates/config.qtpl:19
287-	qb422016 := qt422016.AcquireByteBuffer()
288-//line templates/config.qtpl:19
289-	p.WriteScript(qb422016)
290-//line templates/config.qtpl:19
291-	qs422016 := string(qb422016.B)
292-//line templates/config.qtpl:19
293-	qt422016.ReleaseByteBuffer(qb422016)
294-//line templates/config.qtpl:19
295-	return qs422016
296-//line templates/config.qtpl:19
297-}
298diff --git a/templates/navbar.qtpl b/templates/navbar.qtpl
299index 68b1fd8a530198b17254ae7629bca5c82f1fb683..86141811781819433a83922bfa797b03958b9656 100644
300--- a/templates/navbar.qtpl
301+++ b/templates/navbar.qtpl
302@@ -33,7 +33,6 @@ {% comment %}
303 Add this back if needed
304             <a class="nav-link{%= insertIfEqual(s, About) %}" href="/about/">about</a>
305 {% endcomment %}
306-            <a class="nav-link{%= insertIfEqual(s, Config) %}" href="/config">config</a>
307           </div>
308         </nav>
309 {% endfunc %}
310diff --git a/templates/navbar.qtpl.go b/templates/navbar.qtpl.go
311index 5a27bb48ff8a7727d9f8494beb32945777735fc3..ca3a320443d531ae805bf6273796370bcabe604b 100644
312--- a/templates/navbar.qtpl.go
313+++ b/templates/navbar.qtpl.go
314@@ -92,157 +92,152 @@ 	qw422016.N().S(`
315 `)
316 //line templates/navbar.qtpl:35
317 	qw422016.N().S(`
318-            <a class="nav-link`)
319-//line templates/navbar.qtpl:36
320-	streaminsertIfEqual(qw422016, s, Config)
321-//line templates/navbar.qtpl:36
322-	qw422016.N().S(`" href="/config">config</a>
323           </div>
324         </nav>
325 `)
326-//line templates/navbar.qtpl:39
327+//line templates/navbar.qtpl:38
328 }
329 
330-//line templates/navbar.qtpl:39
331+//line templates/navbar.qtpl:38
332 func WriteNavbar(qq422016 qtio422016.Writer, s Selection) {
333-//line templates/navbar.qtpl:39
334+//line templates/navbar.qtpl:38
335 	qw422016 := qt422016.AcquireWriter(qq422016)
336-//line templates/navbar.qtpl:39
337+//line templates/navbar.qtpl:38
338 	StreamNavbar(qw422016, s)
339-//line templates/navbar.qtpl:39
340+//line templates/navbar.qtpl:38
341 	qt422016.ReleaseWriter(qw422016)
342-//line templates/navbar.qtpl:39
343+//line templates/navbar.qtpl:38
344 }
345 
346-//line templates/navbar.qtpl:39
347+//line templates/navbar.qtpl:38
348 func Navbar(s Selection) string {
349-//line templates/navbar.qtpl:39
350+//line templates/navbar.qtpl:38
351 	qb422016 := qt422016.AcquireByteBuffer()
352-//line templates/navbar.qtpl:39
353+//line templates/navbar.qtpl:38
354 	WriteNavbar(qb422016, s)
355-//line templates/navbar.qtpl:39
356+//line templates/navbar.qtpl:38
357 	qs422016 := string(qb422016.B)
358-//line templates/navbar.qtpl:39
359+//line templates/navbar.qtpl:38
360 	qt422016.ReleaseByteBuffer(qb422016)
361-//line templates/navbar.qtpl:39
362+//line templates/navbar.qtpl:38
363 	return qs422016
364-//line templates/navbar.qtpl:39
365+//line templates/navbar.qtpl:38
366 }
367 
368-//line templates/navbar.qtpl:41
369+//line templates/navbar.qtpl:40
370 func StreamGitItemNav(qw422016 *qt422016.Writer, name, ref string, s GitSelection) {
371-//line templates/navbar.qtpl:41
372+//line templates/navbar.qtpl:40
373 	qw422016.N().S(`
374 <div class="row">
375     <h3 id="name">`)
376-//line templates/navbar.qtpl:43
377+//line templates/navbar.qtpl:42
378 	qw422016.E().S(name)
379-//line templates/navbar.qtpl:43
380+//line templates/navbar.qtpl:42
381 	qw422016.N().S(` `)
382-//line templates/navbar.qtpl:43
383+//line templates/navbar.qtpl:42
384 	if ref != "" && (s == Log || s == Tree) {
385-//line templates/navbar.qtpl:43
386+//line templates/navbar.qtpl:42
387 		qw422016.N().S(`@ `)
388-//line templates/navbar.qtpl:43
389+//line templates/navbar.qtpl:42
390 		qw422016.E().S(ref)
391-//line templates/navbar.qtpl:43
392+//line templates/navbar.qtpl:42
393 	}
394-//line templates/navbar.qtpl:43
395+//line templates/navbar.qtpl:42
396 	qw422016.N().S(`</h3>
397 </div>
398 <div class="row">
399   <ul class="nav">
400     <li class="nav-item">
401       <a class="nav-link`)
402-//line templates/navbar.qtpl:48
403+//line templates/navbar.qtpl:47
404 	streaminsertIfEqual(qw422016, s, Readme)
405-//line templates/navbar.qtpl:48
406+//line templates/navbar.qtpl:47
407 	qw422016.N().S(`" aria-current="page" href="/`)
408-//line templates/navbar.qtpl:48
409+//line templates/navbar.qtpl:47
410 	qw422016.E().S(name)
411-//line templates/navbar.qtpl:48
412+//line templates/navbar.qtpl:47
413 	qw422016.N().S(`/about/">about</a>
414     </li>
415     <li class="nav-item">
416       <a class="nav-link`)
417-//line templates/navbar.qtpl:51
418+//line templates/navbar.qtpl:50
419 	streaminsertIfEqual(qw422016, s, Summary)
420-//line templates/navbar.qtpl:51
421+//line templates/navbar.qtpl:50
422 	qw422016.N().S(`" aria-current="page" href="/`)
423-//line templates/navbar.qtpl:51
424+//line templates/navbar.qtpl:50
425 	qw422016.E().S(name)
426-//line templates/navbar.qtpl:51
427+//line templates/navbar.qtpl:50
428 	qw422016.N().S(`/">summary</a>
429     </li>
430     <li class="nav-item">
431       <a class="nav-link`)
432-//line templates/navbar.qtpl:54
433+//line templates/navbar.qtpl:53
434 	streaminsertIfEqual(qw422016, s, Refs)
435-//line templates/navbar.qtpl:54
436+//line templates/navbar.qtpl:53
437 	qw422016.N().S(`" aria-current="page" href="/`)
438-//line templates/navbar.qtpl:54
439+//line templates/navbar.qtpl:53
440 	qw422016.E().S(name)
441-//line templates/navbar.qtpl:54
442+//line templates/navbar.qtpl:53
443 	qw422016.N().S(`/refs">refs</a>
444     </li>
445     <li class="nav-item">
446       <a class="nav-link`)
447-//line templates/navbar.qtpl:57
448+//line templates/navbar.qtpl:56
449 	streaminsertIfEqual(qw422016, s, Log)
450-//line templates/navbar.qtpl:57
451+//line templates/navbar.qtpl:56
452 	qw422016.N().S(`" aria-current="page" href="/`)
453-//line templates/navbar.qtpl:57
454+//line templates/navbar.qtpl:56
455 	qw422016.E().S(name)
456-//line templates/navbar.qtpl:57
457+//line templates/navbar.qtpl:56
458 	qw422016.N().S(`/log/`)
459-//line templates/navbar.qtpl:57
460+//line templates/navbar.qtpl:56
461 	qw422016.E().S(ref)
462-//line templates/navbar.qtpl:57
463+//line templates/navbar.qtpl:56
464 	qw422016.N().S(`/">log</a>
465     </li>
466     <li class="nav-item">
467       <a class="nav-link`)
468-//line templates/navbar.qtpl:60
469+//line templates/navbar.qtpl:59
470 	streaminsertIfEqual(qw422016, s, Tree)
471-//line templates/navbar.qtpl:60
472+//line templates/navbar.qtpl:59
473 	qw422016.N().S(`" aria-current="page" href="/`)
474-//line templates/navbar.qtpl:60
475+//line templates/navbar.qtpl:59
476 	qw422016.E().S(name)
477-//line templates/navbar.qtpl:60
478+//line templates/navbar.qtpl:59
479 	qw422016.N().S(`/tree/`)
480-//line templates/navbar.qtpl:60
481+//line templates/navbar.qtpl:59
482 	qw422016.E().S(ref)
483-//line templates/navbar.qtpl:60
484+//line templates/navbar.qtpl:59
485 	qw422016.N().S(`/">tree</a>
486     </li>
487   </ul>
488 </div>
489 `)
490-//line templates/navbar.qtpl:64
491+//line templates/navbar.qtpl:63
492 }
493 
494-//line templates/navbar.qtpl:64
495+//line templates/navbar.qtpl:63
496 func WriteGitItemNav(qq422016 qtio422016.Writer, name, ref string, s GitSelection) {
497-//line templates/navbar.qtpl:64
498+//line templates/navbar.qtpl:63
499 	qw422016 := qt422016.AcquireWriter(qq422016)
500-//line templates/navbar.qtpl:64
501+//line templates/navbar.qtpl:63
502 	StreamGitItemNav(qw422016, name, ref, s)
503-//line templates/navbar.qtpl:64
504+//line templates/navbar.qtpl:63
505 	qt422016.ReleaseWriter(qw422016)
506-//line templates/navbar.qtpl:64
507+//line templates/navbar.qtpl:63
508 }
509 
510-//line templates/navbar.qtpl:64
511+//line templates/navbar.qtpl:63
512 func GitItemNav(name, ref string, s GitSelection) string {
513-//line templates/navbar.qtpl:64
514+//line templates/navbar.qtpl:63
515 	qb422016 := qt422016.AcquireByteBuffer()
516-//line templates/navbar.qtpl:64
517+//line templates/navbar.qtpl:63
518 	WriteGitItemNav(qb422016, name, ref, s)
519-//line templates/navbar.qtpl:64
520+//line templates/navbar.qtpl:63
521 	qs422016 := string(qb422016.B)
522-//line templates/navbar.qtpl:64
523+//line templates/navbar.qtpl:63
524 	qt422016.ReleaseByteBuffer(qb422016)
525-//line templates/navbar.qtpl:64
526+//line templates/navbar.qtpl:63
527 	return qs422016
528-//line templates/navbar.qtpl:64
529+//line templates/navbar.qtpl:63
530 }