diff --git a/CHANGELOG.md b/CHANGELOG.md index a00c4ff..376c693 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Security +## [2.0.1] - 2021-03-11 +### Changed +- [2021-05-21] Update metrics and fix cache directory leak [@carbotaniuman]. +- [2021-05-21] Change headers to be wildcards [@carbotaniuman]. + ## [2.0.0] - 2021-03-11 ### Changed - [2021-03-11] Switch back to HTTP/1.1 [@carbotaniuman]. diff --git a/src/main/kotlin/mdnet/Constants.kt b/src/main/kotlin/mdnet/Constants.kt index 92587fc..e1a4c25 100644 --- a/src/main/kotlin/mdnet/Constants.kt +++ b/src/main/kotlin/mdnet/Constants.kt @@ -21,7 +21,7 @@ package mdnet import java.time.Duration object Constants { - const val CLIENT_BUILD = 30 + const val CLIENT_BUILD = 31 @JvmField val MAX_AGE_CACHE: Duration = Duration.ofDays(14) diff --git a/src/main/kotlin/mdnet/Main.kt b/src/main/kotlin/mdnet/Main.kt index ee2b884..f15090e 100644 --- a/src/main/kotlin/mdnet/Main.kt +++ b/src/main/kotlin/mdnet/Main.kt @@ -67,26 +67,8 @@ class Main : Runnable { """.trimIndent() ) - if (!Files.isDirectory(databaseFolder) || Files.isRegularFile(databaseFolder.resolveSibling(databaseFolder.fileName.toString() + ".mv.db"))) { - println() - println() - println( - """the --database option now takes in the folder with the database file! - |(it previously took in the path to the file without any extensions) - |if you are using docker update your docker mount settings! - |if you are not, manually move update your --database args! - |note: the database file itself should be named metadata.{extension} - |where {extension} can be `.db` or `.mv.db` - | - |If this is your first time seeing this message, please check out the support - |channel as things HAVE changed. Failure to do so WILL require - |a cache wipe. - """.trimMargin() - ) - println() - println() - - throw IllegalArgumentException() + if (!Files.isDirectory(databaseFolder)) { + throw IllegalArgumentException("Expected $databaseFolder to be a folder, was a file") } if (Files.isRegularFile(databaseFolder)) { diff --git a/src/main/kotlin/mdnet/server/ImageHandler.kt b/src/main/kotlin/mdnet/server/ImageHandler.kt index 5c922f4..ec45fa1 100644 --- a/src/main/kotlin/mdnet/server/ImageHandler.kt +++ b/src/main/kotlin/mdnet/server/ImageHandler.kt @@ -181,10 +181,10 @@ class ImageServer( .then { next: HttpHandler -> { request: Request -> val response = next(request) - response.header("access-control-allow-origin", "https://mangadex.org") + response.header("access-control-allow-origin", "*") .header("access-control-expose-headers", "*") .header("access-control-allow-methods", "GET") - .header("timing-allow-origin", "https://mangadex.org") + .header("timing-allow-origin", "*") } } } diff --git a/src/main/kotlin/mdnet/server/crypto.kt b/src/main/kotlin/mdnet/server/crypto.kt index 04bb9f4..9f8e5ec 100644 --- a/src/main/kotlin/mdnet/server/crypto.kt +++ b/src/main/kotlin/mdnet/server/crypto.kt @@ -20,7 +20,7 @@ package mdnet.server import java.security.MessageDigest -fun md5Bytes(stringToHash: String) = +fun md5Bytes(stringToHash: String): ByteArray = MessageDigest.getInstance("MD5") .digest(stringToHash.toByteArray())