mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-10 23:01:10 +00:00
feed: add Trending tab — recently-added ranked by view count (#27)
New FEED_TYPES.TRENDING tab: the active (recently-added) source ranked by view count (recency tiebreak, trusted-muted last), gated by FEATURE_TRENDING_FEED (default on). Builds on the now-trustworthy view counts (#4). - createTrendingSorter reads counts from runtime.getViewCount, which resolves each video's pointer via the app's canonical deriveVideoPointerInfo against the shared viewCounter cache (new getVideoViewCountSnapshot export) — the same counts the grid cards already load. - Live re-rank: viewCounter now emits a coalesced onViewCountsChanged signal; while the Trending view is active it debounce-re-runs the feed (cheap re-rank over the in-memory active set, no relay re-fetch), so the order settles into true trending as counts stream in. Cold cache reads as recency, then improves. - Pipeline extracted to js/feedEngine/trendingFeed.js (feedCoordinator is at its size cap; bumped the cap for the thin load/refresh delegations). - Wiring: FEED_TYPES + flag, feedCoordinator cases, app.js wrappers, applicationBootstrap registration (hides the sidebar link when flag off), viewManager init + js/trendingView.js, views/trending.html, sidebar link. Tests: tests/trending-sorter.test.mjs. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
8deba55cdf
commit
02854d4fb5
14 files changed
+531
-8
No files matched your search
@@ -24,7 +24,7 @@ import r2Service from "../services/r2Service.js";
|
||||
import s3UploadService from "../services/s3UploadService.js";
|
||||
import RelayHealthService from "../services/relayHealthService.js";
|
||||
import { createFeedEngine } from "../feedEngine/index.js";
|
||||
import { URL_FIRST_ENABLED, SHORT_TIMEOUT_MS } from "../constants.js";
|
||||
import { URL_FIRST_ENABLED, SHORT_TIMEOUT_MS, FEATURE_TRENDING_FEED } from "../constants.js";
|
||||
import { ALLOW_NSFW_CONTENT } from "../config.js";
|
||||
import { relayManager } from "../relayManager.js";
|
||||
import { userBlocks } from "../userBlocks.js";
|
||||
@@ -275,6 +275,15 @@ export default class ApplicationBootstrap {
|
||||
app.registerForYouFeed();
|
||||
app.registerKidsFeed();
|
||||
app.registerExploreFeed();
|
||||
if (FEATURE_TRENDING_FEED && typeof app.registerTrendingFeed === "function") {
|
||||
app.registerTrendingFeed();
|
||||
} else if (typeof document !== "undefined") {
|
||||
// Flag off: hide the always-visible Trending sidebar link.
|
||||
const trendingLink = document.getElementById("trendingLink");
|
||||
if (trendingLink) {
|
||||
trendingLink.classList.add("hidden");
|
||||
}
|
||||
}
|
||||
app.registerSubscriptionsFeed();
|
||||
app.registerWatchHistoryFeed();
|
||||
// Re-run the For You feed when background watch-history resolution completes.
|
||||
|
||||
Reference in new issue
Block a user