Remove Bongacams basic online check, do complete check straight away
This commit is contained in:
parent
eca4245836
commit
4e2fdf3c00
|
@ -38,8 +38,6 @@ public class BongaCamsModel extends AbstractModel {
|
|||
private static final String SUCCESS = "success";
|
||||
private static final String STATUS = "status";
|
||||
|
||||
private static final Pattern ONLINE_BADGE_REGEX = Pattern.compile("class=\"badge_online\s*\"");
|
||||
|
||||
@Setter
|
||||
private boolean online = false;
|
||||
private final transient List<StreamSource> streamSources = new ArrayList<>();
|
||||
|
@ -51,13 +49,6 @@ public class BongaCamsModel extends AbstractModel {
|
|||
@Override
|
||||
public boolean isOnline(boolean ignoreCache) throws IOException, ExecutionException, InterruptedException {
|
||||
if (ignoreCache) {
|
||||
boolean modelIsConnected = basicOnlineCheck();
|
||||
if (!modelIsConnected) {
|
||||
onlineState = OFFLINE;
|
||||
online = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return completeOnlineCheck();
|
||||
}
|
||||
return online;
|
||||
|
@ -93,25 +84,6 @@ public class BongaCamsModel extends AbstractModel {
|
|||
return online;
|
||||
}
|
||||
|
||||
private boolean basicOnlineCheck() {
|
||||
try {
|
||||
String url = site.getBaseUrl() + "/profile/" + getName().toLowerCase();
|
||||
Request req = newRequestBuilder().url(url).build();
|
||||
try (Response resp = site.getHttpClient().execute(req)) {
|
||||
if (resp.isSuccessful()) {
|
||||
String body = Objects.requireNonNull(resp.body(), HTTP_RESPONSE_BODY_IS_NULL).string();
|
||||
Matcher m = ONLINE_BADGE_REGEX.matcher(body);
|
||||
return m.find();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("Couldn't check if model is connected: {}", e.getLocalizedMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public State mapState(String roomState) {
|
||||
return switch (roomState) {
|
||||
case "private", "fullprivate" -> PRIVATE;
|
||||
|
|
Loading…
Reference in New Issue