mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[feature] add instance-expose-public-timeline flag (#1039)
* Add instance-expose-public-timeline flag Adds a config flag that allows unauthenticated access to /api/v1/timelines/public. Defaults to false to replicate existing behaviour. * Update structure following review * Add comment * Fix linting
This commit is contained in:
@ -620,6 +620,31 @@ func GetInstanceExposeSuspended() bool { return global.GetInstanceExposeSuspende
|
||||
// SetInstanceExposeSuspended safely sets the value for global configuration 'InstanceExposeSuspended' field
|
||||
func SetInstanceExposeSuspended(v bool) { global.SetInstanceExposeSuspended(v) }
|
||||
|
||||
// GetInstanceExposePublicTimeline safely fetches the Configuration value for state's 'InstanceExposePublicTimeline' field
|
||||
func (st *ConfigState) GetInstanceExposePublicTimeline() (v bool) {
|
||||
st.mutex.Lock()
|
||||
v = st.config.InstanceExposePublicTimeline
|
||||
st.mutex.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
// SetInstanceExposePublicTimeline safely sets the Configuration value for state's 'InstanceExposePublicTimeline' field
|
||||
func (st *ConfigState) SetInstanceExposePublicTimeline(v bool) {
|
||||
st.mutex.Lock()
|
||||
defer st.mutex.Unlock()
|
||||
st.config.InstanceExposePublicTimeline = v
|
||||
st.reloadToViper()
|
||||
}
|
||||
|
||||
// InstanceExposePublicTimelineFlag returns the flag name for the 'InstanceExposePublicTimeline' field
|
||||
func InstanceExposePublicTimelineFlag() string { return "instance-expose-public-timeline" }
|
||||
|
||||
// GetInstanceExposePublicTimeline safely fetches the value for global configuration 'InstanceExposePublicTimeline' field
|
||||
func GetInstanceExposePublicTimeline() bool { return global.GetInstanceExposePublicTimeline() }
|
||||
|
||||
// SetInstanceExposePublicTimeline safely sets the value for global configuration 'InstanceExposePublicTimeline' field
|
||||
func SetInstanceExposePublicTimeline(v bool) { global.SetInstanceExposePublicTimeline(v) }
|
||||
|
||||
// GetInstanceDeliverToSharedInboxes safely fetches the Configuration value for state's 'InstanceDeliverToSharedInboxes' field
|
||||
func (st *ConfigState) GetInstanceDeliverToSharedInboxes() (v bool) {
|
||||
st.mutex.Lock()
|
||||
|
Reference in New Issue
Block a user