snowmtl: fix image intercept (#6474)
* fix image intercept * bump version
This commit is contained in:
parent
d04dc0e876
commit
23a4a22ad1
|
@ -1,7 +1,7 @@
|
||||||
ext {
|
ext {
|
||||||
extName = 'Snow Machine Translations'
|
extName = 'Snow Machine Translations'
|
||||||
extClass = '.Snowmtl'
|
extClass = '.Snowmtl'
|
||||||
extVersionCode = 1
|
extVersionCode = 2
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ class ComposedImageInterceptor(
|
||||||
val request = chain.request()
|
val request = chain.request()
|
||||||
val url = request.url.toString()
|
val url = request.url.toString()
|
||||||
|
|
||||||
val isPageImageUrl = url.contains("storage.${baseUrl.substringAfterLast("/")}", true)
|
val isPageImageUrl = url.contains("${baseUrl.substringAfterLast("/")}/storage/", true)
|
||||||
if (isPageImageUrl.not()) {
|
if (isPageImageUrl.not()) {
|
||||||
return chain.proceed(request)
|
return chain.proceed(request)
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,10 @@ class ComposedImageInterceptor(
|
||||||
|
|
||||||
val output = ByteArrayOutputStream()
|
val output = ByteArrayOutputStream()
|
||||||
|
|
||||||
val format = when (url.substringAfterLast(".").lowercase()) {
|
val ext = url.substringBefore("#")
|
||||||
|
.substringAfterLast(".")
|
||||||
|
.lowercase()
|
||||||
|
val format = when (ext) {
|
||||||
"png" -> Bitmap.CompressFormat.PNG
|
"png" -> Bitmap.CompressFormat.PNG
|
||||||
"jpeg", "jpg" -> Bitmap.CompressFormat.JPEG
|
"jpeg", "jpg" -> Bitmap.CompressFormat.JPEG
|
||||||
else -> Bitmap.CompressFormat.WEBP
|
else -> Bitmap.CompressFormat.WEBP
|
||||||
|
|
Loading…
Reference in New Issue