From 4f998a2730450eb9588655075844e2c559f1a7e0 Mon Sep 17 00:00:00 2001 From: B4D_US3R Date: Sat, 31 May 2025 19:24:58 +0500 Subject: [PATCH 1/2] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=20=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B9=D0=BA=D1=83=20?= =?UTF-8?q?=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ config.example.yaml | 2 ++ config/config.go | 5 +++-- service/kiki.go | 2 +- tooter/tooter.go | 4 ++-- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5067564..daabdb8 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,10 @@ instance: https://pleroma.catgirls.asia #Адрес инстанса rss_urls: #YAML массив лент - url: https://habr.com/ru/rss/flows/admin/articles/?fl=ru #Адрес ленты sensitive: false #Нужно ли ставить NSFW плашку + visibility: "unlisted" #Режим отображения постов. Есть public, unlisted, private, direct - url: https://4pda.to/feed sensitive: false + visibility: "unlisted" redis: address: localhost:6379 #Адрес Redis, в случае использования Docker Compose необходимо написать redis:6379 ``` diff --git a/config.example.yaml b/config.example.yaml index 3450bc5..ce83de1 100644 --- a/config.example.yaml +++ b/config.example.yaml @@ -2,7 +2,9 @@ instance: https://pleroma.catgirls.asia rss_urls: - url: https://habr.com/ru/rss/flows/admin/articles/?fl=ru sensitive: false + visibility: "unlisted" - url: https://4pda.to/feed sensitive: false + visibility: "unlisted" redis: address: localhost:6379 \ No newline at end of file diff --git a/config/config.go b/config/config.go index 014aca8..4d5e72b 100644 --- a/config/config.go +++ b/config/config.go @@ -12,8 +12,9 @@ import ( type KikiSettings struct { Instance string `yaml:"instance,omitempty"` RSSURLs []struct { - Url string `yaml:"url,omitempty"` - Sensitive bool `yaml:"sensitive,omitempty"` + Url string `yaml:"url,omitempty"` + Sensitive bool `yaml:"sensitive,omitempty"` + Visibility string `yaml:"visibility"` } `yaml:"rss_urls,omitempty"` Redis struct { Address string `yaml:"address"` diff --git a/service/kiki.go b/service/kiki.go index bc2cc75..e1d4ed1 100644 --- a/service/kiki.go +++ b/service/kiki.go @@ -90,7 +90,7 @@ func main() { if !inStack { log.Println(post.Description) - toot, err := tooter.CreateToot(*mastoClient, post, rssUrl.Sensitive) + toot, err := tooter.CreateToot(*mastoClient, post, rssUrl.Sensitive, rssUrl.Visibility) if err != nil { log.Println(err) } diff --git a/tooter/tooter.go b/tooter/tooter.go index 42229ba..3ae99f3 100644 --- a/tooter/tooter.go +++ b/tooter/tooter.go @@ -154,14 +154,14 @@ func UploadPictures(mastoClient mastodon.Client, filesBytes [][]byte) []*mastodo } // Формирование тела статуса -func CreateToot(mastoClient mastodon.Client, newsDesc *gofeed.Item, sensitive bool) (mastodon.Toot, error) { +func CreateToot(mastoClient mastodon.Client, newsDesc *gofeed.Item, sensitive bool, visibility string) (mastodon.Toot, error) { var imgArray []string var attachments []*mastodon.Attachment var tootText string = fmt.Sprintf("src: %s\n\n", newsDesc.Link) toot := mastodon.Toot{ - Visibility: "unlisted", + Visibility: visibility, Sensitive: sensitive, } From 9455220a0b867e4e810e0f56a42df26c9ba461bd Mon Sep 17 00:00:00 2001 From: B4D_US3R Date: Thu, 1 Jan 2026 21:24:40 +0500 Subject: [PATCH 2/2] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=BF=D0=B8=D1=81?= =?UTF-8?q?=D0=B0=D0=BB=20Dockerfile,=20=D1=82=D0=B5=D0=BF=D0=B5=D1=80?= =?UTF-8?q?=D1=8C=20=D0=BE=D0=B1=D1=80=D0=B0=D0=B7=D1=8B=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BD=D1=82=D0=B5=D0=B9=D0=BD=D0=B5=D1=80=D0=BE=D0=B2=20=D0=B2?= =?UTF-8?q?=D0=B5=D1=81=D1=8F=D1=82=20=D0=BC=D0=B5=D0=BD=D1=8C=D1=88=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + Dockerfile | 12 +++++++++++- docker-compose.yml | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 867ccf5..688a10d 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ config.yaml # Output of the go coverage tool, specifically when used with LiteIDE *.out kiki +redis_data # Dependency directories (remove the comment below to include it) # vendor/ diff --git a/Dockerfile b/Dockerfile index 0ade8a6..777570e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,6 @@ -FROM golang:1.24 +FROM golang:1.24-alpine AS build + +RUN apk add --no-cache make WORKDIR /app/kiki @@ -14,4 +16,12 @@ COPY Makefile /app/kiki/ RUN make +FROM alpine:latest + +WORKDIR /app/kiki/ + +COPY --from=build /app/kiki/kiki /app/kiki/kiki + +RUN chmod +x /app/kiki/kiki + CMD [ "/app/kiki/kiki", "run" ] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 4b7dbc1..f348f4a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: kiki: - build: ./ + image: git.catgirls.asia/b4d_us3r/kiki:latest restart: always volumes: - ./config.yaml:/app/kiki/config.yaml