diff options
Diffstat (limited to 'internal/webpush/realsender.go')
-rw-r--r-- | internal/webpush/realsender.go | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/internal/webpush/realsender.go b/internal/webpush/realsender.go index 8b3a1bd66..4c4657957 100644 --- a/internal/webpush/realsender.go +++ b/internal/webpush/realsender.go @@ -33,30 +33,20 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/filter/usermute" "github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" - "github.com/superseriousbusiness/gotosocial/internal/httpclient" "github.com/superseriousbusiness/gotosocial/internal/log" "github.com/superseriousbusiness/gotosocial/internal/state" "github.com/superseriousbusiness/gotosocial/internal/text" "github.com/superseriousbusiness/gotosocial/internal/typeutils" ) -// realSender is the production Web Push sender, backed by an HTTP client, DB, and worker pool. +// realSender is the production Web Push sender, +// backed by an HTTP client, DB, and worker pool. type realSender struct { httpClient *http.Client state *state.State converter *typeutils.Converter } -// NewRealSender creates a Sender from an http.Client instead of an httpclient.Client. -// This should only be used by NewSender and in tests. -func NewRealSender(httpClient *http.Client, state *state.State, converter *typeutils.Converter) Sender { - return &realSender{ - httpClient: httpClient, - state: state, - converter: converter, - } -} - func (r *realSender) Send( ctx context.Context, notification *gtsmodel.Notification, @@ -329,13 +319,3 @@ func formatNotificationBody(apiNotification *apimodel.Notification) string { func firstNBytesTrimSpace(s string, n int) string { return strings.TrimSpace(text.FirstNBytesByWords(strings.TrimSpace(s), n)) } - -// gtsHTTPClientRoundTripper helps wrap a GtS HTTP client back into a regular HTTP client, -// so that webpush-go can use our IP filters, bad hosts list, and retries. -type gtsHTTPClientRoundTripper struct { - httpClient *httpclient.Client -} - -func (r *gtsHTTPClientRoundTripper) RoundTrip(request *http.Request) (*http.Response, error) { - return r.httpClient.Do(request) -} |