diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..6560a98
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 0000000..797acea
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index ef9a0c1..0932045 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -200,6 +200,10 @@ dependencies {
//SwipeBackLayout
implementation 'me.imid.swipebacklayout.lib:library:1.1.0'
+
+ //JS
+ //noinspection GradleDependency
+ implementation 'com.github.gedoor:rhino-android:1.3'
}
greendao {
diff --git a/app/src/main/java/xyz/fycz/myreader/application/App.java b/app/src/main/java/xyz/fycz/myreader/application/App.java
index 096fcd4..3536e01 100644
--- a/app/src/main/java/xyz/fycz/myreader/application/App.java
+++ b/app/src/main/java/xyz/fycz/myreader/application/App.java
@@ -71,11 +71,13 @@ public class App extends Application {
private static final Handler handler = new Handler();
private static App application;
private ExecutorService mFixedThreadPool;
+ private static boolean debug;
@Override
public void onCreate() {
super.onCreate();
application = this;
+ debug = isApkInDebug(this);
firstInit();
HttpUtil.trustAllHosts();//信任所有证书
RxJavaPlugins.setErrorHandler(Functions.emptyConsumer());
@@ -159,12 +161,7 @@ public class App extends Application {
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
- HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
- @Override
- public boolean verify(String hostname, SSLSession session) {
- return true;
- }
- });
+ HttpsURLConnection.setDefaultHostnameVerifier((hostname, session) -> true);
} catch (Exception ignored) {
}
}
@@ -288,7 +285,7 @@ public class App extends Application {
App.getApplication().newThread(() -> {
try {
String url = "https://shimo.im/docs/cqkgjPRRydYYhQKt/read";
- if (isApkInDebug(getmContext())) {
+ if (getApplication().debug) {
url = "https://shimo.im/docs/zfzpda7MUGskOC9v/read";
}
String html = OkHttpUtils.getHtml(url);
@@ -514,4 +511,8 @@ public class App extends Application {
}
return null;
}
+
+ public static boolean isDebug() {
+ return debug;
+ }
}
diff --git a/app/src/main/java/xyz/fycz/myreader/application/TrustAllCerts.java b/app/src/main/java/xyz/fycz/myreader/application/TrustAllCerts.java
deleted file mode 100644
index d6d62ad..0000000
--- a/app/src/main/java/xyz/fycz/myreader/application/TrustAllCerts.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package xyz.fycz.myreader.application;
-
-import java.security.cert.X509Certificate;
-
-import javax.net.ssl.X509TrustManager;
-
-public class TrustAllCerts implements X509TrustManager {
- @Override
- public void checkClientTrusted(X509Certificate[] chain, String authType) {}
-
- @Override
- public void checkServerTrusted(X509Certificate[] chain, String authType) {}
-
- @Override
- public X509Certificate[] getAcceptedIssuers() {return new X509Certificate[0];}
-}
diff --git a/app/src/main/java/xyz/fycz/myreader/common/APPCONST.java b/app/src/main/java/xyz/fycz/myreader/common/APPCONST.java
index 776bc5a..171e40f 100644
--- a/app/src/main/java/xyz/fycz/myreader/common/APPCONST.java
+++ b/app/src/main/java/xyz/fycz/myreader/common/APPCONST.java
@@ -2,10 +2,18 @@ package xyz.fycz.myreader.common;
import android.os.Environment;
+import com.google.gson.reflect.TypeToken;
+
import xyz.fycz.myreader.R;
import xyz.fycz.myreader.util.utils.FileUtils;
import java.io.File;
+import java.lang.reflect.Type;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
public class APPCONST {
@@ -103,4 +111,13 @@ public class APPCONST {
public static final String DEFAULT_WEB_DAV_URL = "https://dav.jianguoyun.com/dav/";
+
+ public static Type MAP_STRING = new TypeToken