Try to log in on startup
Maybe we have to change this in the future so that the server logs in on a regular basis.
This commit is contained in:
parent
3958a7b5f1
commit
5e46933905
|
@ -95,6 +95,7 @@ public class HttpServer {
|
|||
for (Site site : sites) {
|
||||
if (site.isEnabled()) {
|
||||
site.init();
|
||||
safeLogin(site);
|
||||
}
|
||||
}
|
||||
onlineMonitor = new OnlineMonitor(recorder);
|
||||
|
@ -102,6 +103,21 @@ public class HttpServer {
|
|||
startHttpServer();
|
||||
}
|
||||
|
||||
private void safeLogin(Site site) {
|
||||
if (site.credentialsAvailable()) {
|
||||
try {
|
||||
boolean success = site.login();
|
||||
if (success) {
|
||||
LOG.info("Successfully logged in to {}", site.getName());
|
||||
} else {
|
||||
throw new RuntimeException("Login returned false");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.info("Login to {} failed", site.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void createSites() {
|
||||
sites.add(new BongaCams());
|
||||
sites.add(new Cam4());
|
||||
|
|
Loading…
Reference in New Issue