Add profile pic and correct usage of banner link

This commit is contained in:
2024-11-01 16:31:47 +01:00
parent dbddff6e55
commit b2a8578c72
16 changed files with 176 additions and 277 deletions

View File

@@ -9,7 +9,7 @@ import (
b "streifling.com/jason/cpolis/cmd/backend"
)
func UploadImage(c *b.Config, s *b.CookieStore) http.HandlerFunc {
func UploadEasyMDEImage(c *b.Config, s *b.CookieStore) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
if _, err := GetSession(w, r, c, s); err != nil {
log.Println(err)
@@ -42,7 +42,7 @@ func UploadImage(c *b.Config, s *b.CookieStore) http.HandlerFunc {
}
}
func UploadBanner(c *b.Config, s *b.CookieStore, fileKey, htmlFile, htmlTemplate string) http.HandlerFunc {
func UploadImage(c *b.Config, s *b.CookieStore, fileKey, htmlFile, htmlTemplate string) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
if _, err := GetSession(w, r, c, s); err != nil {
log.Println(err)
@@ -69,8 +69,8 @@ func UploadBanner(c *b.Config, s *b.CookieStore, fileKey, htmlFile, htmlTemplate
return
}
data := new(struct{ BannerImage string })
data.BannerImage = filename
data := new(struct{ Image string })
data.Image = filename
tmpl, err := template.ParseFiles(c.WebDir + "/templates/" + htmlFile)
if err = template.Must(tmpl, err).ExecuteTemplate(w, htmlTemplate, data); err != nil {