1
0
Fork 1
mirror of https://gitlab.com/mangadex-pub/mangadex_at_home.git synced 2024-01-19 02:48:37 +00:00

Clean up some code

This commit is contained in:
carbotaniuman 2020-07-01 14:56:31 -05:00
parent e4ce51be82
commit f77ed40b5b

View file

@ -85,7 +85,7 @@ class ImageServer(private val cache: DiskLruCache, private val statistics: Atomi
} + "/$chapterHash/$fileName" } + "/$chapterHash/$fileName"
if (LOGGER.isInfoEnabled) { if (LOGGER.isInfoEnabled) {
LOGGER.info("Request for $sanitizedUri received") LOGGER.info("Request for $sanitizedUri received from ${request.source?.address}")
} }
statistics.getAndUpdate { statistics.getAndUpdate {
it.copy(requestsServed = it.requestsServed + 1) it.copy(requestsServed = it.requestsServed + 1)
@ -105,10 +105,8 @@ class ImageServer(private val cache: DiskLruCache, private val statistics: Atomi
} }
} }
val referer = request.header("Referer")
handled.set(true) handled.set(true)
if (referer != null && !referer.startsWith("https://mangadex.org")) { if (request.header("Referer")?.startsWith("https://mangadex.org") == true) {
snapshot?.close() snapshot?.close()
Response(Status.FORBIDDEN) Response(Status.FORBIDDEN)
} else if (snapshot != null && imageDatum != null) { } else if (snapshot != null && imageDatum != null) {