Merge branch 'dev' into feature/blog

THAT WAS PAINFUL!
This commit is contained in:
ari melody 2025-11-06 21:24:52 +00:00
commit 3e5ecb9372
Signed by: ari
GPG key ID: CF99829C92678188
99 changed files with 2029 additions and 1010 deletions

View file

@ -1,9 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
"embed"
"arimelody-web/log"
"github.com/jmoiron/sqlx"
"arimelody-web/log"
)
type (
@ -43,5 +45,6 @@ type (
Config Config
Log log.Logger
Twitch *TwitchState
PublicFS embed.FS
}
)

View file

@ -39,7 +39,7 @@ const (
// GETTERS
func (release Release) GetDescriptionHTML() template.HTML {
return template.HTML(strings.Replace(release.Description, "\n", "<br>", -1))
return template.HTML(strings.ReplaceAll(release.Description, "\n", "<br>"))
}
func (release Release) TextReleaseDate() string {

View file

@ -13,19 +13,14 @@ type (
Lyrics string `json:"lyrics" db:"lyrics"`
PreviewURL string `json:"previewURL" db:"preview_url"`
Number int
Number int `json:"-"`
}
)
func (track Track) GetDescriptionHTML() template.HTML {
return template.HTML(strings.Replace(track.Description, "\n", "<br>", -1))
return template.HTML(strings.ReplaceAll(track.Description, "\n", "<br>"))
}
func (track Track) GetLyricsHTML() template.HTML {
return template.HTML(strings.Replace(track.Lyrics, "\n", "<br>", -1))
}
// this function is stupid and i hate that i need it
func (track Track) Add(a int, b int) int {
return a + b
return template.HTML(strings.ReplaceAll(track.Lyrics, "\n", "<br>"))
}

View file

@ -31,13 +31,3 @@ func Test_Track_LyricsHTML(t *testing.T) {
t.Errorf(`track lyrics incorrectly formatted (want "%s", got "%s")`, want, got)
}
}
func Test_Track_Add(t *testing.T) {
track := Track{}
want := 4
got := track.Add(2, 2)
if want != got {
t.Errorf(`somehow, we screwed up addition. (want %d, got %d)`, want, got)
}
}