Мультилента, тестируется. Потом документировать

This commit is contained in:
B4D_US3R 2025-04-30 15:59:44 +05:00
parent 66afe8eac7
commit 47242e5431
2 changed files with 22 additions and 18 deletions

View file

@ -10,8 +10,10 @@ import (
type KikiSettings struct {
Instance string `yaml:"instance,omitempty"`
RSSUri string `yaml:"rss_url,omitempty"`
RSSURLs []struct {
Url string `yaml:"url,omitempty"`
Sensitive bool `yaml:"sensitive,omitempty"`
} `yaml:"rss_urls,omitempty"`
Redis struct {
Address string `yaml:"address"`
} `yaml:"redis"`

View file

@ -74,12 +74,13 @@ func main() {
if file_watcher.IsFileChange(&lastFileMod, confFile) {
log.Println(lastFileMod)
log.Println("RSS ленты перечитаны")
kikiConfig.RSSUri = config.GetKikiConfig(confFile).RSSUri
kikiConfig.RSSURLs = config.GetKikiConfig(confFile).RSSURLs
}
newPosts := tooter.NewsText(kikiConfig.RSSUri)
for _, rssUrl := range kikiConfig.RSSURLs {
newPost := tooter.NewsText(rssUrl.Url)
for _, post := range newPosts {
for _, post := range newPost {
inStack, err := stacker.CheckInRedis(rdb, post.GUID)
if err != nil {
log.Println(err)
@ -88,7 +89,7 @@ func main() {
if !inStack {
log.Println(post.Description)
toot, err := tooter.CreateToot(*mastoClient, post, kikiConfig.Sensitive)
toot, err := tooter.CreateToot(*mastoClient, post, rssUrl.Sensitive)
if err != nil {
log.Println(err)
}
@ -99,6 +100,7 @@ func main() {
}
}
}
}
return nil
},
},