1
0
Fork 0
forked from jriou/coller

Compare commits

..

1 commit

Author SHA1 Message Date
938d10c3a6 fix: remove double rendering and test error (#26)
Remove double template rendering and test error for non password protected note

Co-authored-by: Thibault Piron <thibault.a.piron@gmail.com>
Reviewed-on: jriou/coller#26
Reviewed-by: Julien Riou <jriou@monitoring@riou.xyz>
Co-authored-by: tapiron <tapiron@monitoring@riou.xyz>
Co-committed-by: tapiron <tapiron@monitoring@riou.xyz>
2025-09-13 19:10:50 +02:00
3 changed files with 8 additions and 19 deletions

View file

@ -25,7 +25,6 @@ type Config struct {
ObservationInterval int `json:"observation_internal"`
Languages []string `json:"languages"`
Language string `json:"language"`
UploadFileButton bool `json:"upload_file_button"`
}
func NewConfig() *Config {
@ -70,8 +69,7 @@ func NewConfig() *Config {
"SQL",
"YAML",
},
Language: "text",
UploadFileButton: true,
Language: "text",
}
}

View file

@ -186,14 +186,13 @@ func (h *GetProtectedNoteHandler) ServeHTTP(w http.ResponseWriter, r *http.Reque
}
type PageData struct {
Title string
Version string
Expirations []int
Languages []string
Err error
URL string
Note *Note
UploadFileButton bool
Title string
Version string
Expirations []int
Languages []string
Err error
URL string
Note *Note
}
type HomeHandler struct {
@ -346,9 +345,6 @@ func (h *GetWebNoteHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
h.PageData.Err = fmt.Errorf("jriou")
h.Templates.ExecuteTemplate(w, templateName, h.PageData)
h.PageData.Note = note
h.logger.Debug("rendering note web page")
@ -433,9 +429,6 @@ func (s *Server) Start() error {
if s.config.ShowVersion {
p.Version = s.version
}
if s.config.UploadFileButton {
p.UploadFileButton = true
}
templates, err := template.New("templates").Funcs(funcs).ParseFS(templatesFS, "templates/*.html")
if err != nil {

View file

@ -31,11 +31,9 @@
value="delete-after-read" name="delete-after-read">
<label class="col-form-label col-form-label-sm" for="delete-after-read">Delete after read</label>
</div>
{{if .UploadFileButton}}
<div class="col">
<input type="file" class="form-control" for="file" id="file" name="file" accept="text/plain" />
</div>
{{end}}
<div class="col">
<select class="form-select" aria-label="Expiration" id="expiration" name="expiration">
<option selected="selected" disabled>Expiration</option>