summaryrefslogtreecommitdiff
path: root/internal/config
diff options
context:
space:
mode:
authorLibravatar Rob Sargant <robert@sargant.com>2022-11-14 09:30:01 +0000
committerLibravatar GitHub <noreply@github.com>2022-11-14 10:30:01 +0100
commitd120743e8bee74bbb6381a6ec017d7fa62b3f13e (patch)
tree166ab39f161b77cf6055abcc26de370c932c474f /internal/config
parent[chore]: Bump codeberg.org/gruf/go-cache/v3 from 3.1.7 to 3.1.8 (#1043) (diff)
downloadgotosocial-d120743e8bee74bbb6381a6ec017d7fa62b3f13e.tar.xz
[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
Diffstat (limited to 'internal/config')
-rw-r--r--internal/config/config.go1
-rw-r--r--internal/config/helpers.gen.go25
2 files changed, 26 insertions, 0 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index 907f250b0..ecbd079e6 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -71,6 +71,7 @@ type Configuration struct {
InstanceExposePeers bool `name:"instance-expose-peers" usage:"Allow unauthenticated users to query /api/v1/instance/peers?filter=open"`
InstanceExposeSuspended bool `name:"instance-expose-suspended" usage:"Expose suspended instances via web UI, and allow unauthenticated users to query /api/v1/instance/peers?filter=suspended"`
+ InstanceExposePublicTimeline bool `name:"instance-expose-public-timeline" usage:"Allow unauthenticated users to query /api/v1/timelines/public"`
InstanceDeliverToSharedInboxes bool `name:"instance-deliver-to-shared-inboxes" usage:"Deliver federated messages to shared inboxes, if they're available."`
AccountsRegistrationOpen bool `name:"accounts-registration-open" usage:"Allow anyone to submit an account signup request. If false, server will be invite-only."`
diff --git a/internal/config/helpers.gen.go b/internal/config/helpers.gen.go
index 1947fdadf..2786f5b5a 100644
--- a/internal/config/helpers.gen.go
+++ b/internal/config/helpers.gen.go
@@ -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()