You've already forked gotosocial_aur
update patch to latest version
This commit is contained in:
121
modded.patch
121
modded.patch
@ -42,35 +42,35 @@ index 2b3a873fb..52615a345 100644
|
||||
db-address: ""
|
||||
|
||||
diff --git a/go.mod b/go.mod
|
||||
index 7d15b19dd..beb7b0235 100644
|
||||
index 09796fba7..ff7e08475 100644
|
||||
--- a/go.mod
|
||||
+++ b/go.mod
|
||||
@@ -72,6 +72,7 @@ require (
|
||||
@@ -74,6 +74,7 @@ require (
|
||||
github.com/uptrace/bun/extra/bunotel v1.2.11
|
||||
github.com/wagslane/go-password-validator v0.3.0
|
||||
github.com/yuin/goldmark v1.7.8
|
||||
github.com/yuin/goldmark v1.7.10
|
||||
+ go.balki.me/anyhttp v0.5.0
|
||||
go.opentelemetry.io/otel v1.34.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0
|
||||
go.opentelemetry.io/otel v1.35.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0
|
||||
diff --git a/go.sum b/go.sum
|
||||
index 24176856b..a9680692a 100644
|
||||
index 17885f27e..8a123642f 100644
|
||||
--- a/go.sum
|
||||
+++ b/go.sum
|
||||
@@ -620,6 +620,8 @@ github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic=
|
||||
github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
|
||||
gitlab.com/NyaaaWhatsUpDoc/sqlite v1.35.0-concurrency-workaround h1:rSPHdoNXzXyWQUUeMEy8pdOFn8lH7XqdBRTS9G+jdTg=
|
||||
gitlab.com/NyaaaWhatsUpDoc/sqlite v1.35.0-concurrency-workaround/go.mod h1:9cr2sicr7jIaWTBKQmAxQLfBv9LL0su4ZTEV+utt3ic=
|
||||
@@ -491,6 +491,8 @@ github.com/yuin/goldmark v1.7.10 h1:S+LrtBjRmqMac2UdtB6yyCEJm+UILZ2fefI4p7o0QpI=
|
||||
github.com/yuin/goldmark v1.7.10/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg=
|
||||
gitlab.com/NyaaaWhatsUpDoc/sqlite v1.37.0-concurrency-workaround h1:QbfrBqNKgAFSSK89fYf547vxDQuz8p6iJUzzAMrusNk=
|
||||
gitlab.com/NyaaaWhatsUpDoc/sqlite v1.37.0-concurrency-workaround/go.mod h1:5YiWv+YviqGMuGw4V+PNplcyaJ5v+vQd7TQOgkACoJM=
|
||||
+go.balki.me/anyhttp v0.5.0 h1:uys0oRciBpZfwtxXAevScKy6amIQBXyDrcV0EtGF5zo=
|
||||
+go.balki.me/anyhttp v0.5.0/go.mod h1:JhfekOIjgVODoVqUCficjpIgmB3wwlB7jhN0eN2EZ/s=
|
||||
go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80=
|
||||
go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
go.mongodb.org/mongo-driver v1.17.3 h1:TQyXhnsWfWtgAhMtOgtYHMTkZIfBTpMTsMnd9ZBeHxQ=
|
||||
go.mongodb.org/mongo-driver v1.17.3/go.mod h1:Hy04i7O2kC4RS06ZrhPRqj/u4DTYkFDAAccj+rVKqgQ=
|
||||
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
||||
diff --git a/internal/config/config.go b/internal/config/config.go
|
||||
index 8ce2105b4..93ad8d7b0 100644
|
||||
index d4b3901e7..c63157f0c 100644
|
||||
--- a/internal/config/config.go
|
||||
+++ b/internal/config/config.go
|
||||
@@ -59,6 +59,7 @@ type Configuration struct {
|
||||
@@ -58,6 +58,7 @@ type Configuration struct {
|
||||
BindAddress string `name:"bind-address" usage:"Bind address to use for the GoToSocial server (eg., 0.0.0.0, 172.138.0.9, [::], localhost). For ipv6, enclose the address in square brackets, eg [2001:db8::fed1]. Default binds to all interfaces."`
|
||||
Port int `name:"port" usage:"Port to use for GoToSocial. Change this to 443 if you're running the binary directly on the host machine."`
|
||||
TrustedProxies []string `name:"trusted-proxies" usage:"Proxies to trust when parsing x-forwarded headers into real IPs."`
|
||||
@ -78,7 +78,7 @@ index 8ce2105b4..93ad8d7b0 100644
|
||||
SoftwareVersion string `name:"software-version" usage:""`
|
||||
|
||||
DbType string `name:"db-type" usage:"Database type: eg., postgres"`
|
||||
@@ -194,6 +195,8 @@ type Configuration struct {
|
||||
@@ -192,6 +193,8 @@ type Configuration struct {
|
||||
AdminMediaListRemoteOnly bool `name:"remote-only" usage:"list only remote attachments/emojis; if specified then local-only cannot also be true"`
|
||||
|
||||
RequestIDHeader string `name:"request-id-header" usage:"Header to extract the Request ID from. Eg.,'X-Request-Id'."`
|
||||
@ -88,7 +88,7 @@ index 8ce2105b4..93ad8d7b0 100644
|
||||
|
||||
type HTTPClientConfiguration struct {
|
||||
diff --git a/internal/config/defaults.go b/internal/config/defaults.go
|
||||
index 78a8230d5..b8b2ff5f2 100644
|
||||
index 9a507b421..4f63c2569 100644
|
||||
--- a/internal/config/defaults.go
|
||||
+++ b/internal/config/defaults.go
|
||||
@@ -233,4 +233,6 @@
|
||||
@ -99,19 +99,10 @@ index 78a8230d5..b8b2ff5f2 100644
|
||||
+ KalaclistaAllowedUnauthorizedGet: false,
|
||||
}
|
||||
diff --git a/internal/config/helpers.gen.go b/internal/config/helpers.gen.go
|
||||
index 156c19fd5..ab12c44be 100644
|
||||
index ac41a73e9..39266add6 100644
|
||||
--- a/internal/config/helpers.gen.go
|
||||
+++ b/internal/config/helpers.gen.go
|
||||
@@ -2,7 +2,7 @@
|
||||
// GoToSocial
|
||||
// Copyright (C) GoToSocial Authors admin@gotosocial.org
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
-//
|
||||
+//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
@@ -351,6 +351,31 @@ func GetTrustedProxies() []string { return global.GetTrustedProxies() }
|
||||
@@ -350,6 +350,31 @@ func GetTrustedProxies() []string { return global.GetTrustedProxies() }
|
||||
// SetTrustedProxies safely sets the value for global configuration 'TrustedProxies' field
|
||||
func SetTrustedProxies(v []string) { global.SetTrustedProxies(v) }
|
||||
|
||||
@ -143,30 +134,7 @@ index 156c19fd5..ab12c44be 100644
|
||||
// GetSoftwareVersion safely fetches the Configuration value for state's 'SoftwareVersion' field
|
||||
func (st *ConfigState) GetSoftwareVersion() (v string) {
|
||||
st.mutex.RLock()
|
||||
@@ -3328,19 +3353,13 @@ func (st *ConfigState) SetCacheConversationLastStatusIDsMemRatio(v float64) {
|
||||
}
|
||||
|
||||
// CacheConversationLastStatusIDsMemRatioFlag returns the flag name for the 'Cache.ConversationLastStatusIDsMemRatio' field
|
||||
-func CacheConversationLastStatusIDsMemRatioFlag() string {
|
||||
- return "cache-conversation-last-status-ids-mem-ratio"
|
||||
-}
|
||||
+func CacheConversationLastStatusIDsMemRatioFlag() string { return "cache-conversation-last-status-ids-mem-ratio" }
|
||||
|
||||
// GetCacheConversationLastStatusIDsMemRatio safely fetches the value for global configuration 'Cache.ConversationLastStatusIDsMemRatio' field
|
||||
-func GetCacheConversationLastStatusIDsMemRatio() float64 {
|
||||
- return global.GetCacheConversationLastStatusIDsMemRatio()
|
||||
-}
|
||||
+func GetCacheConversationLastStatusIDsMemRatio() float64 { return global.GetCacheConversationLastStatusIDsMemRatio() }
|
||||
|
||||
// SetCacheConversationLastStatusIDsMemRatio safely sets the value for global configuration 'Cache.ConversationLastStatusIDsMemRatio' field
|
||||
-func SetCacheConversationLastStatusIDsMemRatio(v float64) {
|
||||
- global.SetCacheConversationLastStatusIDsMemRatio(v)
|
||||
-}
|
||||
+func SetCacheConversationLastStatusIDsMemRatio(v float64) { global.SetCacheConversationLastStatusIDsMemRatio(v) }
|
||||
|
||||
// GetCacheDomainPermissionDraftMemRation safely fetches the Configuration value for state's 'Cache.DomainPermissionDraftMemRation' field
|
||||
func (st *ConfigState) GetCacheDomainPermissionDraftMemRation() (v float64) {
|
||||
@@ -4686,3 +4705,29 @@ func GetRequestIDHeader() string { return global.GetRequestIDHeader() }
|
||||
@@ -4656,3 +4681,28 @@ func GetRequestIDHeader() string { return global.GetRequestIDHeader() }
|
||||
|
||||
// SetRequestIDHeader safely sets the value for global configuration 'RequestIDHeader' field
|
||||
func SetRequestIDHeader(v string) { global.SetRequestIDHeader(v) }
|
||||
@ -195,34 +163,6 @@ index 156c19fd5..ab12c44be 100644
|
||||
+
|
||||
+// SetKalaclistaAllowedUnauthorizedGet safely sets the value for global configuration 'KalaclistaAllowedUnauthorizedGet' field
|
||||
+func SetKalaclistaAllowedUnauthorizedGet(v bool) { global.SetKalaclistaAllowedUnauthorizedGet(v) }
|
||||
+
|
||||
diff --git a/internal/middleware/signaturecheck.go b/internal/middleware/signaturecheck.go
|
||||
index ea63ec4f0..cb8b9df9a 100644
|
||||
--- a/internal/middleware/signaturecheck.go
|
||||
+++ b/internal/middleware/signaturecheck.go
|
||||
@@ -33,7 +33,8 @@
|
||||
sigHeader = string(httpsig.Signature)
|
||||
authHeader = string(httpsig.Authorization)
|
||||
// untyped error returned by httpsig when no signature is present
|
||||
- noSigError = "neither \"" + sigHeader + "\" nor \"" + authHeader + "\" have signature parameters"
|
||||
+ noSigError = "neither \"" + sigHeader + "\" nor \"" + authHeader + "\" have signature parameters"
|
||||
+ bothSigError = "both \"" + sigHeader + "\" and \"" + authHeader + "\" have signature parameters"
|
||||
)
|
||||
|
||||
// SignatureCheck returns a gin middleware for checking http signatures.
|
||||
@@ -54,6 +55,12 @@ func SignatureCheck(uriBlocked func(context.Context, *url.URL) (bool, error)) fu
|
||||
// Create the signature verifier from the request;
|
||||
// this will error if the request wasn't signed.
|
||||
verifier, err := httpsig.NewVerifier(c.Request)
|
||||
+ if err != nil && err.Error() == bothSigError {
|
||||
+ log.Debugf(ctx, "this request has both http signature headers, but fix it: %s", err)
|
||||
+ c.Request.Header.Del(authHeader)
|
||||
+ verifier, err = httpsig.NewVerifier(c.Request)
|
||||
+ }
|
||||
+
|
||||
if err != nil {
|
||||
// Only actually *abort* the request with 401
|
||||
// if a signature was present but malformed.
|
||||
diff --git a/internal/processing/fedi/common.go b/internal/processing/fedi/common.go
|
||||
index 1a4d38bc1..1d62aacdb 100644
|
||||
--- a/internal/processing/fedi/common.go
|
||||
@ -252,10 +192,10 @@ index 1a4d38bc1..1d62aacdb 100644
|
||||
}
|
||||
|
||||
diff --git a/internal/processing/fedi/emoji.go b/internal/processing/fedi/emoji.go
|
||||
index 9ac0ea244..446e496c0 100644
|
||||
index 9ac0ea244..1c8b0bda7 100644
|
||||
--- a/internal/processing/fedi/emoji.go
|
||||
+++ b/internal/processing/fedi/emoji.go
|
||||
@@ -20,15 +20,19 @@
|
||||
@@ -20,14 +20,20 @@
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
@ -269,15 +209,15 @@ index 9ac0ea244..446e496c0 100644
|
||||
// EmojiGet handles the GET for a federated emoji originating from this instance.
|
||||
func (p *Processor) EmojiGet(ctx context.Context, requestedEmojiID string) (interface{}, gtserror.WithCode) {
|
||||
if _, errWithCode := p.federator.AuthenticateFederatedRequest(ctx, ""); errWithCode != nil {
|
||||
- return nil, errWithCode
|
||||
+ if !(config.GetKalaclistaAllowedUnauthorizedGet() && errWithCode.Code() == http.StatusUnauthorized) {
|
||||
+ return nil, errWithCode
|
||||
+ }
|
||||
+
|
||||
return nil, errWithCode
|
||||
}
|
||||
|
||||
requestedEmoji, err := p.state.DB.GetEmojiByID(ctx, requestedEmojiID)
|
||||
diff --git a/internal/processing/fedi/user.go b/internal/processing/fedi/user.go
|
||||
index 79c1b4fdb..b980161c9 100644
|
||||
index 79c1b4fdb..376191036 100644
|
||||
--- a/internal/processing/fedi/user.go
|
||||
+++ b/internal/processing/fedi/user.go
|
||||
@@ -21,9 +21,11 @@
|
||||
@ -292,20 +232,19 @@ index 79c1b4fdb..b980161c9 100644
|
||||
"github.com/superseriousbusiness/gotosocial/internal/db"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtserror"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/uris"
|
||||
@@ -67,6 +69,16 @@ func (p *Processor) UserGet(ctx context.Context, requestedUsername string, reque
|
||||
@@ -67,6 +69,15 @@ func (p *Processor) UserGet(ctx context.Context, requestedUsername string, reque
|
||||
// we can serve a more complete profile.
|
||||
pubKeyAuth, errWithCode := p.federator.AuthenticateFederatedRequest(ctx, requestedUsername)
|
||||
if errWithCode != nil {
|
||||
+ // kalaclista modded: unauthorized-fetch
|
||||
+ if config.GetKalaclistaAllowedUnauthorizedGet() && errWithCode.Code() == http.StatusUnauthorized {
|
||||
+ person, err := p.converter.AccountToAS(ctx, receiver)
|
||||
+ if err != nil {
|
||||
+ err := gtserror.Newf("error converting account: %w", err)
|
||||
+ return nil, gtserror.NewErrorInternalError(err)
|
||||
+ }
|
||||
+
|
||||
+ return data(person)
|
||||
+ }
|
||||
+
|
||||
return nil, errWithCode // likely 401
|
||||
}
|
||||
|
||||
@ -1241,10 +1180,10 @@ index 000000000..ee3d81ff1
|
||||
+ return i.c
|
||||
+}
|
||||
diff --git a/vendor/modules.txt b/vendor/modules.txt
|
||||
index e053e6ce0..338ab8877 100644
|
||||
index c0b7298f3..7a620f2fc 100644
|
||||
--- a/vendor/modules.txt
|
||||
+++ b/vendor/modules.txt
|
||||
@@ -959,6 +959,10 @@ github.com/yuin/goldmark/renderer
|
||||
@@ -957,6 +957,10 @@ github.com/yuin/goldmark/renderer
|
||||
github.com/yuin/goldmark/renderer/html
|
||||
github.com/yuin/goldmark/text
|
||||
github.com/yuin/goldmark/util
|
||||
@ -1252,6 +1191,6 @@ index e053e6ce0..338ab8877 100644
|
||||
+## explicit; go 1.20
|
||||
+go.balki.me/anyhttp
|
||||
+go.balki.me/anyhttp/idle
|
||||
# go.mongodb.org/mongo-driver v1.14.0
|
||||
# go.mongodb.org/mongo-driver v1.17.3
|
||||
## explicit; go 1.18
|
||||
go.mongodb.org/mongo-driver/bson
|
||||
|
Reference in New Issue
Block a user