Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "android-stackblur"]
path = android-stackblur
url=https://github.com/hotpro/android-stackblur.git
url=https://github.com/kikoso/android-stackblur.git
2 changes: 1 addition & 1 deletion android-stackblur
Submodule android-stackblur updated 127 files
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
classpath 'com.android.tools.build:gradle:1.5.0'
}
}

Expand Down
5 changes: 4 additions & 1 deletion ehreader/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ android {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/maven/commons-io/commons-io/pom.xml'
exclude 'META-INF/maven/commons-io/commons-io/pom.properties'
}
}

Expand All @@ -65,7 +68,7 @@ dependencies {
compile 'org.apache.httpcomponents:httpcore:4.4'
compile 'org.apache.httpcomponents:httpmime:4.3.6'
compile 'com.jakewharton:butterknife:6.0.0'
compile 'org.apache.commons:commons-io:1.3.2'
compile 'commons-io:commons-io:1.3.2'
compile 'com.edmodo:cropper:1.0.1'
compile project(':android-stackblur:StackBlur')
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.1'
Expand Down
4 changes: 0 additions & 4 deletions ehreader/proguard-rules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@
public static final android.os.Parcelable$Creator *;
}

## External JARs
-libraryjars libs/libGoogleAnalyticsServices.jar
-libraryjars libs/GoogleAdMobAdsSdk-6.4.1.jar

## Butterknife
-dontwarn butterknife.internal.**
-keep class **$$ViewInjector { *; }
Expand Down
1 change: 1 addition & 0 deletions ehreader/res/values/strings_pref.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<string name="pref_login_memberid" translatable="false">login_memberid</string>
<string name="pref_login_passhash" translatable="false">login_passhash</string>
<string name="pref_login_sessionid" translatable="false">login_sessionid</string>
<string name="pref_login_igneous" translatable="false">login_igneous</string>

// View
<string name="pref_view_title">View</string>
Expand Down
26 changes: 26 additions & 0 deletions ehreader/src/tw/skyarrow/ehreader/BaseApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.app.Application;
import android.content.SharedPreferences;
import android.net.Uri;
import android.preference.PreferenceManager;

import com.google.analytics.tracking.android.ExceptionReporter;
Expand All @@ -10,12 +11,17 @@
import com.google.analytics.tracking.android.Tracker;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.download.BaseImageDownloader;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;

import tw.skyarrow.ehreader.util.DownloadHelper;
import tw.skyarrow.ehreader.util.UpdateHelper;

import static tw.skyarrow.ehreader.Constant.*;

