Madara: fix app crash and some sources fixes (#1398)
* Madara: fix crash * fix NPE in ImperioDaBritannia * mangalek use LoadMore * update title selector
This commit is contained in:
		
							parent
							
								
									678c3de899
								
							
						
					
					
						commit
						014ee88bbb
					
				@ -2,7 +2,7 @@ plugins {
 | 
			
		||||
    id("lib-multisrc")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
baseVersionCode = 34
 | 
			
		||||
baseVersionCode = 35
 | 
			
		||||
 | 
			
		||||
dependencies {
 | 
			
		||||
    api(project(":lib:cryptoaes"))
 | 
			
		||||
 | 
			
		||||
@ -723,7 +723,7 @@ abstract class Madara(
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Manga Details Selector
 | 
			
		||||
    open val mangaDetailsSelectorTitle = "div.post-title h3, div.post-title h1"
 | 
			
		||||
    open val mangaDetailsSelectorTitle = "div.post-title h3, div.post-title h1, #manga-title > h1"
 | 
			
		||||
    open val mangaDetailsSelectorAuthor = "div.author-content > a"
 | 
			
		||||
    open val mangaDetailsSelectorArtist = "div.artist-content > a"
 | 
			
		||||
    open val mangaDetailsSelectorStatus = "div.summary-content"
 | 
			
		||||
@ -989,8 +989,7 @@ abstract class Madara(
 | 
			
		||||
            .substringAfter("var manga = ")
 | 
			
		||||
            .substringBeforeLast(";")
 | 
			
		||||
 | 
			
		||||
        val wpManga = runCatching { json.parseToJsonElement(wpMangaInfo).jsonObject }
 | 
			
		||||
            .getOrNull() ?: return null
 | 
			
		||||
        val wpManga = json.parseToJsonElement(wpMangaInfo).jsonObject
 | 
			
		||||
 | 
			
		||||
        if (wpManga["enable_manga_view"]?.jsonPrimitive?.content == "1") {
 | 
			
		||||
            val formBuilder = FormBody.Builder()
 | 
			
		||||
@ -1007,9 +1006,7 @@ abstract class Madara(
 | 
			
		||||
                .set("Referer", document.location())
 | 
			
		||||
                .build()
 | 
			
		||||
 | 
			
		||||
            val ajaxUrl = wpManga["ajax_url"]!!.jsonPrimitive.content
 | 
			
		||||
 | 
			
		||||
            return POST(ajaxUrl, newHeaders, formBody)
 | 
			
		||||
            return POST("$baseUrl/wp-admin/admin-ajax.php", newHeaders, formBody)
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return null
 | 
			
		||||
@ -1020,13 +1017,15 @@ abstract class Madara(
 | 
			
		||||
     *
 | 
			
		||||
     * @param document The response document with the wp-manga data
 | 
			
		||||
     */
 | 
			
		||||
    protected open fun countViews(document: Document) {
 | 
			
		||||
    protected fun countViews(document: Document) {
 | 
			
		||||
        if (!sendViewCount) {
 | 
			
		||||
            return
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        val request = countViewsRequest(document) ?: return
 | 
			
		||||
        runCatching { client.newCall(request).execute().close() }
 | 
			
		||||
        try {
 | 
			
		||||
            val request = countViewsRequest(document) ?: return
 | 
			
		||||
            client.newCall(request).execute().close()
 | 
			
		||||
        } catch (_: Exception) { }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 | 
			
		||||
@ -31,7 +31,7 @@ class Mangalek :
 | 
			
		||||
    ConfigurableSource {
 | 
			
		||||
 | 
			
		||||
    override val fetchGenres = false
 | 
			
		||||
 | 
			
		||||
    override val useLoadMoreRequest = LoadMoreStrategy.Always
 | 
			
		||||
    override val chapterUrlSuffix = ""
 | 
			
		||||
 | 
			
		||||
    private val defaultBaseUrl = "https://manga-lek.net"
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								src/pt/imperiodabritannia/res/mipmap-hdpi/ic_launcher.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								src/pt/imperiodabritannia/res/mipmap-hdpi/ic_launcher.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 7.0 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								src/pt/imperiodabritannia/res/mipmap-mdpi/ic_launcher.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								src/pt/imperiodabritannia/res/mipmap-mdpi/ic_launcher.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 3.6 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								src/pt/imperiodabritannia/res/mipmap-xhdpi/ic_launcher.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								src/pt/imperiodabritannia/res/mipmap-xhdpi/ic_launcher.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 10 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								src/pt/imperiodabritannia/res/mipmap-xxhdpi/ic_launcher.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								src/pt/imperiodabritannia/res/mipmap-xxhdpi/ic_launcher.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 20 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								src/pt/imperiodabritannia/res/mipmap-xxxhdpi/ic_launcher.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								src/pt/imperiodabritannia/res/mipmap-xxxhdpi/ic_launcher.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 30 KiB  | 
@ -19,6 +19,5 @@ class ImperioDaBritannia : Madara(
 | 
			
		||||
        .build()
 | 
			
		||||
 | 
			
		||||
    override val useNewChapterEndpoint = true
 | 
			
		||||
 | 
			
		||||
    override val mangaDetailsSelectorTag = ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user