X-Git-Url: https://code.octet-stream.net/broadcaster/blobdiff_plain/92da3eadf29c9e90cd67fd15dba3b8487ce4a918..0826fb215c2e617e2547a1e0de591fc6540d18ba:/server/main.go?ds=sidebyside diff --git a/server/main.go b/server/main.go index d1d47d3..78cf057 100644 --- a/server/main.go +++ b/server/main.go @@ -5,8 +5,6 @@ import ( "embed" "flag" "fmt" - "golang.org/x/crypto/bcrypt" - "golang.org/x/net/websocket" "html/template" "io" "log" @@ -16,10 +14,13 @@ import ( "strconv" "strings" "time" + + "code.octet-stream.net/broadcaster/internal/protocol" + "golang.org/x/crypto/bcrypt" + "golang.org/x/net/websocket" ) -const version = "v1.0.0" -const formatString = "2006-01-02T15:04" +const version = "v1.2.0" //go:embed templates/* var content embed.FS @@ -518,7 +519,7 @@ func editPlaylistPage(w http.ResponseWriter, r *http.Request, id int, user User) if id == 0 { data.Playlist.Enabled = true data.Playlist.Name = "New Playlist" - data.Playlist.StartTime = time.Now().Format(formatString) + data.Playlist.StartTime = time.Now().Format(protocol.StartTimeFormatSecs) data.Entries = append(data.Entries, PlaylistEntry{}) } else { playlist, err := db.GetPlaylist(id) @@ -543,7 +544,10 @@ func submitPlaylist(w http.ResponseWriter, r *http.Request) { if err != nil { return } - _, err = time.Parse(formatString, r.Form.Get("playlistStartTime")) + _, err = time.Parse(protocol.StartTimeFormatSecs, r.Form.Get("playlistStartTime")) + if err != nil { + _, err = time.Parse(protocol.StartTimeFormat, r.Form.Get("playlistStartTime")) + } if err != nil { return }