/**
* Created by SkyArrow on 2014/1/25.
*/
Expand Down Expand Up @@ -59,6 +65,26 @@ public static Tracker getTracker() {

private void initImageLoader() {
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
.imageDownloader(new BaseImageDownloader(getApplicationContext()) {
protected static final String ALLOWED_URI_CHARS = ";@#&=*+-_.,:!?()/~'%";

@Override
protected HttpURLConnection createConnection(String url, Object extra) throws IOException {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
String memberId = preferences.getString(context.getString(R.string.pref_login_memberid), "");
String passhash = preferences.getString(context.getString(R.string.pref_login_passhash), "");
String igneous = preferences.getString(context.getString(R.string.pref_login_igneous), "");
String encodedUrl = Uri.encode(url, ALLOWED_URI_CHARS);
HttpURLConnection conn = (HttpURLConnection) new URL(encodedUrl).openConnection();
conn.setConnectTimeout(connectTimeout);
conn.setReadTimeout(readTimeout);
conn.setRequestProperty("Cookie", String.format("%s=%s; %s=%s; %s=%s;",
IPB_MEMBER_ID, memberId,
IPB_PASS_HASH, passhash,
IGNEOUS, igneous));
return conn;
}
})
.build();

ImageLoader.getInstance().init(config);
Expand Down
30 changes: 18 additions & 12 deletions ehreader/src/tw/skyarrow/ehreader/Constant.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,33 @@
* Created by SkyArrow on 2014/1/25.
*/
public class Constant {
public static final String API_URL = "http://g.e-hentai.org/api.php";
public static final String API_URL_EX = "http://exhentai.org/api.php";
public static final String API_URL = "https://e-hentai.org/api.php";
public static final String API_URL_EX = "https://exhentai.org/api.php";

public static final String BASE_URL = "http://g.e-hentai.org";
public static final String BASE_URL_EX = "http://exhentai.org";
public static final String BASE_URL = "https://e-hentai.org";
public static final String BASE_URL_EX = "https://exhentai.org";

public static final String GALLERY_URL = "http://g.e-hentai.org/g/%d/%s";
public static final String GALLERY_URL_EX = "http://exhentai.org/g/%d/%s";
public static final String GALLERY_URL = "https://e-hentai.org/g/%d/%s";
public static final String GALLERY_URL_EX = "https://exhentai.org/g/%d/%s";

public static final String PHOTO_URL = "http://g.e-hentai.org/s/%s/%d-%d";
public static final String PHOTO_URL_EX = "http://exhentai.org/s/%s/%d-%d";
public static final String PHOTO_URL = "https://e-hentai.org/s/%s/%d-%d";
public static final String PHOTO_URL_EX = "https://exhentai.org/s/%s/%d-%d";

public static final String IMAGE_SEARCH_URL = "http://ul.e-hentai.org/image_lookup.php";
public static final String IMAGE_SEARCH_URL_EX = "http://ul.exhentai.org/image_lookup.php";
public static final String IMAGE_SEARCH_URL = "https://ul.e-hentai.org/image_lookup.php";
public static final String IMAGE_SEARCH_URL_EX = "https://ul.exhentai.org/image_lookup.php";

public static final String HATHDL_URL = "http://g.e-hentai.org/hathdler.php?gid=%d&t=%s";
public static final String THUMBNAIL_URL = "http://ehgt.org/t/%s/%s/%s_l.jpg";
public static final String HATHDL_URL = "https://e-hentai.org/hathdler.php?gid=%d&t=%s";
public static final String THUMBNAIL_URL = "https://ehgt.org/t/%s/%s/%s_l.jpg";

public static final int PHOTO_PER_PAGE = 40;
public static final String FOLDER_NAME = "ehreader";

public static final String AUTHOR_PAGE = "https://twitter.com/tommy351";
public static final String HOMEPAGE = "https://github.com/tommy351/ehreader-android";

public static final String IPB_MEMBER_ID = "ipb_member_id";
public static final String IPB_PASS_HASH = "ipb_pass_hash";
public static final String IPB_SESSION_ID = "ipb_session_id";
public static final String IGNEOUS = "igneous";

}
30 changes: 21 additions & 9 deletions ehreader/src/tw/skyarrow/ehreader/api/DataLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.client.protocol.ClientContext;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.conn.ssl.X509HostnameVerifier;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.impl.client.DefaultHttpClient;
Expand All @@ -30,6 +33,8 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.net.ssl.HostnameVerifier;

import de.greenrobot.dao.query.QueryBuilder;
import tw.skyarrow.ehreader.Constant;
import tw.skyarrow.ehreader.R;
Expand All @@ -44,6 +49,8 @@
import tw.skyarrow.ehreader.util.L;
import tw.skyarrow.ehreader.util.LoginHelper;

import static tw.skyarrow.ehreader.Constant.*;

/**
* Created by SkyArrow on 2014/2/19.
*/
Expand All @@ -55,15 +62,11 @@ public class DataLoader {
private HttpContext httpContext;
private LoginHelper loginHelper;

private static final String IPB_MEMBER_ID = "ipb_member_id";
private static final String IPB_PASS_HASH = "ipb_pass_hash";
private static final String IPB_SESSION_ID = "ipb_session_id";

public static final Pattern pGalleryUrl = Pattern.compile("http://(g\\.e-|ex)hentai\\.org/g/(\\d+)/(\\w+)");
public static final Pattern pPhotoUrl = Pattern.compile("http://(g\\.e-|ex)hentai\\.org/s/(\\w+?)/(\\d+)-(\\d+)");
public static final Pattern pGalleryUrl = Pattern.compile("https://(e-|ex)hentai\\.org/g/(\\d+)/(\\w+)");
public static final Pattern pPhotoUrl = Pattern.compile("https://(e-|ex)hentai\\.org/s/(\\w+?)/(\\d+)-(\\d+)");
public static final Pattern pShowkey = Pattern.compile("var showkey.*=.*\"([\\w-]+?)\";");
public static final Pattern pImageSrc = Pattern.compile("<img id=\"img\" src=\"(.+)/(.+?)\"");
public static final Pattern pGalleryURL = Pattern.compile("<a href=\"http://(g\\.e-|ex)hentai\\.org/g/(\\d+)/(\\w+)/\" onmouseover");
public static final Pattern pGalleryURL = Pattern.compile("<a href=\"https://(e-|ex)hentai\\.org/g/(\\d+)/(\\w+)/\" onmouseover");

private DataLoader(Context context) {
this.context = context;
Expand Down Expand Up @@ -111,7 +114,7 @@ private Cookie(String name, String value, boolean loggedIn) {
super(name, value);

setPath("/");
setDomain(loggedIn ? "exhentai.org" : "e-hentai.org");
setDomain(loggedIn ? ".exhentai.org" : ".e-hentai.org");
}
}

Expand All @@ -125,7 +128,16 @@ public HttpContext getHttpContext() {

private HttpResponse getHttpResponse(HttpRequestBase httpRequest) throws IOException {
HttpClient httpClient = new DefaultHttpClient();

SSLSocketFactory sslsf;
try {
HostnameVerifier hostnameVerifier = org.apache.http.conn.ssl.SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER;
sslsf = SSLSocketFactory.getSocketFactory();
sslsf.setHostnameVerifier((X509HostnameVerifier) hostnameVerifier);
} catch (Exception e) {
return null;
}
Scheme https = new Scheme("https", sslsf, 443);
httpClient.getConnectionManager().getSchemeRegistry().register(https);
return httpClient.execute(httpRequest, httpContext);
}

Expand Down
10 changes: 10 additions & 0 deletions ehreader/src/tw/skyarrow/ehreader/util/LoginHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import tw.skyarrow.ehreader.R;
import tw.skyarrow.ehreader.event.LoginEvent;

import static tw.skyarrow.ehreader.Constant.IGNEOUS;

/**
* Created by SkyArrow on 2014/3/3.
*/
Expand All @@ -46,6 +48,7 @@ public class LoginHelper {
private String PREF_LOGIN_MEMBERID;
private String PREF_LOGIN_PASSHASH;
private String PREF_LOGIN_SESSIONID;
private String PREF_LOGIN_IGNEOUS;

private LoginHelper(Context context) {
this.context = context;
Expand All @@ -55,6 +58,7 @@ private LoginHelper(Context context) {
PREF_LOGIN_MEMBERID = context.getString(R.string.pref_login_memberid);
PREF_LOGIN_PASSHASH = context.getString(R.string.pref_login_passhash);
PREF_LOGIN_SESSIONID = context.getString(R.string.pref_login_sessionid);
PREF_LOGIN_IGNEOUS = "login_igneous";
}

public static LoginHelper getInstance(Context context) {
Expand Down Expand Up @@ -89,6 +93,7 @@ public boolean login(String username, String password) throws IOException {
String memberId = "";
String passHash = "";
String sessionId = "";
String igneous = "";

for (Cookie cookie : cookies) {
L.d("Cookie: {name: %s, value: %s}", cookie.getName(), cookie.getValue());
Expand All @@ -99,6 +104,8 @@ public boolean login(String username, String password) throws IOException {
passHash = cookie.getValue();
} else if (cookie.getName().equals(IPB_SESSION_ID)) {
sessionId = cookie.getValue();
} else if (cookie.getName().equals(IGNEOUS)) {
igneous = cookie.getValue();
}
}

Expand All @@ -113,6 +120,7 @@ public boolean login(String username, String password) throws IOException {
editor.putString(PREF_LOGIN_MEMBERID, memberId);
editor.putString(PREF_LOGIN_PASSHASH, passHash);
editor.putString(PREF_LOGIN_SESSIONID, sessionId);
editor.putString(PREF_LOGIN_IGNEOUS, igneous);
editor.commit();

EventBus.getDefault().post(new LoginEvent(LoginEvent.LOGIN));
Expand All @@ -125,6 +133,8 @@ public void logout() {
editor.putBoolean(PREF_LOGGED_IN, false);
editor.remove(PREF_LOGIN_MEMBERID);
editor.remove(PREF_LOGIN_PASSHASH);
editor.remove(PREF_LOGIN_SESSIONID);
editor.remove(PREF_LOGIN_IGNEOUS);
editor.commit();

EventBus.getDefault().post(new LoginEvent(LoginEvent.LOGOUT));
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat Feb 08 14:00:41 CST 2014
#Sat Sep 01 16:37:06 CST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip