Update okhttp
This commit is contained in:
1 parent
db63a8f05b
commit
b2bef7a4b0
3 files changed
+10
-24
No files matched your search
@@ -76,6 +76,7 @@ dependencies {
|
||||
compile 'com.github.seven332:yorozuya-thread:0.1.1'
|
||||
compile 'com.github.seven332:yorozuya-collect:0.1.4'
|
||||
compile 'com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.9.2'
|
||||
compile 'com.squareup.okhttp3:okhttp:3.10.0'
|
||||
compile 'org.ccil.cowan.tagsoup:tagsoup:1.2.1'
|
||||
compile 'org.greenrobot:greendao:2.2.1'
|
||||
compile 'org.jsoup:jsoup:1.11.2'
|
||||
@@ -89,5 +90,7 @@ configurations.all {
|
||||
force 'com.github.seven332:glgallery:0f276c0'
|
||||
force 'com.github.seven332:glview-image:4c744db'
|
||||
force 'com.github.seven332:image:bab9b11'
|
||||
|
||||
exclude group: 'com.github.seven332', module: 'okhttp'
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,6 @@ import java.util.List;
|
||||
|
||||
import okhttp3.Cookie;
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.Request;
|
||||
|
||||
public class EhCookieStore extends CookieRepository {
|
||||
|
||||
@@ -86,41 +85,26 @@ public class EhCookieStore extends CookieRepository {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Cookie> loadForRequest(HttpUrl url, Request request) {
|
||||
List<Cookie> cookies = super.loadForRequest(url, request);
|
||||
Object tag = request.tag();
|
||||
public List<Cookie> loadForRequest(HttpUrl url) {
|
||||
List<Cookie> cookies = super.loadForRequest(url);
|
||||
|
||||
boolean checkTips = domainMatch(url, EhUrl.DOMAIN_E);
|
||||
boolean checkUconfig = (domainMatch(url, EhUrl.DOMAIN_E) || domainMatch(url, EhUrl.DOMAIN_EX)) && tag instanceof EhConfig;
|
||||
|
||||
if (checkTips || checkUconfig) {
|
||||
if (checkTips) {
|
||||
List<Cookie> result = new ArrayList<>(cookies.size() + 1);
|
||||
// Add all but skip some
|
||||
for (Cookie cookie: cookies) {
|
||||
String name = cookie.name();
|
||||
if (checkTips && EhConfig.KEY_CONTENT_WARNING.equals(name)) {
|
||||
if (EhConfig.KEY_CONTENT_WARNING.equals(name)) {
|
||||
continue;
|
||||
}
|
||||
if (checkUconfig && EhConfig.KEY_UCONFIG.equals(name)) {
|
||||
if (EhConfig.KEY_UCONFIG.equals(name)) {
|
||||
continue;
|
||||
}
|
||||
result.add(cookie);
|
||||
}
|
||||
// Add some
|
||||
if (checkTips) {
|
||||
result.add(sTipsCookie);
|
||||
}
|
||||
if (checkUconfig) {
|
||||
EhConfig ehConfig = (EhConfig) tag;
|
||||
Cookie uconfigCookie = new Cookie.Builder()
|
||||
.name(EhConfig.KEY_UCONFIG)
|
||||
.value(ehConfig.uconfig())
|
||||
.domain(url.host())
|
||||
.path("/")
|
||||
.expiresAt(Long.MAX_VALUE)
|
||||
.build();
|
||||
result.add(uconfigCookie);
|
||||
}
|
||||
result.add(sTipsCookie);
|
||||
return Collections.unmodifiableList(result);
|
||||
} else {
|
||||
return cookies;
|
||||
|
||||
@@ -31,7 +31,6 @@ import java.util.regex.Pattern;
|
||||
import okhttp3.Cookie;
|
||||
import okhttp3.CookieJar;
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.Request;
|
||||
|
||||
public class CookieRepository implements CookieJar {
|
||||
|
||||
@@ -146,7 +145,7 @@ public class CookieRepository implements CookieJar {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Cookie> loadForRequest(HttpUrl httpUrl, Request request) {
|
||||
public List<Cookie> loadForRequest(HttpUrl httpUrl) {
|
||||
return getCookies(httpUrl);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user