Take control over your live stream video by running it yourself. Streaming + chat out of the box.
HTML activitypubbroadcastingchatdecentralizedfederationfediversegolanghacktoberfesthlslivelivestreamowncastrtmpself-hostedstreaming-videovideo
chore(go): migrate more models to codegen versions. For #3778
Gabe Kangas5b914b46ba34
diff --git a/core/chat/events/events.go b/core/chat/events/events.goindex 030f99e961..e89a4dd136 100644--- a/core/chat/events/events.go+++ b/core/chat/events/events.go@@ -162,9 +162,9 @@ func loadEmoji() {if err != nil {return}- emojiHTML[strings.ToLower(emojiList[i].Name)] = buf.String()+ emojiHTML[strings.ToLower(*emojiList[i].Name)] = buf.String()- emoji := emojiDef.NewEmoji(emojiList[i].Name, nil, strings.ToLower(emojiList[i].Name))+ emoji := emojiDef.NewEmoji(*emojiList[i].Name, nil, strings.ToLower(*emojiList[i].Name))emojiArr = append(emojiArr, emoji)}diff --git a/core/data/emoji.go b/core/data/emoji.goindex 86ea61d501..45c16cb648 100644--- a/core/data/emoji.go+++ b/core/data/emoji.go@@ -10,16 +10,16 @@ import ("time""github.com/owncast/owncast/config"- "github.com/owncast/owncast/models""github.com/owncast/owncast/static""github.com/owncast/owncast/utils"+ "github.com/owncast/owncast/webserver/handlers/generated""github.com/pkg/errors"log "github.com/sirupsen/logrus")var (emojiCacheMu sync.Mutex- emojiCacheData = make([]models.CustomEmoji, 0)+ emojiCacheData = make([]generated.Emoji, 0)emojiCacheModTime time.Time)@@ -51,7 +51,7 @@ func UpdateEmojiList(force bool) (time.Time, error) {return modTime, fmt.Errorf("unable to open custom emoji directory")}- emojiCacheData = make([]models.CustomEmoji, 0)+ emojiCacheData = make([]generated.Emoji, 0)walkFunction := func(path string, d os.DirEntry, err error) error {if d == nil || d.IsDir() {@@ -61,7 +61,7 @@ func UpdateEmojiList(force bool) (time.Time, error) {emojiPath := filepath.Join(config.EmojiDir, path)fileName := d.Name()fileBase := fileName[:len(fileName)-len(filepath.Ext(fileName))]- singleEmoji := models.CustomEmoji{Name: fileBase, URL: emojiPath}+ singleEmoji := generated.Emoji{Name: &fileBase, Url: &emojiPath}emojiCacheData = append(emojiCacheData, singleEmoji)return nil}@@ -76,7 +76,7 @@ func UpdateEmojiList(force bool) (time.Time, error) {}// GetEmojiList returns a list of custom emoji from the emoji directory.-func GetEmojiList() []models.CustomEmoji {+func GetEmojiList() []generated.Emoji {_, err := UpdateEmojiList(false)if err != nil {return nil@@ -88,7 +88,7 @@ func GetEmojiList() []models.CustomEmoji {// return a copy of cache data, ensures underlying slice isn't affected// by future update- emojiData := make([]models.CustomEmoji, len(emojiCacheData))+ emojiData := make([]generated.Emoji, len(emojiCacheData))copy(emojiData, emojiCacheData)return emojiDatadiff --git a/models/emoji.go b/models/emoji.godeleted file mode 100644index 16ea6ae0ef..0000000000--- a/models/emoji.go+++ /dev/null@@ -1,7 +0,0 @@-package models--// CustomEmoji represents an image that can be used in chat as a custom emoji.-type CustomEmoji struct {- Name string `json:"name"`- URL string `json:"url"`-}diff --git a/models/ipAddress.go b/models/ipAddress.godeleted file mode 100644index fa6260017a..0000000000--- a/models/ipAddress.go+++ /dev/null@@ -1,10 +0,0 @@-package models--import "time"--// IPAddress is a simple representation of an IP address.-type IPAddress struct {- CreatedAt time.Time `json:"createdAt"`- IPAddress string `json:"ipAddress"`- Notes string `json:"notes"`-}diff --git a/persistence/authrepository/authrepository.go b/persistence/authrepository/authrepository.goindex a1ca46715b..b2c7dc5aae 100644--- a/persistence/authrepository/authrepository.go+++ b/persistence/authrepository/authrepository.go@@ -3,13 +3,13 @@ package authrepositoryimport ("database/sql"- "github.com/owncast/owncast/models"+ "github.com/owncast/owncast/webserver/handlers/generated")type AuthRepository interface {CreateBanIPTable(db *sql.DB)BanIPAddress(address, note string) errorIsIPAddressBanned(address string) (bool, error)- GetIPAddressBans() ([]models.IPAddress, error)+ GetIPAddressBans() ([]generated.IPAddress, error)RemoveIPAddressBan(address string) error}diff --git a/persistence/authrepository/bans.go b/persistence/authrepository/bans.goindex 2262a28326..1370bd2812 100644--- a/persistence/authrepository/bans.go+++ b/persistence/authrepository/bans.go@@ -6,7 +6,7 @@ import ("log""github.com/owncast/owncast/db"- "github.com/owncast/owncast/models"+ "github.com/owncast/owncast/webserver/handlers/generated")// CreateBanIPTable will create the IP ban table if needed.@@ -42,18 +42,18 @@ func (r *SqlAuthRepository) IsIPAddressBanned(address string) (bool, error) {}// GetIPAddressBans will return all the banned IP addresses.-func (r *SqlAuthRepository) GetIPAddressBans() ([]models.IPAddress, error) {+func (r *SqlAuthRepository) GetIPAddressBans() ([]generated.IPAddress, error) {result, err := r.datastore.GetQueries().GetIPAddressBans(context.Background())if err != nil {return nil, err}- response := []models.IPAddress{}+ response := []generated.IPAddress{}for _, ip := range result {- response = append(response, models.IPAddress{- IPAddress: ip.IpAddress,- Notes: ip.Notes.String,- CreatedAt: ip.CreatedAt.Time,+ response = append(response, generated.IPAddress{+ IpAddress: &ip.IpAddress,+ Notes: &ip.Notes.String,+ CreatedAt: &ip.CreatedAt.Time,})}return response, err