summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorstuebinm2021-12-24 16:27:52 +0100
committerstuebinm2021-12-24 16:27:52 +0100
commit78e6f6928db911e6c4eb769016a91832d27ae5bd (patch)
tree1faec2cc382e06facfb54ba9405350408a92d150 /lib
parente3d6b59b76f7057179723d4853220c2db9c18064 (diff)
allow openWebsiteAllowApi if website is on static.rc3.world
Diffstat (limited to '')
-rw-r--r--lib/Properties.hs14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/Properties.hs b/lib/Properties.hs
index edffe8d..cf63e12 100644
--- a/lib/Properties.hs
+++ b/lib/Properties.hs
@@ -27,6 +27,7 @@ import Badges (Badge (Badge),
BadgeArea (BadgePoint, BadgeRect),
BadgeToken, parseToken)
import Data.Data (Proxy (Proxy))
+import Data.Functor ((<&>))
import Data.List ((\\))
import Data.Maybe (fromMaybe, isJust)
import Data.Set (Set)
@@ -471,9 +472,18 @@ checkTileLayerProperty p@(Property name _value) = case name of
-> do { isString p; requireProperty "bindVariable" }
| T.toLower name `elem` [ "jitsiurl", "jitsiconfig", "jitsiclientconfig"
, "jitsiroomadmintag", "jitsiinterfaceconfig"
- , "openwebsitepolicy", "openwebsiteallowapi"
- , "allowapi" ]
+ , "openwebsitepolicy", "allowapi" ]
-> forbidProperty name
+ -- the openWebsite Api can only be allowed if the website is on static.rc3.world
+ | T.toLower name == "openwebsiteallowapi"
+ -> do
+ properties <- askContext <&> getProperties
+ unless (all (\(Property name value) -> case value of
+ StrProp str -> name /= "openWebsite" || "https://static.rc3.world" `isPrefixOf` str
+ _ -> True
+ ) properties)
+ $ complain "\"openWebsiteAllowApi\" can only be used with websites hosted \
+ \on https://static.rc3.world"
| name `elem` [ "openWebsite", "openTab" ] -> do
uselessEmptyLayer
suggestProperty $ Property "openWebsiteTrigger" (StrProp "onaction")