Skip to content
This repository has been archived by the owner on Dec 17, 2023. It is now read-only.

Commit

Permalink
feat: support NIP-48, bump dependencies and go version
Browse files Browse the repository at this point in the history
  • Loading branch information
piraces committed Aug 9, 2023
1 parent 4b2d4ec commit 18aefe8
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -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=""
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/goreleaser-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ./...
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20-alpine as build
FROM golang:1.21-alpine as build

WORKDIR /app

Expand Down Expand Up @@ -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=""
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.fly
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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=""
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.railwayapp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20-alpine as build
FROM golang:1.21-alpine as build

ARG PORT
ARG DB_DIR
Expand Down Expand Up @@ -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=""
Expand Down
2 changes: 1 addition & 1 deletion fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 (
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
10 changes: 8 additions & 2 deletions pkg/feed/feed.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"html"
"log"
"net/http"
"net/url"
"strings"
"time"
)
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion pkg/feed/feed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down

0 comments on commit 18aefe8

Please sign in to comment.