summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstuebinm2021-11-16 19:51:58 +0100
committerstuebinm2021-11-16 19:51:58 +0100
commitb1dcbc9edd964b9d0cab6c26db4d502840011ac4 (patch)
treebaab42a8926f65f4d09ef982f3dee987c4ddffbd
parent6c674fa7c2916149937c54b8241d28f0d7c97976 (diff)
add adjustment: add prefix for openWebsite
-rw-r--r--config.json3
-rw-r--r--lib/LintConfig.hs1
-rw-r--r--lib/Properties.hs7
3 files changed, 8 insertions, 3 deletions
diff --git a/config.json b/config.json
index 87298f0..f52e1a2 100644
--- a/config.json
+++ b/config.json
@@ -3,5 +3,6 @@
"ScriptInject":null,
"AllowScripts":true,
"MaxWarnLevel":"Suggestion",
- "DontCopyAssets":true
+ "DontCopyAssets":true,
+ "LinkPrefix":"https://exit.rc3.world?link="
}
diff --git a/lib/LintConfig.hs b/lib/LintConfig.hs
index 5596005..5c1ae20 100644
--- a/lib/LintConfig.hs
+++ b/lib/LintConfig.hs
@@ -40,6 +40,7 @@ data LintConfig f = LintConfig
-- ^ Don't copy map assets (mostly useful for development)
, configAllowScripts :: HKD f Bool
-- ^ Allow defining custom scripts in maps
+ , configLinkPrefix :: HKD f Text
} deriving (Generic)
type LintConfig' = LintConfig Identity
diff --git a/lib/Properties.hs b/lib/Properties.hs
index 50fec53..90aa3ad 100644
--- a/lib/Properties.hs
+++ b/lib/Properties.hs
@@ -153,7 +153,10 @@ checkLayerProperty p@(Property name _value) = case name of
uselessEmptyLayer
suggestProperty $ Property "openWebsiteTrigger" (StrProp "onaction")
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)
"openWebsiteTrigger" -> do
isString p
@@ -173,7 +176,7 @@ checkLayerProperty p@(Property name _value) = case name of
"allowApi" -> isForbidden
"exitUrl" -> do
forbidEmptyLayer
- unwrapLink p $ \link -> if "https://" `isPrefixOf` link
+ unwrapLink p $ \link -> if "/" `isPrefixOf` link
then dependsOn $ MapLink link
else unwrapPath link (dependsOn . LocalMap)
"startLayer" -> do