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;
|
||||
}
|
||||
|
||||
boolean automaticLogin = liveJasmin.login();
|
||||
if (automaticLogin && !renew) {
|
||||
boolean automaticLogin = liveJasmin.login(renew);
|
||||
if (automaticLogin) {
|
||||
lastLoginTime = System.currentTimeMillis();
|
||||
return true;
|
||||
} else {
|
||||
lastLoginTime = System.currentTimeMillis();
|
||||
|
|
|
@ -192,7 +192,7 @@ public class LiveJasmin extends AbstractSite {
|
|||
}
|
||||
|
||||
private LiveJasminHttpClient getLiveJasminHttpClient() {
|
||||
return (LiveJasminHttpClient) httpClient;
|
||||
return (LiveJasminHttpClient) getHttpClient();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -210,4 +210,8 @@ public class LiveJasmin extends AbstractSite {
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
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 {
|
||||
OkHttpClient temp = client.newBuilder()
|
||||
.followRedirects(false)
|
||||
|
|
Loading…
Reference in New Issue