Add settings option to disable federation
This commit is contained in:
parent
e53c056e1e
commit
cdb1c8b121
3 changed files with 21 additions and 1 deletions
|
@ -131,6 +131,14 @@ max-accounts: 3
|
|||
# Federation
|
||||
###############################################################################
|
||||
|
||||
|
||||
# Whether to support federation. This includes:
|
||||
#
|
||||
# * Accept activities from other servers in the inbox
|
||||
# * Accept activities from users in the outbox
|
||||
# * Deliver local activities to other servers
|
||||
federation: false
|
||||
|
||||
# Signing key file for signing object capabilities sent to remote users
|
||||
capability-signing-key: config/capability_signing_key
|
||||
|
||||
|
|
|
@ -91,8 +91,9 @@ import Vervis.ActorKey
|
|||
import Vervis.Federation
|
||||
import Vervis.Foundation
|
||||
import Vervis.Model
|
||||
import Vervis.Model.Ident
|
||||
import Vervis.RemoteActorStore
|
||||
import Vervis.Settings (AppSettings (appHttpSigTimeLimit))
|
||||
import Vervis.Settings
|
||||
|
||||
getInboxR :: Handler Html
|
||||
getInboxR = do
|
||||
|
@ -129,6 +130,8 @@ getInboxR = do
|
|||
|
||||
postInboxR :: Handler ()
|
||||
postInboxR = do
|
||||
federation <- getsYesod $ appFederation . appSettings
|
||||
unless federation badMethod
|
||||
now <- liftIO getCurrentTime
|
||||
r <- runExceptT $ getActivity now
|
||||
case r of
|
||||
|
@ -231,6 +234,8 @@ getOutboxR = error "Not implemented yet"
|
|||
|
||||
postOutboxR :: Handler Html
|
||||
postOutboxR = do
|
||||
federation <- getsYesod $ appFederation . appSettings
|
||||
unless federation badMethod
|
||||
((result, widget), enctype) <- runFormPost activityForm
|
||||
defaultLayout $ activityWidget widget enctype
|
||||
case result of
|
||||
|
|
|
@ -114,6 +114,12 @@ data AppSettings = AppSettings
|
|||
-- details. If set to 'Nothing', no email will be sent.
|
||||
, appMail :: Maybe MailSettings
|
||||
|
||||
-- | Whether to support federation. This includes:
|
||||
--
|
||||
-- * Accept activities from other servers in the inbox
|
||||
-- * Accept activities from users in the outbox
|
||||
-- * Deliver local activities to other servers
|
||||
, appFederation :: Bool
|
||||
-- | Signing key file for signing object capabilities sent to remote
|
||||
-- users
|
||||
, appCapabilitySigningKeyFile :: FilePath
|
||||
|
@ -175,6 +181,7 @@ instance FromJSON AppSettings where
|
|||
appEmailVerification <- o .:? "email-verification" .!= not defaultDev
|
||||
appMail <- o .:? "mail"
|
||||
|
||||
appFederation <- o .:? "federation" .!= False
|
||||
appCapabilitySigningKeyFile <- o .: "capability-signing-key"
|
||||
appHashidsSaltFile <- o .: "hashids-salt-file"
|
||||
appRejectOnMaxKeys <- o .: "reject-on-max-keys"
|
||||
|
|
Loading…
Reference in a new issue