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

Commit

Permalink
feat: improve logging, bump dependencies and other fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
piraces committed Mar 21, 2023
1 parent eea5119 commit edfff2d
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SECRET=test
DB_DIR="/db/rsslay.sqlite"
DEFAULT_PROFILE_PICTURE_URL="https://i.imgur.com/MaceU96.png"
SECRET="CHANGE_ME"
VERSION=0.4.5
VERSION=0.4.6
REPLAY_TO_RELAYS=false
RELAYS_TO_PUBLISH_TO=""
DEFAULT_WAIT_TIME_BETWEEN_BATCHES=60000
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
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.4.5
ENV VERSION=0.4.6
ENV REPLAY_TO_RELAYS=false
ENV RELAYS_TO_PUBLISH_TO=""
ENV DEFAULT_WAIT_TIME_BETWEEN_BATCHES=60000
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.fly
Original file line number Diff line number Diff line change
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.4.5
ENV VERSION=0.4.6
ENV REPLAY_TO_RELAYS=false
ENV RELAYS_TO_PUBLISH_TO=""
ENV DEFAULT_WAIT_TIME_BETWEEN_BATCHES=60000
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.railwayapp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ ENV PORT=$PORT
ENV DB_DIR=$DB_DIR
ENV DEFAULT_PROFILE_PICTURE_URL=$DEFAULT_PROFILE_PICTURE_URL
ENV SECRET=$SECRET
ENV VERSION=0.4.5
ENV VERSION=0.4.6
ENV REPLAY_TO_RELAYS=false
ENV RELAYS_TO_PUBLISH_TO=""
ENV DEFAULT_WAIT_TIME_BETWEEN_BATCHES=60000
Expand Down
4 changes: 2 additions & 2 deletions fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ app = "rsslay"
INFO_RELAY_NAME = "rsslay public instance"
INFO_CONTACT = "mailto:[email protected]"
MAX_CONTENT_LENGTH = 5000
VERSION = "0.4.5"
LOG_LEVEL = "WARN"
VERSION = "0.4.6"
LOG_LEVEL = "INFO"
DELETE_FAILING_FEEDS = "false"

[[services]]
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/mattn/go-sqlite3 v1.14.16
github.com/microcosm-cc/bluemonday v1.0.23
github.com/mmcdole/gofeed v1.2.1
github.com/nbd-wtf/go-nostr v0.13.2
github.com/nbd-wtf/go-nostr v0.14.1
github.com/rif/cache2go v1.0.0
github.com/stretchr/testify v1.8.2
golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/nbd-wtf/go-nostr v0.13.2 h1:w/TgXbkWqkZQsPRZffPZpvR/uskOSSUCGYhtW6I3xPI=
github.com/nbd-wtf/go-nostr v0.13.2/go.mod h1:qFFTIxh15H5GGN0WsBI/P73DteqsevnhSEW/yk8nEf4=
github.com/nbd-wtf/go-nostr v0.14.1 h1:OBpT+fnVqg2mcaWZKgUmLMAzQT8QdhbYGTU/uagpySA=
github.com/nbd-wtf/go-nostr v0.14.1/go.mod h1:qFFTIxh15H5GGN0WsBI/P73DteqsevnhSEW/yk8nEf4=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down
12 changes: 9 additions & 3 deletions pkg/replayer/replayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,14 @@ func ReplayEventsToRelays(parameters *ReplayParameters) {
if shouldPerformAuthRequest && !tryAuth(relay, *challenge, url, parameters.WaitTimeForRelayResponse, &ev) {
continue
}
publishStatus := relay.Publish(context.Background(), ev.Event)
publishStatus, err := relay.Publish(context.Background(), ev.Event)
if err != nil {
log.Printf("[INFO] Failed to replay event to %s with error: %v", url, err)
}
statusSummary = statusSummary | int(publishStatus)
}
if statusSummary < 0 {
log.Printf("[WARN] Replayed %d events to %s with failed status summary %d\n", len(parameters.Events), url, statusSummary)

} else {
log.Printf("[DEBUG] Replayed %d events to %s with status summary %d\n", len(parameters.Events), url, statusSummary)
}
Expand Down Expand Up @@ -101,7 +103,11 @@ func tryAuth(relay *nostr.Relay, challenge string, url string, waitTime int64, e

// Send the event by calling relay.Auth.
// Returned status is either success, fail, or sent (if no reply given in the 3-second timeout).
authStatus := relay.Auth(ctx, event)
authStatus, err := relay.Auth(ctx, event)
if err != nil {
log.Printf("[ERROR] Failed while trying to authenticate after sending AUTH event. Error: %v\n", err)
return false
}

log.Printf("[DEBUG] authenticated as %s: %s\n", ev.Event.PubKey, authStatus)
if authStatus == nostr.PublishStatusSucceeded || authStatus == nostr.PublishStatusSent {
Expand Down
1 change: 0 additions & 1 deletion web/assets/js/nostr.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ function tryRemoveFromFollowList(publicKeyToUnfollow) {
tagsSet.add(value);
}
});
debugger;
return [...tagsSet];
} else {
swal({
Expand Down

0 comments on commit edfff2d

Please sign in to comment.