mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[feature] Implement /api/v1/instance/peers
endpoint (#660)
* add missing license headers * start adding instance peers get * rename domainblock.go * embed domain in domainblock so it can be reused * update swagger docs * add test instances to db * update tests * add/update instancepeersget * update domain model * add getinstancepeers to db * instance-expose-peers, instance-expose-suspended * add auth checks for both current filters * attach endpoint to router * include public comment * obfuscate domain if required * go mod tidy * update swagger docs * remove unnecessary comment * return 'flat' peerlist if no query params provided
This commit is contained in:
@@ -543,6 +543,56 @@ func GetWebAssetBaseDir() string { return global.GetWebAssetBaseDir() }
|
||||
// SetWebAssetBaseDir safely sets the value for global configuration 'WebAssetBaseDir' field
|
||||
func SetWebAssetBaseDir(v string) { global.SetWebAssetBaseDir(v) }
|
||||
|
||||
// GetInstanceExposePeers safely fetches the Configuration value for state's 'InstanceExposePeers' field
|
||||
func (st *ConfigState) GetInstanceExposePeers() (v bool) {
|
||||
st.mutex.Lock()
|
||||
v = st.config.InstanceExposePeers
|
||||
st.mutex.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
// SetInstanceExposePeers safely sets the Configuration value for state's 'InstanceExposePeers' field
|
||||
func (st *ConfigState) SetInstanceExposePeers(v bool) {
|
||||
st.mutex.Lock()
|
||||
defer st.mutex.Unlock()
|
||||
st.config.InstanceExposePeers = v
|
||||
st.reloadToViper()
|
||||
}
|
||||
|
||||
// InstanceExposePeersFlag returns the flag name for the 'InstanceExposePeers' field
|
||||
func InstanceExposePeersFlag() string { return "instance-expose-peers" }
|
||||
|
||||
// GetInstanceExposePeers safely fetches the value for global configuration 'InstanceExposePeers' field
|
||||
func GetInstanceExposePeers() bool { return global.GetInstanceExposePeers() }
|
||||
|
||||
// SetInstanceExposePeers safely sets the value for global configuration 'InstanceExposePeers' field
|
||||
func SetInstanceExposePeers(v bool) { global.SetInstanceExposePeers(v) }
|
||||
|
||||
// GetInstanceExposeSuspended safely fetches the Configuration value for state's 'InstanceExposeSuspended' field
|
||||
func (st *ConfigState) GetInstanceExposeSuspended() (v bool) {
|
||||
st.mutex.Lock()
|
||||
v = st.config.InstanceExposeSuspended
|
||||
st.mutex.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
// SetInstanceExposeSuspended safely sets the Configuration value for state's 'InstanceExposeSuspended' field
|
||||
func (st *ConfigState) SetInstanceExposeSuspended(v bool) {
|
||||
st.mutex.Lock()
|
||||
defer st.mutex.Unlock()
|
||||
st.config.InstanceExposeSuspended = v
|
||||
st.reloadToViper()
|
||||
}
|
||||
|
||||
// InstanceExposeSuspendedFlag returns the flag name for the 'InstanceExposeSuspended' field
|
||||
func InstanceExposeSuspendedFlag() string { return "instance-expose-suspended" }
|
||||
|
||||
// GetInstanceExposeSuspended safely fetches the value for global configuration 'InstanceExposeSuspended' field
|
||||
func GetInstanceExposeSuspended() bool { return global.GetInstanceExposeSuspended() }
|
||||
|
||||
// SetInstanceExposeSuspended safely sets the value for global configuration 'InstanceExposeSuspended' field
|
||||
func SetInstanceExposeSuspended(v bool) { global.SetInstanceExposeSuspended(v) }
|
||||
|
||||
// GetAccountsRegistrationOpen safely fetches the Configuration value for state's 'AccountsRegistrationOpen' field
|
||||
func (st *ConfigState) GetAccountsRegistrationOpen() (v bool) {
|
||||
st.mutex.Lock()
|
||||
|
Reference in New Issue
Block a user