From 64719928d85447fc75197861c066d730500f9310 Mon Sep 17 00:00:00 2001
From: raulhaag <2048339+raulhaag@users.noreply.github.com>
Date: Thu, 23 Apr 2020 15:10:37 -0300
Subject: [PATCH] v 1.129
---
README.md | 10 +++++
app/build.gradle | 13 ++++--
.../java/ar/rulosoft/mimanganu/testNine.java | 41 ++++++++++++-------
.../mimanganu/servers/TuMangaOnline.java | 6 +--
.../mimanganu/services/SingleDownload.java | 17 ++++++--
.../rulosoft/navegadores/CFInterceptor.java | 4 +-
.../ar/rulosoft/navegadores/Navigator.java | 41 +++++++++++++++++--
app/src/main/res/values-es/strings.xml | 15 ++++++-
app/src/main/res/values/strings.xml | 4 +-
app/src/main/res/xml/fragment_preferences.xml | 5 +++
build.gradle | 3 ++
11 files changed, 127 insertions(+), 32 deletions(-)
diff --git a/README.md b/README.md
index 68a670ba..dfc3a29b 100644
--- a/README.md
+++ b/README.md
@@ -49,6 +49,16 @@ Downloads
Changelog
---------
+Cambios en v1.129:
+* Fix cfi.
+* Agregado fr.ninemanga.
+* Opción para desabilitar el chequeo de certificados.
+
+Changes on v1.129:
+* Fix cfi.
+* Added fr.ninemanga.
+* Option to disable cert checks.
+
Cambios en v1.128:
* Pequeños arreglos.
diff --git a/app/build.gradle b/app/build.gradle
index f97ca19c..0ce45695 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -5,8 +5,8 @@ android {
buildToolsVersion '29.0.3'
defaultConfig {
applicationId "ar.rulosoft.mimanganu"
- versionCode 128
- versionName "1.128"
+ versionCode 129
+ versionName "1.129"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
minSdkVersion 15
}
@@ -39,6 +39,10 @@ android {
signingConfig signingConfigs.debug
}
}
+ compileOptions {
+ sourceCompatibility = 1.8
+ targetCompatibility = 1.8
+ }
compileOptions.encoding = 'UTF-8'
flavorDimensions "builds"
productFlavors {
@@ -83,7 +87,10 @@ dependencies {
implementation 'com.github.sevar83:indeterminate-checkbox:1.0.5@aar'
implementation group: 'org.brotli', name: 'dec', version: '0.1.2'
//implementation group: 'com.github.junrar', name: 'junrar', version: '4.0.0'
- implementation 'com.github.raulhaag:RapidDecoder:0.3.1Ax'
+ implementation 'rapid.decoder:library:0.3.0'
+ implementation 'rapid.decoder:jpeg-decoder:0.3.0'
+ implementation 'rapid.decoder:png-decoder:0.3.0'
+ //implementation 'com.github.raulhaag:RapidDecoder:0.3.1Ax'
implementation 'com.squareup.okhttp3:okhttp:3.9.1' //on 3.10.0 are deprecated some ciphers
implementation 'com.squareup.okio:okio:1.15.0'
implementation 'com.squareup.duktape:duktape-android:1.2.0'/* v 1.2.0 need 4+mb extra*/
diff --git a/app/src/androidTest/java/ar/rulosoft/mimanganu/testNine.java b/app/src/androidTest/java/ar/rulosoft/mimanganu/testNine.java
index 9e6a5867..f739e983 100644
--- a/app/src/androidTest/java/ar/rulosoft/mimanganu/testNine.java
+++ b/app/src/androidTest/java/ar/rulosoft/mimanganu/testNine.java
@@ -1,7 +1,6 @@
package ar.rulosoft.mimanganu;
import android.content.Context;
-import android.util.Log;
import androidx.test.filters.LargeTest;
import androidx.test.rule.ActivityTestRule;
@@ -13,10 +12,17 @@
import ar.rulosoft.mimanganu.componentes.Chapter;
import ar.rulosoft.mimanganu.componentes.Manga;
+import ar.rulosoft.mimanganu.servers.JSServerHelper;
+import ar.rulosoft.mimanganu.servers.TuMangaOnline;
+import ar.rulosoft.mimanganu.utils.Util;
import ar.rulosoft.navegadores.Navigator;
import okhttp3.Request;
import okio.Buffer;
+import static ar.rulosoft.mimanganu.servers.ServerBase.TUMANGAONLINE;
+import static ar.rulosoft.mimanganu.servers.ServerBase.getFirstMatch;
+import static ar.rulosoft.mimanganu.servers.ServerBase.getServer;
+
/**
* Created by Raul on 01/04/2017.
*/
@@ -28,6 +34,10 @@ public class testNine {
private Context context;
private Manga manga;
private Chapter chapter;
+ private String script;
+ private TuMangaOnline tmoServ = (TuMangaOnline) getServer(TUMANGAONLINE, context);
+ private JSServerHelper scriptHelper;
+
private static String bodyToString(final Request request){
try {
@@ -43,19 +53,22 @@ private static String bodyToString(final Request request){
@Test
public void testImages() throws Exception {
Navigator nav = Navigator.getInstance();
- nav.addHeader("Accept-Language", "es-AR,es;q=0.8,en-US;q=0.5,en;q=0.3");
- nav.addHeader("Accept-Encoding", "deflate");
- nav.addHeader("Accept","application/json, text/plain, */*");
- nav.addHeader("Accept-Encoding","gzip, deflate, br");
- nav.addHeader("Accept-Language","es-AR,es;q=0.8,en-US;q=0.5,en;q=0.3");
- nav.addHeader("Cache-mode","no-cache");
- //nav.addHeader("Connection","keep-alive");
- nav.addHeader("Cookie","__cfduid=d7025d17b59e189d890c2cc05b9feb5c31505483555; tmoSession=eyJpdiI6ImZXZUlPZjVWOGNKS2VCRkVcL1I3XC9iZz09IiwidmFsdWUiOiJ0MEhzdXF0XC93YkFvSkJlUnVvZ3hnN011WWtGUzdEdnJrY1ZOakhnTVRBTGJQZk91NmphTTFaNDhhbUozUnZnRmJndGtBdkNHZlFsTTFZT2RvSWlBSGc9PSIsIm1hYyI6ImMxODZmYmRkNTJiZTQ4YjUwZGQ0MTBkYTRlOWExNmU1NjM3YWFkMTA2MGJjNGJhMzMwOGY3NjY0YmFhMDIyMmIifQ%3D%3D");
- //nav.addHeader("Host","www.tumangaonline.com");
- nav.addHeader("Referer","https://www.tumangaonline.com/biblioteca");
- //nav.addHeader("User-Agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0");
- //nav.addHeader("X-Requested-With","XMLHttpRequest");
- Log.e("respuesta", nav.get("https://www.tumangaonline.com/api/v1/mangas/2968/capitulos?page=2&tomo=-1"));
+ checkScript();
+ scriptHelper.notifyAll();
+ }
+
+ private void checkScript() throws Exception {
+ if (scriptHelper == null) {
+ String d = " " + context.getString(R.string.factor_suffix).hashCode() + getServer(TUMANGAONLINE, context).getServerID() + TUMANGAONLINE;
+ try {
+ script = Util.xorDecode(tmoServ.getNavWithNeededHeaders().get("https://raw.githubusercontent.com/raulhaag/MiMangaNu/master/js_plugin/" + tmoServ.getServerID() + "_5.js"), d);
+ } catch (Exception e) {
+ script = tmoServ.getNavWithNeededHeaders().get("https://github.com/raulhaag/MiMangaNu/blob/master/js_plugin/" + tmoServ.getServerID() + "_5.js");
+ script = Util.xorDecode(Util.getInstance().fromHtml(getFirstMatch("(
)", script, "error obteniendo script")).toString(), d);
+ }
+ if (!script.isEmpty())
+ scriptHelper = new JSServerHelper(context, script);
+ }
}
diff --git a/app/src/main/java/ar/rulosoft/mimanganu/servers/TuMangaOnline.java b/app/src/main/java/ar/rulosoft/mimanganu/servers/TuMangaOnline.java
index df8c4879..7f110fb2 100644
--- a/app/src/main/java/ar/rulosoft/mimanganu/servers/TuMangaOnline.java
+++ b/app/src/main/java/ar/rulosoft/mimanganu/servers/TuMangaOnline.java
@@ -16,11 +16,11 @@
/**
* Created by Raul on 05/04/2016.
*/
-class TuMangaOnline extends ServerBase {
+public class TuMangaOnline extends ServerBase {
private static final String HOST = "https://tmofans.com";
public static String script = null;
- private JSServerHelper scriptHelper;
+ public JSServerHelper scriptHelper;
public static String[] type = new String[]{
"Todos", "Manga", "Manhua", "Manhwa", "Novela", "One Shot", "Dounjinshi", "Oel"
@@ -160,7 +160,7 @@ public ArrayList getMangasFiltered(int[][] filters, int pageNumber) throw
return scriptHelper.getMangasFiltered(filters, pageNumber);
}
- private Navigator getNavWithNeededHeaders() {
+ public Navigator getNavWithNeededHeaders() {
Navigator nav = getNavigatorAndFlushParameters();
nav.addHeader("Cache-mode", "no-cache");
nav.addHeader("Referer", HOST + "/library/manga/");
diff --git a/app/src/main/java/ar/rulosoft/mimanganu/services/SingleDownload.java b/app/src/main/java/ar/rulosoft/mimanganu/services/SingleDownload.java
index 2065ec87..765bf00d 100644
--- a/app/src/main/java/ar/rulosoft/mimanganu/services/SingleDownload.java
+++ b/app/src/main/java/ar/rulosoft/mimanganu/services/SingleDownload.java
@@ -11,6 +11,9 @@
import java.io.OutputStream;
import java.util.concurrent.TimeUnit;
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.SSLSession;
+
import ar.rulosoft.mimanganu.utils.PostProcess;
import ar.rulosoft.navegadores.Navigator;
import okhttp3.OkHttpClient;
@@ -84,9 +87,16 @@ public void run() {
copy = Navigator.getInstance().getHttpClient().newBuilder()
.connectTimeout(5, TimeUnit.SECONDS)
.readTimeout(20, TimeUnit.SECONDS)
+ .hostnameVerifier(new HostnameVerifier() {
+ @Override
+ public boolean verify(String hostname, SSLSession session) {
+ return true;
+ }
+ })
.build();
rBuilder = new Request.Builder()
- .addHeader("User-Agent", Navigator.USER_AGENT);
+ .addHeader("User-Agent", Navigator.USER_AGENT)
+ .addHeader("Connection", "keep-alive");
if (referer) {
if (inRef != null) {
rBuilder.addHeader("Referer", inRef);
@@ -103,9 +113,8 @@ public void run() {
changeStatus(Status.ERROR_CONNECTION);
}
retry = 0;
- if (!ot.delete()) {
- Log.e("SingleDownload", "failed to delete temporary file");
- }
+ //noinspection ResultOfMethodCallIgnored
+ ot.delete();
writeErrorImage(ot);
if (!ot.renameTo(o)) {
Log.e("SingleDownload", "failed to rename temporary file");
diff --git a/app/src/main/java/ar/rulosoft/navegadores/CFInterceptor.java b/app/src/main/java/ar/rulosoft/navegadores/CFInterceptor.java
index 77c7b0b9..4106de09 100644
--- a/app/src/main/java/ar/rulosoft/navegadores/CFInterceptor.java
+++ b/app/src/main/java/ar/rulosoft/navegadores/CFInterceptor.java
@@ -28,8 +28,6 @@
public class CFInterceptor implements Interceptor {
private final static Pattern OPERATION_PATTERN = Pattern.compile("setTimeout\\(function\\(\\)\\{\\s+(var .,.,.,.[\\s\\S]+?a\\.value = .+?;)", Pattern.DOTALL);
- private final static Pattern PASS_PATTERN = Pattern.compile("name=\"pass\" value=\"(.+?)\"", Pattern.DOTALL);
- private final static Pattern CHALLENGE_PATTERN = Pattern.compile("name=\"jschl_vc\" value=\"(\\w+)\"", Pattern.DOTALL);
private final static Pattern EXTRA_STRING_ADDED_PATTERN = Pattern.compile("([^<]+)<");
private final static Pattern FORM_ACTION = Pattern.compile("action=\"([^\"]+)");
@@ -52,7 +50,7 @@ public Response intercept(Chain chain) throws IOException {
return response;
}
- public Response resolveOverCF(Chain chain, Response response) throws IOException {
+ public synchronized Response resolveOverCF(Chain chain, Response response) throws IOException {
Request request = response.request();
String domain = request.url().host().trim();
String content = response.body().string();
diff --git a/app/src/main/java/ar/rulosoft/navegadores/Navigator.java b/app/src/main/java/ar/rulosoft/navegadores/Navigator.java
index 6f1c34b1..63cc23fb 100644
--- a/app/src/main/java/ar/rulosoft/navegadores/Navigator.java
+++ b/app/src/main/java/ar/rulosoft/navegadores/Navigator.java
@@ -29,7 +29,9 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
@@ -55,6 +57,7 @@ public class Navigator {
public static int writeTimeout = 10;
public static int readTimeout = 30;
public static int connectionRetry = 10;
+ private static boolean trustAll;
private static CookieJar cookieJar;
private static Navigator instance;
public OkHttpClient httpClient;
@@ -74,6 +77,7 @@ private Navigator(Context context) throws Exception {
connectionRetry = Integer.parseInt(prefs.getString("connection_retry", "10"));
readTimeout = Integer.parseInt(prefs.getString("read_timeout", "30"));
connectionTimeout = Integer.parseInt(prefs.getString("connection_timeout", "10"));
+ trustAll = prefs.getBoolean("accept_all_certs", false);
cookieJar = new CookieFilter(new SetCookieCache(), new SharedPrefsCookiePersistor(context));
initClient(cookieJar, context);
}
@@ -110,7 +114,28 @@ public static CookieJar getCookieJar() {
}
private void initClient(CookieJar cookieJar, Context context) throws KeyManagementException, NoSuchAlgorithmException {
- TrustManager[] trustManagers = getTrustManagers(context);
+ TrustManager[] trustManagers;
+ if (trustAll) {
+ trustManagers = new TrustManager[]{
+ new X509TrustManager() {
+ @Override
+ public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException {
+ }
+
+ @Override
+ public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException {
+ }
+
+ @Override
+ public java.security.cert.X509Certificate[] getAcceptedIssuers() {
+ return new java.security.cert.X509Certificate[]{};
+ }
+ }
+ };
+ } else {
+ trustManagers = getTrustManagers(context);
+ }
+
SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(null, trustManagers, null);
SSLSocketFactory socketFactory = null;
@@ -119,7 +144,8 @@ private void initClient(CookieJar cookieJar, Context context) throws KeyManageme
} else {
socketFactory = sslContext.getSocketFactory();
}
- httpClient = new OkHttpClientConnectionChecker.Builder()
+
+ OkHttpClientConnectionChecker.Builder cBuilder = new OkHttpClientConnectionChecker.Builder()
.addInterceptor(new UncompressInterceptor())
.addInterceptor(new RetryInterceptor())// the interceptors list appear to be a lifo
.addInterceptor(new CFInterceptor())
@@ -129,7 +155,16 @@ private void initClient(CookieJar cookieJar, Context context) throws KeyManageme
.readTimeout(30, TimeUnit.SECONDS)
.cookieJar(cookieJar)
//.dns(new MmNDNS())//
- .build();
+ ;
+ if (trustAll) {
+ cBuilder.hostnameVerifier(new HostnameVerifier() {
+ @Override
+ public boolean verify(String hostname, SSLSession session) {
+ return true;
+ }
+ });
+ }
+ httpClient = cBuilder.build();
Navigator.cookieJar = cookieJar;
}
diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml
index 7b40b532..8c02fdac 100644
--- a/app/src/main/res/values-es/strings.xml
+++ b/app/src/main/res/values-es/strings.xml
@@ -1,6 +1,7 @@
- Cambios en v1.128:\n\t* Pequeños arreglos.
+ Cambios en v1.129:\n\t* Fix cfi.\n\t* Agregado fr.ninemanga.\n\t* Opción para desabilitar el chequeo de certificados.
+
Ajustar a
Descargas
Datos de
@@ -466,5 +467,17 @@
Tu dispositivo no soporta esta función.
Reiniciar aplicación
Contactar al desarrollador
+ Si estas necesitando espacio
+ Borrar la imagenes de todos los mangas
+ Borrando imagenes, espera hasta el próximo mensaje.
+ Preceso terminado.
+ ¿Estas seguro?
+ Deshabilitar el chequeo de certificados
+ Si tienes una vesion vieja de android o un servidor tiene problemas.
+ Backup no encotrado
+ Correr test de servidores
+ Test basico sobre servidores.
+ Nuevos mangas y actualizaciones.
+ Buqueda de nuevos capítulos.
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index c9c9929c..b512103e 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,6 +1,6 @@
- Changes on v1.128:\n\t* Small Fixes.
+ Changes on v1.129:\n\t* Fix cfi.\n\t* Added fr.ninemanga.\n\t* Option to disable cert checks.
12 Hours
1 day
2 days
@@ -514,5 +514,7 @@
Deleting all images please wait until next message.
Process finished.
Are you sure?
+ Disable cert check
+ If you have old android and/or the server cert are\'t trusted (need restart)
diff --git a/app/src/main/res/xml/fragment_preferences.xml b/app/src/main/res/xml/fragment_preferences.xml
index 68fd32aa..c95fa479 100644
--- a/app/src/main/res/xml/fragment_preferences.xml
+++ b/app/src/main/res/xml/fragment_preferences.xml
@@ -34,6 +34,11 @@
android:key="only_wifi"
android:summary="@string/use_only_wifi_subtitle"
android:title="@string/use_only_wifi_title" />
+