summaryrefslogtreecommitdiff
path: root/internal/web
diff options
context:
space:
mode:
Diffstat (limited to 'internal/web')
-rw-r--r--internal/web/profile.go21
-rw-r--r--internal/web/thread.go21
2 files changed, 10 insertions, 32 deletions
diff --git a/internal/web/profile.go b/internal/web/profile.go
index 56f8e0a56..2ffc7411e 100644
--- a/internal/web/profile.go
+++ b/internal/web/profile.go
@@ -26,7 +26,6 @@ import (
"strings"
"github.com/gin-gonic/gin"
- "github.com/superseriousbusiness/gotosocial/internal/ap"
apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model"
apiutil "github.com/superseriousbusiness/gotosocial/internal/api/util"
"github.com/superseriousbusiness/gotosocial/internal/config"
@@ -75,7 +74,7 @@ func (m *Module) profileGETHandler(c *gin.Context) {
// should render the account's AP representation instead
accept := apiutil.NegotiateFormat(c, string(apiutil.TextHTML), string(apiutil.AppActivityJSON), string(apiutil.AppActivityLDJSON))
if accept == string(apiutil.AppActivityJSON) || accept == string(apiutil.AppActivityLDJSON) {
- m.returnAPProfile(ctx, c, username, accept)
+ m.returnAPProfile(c, username, accept)
return
}
@@ -145,27 +144,17 @@ func (m *Module) profileGETHandler(c *gin.Context) {
})
}
-func (m *Module) returnAPProfile(ctx context.Context, c *gin.Context, username string, accept string) {
- verifier, signed := c.Get(string(ap.ContextRequestingPublicKeyVerifier))
- if signed {
- ctx = context.WithValue(ctx, ap.ContextRequestingPublicKeyVerifier, verifier)
- }
-
- signature, signed := c.Get(string(ap.ContextRequestingPublicKeySignature))
- if signed {
- ctx = context.WithValue(ctx, ap.ContextRequestingPublicKeySignature, signature)
- }
-
- user, errWithCode := m.processor.Fedi().UserGet(ctx, username, c.Request.URL)
+func (m *Module) returnAPProfile(c *gin.Context, username string, accept string) {
+ user, errWithCode := m.processor.Fedi().UserGet(c.Request.Context(), username, c.Request.URL)
if errWithCode != nil {
- apiutil.WebErrorHandler(c, errWithCode, m.processor.InstanceGetV1) //nolint:contextcheck
+ apiutil.WebErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return
}
b, mErr := json.Marshal(user)
if mErr != nil {
err := fmt.Errorf("could not marshal json: %s", mErr)
- apiutil.WebErrorHandler(c, gtserror.NewErrorInternalError(err), m.processor.InstanceGetV1) //nolint:contextcheck
+ apiutil.WebErrorHandler(c, gtserror.NewErrorInternalError(err), m.processor.InstanceGetV1)
return
}
diff --git a/internal/web/thread.go b/internal/web/thread.go
index 8d4e99bef..41f81eb14 100644
--- a/internal/web/thread.go
+++ b/internal/web/thread.go
@@ -26,7 +26,6 @@ import (
"strings"
"github.com/gin-gonic/gin"
- "github.com/superseriousbusiness/gotosocial/internal/ap"
apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model"
apiutil "github.com/superseriousbusiness/gotosocial/internal/api/util"
"github.com/superseriousbusiness/gotosocial/internal/config"
@@ -92,7 +91,7 @@ func (m *Module) threadGETHandler(c *gin.Context) {
// should render the status's AP representation instead
accept := apiutil.NegotiateFormat(c, string(apiutil.TextHTML), string(apiutil.AppActivityJSON), string(apiutil.AppActivityLDJSON))
if accept == string(apiutil.AppActivityJSON) || accept == string(apiutil.AppActivityLDJSON) {
- m.returnAPStatus(ctx, c, username, statusID, accept)
+ m.returnAPStatus(c, username, statusID, accept)
return
}
@@ -120,27 +119,17 @@ func (m *Module) threadGETHandler(c *gin.Context) {
})
}
-func (m *Module) returnAPStatus(ctx context.Context, c *gin.Context, username string, statusID string, accept string) {
- verifier, signed := c.Get(string(ap.ContextRequestingPublicKeyVerifier))
- if signed {
- ctx = context.WithValue(ctx, ap.ContextRequestingPublicKeyVerifier, verifier)
- }
-
- signature, signed := c.Get(string(ap.ContextRequestingPublicKeySignature))
- if signed {
- ctx = context.WithValue(ctx, ap.ContextRequestingPublicKeySignature, signature)
- }
-
- status, errWithCode := m.processor.Fedi().StatusGet(ctx, username, statusID)
+func (m *Module) returnAPStatus(c *gin.Context, username string, statusID string, accept string) {
+ status, errWithCode := m.processor.Fedi().StatusGet(c.Request.Context(), username, statusID)
if errWithCode != nil {
- apiutil.WebErrorHandler(c, errWithCode, m.processor.InstanceGetV1) //nolint:contextcheck
+ apiutil.WebErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return
}
b, mErr := json.Marshal(status)
if mErr != nil {
err := fmt.Errorf("could not marshal json: %s", mErr)
- apiutil.WebErrorHandler(c, gtserror.NewErrorInternalError(err), m.processor.InstanceGetV1) //nolint:contextcheck
+ apiutil.WebErrorHandler(c, gtserror.NewErrorInternalError(err), m.processor.InstanceGetV1)
return
}