diff --git a/.env.sample b/.env.sample index afc3dff..20d8c5c 100644 --- a/.env.sample +++ b/.env.sample @@ -5,7 +5,7 @@ PORT=8080 DB_DIR="/db/rsslay.sqlite" DEFAULT_PROFILE_PICTURE_URL="https://i.imgur.com/MaceU96.png" SECRET="CHANGE_ME" -VERSION=0.5.3 +VERSION=0.5.4 REPLAY_TO_RELAYS=false RELAYS_TO_PUBLISH_TO="" NITTER_INSTANCES="" diff --git a/.github/workflows/goreleaser-snapshot.yml b/.github/workflows/goreleaser-snapshot.yml index b736293..9580d54 100644 --- a/.github/workflows/goreleaser-snapshot.yml +++ b/.github/workflows/goreleaser-snapshot.yml @@ -18,7 +18,7 @@ jobs: - run: git fetch --force --tags - uses: actions/setup-go@v4 with: - go-version: '>=1.20.0' + go-version: '>=1.21.0' cache: true - uses: goreleaser/goreleaser-action@v4 with: diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index e5f6be0..02d5836 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -21,7 +21,7 @@ jobs: - run: git fetch --force --tags - uses: actions/setup-go@v4 with: - go-version: '>=1.20.0' + go-version: '>=1.21.0' cache: true - uses: goreleaser/goreleaser-action@v4 with: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f4ba277..d853aa5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: 1.20.0 + go-version: 1.21.0 - name: Build run: go build -v ./... diff --git a/Dockerfile b/Dockerfile index 2750f56..06a1462 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.20-alpine as build +FROM golang:1.21-alpine as build WORKDIR /app @@ -28,7 +28,7 @@ ENV PORT="8080" ENV DB_DIR="/db/rsslay.sqlite" ENV DEFAULT_PROFILE_PICTURE_URL="https://i.imgur.com/MaceU96.png" ENV SECRET="CHANGE_ME" -ENV VERSION=0.5.3 +ENV VERSION=0.5.4 ENV REPLAY_TO_RELAYS=false ENV RELAYS_TO_PUBLISH_TO="" ENV NITTER_INSTANCES="" diff --git a/Dockerfile.fly b/Dockerfile.fly index e025f64..d2f320e 100644 --- a/Dockerfile.fly +++ b/Dockerfile.fly @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 FROM flyio/litefs:0.4 AS litefs -FROM golang:1.20-alpine as build +FROM golang:1.21-alpine as build WORKDIR /app @@ -30,7 +30,7 @@ ENV PORT="8080" ENV DB_DIR="/db/rsslay.sqlite" ENV DEFAULT_PROFILE_PICTURE_URL="https://i.imgur.com/MaceU96.png" ENV SECRET="CHANGE_ME" -ENV VERSION=0.5.3 +ENV VERSION=0.5.4 ENV REPLAY_TO_RELAYS=false ENV RELAYS_TO_PUBLISH_TO="" ENV NITTER_INSTANCES="" diff --git a/Dockerfile.railwayapp b/Dockerfile.railwayapp index f0f0872..d62b93f 100644 --- a/Dockerfile.railwayapp +++ b/Dockerfile.railwayapp @@ -1,4 +1,4 @@ -FROM golang:1.20-alpine as build +FROM golang:1.21-alpine as build ARG PORT ARG DB_DIR @@ -69,7 +69,7 @@ ENV PORT=$PORT ENV DB_DIR=$DB_DIR ENV DEFAULT_PROFILE_PICTURE_URL=$DEFAULT_PROFILE_PICTURE_URL ENV SECRET=$SECRET -ENV VERSION=0.5.3 +ENV VERSION=0.5.4 ENV REPLAY_TO_RELAYS=false ENV RELAYS_TO_PUBLISH_TO="" ENV NITTER_INSTANCES="" diff --git a/fly.toml b/fly.toml index c64b7b0..a2a2d23 100644 --- a/fly.toml +++ b/fly.toml @@ -29,7 +29,7 @@ kill_timeout = 5 PORT = "8080" RELAYS_TO_PUBLISH_TO = "" REPLAY_TO_RELAYS = "false" - VERSION = "0.5.3" + VERSION = "0.5.4" [[mounts]] source = "rsslay_data_machines" diff --git a/go.mod b/go.mod index 7c38585..210719e 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/piraces/rsslay -go 1.20 +go 1.21 require ( github.com/DATA-DOG/go-sqlmock v1.5.0 @@ -21,7 +21,7 @@ require ( github.com/prometheus/client_golang v1.16.0 github.com/redis/go-redis/v9 v9.0.5 github.com/stretchr/testify v1.8.4 - golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0 + golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 ) require ( diff --git a/go.sum b/go.sum index d84ca4b..2565b65 100644 --- a/go.sum +++ b/go.sum @@ -207,6 +207,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0 h1:pVgRXcIictcr+lBQIFeiwuwtDIs4eL21OuM9nyAADmo= golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= +golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 h1:EDuYyU/MkFXllv9QF9819VlI9a4tzGuCbhG0ExK9o1U= +golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= diff --git a/pkg/feed/feed.go b/pkg/feed/feed.go index 40619a7..aa860da 100644 --- a/pkg/feed/feed.go +++ b/pkg/feed/feed.go @@ -21,6 +21,7 @@ import ( "html" "log" "net/http" + "net/url" "strings" "time" ) @@ -178,7 +179,7 @@ func EntryFeedToSetMetadata(pubkey string, feed *gofeed.Feed, originalUrl string PubKey: pubkey, CreatedAt: nostr.Timestamp(createdAt.Unix()), Kind: nostr.KindSetMetadata, - Tags: nostr.Tags{}, + Tags: nostr.Tags{[]string{"proxy", feed.FeedLink, "rss"}}, Content: string(content), } evt.ID = string(evt.Serialize()) @@ -266,11 +267,16 @@ func ItemToTextNote(pubkey string, item *gofeed.Item, feed *gofeed.Feed, default createdAt = *item.PublishedParsed } + composedProxyLink := feed.FeedLink + if item.GUID != "" { + composedProxyLink += fmt.Sprintf("#%s", url.QueryEscape(item.GUID)) + } + evt := nostr.Event{ PubKey: pubkey, CreatedAt: nostr.Timestamp(createdAt.Unix()), Kind: nostr.KindTextNote, - Tags: nostr.Tags{}, + Tags: nostr.Tags{[]string{"proxy", composedProxyLink, "rss"}}, Content: strings.ToValidUTF8(content, ""), } evt.ID = string(evt.Serialize()) diff --git a/pkg/feed/feed_test.go b/pkg/feed/feed_test.go index 366030d..18b16f0 100644 --- a/pkg/feed/feed_test.go +++ b/pkg/feed/feed_test.go @@ -296,7 +296,7 @@ func TestItemToTextNote(t *testing.T) { assert.Equal(t, 1, event.Kind) assert.Equal(t, tc.expectedContent, event.Content) assert.Empty(t, event.Sig) - assert.Empty(t, event.Tags) + assert.NotEmpty(t, event.Tags) } }