Skip to content

Commit 9cd6a37

Browse files
authored
4.4.0 (#19)
* Update dependencies and update to check v5 of index
1 parent b2c2797 commit 9cd6a37

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ plugins {
44
}
55

66
group = "com.github.reviversmc.themodindex.validation"
7-
version = "4.3.1"
7+
version = "4.4.0"
88

99
repositories {
1010
mavenCentral()
1111
maven("https://jitpack.io")
1212
}
1313

1414
dependencies {
15-
api("com.github.reviversmc:the-mod-index-api:8.0.0")
15+
api("com.github.reviversmc:the-mod-index-api:9.0.0")
1616
api("org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4")
1717
}
1818

src/main/kotlin/com/github/reviversmc/themodindex/validation/Validation.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const val COROUTINES_PER_TASK = 5 // Arbitrary number of concurrent downloads. C
1717
private fun validateIndexRegex(indexJson: IndexJson) {
1818
if (!Regex("^[0-9]+\\.[0-9]+\\.[0-9]+\$").matches(indexJson.indexVersion)) throw IllegalArgumentException("Invalid index version: ${indexJson.indexVersion}")
1919
indexJson.identifiers.forEach {
20-
if (!Regex("^[a-z0-9\\-_]+:[a-z0-9\\-_]+:[a-z0-9\\-_]+\$").matches(it)) throw IllegalArgumentException("Invalid identifier: $it")
20+
if (!Regex("^[a-z0-9\\-_]+:[a-z0-9\\-_]+:[a-z0-9]{15}\$").matches(it)) throw IllegalArgumentException("Invalid identifier: $it")
2121
}
2222
}
2323

@@ -40,7 +40,7 @@ private fun validateManifestRegex(manifestJson: ManifestJson) {
4040
versionFile.mcVersions.forEach {
4141
if (!Regex("^[0-9]+\\.[0-9]+\\.[0-9]+[a-zA-Z0-9\\-+._\\s]*\$").matches(it)) throw IllegalArgumentException("Invalid MC version: $it in ${manifestJson.genericIdentifier}")
4242
}
43-
if (!Regex("^[a-z0-9]{128}\$").matches(versionFile.sha512Hash)) throw IllegalArgumentException("Invalid SHA512 hash: ${versionFile.sha512Hash} in ${manifestJson.genericIdentifier}")
43+
if (!Regex("^[a-z0-9]{15}\$").matches(versionFile.shortSha512Hash)) throw IllegalArgumentException("Invalid SHA512 hash: ${versionFile.shortSha512Hash} in ${manifestJson.genericIdentifier}")
4444
versionFile.downloadUrls.forEach {
4545
if (!Regex("^[a-zA-Z0-9\\-_:/?&]+\$").matches(it)) throw IllegalArgumentException("Invalid download url: $it in ${manifestJson.genericIdentifier}")
4646
}

0 commit comments

Comments
 (0)