diff --git a/client/src/main/java/ctbrec/ui/settings/SettingsTab.java b/client/src/main/java/ctbrec/ui/settings/SettingsTab.java index 9b924d7a..cca8c39e 100644 --- a/client/src/main/java/ctbrec/ui/settings/SettingsTab.java +++ b/client/src/main/java/ctbrec/ui/settings/SettingsTab.java @@ -246,15 +246,46 @@ public class SettingsTab extends Tab implements TabSelectionListener { private void refreshChaturbateTabs() { System.out.println("Refreshing Chaturbate Tabs..."); // Debugging output - getTabPane().getTabs().removeIf(tab -> tab instanceof ThumbOverviewTab); // Remove all Chaturbate tabs - var newTabs = SiteUiFactory.getUi(new Chaturbate()).getTabProvider().getTabs(getTabPane().getScene()); // Get updated tabs - getTabPane().getTabs().addAll(newTabs); // Add them back with new URLs + // Find the Chaturbate tab + Tab chaturbateTab = null; + for (Tab tab : getTabPane().getTabs()) { + if (tab.getText().equalsIgnoreCase("Chaturbate")) { + chaturbateTab = tab; + break; + } + } - System.out.println("Chaturbate tabs refreshed!"); // Debugging line + if (chaturbateTab == null) { + System.out.println("Chaturbate tab not found! Cannot refresh."); + return; + } + + if (chaturbateTab instanceof ThumbOverviewTab overviewTab) { + overviewTab.getUpdateService().reset(); // Reset update service for new URLs + } + + // Get the tab container inside the Chaturbate tab + if (chaturbateTab.getContent() instanceof Parent parent) { + var chaturbateTabsContainer = parent.lookup(".tab-pane"); + if (chaturbateTabsContainer instanceof TabPane chaturbateTabPane) { + // Remove all existing Chaturbate sub-tabs + chaturbateTabPane.getTabs().clear(); + + // Get updated Chaturbate tabs and add them inside the Chaturbate section + var newTabs = SiteUiFactory.getUi(new Chaturbate()).getTabProvider().getTabs(getTabPane().getScene()); + chaturbateTabPane.getTabs().addAll(newTabs); + + System.out.println("Chaturbate tabs refreshed!"); + return; + } + } + + System.out.println("Could not find the correct TabPane inside Chaturbate tab!"); } + private void createGui() { var postProcessingStepPanel = new PostProcessingStepPanel(config); var variablesHelpButton = createHelpButton("Variables", "http://localhost:5689/docs/PostProcessing.md#variables");