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

add adjustment: add prefix for openWebsite

parent 6c674fa7
Branches
No related tags found
No related merge requests found
...@@ -3,5 +3,6 @@ ...@@ -3,5 +3,6 @@
"ScriptInject":null, "ScriptInject":null,
"AllowScripts":true, "AllowScripts":true,
"MaxWarnLevel":"Suggestion", "MaxWarnLevel":"Suggestion",
"DontCopyAssets":true "DontCopyAssets":true,
"LinkPrefix":"https://exit.rc3.world?link="
} }
...@@ -40,6 +40,7 @@ data LintConfig f = LintConfig ...@@ -40,6 +40,7 @@ data LintConfig f = LintConfig
-- ^ Don't copy map assets (mostly useful for development) -- ^ Don't copy map assets (mostly useful for development)
, configAllowScripts :: HKD f Bool , configAllowScripts :: HKD f Bool
-- ^ Allow defining custom scripts in maps -- ^ Allow defining custom scripts in maps
, configLinkPrefix :: HKD f Text
} deriving (Generic) } deriving (Generic)
type LintConfig' = LintConfig Identity type LintConfig' = LintConfig Identity
......
...@@ -153,7 +153,10 @@ checkLayerProperty p@(Property name _value) = case name of ...@@ -153,7 +153,10 @@ checkLayerProperty p@(Property name _value) = case name of
uselessEmptyLayer uselessEmptyLayer
suggestProperty $ Property "openWebsiteTrigger" (StrProp "onaction") suggestProperty $ Property "openWebsiteTrigger" (StrProp "onaction")
unwrapLink p $ \link -> if "https://" `isPrefixOf` link unwrapLink p $ \link -> if "https://" `isPrefixOf` link
then dependsOn $ Link link then do
dependsOn $ Link link
prefix <- lintConfig configLinkPrefix
setProperty "openWebsite" (prefix <> link)
else unwrapPath link (dependsOn . Local) else unwrapPath link (dependsOn . Local)
"openWebsiteTrigger" -> do "openWebsiteTrigger" -> do
isString p isString p
...@@ -173,7 +176,7 @@ checkLayerProperty p@(Property name _value) = case name of ...@@ -173,7 +176,7 @@ checkLayerProperty p@(Property name _value) = case name of
"allowApi" -> isForbidden "allowApi" -> isForbidden
"exitUrl" -> do "exitUrl" -> do
forbidEmptyLayer forbidEmptyLayer
unwrapLink p $ \link -> if "https://" `isPrefixOf` link unwrapLink p $ \link -> if "/" `isPrefixOf` link
then dependsOn $ MapLink link then dependsOn $ MapLink link
else unwrapPath link (dependsOn . LocalMap) else unwrapPath link (dependsOn . LocalMap)
"startLayer" -> do "startLayer" -> do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment