forked from j62/ctbrec
Change how LiveJasmin refreshes the HTTP session
... which does not require to open the login dialog on the start anymore
This commit is contained in:
parent
ec822ec356
commit
a3ee92f269
|
@ -50,8 +50,9 @@ public class LiveJasminSiteUi extends AbstractSiteUi {
|
||||||
renew = true;
|
renew = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean automaticLogin = liveJasmin.login();
|
boolean automaticLogin = liveJasmin.login(renew);
|
||||||
if (automaticLogin && !renew) {
|
if (automaticLogin) {
|
||||||
|
lastLoginTime = System.currentTimeMillis();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
lastLoginTime = System.currentTimeMillis();
|
lastLoginTime = System.currentTimeMillis();
|
||||||
|
|
|
@ -192,7 +192,7 @@ public class LiveJasmin extends AbstractSite {
|
||||||
}
|
}
|
||||||
|
|
||||||
private LiveJasminHttpClient getLiveJasminHttpClient() {
|
private LiveJasminHttpClient getLiveJasminHttpClient() {
|
||||||
return (LiveJasminHttpClient) httpClient;
|
return (LiveJasminHttpClient) getHttpClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -210,4 +210,8 @@ public class LiveJasmin extends AbstractSite {
|
||||||
|
|
||||||
return super.createModelFromUrl(url);
|
return super.createModelFromUrl(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean login(boolean renew) throws IOException {
|
||||||
|
return getLiveJasminHttpClient().login(renew);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,21 @@ public class LiveJasminHttpClient extends HttpClient {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized boolean login(boolean renew) throws IOException {
|
||||||
|
if (loggedIn && !renew) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean cookiesWorked = checkLoginSuccess();
|
||||||
|
if (cookiesWorked) {
|
||||||
|
loggedIn = true;
|
||||||
|
LOG.debug("Logged in with cookies");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean checkLoginSuccess() throws IOException {
|
public boolean checkLoginSuccess() throws IOException {
|
||||||
OkHttpClient temp = client.newBuilder()
|
OkHttpClient temp = client.newBuilder()
|
||||||
.followRedirects(false)
|
.followRedirects(false)
|
||||||
|
|
Loading…
Reference in New Issue