Remove unnecessary storage config variables (#344)

* rewire config to not use extraneous serve vars

* rename 'file' to 'local' for consistency

* use Type and Size again
This commit is contained in:
tobi 2021-12-20 15:19:53 +01:00 committed by GitHub
commit cb8688f429
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 310 additions and 408 deletions

View file

@ -22,21 +22,21 @@ import (
"context"
"github.com/gin-gonic/gin"
"github.com/superseriousbusiness/gotosocial/internal/util"
"github.com/superseriousbusiness/gotosocial/internal/ap"
)
// transferContext transfers the signature verifier and signature from the gin context to the request context
func transferContext(c *gin.Context) context.Context {
ctx := c.Request.Context()
verifier, signed := c.Get(string(util.APRequestingPublicKeyVerifier))
verifier, signed := c.Get(string(ap.ContextRequestingPublicKeyVerifier))
if signed {
ctx = context.WithValue(ctx, util.APRequestingPublicKeyVerifier, verifier)
ctx = context.WithValue(ctx, ap.ContextRequestingPublicKeyVerifier, verifier)
}
signature, signed := c.Get(string(util.APRequestingPublicKeySignature))
signature, signed := c.Get(string(ap.ContextRequestingPublicKeySignature))
if signed {
ctx = context.WithValue(ctx, util.APRequestingPublicKeySignature, signature)
ctx = context.WithValue(ctx, ap.ContextRequestingPublicKeySignature, signature)
}
return ctx

View file

@ -24,7 +24,7 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/api"
"github.com/superseriousbusiness/gotosocial/internal/processing"
"github.com/superseriousbusiness/gotosocial/internal/router"
"github.com/superseriousbusiness/gotosocial/internal/util"
"github.com/superseriousbusiness/gotosocial/internal/uris"
)
const (
@ -42,23 +42,23 @@ const (
PageKey = "page"
// UsersBasePath is the base path for serving information about Users eg https://example.org/users
UsersBasePath = "/" + util.UsersPath
UsersBasePath = "/" + uris.UsersPath
// UsersBasePathWithUsername is just the users base path with the Username key in it.
// Use this anywhere you need to know the username of the user being queried.
// Eg https://example.org/users/:username
UsersBasePathWithUsername = UsersBasePath + "/:" + UsernameKey
// UsersPublicKeyPath is a path to a user's public key, for serving bare minimum AP representations.
UsersPublicKeyPath = UsersBasePathWithUsername + "/" + util.PublicKeyPath
UsersPublicKeyPath = UsersBasePathWithUsername + "/" + uris.PublicKeyPath
// UsersInboxPath is for serving POST requests to a user's inbox with the given username key.
UsersInboxPath = UsersBasePathWithUsername + "/" + util.InboxPath
UsersInboxPath = UsersBasePathWithUsername + "/" + uris.InboxPath
// UsersOutboxPath is for serving GET requests to a user's outbox with the given username key.
UsersOutboxPath = UsersBasePathWithUsername + "/" + util.OutboxPath
UsersOutboxPath = UsersBasePathWithUsername + "/" + uris.OutboxPath
// UsersFollowersPath is for serving GET request's to a user's followers list, with the given username key.
UsersFollowersPath = UsersBasePathWithUsername + "/" + util.FollowersPath
UsersFollowersPath = UsersBasePathWithUsername + "/" + uris.FollowersPath
// UsersFollowingPath is for serving GET request's to a user's following list, with the given username key.
UsersFollowingPath = UsersBasePathWithUsername + "/" + util.FollowingPath
UsersFollowingPath = UsersBasePathWithUsername + "/" + uris.FollowingPath
// UsersStatusPath is for serving GET requests to a particular status by a user, with the given username key and status ID
UsersStatusPath = UsersBasePathWithUsername + "/" + util.StatusesPath + "/:" + StatusIDKey
UsersStatusPath = UsersBasePathWithUsername + "/" + uris.StatusesPath + "/:" + StatusIDKey
// UsersStatusRepliesPath is for serving the replies collection of a status.
UsersStatusRepliesPath = UsersStatusPath + "/replies"
)

View file

@ -27,9 +27,9 @@ import (
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"
"github.com/spf13/viper"
"github.com/superseriousbusiness/gotosocial/internal/ap"
"github.com/superseriousbusiness/gotosocial/internal/api"
"github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/util"
)
// WebfingerGETRequest swagger:operation GET /.well-known/webfinger webfingerGet
@ -107,9 +107,9 @@ func (m *Module) WebfingerGETRequest(c *gin.Context) {
// transfer the signature verifier from the gin context to the request context
ctx := c.Request.Context()
verifier, signed := c.Get(string(util.APRequestingPublicKeyVerifier))
verifier, signed := c.Get(string(ap.ContextRequestingPublicKeyVerifier))
if signed {
ctx = context.WithValue(ctx, util.APRequestingPublicKeyVerifier, verifier)
ctx = context.WithValue(ctx, ap.ContextRequestingPublicKeyVerifier, verifier)
}
resp, err := m.processor.GetWebfingerAccount(ctx, username)