Allow explorers starting with http:// :-(

it's sad - but can't really force them to use https://
This commit is contained in:
ligi 2022-11-04 02:12:50 +01:00
parent 2f42e78adb
commit 9c89bcbd2f
3 changed files with 5 additions and 5 deletions

View File

@ -262,8 +262,8 @@ fun checkChain(chainFile: File, connectRPC: Boolean) {
} }
val url = explorer["url"] val url = explorer["url"]
if (url == null || url !is String || !url.startsWith("https://")) { if (url == null || url !is String || !(url.startsWith("https://") || url.startsWith("http://"))) {
throw (ExplorerMustWithHttps()) throw (ExplorerMustWithHttpsOrHttp())
} }
if (url.endsWith("/")) { if (url.endsWith("/")) {

View File

@ -17,7 +17,7 @@ class ShortNameMustNotBeStar: Exception("short name must not be '*'")
class UnsupportedNamespace: Exception("So far only the EIP155 namespace is supported") class UnsupportedNamespace: Exception("So far only the EIP155 namespace is supported")
class ExplorersMustBeArray: Exception("explorers must be an array") class ExplorersMustBeArray: Exception("explorers must be an array")
class ExplorerMustHaveName: Exception("Explorer must have name") class ExplorerMustHaveName: Exception("Explorer must have name")
class ExplorerMustWithHttps: Exception("Explorer have url starting with https://") class ExplorerMustWithHttpsOrHttp: Exception("Explorer have url starting with https:// or http://")
class ExplorerCannotEndInSlash: Exception("Explorer cannot have a slash on the end") class ExplorerCannotEndInSlash: Exception("Explorer cannot have a slash on the end")
class ExplorerStandardMustBeEIP3091OrNone: Exception("explorer standard must be 'none' or 'EIP3091'") class ExplorerStandardMustBeEIP3091OrNone: Exception("explorer standard must be 'none' or 'EIP3091'")
class ParentHasInvalidType(type: String?): Exception("Parent has invalid type $type - only L2 or shard allowed") class ParentHasInvalidType(type: String?): Exception("Parent has invalid type $type - only L2 or shard allowed")

View File

@ -226,12 +226,12 @@ class TheChainChecker {
checkChain(getFile("invalid/explorernoname/eip155-1.json"), false) checkChain(getFile("invalid/explorernoname/eip155-1.json"), false)
} }
@Test(expected = ExplorerMustWithHttps::class) @Test(expected = ExplorerMustWithHttpsOrHttp::class)
fun shouldFailOnInvalidUrl() { fun shouldFailOnInvalidUrl() {
checkChain(getFile("invalid/explorerinvalidurl/eip155-1.json"), false) checkChain(getFile("invalid/explorerinvalidurl/eip155-1.json"), false)
} }
@Test(expected = ExplorerMustWithHttps::class) @Test(expected = ExplorerMustWithHttpsOrHttp::class)
fun shouldFailOnMissingURL() { fun shouldFailOnMissingURL() {
checkChain(getFile("invalid/explorermissingurl/eip155-1.json"), false) checkChain(getFile("invalid/explorermissingurl/eip155-1.json"), false)
} }