diff --git a/client/src/main/java/ctbrec/ui/settings/SettingsTab.java b/client/src/main/java/ctbrec/ui/settings/SettingsTab.java index c7c13d28..248c7671 100644 --- a/client/src/main/java/ctbrec/ui/settings/SettingsTab.java +++ b/client/src/main/java/ctbrec/ui/settings/SettingsTab.java @@ -70,6 +70,7 @@ public class SettingsTab extends Tab implements TabSelectionListener { private SimpleBooleanProperty determineResolution; private SimpleBooleanProperty chooseStreamQuality; private SimpleBooleanProperty confirmationDialogs; + private SimpleBooleanProperty naCamsOnly; private SimpleBooleanProperty livePreviews; private SimpleBooleanProperty monitorClipboard; private SimpleListProperty startTab; @@ -152,7 +153,7 @@ public class SettingsTab extends Tab implements TabSelectionListener { private void initializeProperties() { flaresolverrApiUrl = new SimpleStringProperty(null, "flaresolverr.apiUrl", settings.flaresolverr.apiUrl); flaresolverrTimeoutInMillis = new SimpleIntegerProperty(null, "flaresolverr.timeoutInMillis", settings.flaresolverr.timeoutInMillis); - flaresolverrUseForDomains = new SimpleJoinedStringListProperty(null, "flaresolverr.useForDomains", "\n", + flaresolverrUseForDomains = new SimpleJoinedStringListProperty(null, "flaresolverr.useForDomains", "\n", FXCollections.observableList(settings.flaresolverr.useForDomains)); httpUserAgent = new SimpleStringProperty(null, "httpUserAgent", settings.httpUserAgent); httpUserAgentMobile = new SimpleStringProperty(null, "httpUserAgentMobile", settings.httpUserAgentMobile); @@ -207,6 +208,8 @@ public class SettingsTab extends Tab implements TabSelectionListener { onlineCheckSkipsPausedModels = new SimpleBooleanProperty(null, "onlineCheckSkipsPausedModels", settings.onlineCheckSkipsPausedModels); fastScrollSpeed = new SimpleBooleanProperty(null, "fastScrollSpeed", settings.fastScrollSpeed); confirmationDialogs = new SimpleBooleanProperty(null, "confirmationForDangerousActions", settings.confirmationForDangerousActions); + naCamsOnly = new SimpleBooleanProperty(null, "filterNAcamsOnly", settings.filterNAcamsOnly != null ? settings.filterNAcamsOnly : false); + naCamsOnly.addListener((obs, oldValue, newValue) -> { settings.filterNAcamsOnly = newValue; saveConfig();}); useHlsdl = new SimpleBooleanProperty(null, "useHlsdl", settings.useHlsdl); hlsdlExecutable = new SimpleFileProperty(null, "hlsdlExecutable", settings.hlsdlExecutable); recentlyWatched = new SimpleBooleanProperty(null, "recentlyWatched", settings.recentlyWatched); @@ -257,6 +260,7 @@ public class SettingsTab extends Tab implements TabSelectionListener { Setting.of("Start minimized", startMinimized, "Start the app minimized to the tray, automatically activates \"Minimize to tray\""), Setting.of("Add models from clipboard", monitorClipboard, "Monitor clipboard for model URLs and automatically add them to the recorder").needsRestart(), Setting.of("Show confirmation dialogs", confirmationDialogs, "Show confirmation dialogs for irreversible actions"), + Setting.of("Show only North America Cams", naCamsOnly, "Show only North America Cams"), Setting.of("Recording tab per site", recordedModelsPerSite, "Add a Recording tab for each site").needsRestart(), Setting.of("Check for new versions at startup", checkForUpdates, "Search for updates every startup"), Setting.of("Start Tab", startTab)), @@ -272,7 +276,7 @@ public class SettingsTab extends Tab implements TabSelectionListener { Setting.of("Browser", browserOverride), Setting.of("Start parameters", browserParams), Setting.of("Force use (ignore default browser)", forceBrowserOverride, "Default behaviour will fallback to OS default if the above browser fails")), - + Group.of("Flaresolverr", Setting.of("API URL", flaresolverrApiUrl), Setting.of("Request timeout", flaresolverrTimeoutInMillis), @@ -343,11 +347,11 @@ public class SettingsTab extends Tab implements TabSelectionListener { Category.of("Advanced / Devtools", Group.of("Networking", Setting.of("Playlist request timeout (ms)", playlistRequestTimeout, "Timeout in ms for playlist requests"), - Setting.of("Max requests", httpClientMaxRequests, + Setting.of("Max requests", httpClientMaxRequests, "The maximum number of requests to execute concurrently. Above this requests queue in memory,\n" + // "waiting for the running calls to complete.\n\n" + // "If more than [maxRequests] requests are in flight when this is invoked, those requests will remain in flight."), - Setting.of("Max requests per host", httpClientMaxRequestsPerHost, + Setting.of("Max requests per host", httpClientMaxRequestsPerHost, "The maximum number of requests for each host to execute concurrently. This limits requests by\n" + // "the URL's host name. Note that concurrent requests to a single IP address may still exceed this\n" + // "limit: multiple hostnames may share an IP address or be routed through the same HTTP proxy.\n\n" + // @@ -363,7 +367,7 @@ public class SettingsTab extends Tab implements TabSelectionListener { Setting.of("hlsdl executable", hlsdlExecutable, "Path to the hlsdl executable"), Setting.of("Log hlsdl output", loghlsdlOutput, "Log hlsdl output to files in the system's temp directory")), Group.of("Miscelaneous", - Setting.of("Config file saving delay (ms)", configSavingDelayMs, + Setting.of("Config file saving delay (ms)", configSavingDelayMs, "Wait specified number of milliseconds before actually writing config to disk")))); Region preferencesView = prefs.getView(); prefs.onRestartRequired(this::showRestartRequired); @@ -667,7 +671,7 @@ public class SettingsTab extends Tab implements TabSelectionListener { private static final String DATE_FORMATTER_TOOLTIP = """ Leave empty for system default - + Symbol Meaning Presentation Examples ------ ------- ------------ ------- G era text AD; Anno Domini; A @@ -676,7 +680,7 @@ public class SettingsTab extends Tab implements TabSelectionListener { D day-of-year number 189 M/L month-of-year number/text 7; 07; Jul; July; J d day-of-month number 10 - + Q/q quarter-of-year number/text 3; 03; Q3; 3rd quarter Y week-based-year year 1996; 96 w week-of-week-based-year number 27 @@ -684,12 +688,12 @@ public class SettingsTab extends Tab implements TabSelectionListener { E day-of-week text Tue; Tuesday; T e/c localized day-of-week number/text 2; 02; Tue; Tuesday; T F week-of-month number 3 - + a am-pm-of-day text PM h clock-hour-of-am-pm (1-12) number 12 K hour-of-am-pm (0-11) number 0 k clock-hour-of-am-pm (1-24) number 0 - + H hour-of-day (0-23) number 0 m minute-of-hour number 30 s second-of-minute number 55 @@ -697,16 +701,16 @@ public class SettingsTab extends Tab implements TabSelectionListener { A milli-of-day number 1234 n nano-of-second number 987654321 N nano-of-day number 1234000000 - + V time-zone ID zone-id America/Los_Angeles; Z; -08:30 z time-zone name zone-name Pacific Standard Time; PST O localized zone-offset offset-O GMT+8; GMT+08:00; UTC-08:00; X zone-offset 'Z' for zero offset-X Z; -08; -0830; -08:30; -083015; -08:30:15; x zone-offset offset-x +0000; -08; -0830; -08:30; -083015; -08:30:15; Z zone-offset offset-Z +0000; -0800; -08:00; - + p pad next pad modifier 1 - + ' escape for text delimiter '' single quote literal ' [ optional section start diff --git a/client/src/main/java/ctbrec/ui/sites/chaturbate/ChaturbateTabProvider.java b/client/src/main/java/ctbrec/ui/sites/chaturbate/ChaturbateTabProvider.java index ebbd4d09..44f35f8b 100644 --- a/client/src/main/java/ctbrec/ui/sites/chaturbate/ChaturbateTabProvider.java +++ b/client/src/main/java/ctbrec/ui/sites/chaturbate/ChaturbateTabProvider.java @@ -1,5 +1,6 @@ package ctbrec.ui.sites.chaturbate; +import ctbrec.Config; import ctbrec.sites.chaturbate.Chaturbate; import ctbrec.ui.sites.AbstractTabProvider; import ctbrec.ui.tabs.PaginatedScheduledService; @@ -14,40 +15,45 @@ public class ChaturbateTabProvider extends AbstractTabProvider { private final String apiUrl; private final ChaturbateFollowedTab followedTab; + private final boolean regionNAEnabled; // Store the setting public ChaturbateTabProvider(Chaturbate chaturbate) { super(chaturbate); apiUrl = site.getBaseUrl() + "/api/ts"; - this.followedTab = new ChaturbateFollowedTab("Followed", apiUrl + "/roomlist/room-list/?enable_recommendations=false&follow=true", chaturbate); + regionNAEnabled = Config.getInstance().getSettings().filterNAcamsOnly; // Load setting from Config + this.followedTab = new ChaturbateFollowedTab("Followed", buildUrl("/roomlist/room-list/?enable_recommendations=false&follow=true"), chaturbate); } @Override protected List getSiteTabs(Scene scene) { List tabs = new ArrayList<>(); - tabs.add(createTab("Featured", apiUrl + "/roomlist/room-list/?enable_recommendations=false")); - tabs.add(createTab("Female", apiUrl + "/roomlist/room-list/?enable_recommendations=false&genders=f")); - tabs.add(createTab("New Female", apiUrl + "/roomlist/room-list/?enable_recommendations=false&genders=f&new_cams=true")); - tabs.add(createTab("Milf", apiUrl + "/roomlist/room-list/?enable_recommendations=false&hashtags=milf")); - tabs.add(createTab("Teen", apiUrl + "/roomlist/room-list/?enable_recommendations=false&hashtags=teen")); - tabs.add(createTab("Creampie", apiUrl + "/roomlist/room-list/?enable_recommendations=false&hashtags=creampie")); - tabs.add(createTab("BBW", apiUrl + "/roomlist/room-list/?enable_recommendations=false&hashtags=bbw")); - tabs.add(createTab("Chubby", apiUrl + "/roomlist/room-list/?enable_recommendations=false&hashtags=chubby")); - tabs.add(createTab("Pregnant", apiUrl + "/roomlist/room-list/?enable_recommendations=false&hashtags=pregnant")); - tabs.add(createTab("Male", apiUrl + "/roomlist/room-list/?enable_recommendations=false&genders=m")); - tabs.add(createTab("New Male", apiUrl + "/roomlist/room-list/?enable_recommendations=false&genders=m&new_cams=true")); - tabs.add(createTab("Couples", apiUrl + "/roomlist/room-list/?enable_recommendations=false&genders=c")); - tabs.add(createTab("Trans", apiUrl + "/roomlist/room-list/?enable_recommendations=false&genders=t")); - tabs.add(createTab("N.American Cams", apiUrl + "/roomlist/room-list/?enable_recommendations=false®ions=NA")); - tabs.add(createTab("6TPM private", apiUrl + "/roomlist/room-list/?enable_recommendations=false&private_prices=6")); - tabs.add(createTab("Private", apiUrl + "/roomlist/room-list/?enable_recommendations=false&private=true")); - tabs.add(createTab("Hidden", apiUrl + "/roomlist/room-list/?enable_recommendations=false&hidden=true")); - tabs.add(createTab("Gaming", apiUrl + "/roomlist/room-list/?enable_recommendations=false&gaming=true")); + tabs.add(createTab("Featured", buildUrl("/roomlist/room-list/?enable_recommendations=false"))); + tabs.add(createTab("Female", buildUrl("/roomlist/room-list/?enable_recommendations=false&genders=f"))); + tabs.add(createTab("New Female", buildUrl("/roomlist/room-list/?enable_recommendations=false&genders=f&new_cams=true"))); + tabs.add(createTab("Milf", buildUrl("/roomlist/room-list/?enable_recommendations=false&hashtags=milf"))); + tabs.add(createTab("Teen", buildUrl("/roomlist/room-list/?enable_recommendations=false&hashtags=teen"))); + tabs.add(createTab("Creampie", buildUrl("/roomlist/room-list/?enable_recommendations=false&hashtags=creampie"))); + tabs.add(createTab("BBW", buildUrl("/roomlist/room-list/?enable_recommendations=false&hashtags=bbw"))); + tabs.add(createTab("Chubby", buildUrl("/roomlist/room-list/?enable_recommendations=false&hashtags=chubby"))); + tabs.add(createTab("Pregnant", buildUrl("/roomlist/room-list/?enable_recommendations=false&hashtags=pregnant"))); + tabs.add(createTab("Male", buildUrl("/roomlist/room-list/?enable_recommendations=false&genders=m"))); + tabs.add(createTab("New Male", buildUrl("/roomlist/room-list/?enable_recommendations=false&genders=m&new_cams=true"))); + tabs.add(createTab("Couples", buildUrl("/roomlist/room-list/?enable_recommendations=false&genders=c"))); + tabs.add(createTab("Trans", buildUrl("/roomlist/room-list/?enable_recommendations=false&genders=t"))); + tabs.add(createTab("N.American Cams", buildUrl("/roomlist/room-list/?enable_recommendations=false®ions=NA"))); + tabs.add(createTab("6TPM private", buildUrl("/roomlist/room-list/?enable_recommendations=false&private_prices=6"))); + tabs.add(createTab("Private", buildUrl("/roomlist/room-list/?enable_recommendations=false&private=true"))); + tabs.add(createTab("Hidden", buildUrl("/roomlist/room-list/?enable_recommendations=false&hidden=true"))); + tabs.add(createTab("Gaming", buildUrl("/roomlist/room-list/?enable_recommendations=false&gaming=true"))); + followedTab.setScene(scene); followedTab.setRecorder(recorder); followedTab.setImageAspectRatio(9.0 / 16.0); tabs.add(followedTab); - tabs.add(createApiTab("Top Rated", apiUrl + "/discover/carousels/top-rated/")); - tabs.add(createApiTab("Trending", apiUrl + "/discover/carousels/trending/")); + + tabs.add(createApiTab("Top Rated", buildUrl("/discover/carousels/top-rated/"))); + tabs.add(createApiTab("Trending", buildUrl("/discover/carousels/trending/"))); + return tabs; } @@ -72,4 +78,9 @@ public class ChaturbateTabProvider extends AbstractTabProvider { var updateService = new ChaturbateApiUpdateService(apiUrl, (Chaturbate) site); return createTab(title, updateService); } -} + + // Helper function to append region filter if enabled + private String buildUrl(String endpoint) { + return apiUrl + endpoint + (regionNAEnabled ? "®ion=NA" : ""); + } +} \ No newline at end of file