snowmtl: fix image intercept (#6474)
* fix image intercept * bump version
This commit is contained in:
		
							parent
							
								
									d04dc0e876
								
							
						
					
					
						commit
						23a4a22ad1
					
				@ -1,7 +1,7 @@
 | 
			
		||||
ext {
 | 
			
		||||
    extName = 'Snow Machine Translations'
 | 
			
		||||
    extClass = '.Snowmtl'
 | 
			
		||||
    extVersionCode = 1
 | 
			
		||||
    extVersionCode = 2
 | 
			
		||||
    isNsfw = true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user