diff --git a/pages/category.html b/pages/category.html index 67037f3..6431d2f 100644 --- a/pages/category.html +++ b/pages/category.html @@ -60,8 +60,9 @@
{{index .Translation "category modal todo text"}} - -
+ + +
{{index .Translation "category modal todo created"}}
@@ -114,8 +115,9 @@
- -
+ + +
@@ -134,22 +136,29 @@ - + {{ range .Data.Todos }} {{ if not .IsDone }} - + + + {{ if lt (len .Text) 25 }} + + {{ else }} + + {{ end }} + {{ if not .Image }} {{ else }} {{ end }} - + @@ -160,7 +169,7 @@ - @@ -173,29 +182,36 @@
{{index .Translation "category image"}} {{index .Translation "category todo"}}{{index .Translation "category image"}} {{index .Translation "category created"}} {{index .Translation "category due"}}
{{ .Text }}{{ printf "%.25s" .Text }}...... {{ .Text }}{{ .TimeCreated }} {{ .Due }}
- + {{ range .Data.Todos }} {{ if .IsDone }} - + + + {{ if lt (len .Text) 25 }} + + {{ else }} + + {{ end }} + {{ if not .Image }} {{ else }} {{ end }} - + diff --git a/src/main.go b/src/main.go index 9a7234b..649246a 100644 --- a/src/main.go +++ b/src/main.go @@ -28,7 +28,7 @@ import ( "path/filepath" ) -const Version string = "0.2.0" +const Version string = "0.3.0" var ( printVersion *bool = flag.Bool("version", false, "Print version information and exit") @@ -42,10 +42,20 @@ var ( ) func init() { + // Output Banner + fmt.Println( + `██████╗ ███████╗██╗ █████╗ +██╔══██╗██╔════╝██║ ██╔══██╗ +██║ ██║█████╗ ██║ ███████║ +██║ ██║██╔══╝ ██║ ██╔══██║ +██████╔╝███████╗███████╗██║ ██║ +╚═════╝ ╚══════╝╚══════╝╚═╝ ╚═╝ v` + Version, + ) + // Parse flags flag.Parse() if *printVersion { - fmt.Printf("dela v%s - a web TODO list\n(c) 2023 Kasyanov Nikolay Alexeyevich (Unbewohnte)\n", Version) + fmt.Printf("dela v%s - a web TODO list\n(c) 2023-2025 Kasyanov Nikolay Alexeyevich (Unbewohnte)\n", Version) os.Exit(0) } diff --git a/src/server/endpoints.go b/src/server/endpoints.go index 07aef4f..4143548 100644 --- a/src/server/endpoints.go +++ b/src/server/endpoints.go @@ -599,6 +599,12 @@ func (s *Server) EndpointTodoCreate(w http.ResponseWriter, req *http.Request) { return } + // Check if text is too long or not + if uint(len(newTodo.Text)) > MaxTodoTextLength { + http.Error(w, "Text is too big!", http.StatusBadRequest) + return + } + // Add TODO to the database if newTodo.GroupID == 0 { http.Error(w, "No group ID was provided", http.StatusBadRequest) diff --git a/src/server/validation.go b/src/server/validation.go index a540b83..85f3abb 100644 --- a/src/server/validation.go +++ b/src/server/validation.go @@ -33,7 +33,7 @@ const ( MinimalPasswordLength uint = 5 MaxEmailLength uint = 60 MaxPasswordLength uint = 250 - MaxTodoLength uint = 150 + MaxTodoTextLength uint = 250 ) // Check if user is valid. Returns false and a reason-string if not