Skip to content
Snippets Groups Projects
Commit 714ddd55 authored by stuebinm's avatar stuebinm
Browse files

correct bbb link substitution

(unfortunately this one's hardcoded, the config options just aren't
general enough)
parent 92d73fdf
No related branches found
No related tags found
No related merge requests found
...@@ -16,12 +16,6 @@ ...@@ -16,12 +16,6 @@
"scope" : ["map"], "scope" : ["map"],
"substs" : { "substs" : {
} }
},
"bbb" : {
"scope" : ["bbb"],
"allowed" : [],
"blocked" : [],
"prefix" : "https://bbb.rc3.world/"
} }
} }
} }
...@@ -40,7 +40,7 @@ import LintWriter (LintWriter, adjust, askContext, askFileDepth, ...@@ -40,7 +40,7 @@ import LintWriter (LintWriter, adjust, askContext, askFileDepth,
import Paths (PathResult (..), RelPath (..), getExtension, import Paths (PathResult (..), RelPath (..), getExtension,
isOldStyle, parsePath) isOldStyle, parsePath)
import Types (Dep (Link, Local, LocalMap, MapLink)) import Types (Dep (Link, Local, LocalMap, MapLink))
import Uris (SubstError (..), applySubst) import Uris (SubstError (..), applySubst, parseUri)
-- | Checks an entire map for "general" lints. -- | Checks an entire map for "general" lints.
...@@ -289,15 +289,16 @@ checkTileLayerProperty p@(Property name _value) = case name of ...@@ -289,15 +289,16 @@ checkTileLayerProperty p@(Property name _value) = case name of
isIntInRange 0 100 p isIntInRange 0 100 p
"bbbRoom" -> do "bbbRoom" -> do
removeProperty "bbbRoom" removeProperty "bbbRoom"
unwrapURI (Proxy @"bbb") p unwrapString p $ \str -> case parseUri str of
(\link -> do 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) dependsOn (Link link)
setProperty "openWebsite" link setProperty "openWebsite" link
setProperty "silent" (BoolProp True) setProperty "silent" (BoolProp True)
setProperty "openWebsitePolicy" setProperty "openWebsitePolicy"
("fullscreen;camera;microphone;display-capture" :: Text) ("fullscreen;camera;microphone;display-capture" :: Text)
) _ -> complain "the \"bbbRoom\" property must take a link of the form bbb://assembly_slug/room_slug."
(const $ complain "property \"bbbRoom\" cannot be used with local links.")
"bbbTrigger" -> do "bbbTrigger" -> do
removeProperty "bbbTrigger" removeProperty "bbbTrigger"
requireProperty "bbbRoom" requireProperty "bbbRoom"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment