From 4e2fdf3c00b8123ef6bf6c731e5041f39306619a Mon Sep 17 00:00:00 2001 From: reusedname <155286845+reusedname@users.noreply.github.com> Date: Sat, 1 Mar 2025 15:29:50 +0500 Subject: [PATCH] Remove Bongacams basic online check, do complete check straight away --- .../ctbrec/sites/bonga/BongaCamsModel.java | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/common/src/main/java/ctbrec/sites/bonga/BongaCamsModel.java b/common/src/main/java/ctbrec/sites/bonga/BongaCamsModel.java index 003bccb2..839b4068 100644 --- a/common/src/main/java/ctbrec/sites/bonga/BongaCamsModel.java +++ b/common/src/main/java/ctbrec/sites/bonga/BongaCamsModel.java @@ -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 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;