Skip to content
This repository has been archived by the owner on Aug 26, 2019. It is now read-only.

Commit

Permalink
Rename XXX_G to XXX_E
Browse files Browse the repository at this point in the history
  • Loading branch information
seven332 committed Jan 24, 2017
1 parent 92490ca commit 636c011
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/com/hippo/ehviewer/EhApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ private void update() {
Settings.putGuideGallery(true);
}
if (version < 56) { // Make cookie long live
HttpUrl eUrl = HttpUrl.parse(EhUrl.HOST_G);
HttpUrl eUrl = HttpUrl.parse(EhUrl.HOST_E);
HttpUrl exUrl = HttpUrl.parse(EhUrl.HOST_EX);
EhCookieStore cookieStore = getEhCookieStore(this);

Expand Down
10 changes: 5 additions & 5 deletions app/src/main/java/com/hippo/ehviewer/client/EhCookieStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class EhCookieStore extends CookieDBStore {
new Cookie.Builder()
.name(EhConfig.KEY_CONTENT_WARNING)
.value(EhConfig.CONTENT_WARNING_NOT_SHOW)
.domain(EhUrl.DOMAIN_G)
.domain(EhUrl.DOMAIN_E)
.path("/")
.expiresAt(Long.MAX_VALUE)
.build();
Expand Down Expand Up @@ -83,8 +83,8 @@ public List<Cookie> loadForRequest(HttpUrl url, Request request) {
Object tag = request.tag();
String host = url.host();

boolean checkTips = domainMatch(host, EhUrl.DOMAIN_G);
boolean checkUconfig = (domainMatch(host, EhUrl.DOMAIN_G) || domainMatch(host, EhUrl.DOMAIN_EX)) && tag instanceof EhConfig;
boolean checkTips = domainMatch(host, EhUrl.DOMAIN_E);
boolean checkUconfig = (domainMatch(host, EhUrl.DOMAIN_E) || domainMatch(host, EhUrl.DOMAIN_EX)) && tag instanceof EhConfig;

if (checkTips || checkUconfig) {
List<Cookie> result = new ArrayList<>(cookies.size() + 1);
Expand Down Expand Up @@ -125,11 +125,11 @@ public void saveFromResponse(HttpUrl url, List<Cookie> cookies) {
List<Cookie> result = new ArrayList<>(cookies.size() + 2);

for (Cookie cookie: cookies) {
if (EhUrl.DOMAIN_G.equals(cookie.domain())) {
if (EhUrl.DOMAIN_E.equals(cookie.domain())) {
// Save id and hash for exhentai
if (KEY_IPD_MEMBER_ID.equals(cookie.name()) ||
KEY_IPD_PASS_HASH.equals(cookie.name())) {
result.add(newCookie(cookie, EhUrl.DOMAIN_G, true, true, true));
result.add(newCookie(cookie, EhUrl.DOMAIN_E, true, true, true));
result.add(newCookie(cookie, EhUrl.DOMAIN_EX, true, true, true));
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/hippo/ehviewer/client/EhEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ public static Pair<String, String>[] getTorrentList(@Nullable EhClient.Task task

public static List<GalleryInfo> getWhatsHot(@Nullable EhClient.Task task,
OkHttpClient okHttpClient) throws Exception {
String url = EhUrl.HOST_G;
String url = EhUrl.HOST_E;
Log.d(TAG, url);
Request request = new EhRequestBuilder(url, null != task ? task.getEhConfig() : Settings.getEhConfig()).build();
Call call = okHttpClient.newCall(request);
Expand Down
34 changes: 17 additions & 17 deletions app/src/main/java/com/hippo/ehviewer/client/EhUrl.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,31 @@

public class EhUrl {

public static final int SITE_G = 0;
public static final int SITE_E = 0;
public static final int SITE_EX = 1;

public static final String DOMAIN_EX = "exhentai.org";
public static final String DOMAIN_G = "e-hentai.org";
public static final String DOMAIN_E = "e-hentai.org";
public static final String DOMAIN_LOFI = "lofi.e-hentai.org";

public static final String HOST_EX = "https://" + DOMAIN_EX + "/";
public static final String HOST_G = "https://" + DOMAIN_G + "/";
public static final String HOST_E = "https://" + DOMAIN_E + "/";

public static final String API_SIGN_IN = "https://forums.e-hentai.org/index.php?act=Login&CODE=01";

public static final String API_G = HOST_G + "api.php";
public static final String API_E = HOST_E + "api.php";
public static final String API_EX = HOST_EX + "api.php";

public static final String URL_IMAGE_SEARCH_G = "https://upload.e-hentai.org/image_lookup.php";
public static final String URL_IMAGE_SEARCH_E = "https://upload.e-hentai.org/image_lookup.php";
public static final String URL_IMAGE_SEARCH_EX = "https://exhentai.org/upload/image_lookup.php";

public static final String URL_SIGN_IN = "https://forums.e-hentai.org/index.php?act=Login";
public static final String URL_REGISTER = "https://forums.e-hentai.org/index.php?act=Reg&CODE=00";
public static final String URL_FAVORITES_G = HOST_G + "favorites.php";
public static final String URL_FAVORITES_E = HOST_E + "favorites.php";
public static final String URL_FAVORITES_EX = HOST_EX + "favorites.php";
public static final String URL_FORUMS = "https://forums.e-hentai.org/";

private static final String URL_PREFIX_THUMB_G = "https://ehgt.org/t/";
private static final String URL_PREFIX_THUMB_E = "https://ehgt.org/t/";
private static final String URL_PREFIX_THUMB_EX = "https://exhentai.org/t/";

public static String getGalleryDetailUrl(long gid, String token) {
Expand All @@ -62,8 +62,8 @@ public static String getGalleryDetailUrl(long gid, String token) {
public static String getHost() {
switch (Settings.getGallerySite()) {
default:
case SITE_G:
return HOST_G;
case SITE_E:
return HOST_E;
case SITE_EX:
return HOST_EX;
}
Expand All @@ -72,8 +72,8 @@ public static String getHost() {
public static String getFavoritesUrl() {
switch (Settings.getGallerySite()) {
default:
case SITE_G:
return URL_FAVORITES_G;
case SITE_E:
return URL_FAVORITES_E;
case SITE_EX:
return URL_FAVORITES_EX;
}
Expand All @@ -82,8 +82,8 @@ public static String getFavoritesUrl() {
public static String getApiUrl() {
switch (Settings.getGallerySite()) {
default:
case SITE_G:
return API_G;
case SITE_E:
return API_E;
case SITE_EX:
return API_EX;
}
Expand Down Expand Up @@ -116,8 +116,8 @@ public static String getTagDefinitionUrl(String tag) {
public static String getImageSearchUrl() {
switch (Settings.getGallerySite()) {
default:
case SITE_G:
return URL_IMAGE_SEARCH_G;
case SITE_E:
return URL_IMAGE_SEARCH_E;
case SITE_EX:
return URL_IMAGE_SEARCH_EX;
}
Expand All @@ -126,8 +126,8 @@ public static String getImageSearchUrl() {
public static String getThumbUrlPrefix() {
switch (Settings.getGallerySite()) {
default:
//case SITE_G:
return URL_PREFIX_THUMB_G;
//case SITE_E:
return URL_PREFIX_THUMB_E;
//case SITE_EX:
// return URL_PREFIX_THUMB_EX;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
public final class GalleryDetailUrlParser {

public static final Pattern URL_PATTERN = Pattern.compile("https?://(?:" +
EhUrl.DOMAIN_EX + "|" + EhUrl.DOMAIN_G + "|" + EhUrl.DOMAIN_LOFI + ")/g/(\\d+)/(\\w+)");
EhUrl.DOMAIN_EX + "|" + EhUrl.DOMAIN_E + "|" + EhUrl.DOMAIN_LOFI + ")/g/(\\d+)/(\\w+)");

@Nullable
public static Result parse(String url) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

public final class GalleryListUrlParser {

private static final String[] VALID_HOSTS = {EhUrl.DOMAIN_EX, EhUrl.DOMAIN_G, EhUrl.DOMAIN_LOFI};
private static final String[] VALID_HOSTS = {EhUrl.DOMAIN_EX, EhUrl.DOMAIN_E, EhUrl.DOMAIN_LOFI};

private static final String PATH_NORMAL = "/";
private static final String PATH_UPLOADER = "/uploader/";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
public final class GalleryPageUrlParser {

public static final Pattern URL_PATTERN = Pattern.compile("https?://(?:" +
EhUrl.DOMAIN_EX + "|" + EhUrl.DOMAIN_G + "|" + EhUrl.DOMAIN_LOFI + ")/s/(\\w+)/(\\d+)-(\\d+)");
EhUrl.DOMAIN_EX + "|" + EhUrl.DOMAIN_E + "|" + EhUrl.DOMAIN_LOFI + ")/s/(\\w+)/(\\d+)-(\\d+)");

public static Result parse(String url) {
if (url == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ private void storeCookie(String id, String hash) {
EhUtils.signOut(context);

EhCookieStore store = EhApplication.getEhCookieStore(context);
store.add(newCookie(EhCookieStore.KEY_IPD_MEMBER_ID, id, EhUrl.DOMAIN_G));
store.add(newCookie(EhCookieStore.KEY_IPD_MEMBER_ID, id, EhUrl.DOMAIN_E));
store.add(newCookie(EhCookieStore.KEY_IPD_MEMBER_ID, id, EhUrl.DOMAIN_EX));
store.add(newCookie(EhCookieStore.KEY_IPD_PASS_HASH, hash, EhUrl.DOMAIN_G));
store.add(newCookie(EhCookieStore.KEY_IPD_PASS_HASH, hash, EhUrl.DOMAIN_E));
store.add(newCookie(EhCookieStore.KEY_IPD_PASS_HASH, hash, EhUrl.DOMAIN_EX));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void onClick(View v) {
switch (id) {
case R.id.site_e:
Settings.putSelectSite(false);
Settings.putGallerySite(EhUrl.SITE_G);
Settings.putGallerySite(EhUrl.SITE_E);
startSceneForCheckStep(CHECK_STEP_SELECT_SITE, getArguments());
finish();
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ public void onClick(View v) {
} else if (mSignInViaCookies == v) {
startScene(new Announcer(CookieSignInScene.class).setRequestCode(this, REQUEST_CODE_COOKIE));
} else if (mSkipSigningIn == v) {
// Set gallery size SITE_G if skip sign in
Settings.putGallerySite(EhUrl.SITE_G);
// Set gallery size SITE_E if skip sign in
Settings.putGallerySite(EhUrl.SITE_E);
redirectTo();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ public void onPageFinished(WebView view, String url) {
if (EhCookieStore.KEY_IPD_MEMBER_ID.equals(cookie.name())) {
getId = true;
addCookie(context, EhUrl.DOMAIN_EX, cookie);
addCookie(context, EhUrl.DOMAIN_G, cookie);
addCookie(context, EhUrl.DOMAIN_E, cookie);
} else if (EhCookieStore.KEY_IPD_PASS_HASH.equals(cookie.name())) {
getHash = true;
addCookie(context, EhUrl.DOMAIN_EX, cookie);
addCookie(context, EhUrl.DOMAIN_G, cookie);
addCookie(context, EhUrl.DOMAIN_E, cookie);
}
}

Expand Down

0 comments on commit 636c011

Please sign in to comment.