diff --git a/config.json b/config.json index 87298f07abd29bf7a86844269e52523aae3955c7..f52e1a2165a396bc9a749d7927dd4a0f95c78862 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 55960050deba6bd14b4340637d477324d565393b..5c1ae20fb12f3887cf4030095df15173ff2d53d4 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 50fec53d5a09263d7397586660e01d5839516fa7..90aa3ada865c673d9e65a08223a30a36ab5f4e31 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