Show note about federation being disabled, and list other known instances

This commit is contained in:
fr33domlover 2019-05-05 22:00:26 +00:00
parent 6bba8ff47f
commit a6bfb0cf36
4 changed files with 26 additions and 1 deletions

View file

@ -165,3 +165,6 @@ retry-delivery-every:
# activities received in local inboxes and the result of their processing.
# 'null' means disable the report page entirely.
#activity-debug-reports: 10
# List of (hosts of) other known federating instances.
#instances: []

View file

@ -222,11 +222,14 @@ instance Yesod App where
pc <- widgetToPageContent $ do
setTitle $ toHtml $
T.intercalate "" (map snd bcs) <> "" <> title
let instanceHost = appInstanceHost $ appSettings master
let settings = appSettings master
instanceHost = appInstanceHost settings
federationPage :: Text
federationPage =
"https://dev.angeley.es\
\/s/fr33domlover/r/vervis/s/FEDERATION.md"
federationDisabled = not $ appFederation settings
federatedServers = appInstances settings
$(widgetFile "default-layout")
withUrlRenderer $(hamletFile "templates/default-layout-wrapper.hamlet")

View file

@ -152,6 +152,8 @@ data AppSettings = AppSettings
-- latest activities received in local inboxes and the result of their
-- processing. 'Nothing' means disable the report page entirely.
, appInboxDebugReportLength :: Maybe Int
-- | List of (hosts of) other known federating instances.
, appInstances :: [Text]
}
instance FromJSON AppSettings where
@ -201,6 +203,7 @@ instance FromJSON AppSettings where
appDropDeliveryAfter <- ndt <$> o .: "drop-delivery-after"
appDeliveryRetryFreq <- interval <$> o .: "retry-delivery-every"
appInboxDebugReportLength <- o .:? "activity-debug-reports"
appInstances <- o .:? "instances" .!= []
return AppSettings {..}
where

View file

@ -32,6 +32,22 @@ $nothing
<p>
Federation status: See <a href="#{federationPage}">here</a>!
$if federationDisabled
<p>
<span>
NOTE: Federation is disabled on this instance!
$if null federatedServers
<span>
You can test federation between other instances.
$else
<span>
You can test federation between the following instances:
<ul>
$forall h <- federatedServers
<li>
<code>
#{h}
<.instance>
Vervis @ #{instanceHost}