diff options
Diffstat (limited to 'internal/handler/websocket/handler.go')
| -rw-r--r-- | internal/handler/websocket/handler.go | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/internal/handler/websocket/handler.go b/internal/handler/websocket/handler.go index 6eb8763..b11171d 100644 --- a/internal/handler/websocket/handler.go +++ b/internal/handler/websocket/handler.go | |||
| @@ -49,6 +49,14 @@ type AuthConfig struct { | |||
| 49 | WriteAllowedPubkeys []string | 49 | WriteAllowedPubkeys []string |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | type RelayInfoConfig struct { | ||
| 53 | Name string | ||
| 54 | Description string | ||
| 55 | Pubkey string | ||
| 56 | Contact string | ||
| 57 | Icon string | ||
| 58 | } | ||
| 59 | |||
| 52 | type connState struct { | 60 | type connState struct { |
| 53 | authenticatedPubkey string | 61 | authenticatedPubkey string |
| 54 | authChallenge string | 62 | authChallenge string |
| @@ -56,13 +64,14 @@ type connState struct { | |||
| 56 | } | 64 | } |
| 57 | 65 | ||
| 58 | type Handler struct { | 66 | type Handler struct { |
| 59 | store EventStore | 67 | store EventStore |
| 60 | auth AuthStore | 68 | auth AuthStore |
| 61 | subs *subscription.Manager | 69 | subs *subscription.Manager |
| 62 | metrics MetricsRecorder | 70 | metrics MetricsRecorder |
| 63 | limiter RateLimiter | 71 | limiter RateLimiter |
| 64 | authConfig *AuthConfig | 72 | authConfig *AuthConfig |
| 65 | indexData IndexData | 73 | relayConfig *RelayInfoConfig |
| 74 | indexData IndexData | ||
| 66 | } | 75 | } |
| 67 | 76 | ||
| 68 | func NewHandler(store EventStore, subs *subscription.Manager) *Handler { | 77 | func NewHandler(store EventStore, subs *subscription.Manager) *Handler { |
| @@ -88,6 +97,10 @@ func (h *Handler) SetAuthConfig(cfg *AuthConfig) { | |||
| 88 | h.authConfig = cfg | 97 | h.authConfig = cfg |
| 89 | } | 98 | } |
| 90 | 99 | ||
| 100 | func (h *Handler) SetRelayConfig(cfg *RelayInfoConfig) { | ||
| 101 | h.relayConfig = cfg | ||
| 102 | } | ||
| 103 | |||
| 91 | // SetIndexData sets the addresses for the index page | 104 | // SetIndexData sets the addresses for the index page |
| 92 | func (h *Handler) SetIndexData(grpcAddr, httpAddr, wsAddr string) { | 105 | func (h *Handler) SetIndexData(grpcAddr, httpAddr, wsAddr string) { |
| 93 | h.indexData = IndexData{ | 106 | h.indexData = IndexData{ |
