From 714ddd55d1cc6ef55941ecba1b0fdbce2f3193db Mon Sep 17 00:00:00 2001 From: stuebinm Date: Tue, 21 Dec 2021 21:20:43 +0100 Subject: correct bbb link substitution (unfortunately this one's hardcoded, the config options just aren't general enough) --- lib/Properties.hs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'lib') 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" -- cgit v1.2.3