aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGusted2022-06-20 08:44:55 +0200
committerGitHub2022-06-20 14:44:55 +0800
commit761db4d53ed47234c6016411f09597e419a8473e (patch)
tree73cbb2689cfcd4e98b0c06deb45534da33ba7390
parent2dc657108525194d18524f86d71f3e0d98d5654e (diff)
Disable federation by default (#20045) (#20046)
* Disable federation by default (#20045) - Backport #20045 - A Gitea instance should choose whetever they want to federate(as once it has more features also brings extra costs/moderation/unexpected behavior) with other AP/ForgeFed software. * Fix tests
-rw-r--r--custom/conf/app.example.ini4
-rw-r--r--docs/content/doc/advanced/config-cheat-sheet.en-us.md2
-rw-r--r--integrations/api_nodeinfo_test.go13
-rw-r--r--modules/setting/federation.go2
4 files changed, 12 insertions, 9 deletions
diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini
index 065c57ef5..dfaea7002 100644
--- a/custom/conf/app.example.ini
+++ b/custom/conf/app.example.ini
@@ -2247,10 +2247,10 @@ PATH =
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Enable/Disable federation capabilities
-; ENABLED = true
+;ENABLED = false
;;
;; Enable/Disable user statistics for nodeinfo if federation is enabled
-; SHARE_USER_STATISTICS = true
+;SHARE_USER_STATISTICS = true
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md
index 4f041d417..42499ba80 100644
--- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md
+++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md
@@ -1088,7 +1088,7 @@ Task queue configuration has been moved to `queue.task`. However, the below conf
## Federation (`federation`)
-- `ENABLED`: **true**: Enable/Disable federation capabilities
+- `ENABLED`: **false**: Enable/Disable federation capabilities
- `SHARE_USER_STATISTICS`: **true**: Enable/Disable user statistics for nodeinfo if federation is enabled
## Packages (`packages`)
diff --git a/integrations/api_nodeinfo_test.go b/integrations/api_nodeinfo_test.go
index c2fcd2fea..cf9ff4da1 100644
--- a/integrations/api_nodeinfo_test.go
+++ b/integrations/api_nodeinfo_test.go
@@ -11,17 +11,20 @@ import (
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
+ "code.gitea.io/gitea/routers"
"github.com/stretchr/testify/assert"
)
func TestNodeinfo(t *testing.T) {
- onGiteaRun(t, func(*testing.T, *url.URL) {
- setting.Federation.Enabled = true
- defer func() {
- setting.Federation.Enabled = false
- }()
+ setting.Federation.Enabled = true
+ c = routers.NormalRoutes()
+ defer func() {
+ setting.Federation.Enabled = false
+ c = routers.NormalRoutes()
+ }()
+ onGiteaRun(t, func(*testing.T, *url.URL) {
req := NewRequestf(t, "GET", "/api/v1/nodeinfo")
resp := MakeRequest(t, req, http.StatusOK)
var nodeinfo api.NodeInfo
diff --git a/modules/setting/federation.go b/modules/setting/federation.go
index fd39e5c7c..258a666ae 100644
--- a/modules/setting/federation.go
+++ b/modules/setting/federation.go
@@ -12,7 +12,7 @@ var (
Enabled bool
ShareUserStatistics bool
}{
- Enabled: true,
+ Enabled: false,
ShareUserStatistics: true,
}
)