snowmtl: fix image intercept (#6474)

* fix image intercept

* bump version
This commit is contained in:
Cuong-Tran 2024-12-06 03:48:08 +07:00 committed by Draff
parent d04dc0e876
commit 23a4a22ad1
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
2 changed files with 6 additions and 3 deletions

View File

@ -1,7 +1,7 @@
ext {
extName = 'Snow Machine Translations'
extClass = '.Snowmtl'
extVersionCode = 1
extVersionCode = 2
isNsfw = true
}

View File

@ -48,7 +48,7 @@ class ComposedImageInterceptor(
val request = chain.request()
val url = request.url.toString()
val isPageImageUrl = url.contains("storage.${baseUrl.substringAfterLast("/")}", true)
val isPageImageUrl = url.contains("${baseUrl.substringAfterLast("/")}/storage/", true)
if (isPageImageUrl.not()) {
return chain.proceed(request)
}
@ -84,7 +84,10 @@ class ComposedImageInterceptor(
val output = ByteArrayOutputStream()
val format = when (url.substringAfterLast(".").lowercase()) {
val ext = url.substringBefore("#")
.substringAfterLast(".")
.lowercase()
val format = when (ext) {
"png" -> Bitmap.CompressFormat.PNG
"jpeg", "jpg" -> Bitmap.CompressFormat.JPEG
else -> Bitmap.CompressFormat.WEBP