mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 04:22:24 -05:00
update to just pass instance account directly to nollamas middleware
This commit is contained in:
parent
86e342c443
commit
b98ed0db3f
3 changed files with 5 additions and 13 deletions
|
|
@ -499,7 +499,7 @@ var Start action.GTSAction = func(ctx context.Context) error {
|
|||
s2sLimit := middleware.RateLimit(rlLimit, exceptions) // server-to-server (AP)
|
||||
fsMainLimit := middleware.RateLimit(rlLimit, exceptions) // fileserver / web templates
|
||||
fsEmojiLimit := middleware.RateLimit(rlLimit*2, exceptions) // fileserver (emojis only, use high limit)
|
||||
nollamas := middleware.NoLLaMas(state.DB)
|
||||
nollamas := middleware.NoLLaMas(instanceAccount)
|
||||
|
||||
// throttling
|
||||
cpuMultiplier := config.GetAdvancedThrottlingMultiplier()
|
||||
|
|
|
|||
|
|
@ -257,8 +257,6 @@ var Start action.GTSAction = func(ctx context.Context) error {
|
|||
nodeInfoModule = api.NewNodeInfo(processor) // nodeinfo endpoint
|
||||
activityPubModule = api.NewActivityPub(state.DB, processor) // ActivityPub endpoints
|
||||
webModule = web.New(state.DB, processor) // web pages + user profiles + settings panels etc
|
||||
|
||||
nollamas = middleware.NoLLaMas(state.DB)
|
||||
)
|
||||
|
||||
// these should be routed in order
|
||||
|
|
@ -273,7 +271,7 @@ var Start action.GTSAction = func(ctx context.Context) error {
|
|||
nodeInfoModule.Route(route)
|
||||
activityPubModule.Route(route)
|
||||
activityPubModule.RoutePublicKey(route)
|
||||
webModule.Route(route, nollamas)
|
||||
webModule.Route(route)
|
||||
|
||||
// Create background cleaner.
|
||||
cleaner := cleaner.New(state)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
package middleware
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"crypto/sha512"
|
||||
"crypto/subtle"
|
||||
|
|
@ -30,19 +29,14 @@ import (
|
|||
|
||||
"codeberg.org/gruf/go-byteutil"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/db"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/oauth"
|
||||
)
|
||||
|
||||
func NoLLaMas(db db.DB) gin.HandlerFunc {
|
||||
instance, err := db.GetInstanceAccount(context.Background(), "")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
func NoLLaMas(instanceAcc *gtsmodel.Account) gin.HandlerFunc {
|
||||
// Generate seed hash from
|
||||
// this instance private key.
|
||||
priv := instance.PrivateKey
|
||||
priv := instanceAcc.PrivateKey
|
||||
bpriv := x509.MarshalPKCS1PrivateKey(priv)
|
||||
seed := sha512.Sum512(bpriv)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue