diff options
author | 2022-09-23 21:27:35 +0200 | |
---|---|---|
committer | 2022-09-23 20:27:35 +0100 | |
commit | 69a193dae543641a2db6823fa6493c02f56fafbd (patch) | |
tree | c1a0c71d64642db12a17c6770642c3e0af859960 /internal/config | |
parent | [docs] NLnet follow up questions (#846) (diff) | |
download | gotosocial-69a193dae543641a2db6823fa6493c02f56fafbd.tar.xz |
[feature] Allow delivery to sharedInboxes where possible (#847)
* update Activity
* add instance-deliver-to-shared-inboxes setting
* update activity version again
* add SharedInboxURI field to accounts
* serdes for endpoints/sharedInbox
* deliver to sharedInbox if one is available
* update tests
* only assign shared inbox if shared domain
* look for shared inbox if currently nil
* go fmt
* finger to get params.RemoteAccountID if necessary
* make comments clearer
* compare dns more consistently
Diffstat (limited to 'internal/config')
-rw-r--r-- | internal/config/config.go | 5 | ||||
-rw-r--r-- | internal/config/defaults.go | 5 | ||||
-rw-r--r-- | internal/config/flags.go | 1 | ||||
-rw-r--r-- | internal/config/helpers.gen.go | 25 |
4 files changed, 32 insertions, 4 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index 7c0bf99a7..ff77bd367 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -67,8 +67,9 @@ type Configuration struct { WebTemplateBaseDir string `name:"web-template-base-dir" usage:"Basedir for html templating files for rendering pages and composing emails."` WebAssetBaseDir string `name:"web-asset-base-dir" usage:"Directory to serve static assets from, accessible at example.org/assets/"` - 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"` + 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"` + 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."` AccountsApprovalRequired bool `name:"accounts-approval-required" usage:"Do account signups require approval by an admin or moderator before user can log in? If false, new registrations will be automatically approved."` diff --git a/internal/config/defaults.go b/internal/config/defaults.go index a0d409c5f..5eb87ce68 100644 --- a/internal/config/defaults.go +++ b/internal/config/defaults.go @@ -46,8 +46,9 @@ var Defaults = Configuration{ WebTemplateBaseDir: "./web/template/", WebAssetBaseDir: "./web/assets/", - InstanceExposePeers: false, - InstanceExposeSuspended: false, + InstanceExposePeers: false, + InstanceExposeSuspended: false, + InstanceDeliverToSharedInboxes: true, AccountsRegistrationOpen: true, AccountsApprovalRequired: true, diff --git a/internal/config/flags.go b/internal/config/flags.go index 183ed3762..f37a50c9e 100644 --- a/internal/config/flags.go +++ b/internal/config/flags.go @@ -63,6 +63,7 @@ func AddServerFlags(cmd *cobra.Command) { // Instance cmd.Flags().Bool(InstanceExposePeersFlag(), cfg.InstanceExposePeers, fieldtag("InstanceExposePeers", "usage")) cmd.Flags().Bool(InstanceExposeSuspendedFlag(), cfg.InstanceExposeSuspended, fieldtag("InstanceExposeSuspended", "usage")) + cmd.Flags().Bool(InstanceDeliverToSharedInboxesFlag(), cfg.InstanceDeliverToSharedInboxes, fieldtag("InstanceDeliverToSharedInboxes", "usage")) // Accounts cmd.Flags().Bool(AccountsRegistrationOpenFlag(), cfg.AccountsRegistrationOpen, fieldtag("AccountsRegistrationOpen", "usage")) diff --git a/internal/config/helpers.gen.go b/internal/config/helpers.gen.go index c8fd4f621..adc020aba 100644 --- a/internal/config/helpers.gen.go +++ b/internal/config/helpers.gen.go @@ -593,6 +593,31 @@ func GetInstanceExposeSuspended() bool { return global.GetInstanceExposeSuspende // SetInstanceExposeSuspended safely sets the value for global configuration 'InstanceExposeSuspended' field func SetInstanceExposeSuspended(v bool) { global.SetInstanceExposeSuspended(v) } +// GetInstanceDeliverToSharedInboxes safely fetches the Configuration value for state's 'InstanceDeliverToSharedInboxes' field +func (st *ConfigState) GetInstanceDeliverToSharedInboxes() (v bool) { + st.mutex.Lock() + v = st.config.InstanceDeliverToSharedInboxes + st.mutex.Unlock() + return +} + +// SetInstanceDeliverToSharedInboxes safely sets the Configuration value for state's 'InstanceDeliverToSharedInboxes' field +func (st *ConfigState) SetInstanceDeliverToSharedInboxes(v bool) { + st.mutex.Lock() + defer st.mutex.Unlock() + st.config.InstanceDeliverToSharedInboxes = v + st.reloadToViper() +} + +// InstanceDeliverToSharedInboxesFlag returns the flag name for the 'InstanceDeliverToSharedInboxes' field +func InstanceDeliverToSharedInboxesFlag() string { return "instance-deliver-to-shared-inboxes" } + +// GetInstanceDeliverToSharedInboxes safely fetches the value for global configuration 'InstanceDeliverToSharedInboxes' field +func GetInstanceDeliverToSharedInboxes() bool { return global.GetInstanceDeliverToSharedInboxes() } + +// SetInstanceDeliverToSharedInboxes safely sets the value for global configuration 'InstanceDeliverToSharedInboxes' field +func SetInstanceDeliverToSharedInboxes(v bool) { global.SetInstanceDeliverToSharedInboxes(v) } + // GetAccountsRegistrationOpen safely fetches the Configuration value for state's 'AccountsRegistrationOpen' field func (st *ConfigState) GetAccountsRegistrationOpen() (v bool) { st.mutex.Lock() |