Skip to content
This repository has been archived by the owner on Jul 23, 2020. It is now read-only.

Commit

Permalink
v 1.129
Browse files Browse the repository at this point in the history
  • Loading branch information
raulhaag committed Apr 23, 2020
1 parent 23bb90b commit 6471992
Show file tree
Hide file tree
Showing 11 changed files with 127 additions and 32 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
13 changes: 10 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -39,6 +39,10 @@ android {
signingConfig signingConfigs.debug
}
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
compileOptions.encoding = 'UTF-8'
flavorDimensions "builds"
productFlavors {
Expand Down Expand Up @@ -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*/
Expand Down
41 changes: 27 additions & 14 deletions app/src/androidTest/java/ar/rulosoft/mimanganu/testNine.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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.
*/
Expand All @@ -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 {
Expand All @@ -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("(<table class=\"highlight tab-size js-file-line-container\"[\\s\\S]+<\\/table>)", script, "error obteniendo script")).toString(), d);
}
if (!script.isEmpty())
scriptHelper = new JSServerHelper(context, script);
}

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -160,7 +160,7 @@ public ArrayList<Manga> 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/");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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");
Expand Down
4 changes: 1 addition & 3 deletions app/src/main/java/ar/rulosoft/navegadores/CFInterceptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -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("<input type=\"hidden\" name=\"r\" value=\"([^\"]*)");
private final static Pattern REPLACE_VALUE = Pattern.compile("visibility:hidden;\" id=\".+\">([^<]+)<");
private final static Pattern FORM_ACTION = Pattern.compile("action=\"([^\"]+)");
Expand All @@ -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();
Expand Down
41 changes: 38 additions & 3 deletions app/src/main/java/ar/rulosoft/navegadores/Navigator.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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);
}
Expand Down Expand Up @@ -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;
Expand All @@ -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())
Expand All @@ -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;
}

Expand Down
15 changes: 14 additions & 1 deletion app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="update_message">Cambios en v1.128:\n\t* Pequeños arreglos.</string>
<string name="update_message">Cambios en v1.129:\n\t* Fix cfi.\n\t* Agregado fr.ninemanga.\n\t* Opción para desabilitar el chequeo de certificados.
</string>
<string name="action_ajustar_a">Ajustar a</string>
<string name="descargas">Descargas</string>
<string name="datosde">Datos de </string>
Expand Down Expand Up @@ -466,5 +467,17 @@
<string name="device_dont_supported">Tu dispositivo no soporta esta función.</string>
<string name="restart">Reiniciar aplicación</string>
<string name="contact">Contactar al desarrollador</string>
<string name="clear_images_summary">Si estas necesitando espacio</string>
<string name="clear_images_title">Borrar la imagenes de todos los mangas</string>
<string name="deleting_all_images_message">Borrando imagenes, espera hasta el próximo mensaje.</string>
<string name="process_finished">Preceso terminado.</string>
<string name="are_you_sure">¿Estas seguro?</string>
<string name="accept_all_certs_title">Deshabilitar el chequeo de certificados</string>
<string name="accept_all_certs_summary">Si tienes una vesion vieja de android o un servidor tiene problemas.</string>
<string name="backup_dont_found">Backup no encotrado</string>
<string name="run_test">Correr test de servidores</string>
<string name="run_test_summary">Test basico sobre servidores.</string>
<string name="notification_channel_new">Nuevos mangas y actualizaciones.</string>
<string name="notification_channel_update">Buqueda de nuevos capítulos.</string>

</resources>
4 changes: 3 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="update_message">Changes on v1.128:\n\t* Small Fixes.</string>
<string name="update_message">Changes on v1.129:\n\t* Fix cfi.\n\t* Added fr.ninemanga.\n\t* Option to disable cert checks.</string>
<string name="_12hours">12 Hours</string>
<string name="_1day">1 day</string>
<string name="_2day">2 days</string>
Expand Down Expand Up @@ -514,5 +514,7 @@
<string name="deleting_all_images_message">Deleting all images please wait until next message.</string>
<string name="process_finished">Process finished.</string>
<string name="are_you_sure">Are you sure?</string>
<string name="accept_all_certs_title">Disable cert check</string>
<string name="accept_all_certs_summary">If you have old android and/or the server cert are\'t trusted (need restart)</string>

</resources>
5 changes: 5 additions & 0 deletions app/src/main/res/xml/fragment_preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
android:key="only_wifi"
android:summary="@string/use_only_wifi_subtitle"
android:title="@string/use_only_wifi_title" />
<androidx.preference.SwitchPreferenceCompat
android:defaultValue="false"
android:key="accept_all_certs"
android:summary="@string/accept_all_certs_summary"
android:title="@string/accept_all_certs_title" />
<ar.rulosoft.custompref.SeekBarCustomPreference
android:defaultValue="10"
android:dialogTitle="@string/connection_retry_title"
Expand Down
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ allprojects {
google()
jcenter()
maven { url "https://jitpack.io" }
maven {
url 'https://github.com/suckgamony/RapidDecoder/raw/master/repository'
}
}
// tasks.withType(JavaCompile) {
// options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
Expand Down

0 comments on commit 6471992

Please sign in to comment.