mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-23 20:17:03 +01:00
* 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
This commit is contained in:
parent
2dc6571085
commit
761db4d53e
4 changed files with 12 additions and 9 deletions
|
@ -2247,10 +2247,10 @@ PATH =
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;
|
;;
|
||||||
;; Enable/Disable federation capabilities
|
;; Enable/Disable federation capabilities
|
||||||
; ENABLED = true
|
;ENABLED = false
|
||||||
;;
|
;;
|
||||||
;; Enable/Disable user statistics for nodeinfo if federation is enabled
|
;; Enable/Disable user statistics for nodeinfo if federation is enabled
|
||||||
; SHARE_USER_STATISTICS = true
|
;SHARE_USER_STATISTICS = true
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
|
@ -1088,7 +1088,7 @@ Task queue configuration has been moved to `queue.task`. However, the below conf
|
||||||
|
|
||||||
## Federation (`federation`)
|
## 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
|
- `SHARE_USER_STATISTICS`: **true**: Enable/Disable user statistics for nodeinfo if federation is enabled
|
||||||
|
|
||||||
## Packages (`packages`)
|
## Packages (`packages`)
|
||||||
|
|
|
@ -11,17 +11,20 @@ import (
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
api "code.gitea.io/gitea/modules/structs"
|
api "code.gitea.io/gitea/modules/structs"
|
||||||
|
"code.gitea.io/gitea/routers"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNodeinfo(t *testing.T) {
|
func TestNodeinfo(t *testing.T) {
|
||||||
onGiteaRun(t, func(*testing.T, *url.URL) {
|
|
||||||
setting.Federation.Enabled = true
|
setting.Federation.Enabled = true
|
||||||
|
c = routers.NormalRoutes()
|
||||||
defer func() {
|
defer func() {
|
||||||
setting.Federation.Enabled = false
|
setting.Federation.Enabled = false
|
||||||
|
c = routers.NormalRoutes()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
onGiteaRun(t, func(*testing.T, *url.URL) {
|
||||||
req := NewRequestf(t, "GET", "/api/v1/nodeinfo")
|
req := NewRequestf(t, "GET", "/api/v1/nodeinfo")
|
||||||
resp := MakeRequest(t, req, http.StatusOK)
|
resp := MakeRequest(t, req, http.StatusOK)
|
||||||
var nodeinfo api.NodeInfo
|
var nodeinfo api.NodeInfo
|
||||||
|
|
|
@ -12,7 +12,7 @@ var (
|
||||||
Enabled bool
|
Enabled bool
|
||||||
ShareUserStatistics bool
|
ShareUserStatistics bool
|
||||||
}{
|
}{
|
||||||
Enabled: true,
|
Enabled: false,
|
||||||
ShareUserStatistics: true,
|
ShareUserStatistics: true,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue