Dmzj - encode imageUrl requests (#3474)
This commit is contained in:
		
							parent
							
								
									6ab30f8e2c
								
							
						
					
					
						commit
						b1a4cd44b5
					
				@ -5,7 +5,7 @@ ext {
 | 
			
		||||
    appName = 'Tachiyomi: Dmzj'
 | 
			
		||||
    pkgNameSuffix = 'zh.dmzj'
 | 
			
		||||
    extClass = '.Dmzj'
 | 
			
		||||
    extVersionCode = 8
 | 
			
		||||
    extVersionCode = 9
 | 
			
		||||
    libVersion = '1.2'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -9,6 +9,7 @@ import eu.kanade.tachiyomi.source.model.Page
 | 
			
		||||
import eu.kanade.tachiyomi.source.model.SChapter
 | 
			
		||||
import eu.kanade.tachiyomi.source.model.SManga
 | 
			
		||||
import eu.kanade.tachiyomi.source.online.HttpSource
 | 
			
		||||
import java.net.URLEncoder
 | 
			
		||||
import java.util.ArrayList
 | 
			
		||||
import okhttp3.Request
 | 
			
		||||
import okhttp3.Response
 | 
			
		||||
@ -179,6 +180,16 @@ class Dmzj : HttpSource() {
 | 
			
		||||
        return ret
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private fun String.encoded(): String {
 | 
			
		||||
        return this.chunked(1)
 | 
			
		||||
            .joinToString("") { if (it in setOf("%", " ", "+", "#")) URLEncoder.encode(it, "UTF-8") else it }
 | 
			
		||||
            .let { if (it.endsWith(".jp")) "${it}g" else it }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    override fun imageRequest(page: Page): Request {
 | 
			
		||||
        return GET(page.imageUrl!!.encoded(), headers)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Unused, we can get image urls directly from the chapter page
 | 
			
		||||
    override fun imageUrlParse(response: Response) =
 | 
			
		||||
            throw UnsupportedOperationException("This method should not be called!")
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user