diff --git a/lib/screens/discover_screen.dart b/lib/screens/discover_screen.dart index 815fdd9c..e7b3341e 100644 --- a/lib/screens/discover_screen.dart +++ b/lib/screens/discover_screen.dart @@ -325,9 +325,18 @@ class _DiscoverScreenState extends State // Wait for libraries and then fetch hubs final librariesByServer = await librariesFuture; - // Fetch hubs using the pre-fetched libraries + // Get hidden libraries to filter from hubs + final hiddenLibrariesProvider = Provider.of( + context, + listen: false, + ); + + // Fetch hubs using the pre-fetched libraries and hidden keys final allHubs = await multiServerProvider.aggregationService - .getHubsFromAllServers(librariesByServer: librariesByServer); + .getHubsFromAllServers( + librariesByServer: librariesByServer, + hiddenLibraryKeys: hiddenLibrariesProvider.hiddenLibraryKeys, + ); // Filter out duplicate hubs that we already fetch separately final filteredHubs = allHubs.where((hub) { diff --git a/lib/services/data_aggregation_service.dart b/lib/services/data_aggregation_service.dart index f9b5a36d..24f68217 100644 --- a/lib/services/data_aggregation_service.dart +++ b/lib/services/data_aggregation_service.dart @@ -134,6 +134,7 @@ class DataAggregationService { Future> getHubsFromAllServers({ int? limit, Map>? librariesByServer, + Set? hiddenLibraryKeys, }) async { final clients = _serverManager.onlineClients; @@ -171,6 +172,11 @@ class DataAggregationService { if (library.hidden != null && library.hidden != 0) { return false; } + // Check app-level hidden libraries + if (hiddenLibraryKeys != null && + hiddenLibraryKeys.contains(library.globalKey)) { + return false; + } return true; }).toList();