Skip to content

Commit

Permalink
Fix auth and test (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
ice-dionysos authored Feb 17, 2025
1 parent ed7c729 commit e0969bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions cmd/subzero-ion-connect/subzero_ion_connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ var (
initFlags = func() {
subzero.Flags().StringVar(&configPath, "config", cfg.DefaultYAMLConfigurationFilePath, "absolute path to the service config yaml file")
}

// Do not require authentication for these kinds of events (publishing).
eventKindsNoAuth = map[int]struct{}{
nostr.KindGiftWrap: {},
nostr.KindFileMetadata: {},
}
)

func init() {
Expand All @@ -50,8 +56,8 @@ func init() {
return true
})
wsserver.RegisterEventMustAuthenticate(func(_ context.Context, events ...*model.Event) (authRequired bool) {
for _, event := range events {
if event.Kind != nostr.KindGiftWrap {
for _, e := range events {
if _, exists := eventKindsNoAuth[e.Kind]; !exists {
return true
}
}
Expand Down
2 changes: 1 addition & 1 deletion database/query/query_rank_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func helperPointsScoreEqual(t *testing.T, db *dbClient, eventID string, points i

p, s := helperGetEventPointsAndScore(t, db, eventID)
require.EqualValues(t, points, p)
require.EqualValues(t, score, s)
require.InDelta(t, score, s, 0.3)
}

func TestEventScore(t *testing.T) {
Expand Down

0 comments on commit e0969bf

Please sign in to comment.