summaryrefslogtreecommitdiff
path: root/lib/Properties.hs
diff options
context:
space:
mode:
authorstuebinm2021-12-21 21:20:43 +0100
committerstuebinm2021-12-21 21:20:43 +0100
commit714ddd55d1cc6ef55941ecba1b0fdbce2f3193db (patch)
treed6a0b2c8d3ac3a36a8580e49c4774e743bd8c9b0 /lib/Properties.hs
parent92d73fdfd296a38cb385108ce63291bdc718fc40 (diff)
correct bbb link substitution
(unfortunately this one's hardcoded, the config options just aren't general enough)
Diffstat (limited to 'lib/Properties.hs')
-rw-r--r--lib/Properties.hs21
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/Properties.hs b/lib/Properties.hs
index 37b6bc4..dd680ea 100644
--- a/lib/Properties.hs
+++ b/lib/Properties.hs
@@ -40,7 +40,7 @@ import LintWriter (LintWriter, adjust, askContext, askFileDepth,
import Paths (PathResult (..), RelPath (..), getExtension,
isOldStyle, parsePath)
import Types (Dep (Link, Local, LocalMap, MapLink))
-import Uris (SubstError (..), applySubst)
+import Uris (SubstError (..), applySubst, parseUri)
-- | Checks an entire map for "general" lints.
@@ -289,15 +289,16 @@ checkTileLayerProperty p@(Property name _value) = case name of
isIntInRange 0 100 p
"bbbRoom" -> do
removeProperty "bbbRoom"
- unwrapURI (Proxy @"bbb") p
- (\link -> do
- dependsOn (Link link)
- setProperty "openWebsite" link
- setProperty "silent" (BoolProp True)
- setProperty "openWebsitePolicy"
- ("fullscreen;camera;microphone;display-capture" :: Text)
- )
- (const $ complain "property \"bbbRoom\" cannot be used with local links.")
+ unwrapString p $ \str -> case parseUri str of
+ Just ("bbb",assembly_slug, room_slug)
+ | "/" `isPrefixOf` room_slug && T.length room_slug >= 2 -> do
+ let link = "https://rc3.world/assembly/"<>assembly_slug<>"/bbb"<>room_slug
+ dependsOn (Link link)
+ setProperty "openWebsite" link
+ setProperty "silent" (BoolProp True)
+ setProperty "openWebsitePolicy"
+ ("fullscreen;camera;microphone;display-capture" :: Text)
+ _ -> complain "the \"bbbRoom\" property must take a link of the form bbb://assembly_slug/room_slug."
"bbbTrigger" -> do
removeProperty "bbbTrigger"
requireProperty "bbbRoom"