clone

a self-hosted multitenant nostr relay with sites, file storage, git hosting, and inbox and outbox delivery

fix: remove duplicate activity feed from home

Dami committed 91c15ac
Keep the home page focused on relay identity and connection information. Social provides the notes and articles feed, while Search retains raw event inspection.

Remove the home feed query and cover guest and signed-in rendering without loading social events.
commit
91c15ac8a61eb037b8853692dc017dce415920df
parent
862b2c259a03c76493dbb3a30ce5d91d5dce7516
author
Dami <dami.etoile@gmail.com>
4 files changed, +30 -6
Minternal/webui/public.html3+--
Minternal/webui/public_pages.go2--
Minternal/webui/public_pages_test.go29++++++++++++++++++++++++++++-
Minternal/webui/webui.go2+-
M internal/webui/public.html +1 -2
M internal/webui/public_pages.go +0 -2
M internal/webui/public_pages_test.go +28 -1
@@ -11,15 +11,42 @@ import (
1111 "github.com/FelineStateMachine/tinyrelay/internal/policy"1212 )1313 14-type publicBackend struct{ fakeBackend }14+type publicBackend struct {15+ fakeBackend16+ eventQueries int17+}1518 1619 func (b *publicBackend) Query(_ context.Context, method string, _ []json.RawMessage, actor string) (any, error) {1720 if method != "queryevents" {1821 return b.fakeBackend.Query(context.Background(), method, nil, actor)1922 }23+ b.eventQueries++2024 return []map[string]any{{"id": "event-1", "pubkey": actor, "content": "visible result"}}, nil2125 }2226 27+func TestHomeShowsRelayInformationWithoutQueryingSocialEvents(t *testing.T) {28+ owner := strings.Repeat("a", 64)29+ for _, actor := range []string{"", owner} {30+ backend := &publicBackend{fakeBackend: fakeBackend{policy: policy.Defaults(owner)}}31+ backend.policy.Description = "A place to connect."32+ app, err := New(backend, Options{Actor: func(*http.Request) (string, error) { return actor, nil }})33+ if err != nil {34+ t.Fatal(err)35+ }36+ for _, path := range []string{"/", "/?kinds=all"} {37+ recorder := httptest.NewRecorder()38+ app.ServeHTTP(recorder, httptest.NewRequest(http.MethodGet, path, nil))39+ body := recorder.Body.String()40+ if recorder.Code != http.StatusOK || !strings.Contains(body, "A place to connect.") || !strings.Contains(body, `href="/social"`) {41+ t.Fatalf("home lost relay information or Social navigation: status=%d", recorder.Code)42+ }43+ if backend.eventQueries != 0 || strings.Contains(body, "Recent activity") || strings.Contains(body, "visible result") {44+ t.Fatalf("home still loads the duplicate feed: queries=%d", backend.eventQueries)45+ }46+ }47+ }48+}49+2350 type articleBackend struct{ fakeBackend }2451 2552 func (b *articleBackend) Query(_ context.Context, method string, _ []json.RawMessage, _ string) (any, error) {
M internal/webui/webui.go +1 -1