Prepare 4.0.5 Firefox update and Shorts fixes

Add Firefox data consent, repair contributor sign-in, and introduce optional Hide clutter buttons. Harden video navigation, voting, and action layouts with shared browser regression coverage and reproducible release packaging.
This commit is contained in:
Anarios committed 2026-09-06 12:51:12 +02:00
1 parent 3657de9b2c
commit e500088e65
196 files changed
+39706 -2694

No files matched your search

+50 -19
View File
@@ -3,11 +3,21 @@ const fs = require("node:fs");
const path = require("node:path");
const extensionPackage = require("../../../package.json");
const userscriptVersion = require("../userscript-version.json");
const { assertCurrentLiveArtifact } = require("../e2e/live/live-artifact-readiness");
const { resolveCdpEndpoint } = require("./live-cdp-endpoint");
const {
DEFAULT_LIVE_SHORTS_NEXT_HOPS,
MAX_LIVE_SHORTS_NEXT_HOPS,
MIN_LIVE_SHORTS_NEXT_HOPS,
} = require("./live-navigation-constants");
const LIVE_VOTE_APPROVAL_WINDOW_SECONDS = 120;
const LIVE_VOTE_APPROVALS_DIRECTORY = path.resolve(__dirname, "../../../test-results/live-youtube-vote-approvals");
const DEFAULT_LIVE_NAV_CHANNEL_URL = "https://www.youtube.com/@SmashTrash";
const DEFAULT_LIVE_NAV_SHORT = "iKQhN7omLM4";
const DEFAULT_LIVE_CDP_CONNECT_TIMEOUT_MILLISECONDS = 120_000;
const MIN_LIVE_CDP_CONNECT_TIMEOUT_MILLISECONDS = 15_000;
const MAX_LIVE_CDP_CONNECT_TIMEOUT_MILLISECONDS = 300_000;
const DEFAULT_LIVE_NAV_CHANNEL_URL = "https://www.youtube.com/@MrBeast";
const DEFAULT_LIVE_NAV_SHORT = "5mU6SRS2Bxo";
const DEFAULT_LIVE_SIDEBAR_HOPS = 3;
const MAX_LIVE_SIDEBAR_HOPS = 10;
const VIDEO_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
@@ -32,25 +42,16 @@ function requireVideoId(environment, name) {
return value;
}
function optionalVideoId(environment, name) {
const value = environment[name]?.trim();
if (!value) return null;
if (!VIDEO_ID_PATTERN.test(value)) {
throw new Error(`${name} must be an 11-character YouTube video ID when provided.`);
}
return value;
}
function optionalBoundedInteger(environment, name, defaultValue, maximum) {
function optionalBoundedInteger(environment, name, defaultValue, maximum, minimum = 1) {
const rawValue = environment[name]?.trim();
if (!rawValue) return defaultValue;
if (!/^\d+$/.test(rawValue)) {
throw new Error(`${name} must be a whole number from 1 to ${maximum}.`);
throw new Error(`${name} must be a whole number from ${minimum} to ${maximum}.`);
}
const value = Number(rawValue);
if (!Number.isSafeInteger(value) || value < 1 || value > maximum) {
throw new Error(`${name} must be a whole number from 1 to ${maximum}.`);
if (!Number.isSafeInteger(value) || value < minimum || value > maximum) {
throw new Error(`${name} must be a whole number from ${minimum} to ${maximum}.`);
}
return value;
}
@@ -149,7 +150,14 @@ function parseChannelUrl(value) {
return url.toString();
}
function readExpectedBuildId(runtime, { markerPaths = LIVE_BUILD_MARKER_PATHS, readFileSync = fs.readFileSync } = {}) {
function readExpectedBuildId(
runtime,
{
assertArtifactCurrent = assertCurrentLiveArtifact,
markerPaths = LIVE_BUILD_MARKER_PATHS,
readFileSync = fs.readFileSync,
} = {},
) {
const markerPath = markerPaths[runtime];
let marker;
try {
@@ -163,13 +171,14 @@ function readExpectedBuildId(runtime, { markerPaths = LIVE_BUILD_MARKER_PATHS, r
if (!LIVE_BUILD_ID_PATTERN.test(marker?.buildId)) {
throw new Error(`The ${runtime} live-build marker at ${markerPath} is malformed.`);
}
assertArtifactCurrent(runtime, marker.buildId);
return marker.buildId;
}
function readLiveOptions(
environment = process.env,
nowMilliseconds = Date.now(),
{ readBuildId = readExpectedBuildId } = {},
{ readBuildId = readExpectedBuildId, resolveEndpoint = resolveCdpEndpoint } = {},
) {
if (environment.RYD_LIVE_YOUTUBE !== "1") return null;
@@ -187,6 +196,9 @@ function readLiveOptions(
const watchA = requireVideoId(environment, "RYD_LIVE_WATCH_A");
const watchB = requireVideoId(environment, "RYD_LIVE_WATCH_B");
const short = requireVideoId(environment, "RYD_LIVE_SHORT");
const reactionShort = environment.RYD_LIVE_REACTION_SHORT?.trim()
? requireVideoId(environment, "RYD_LIVE_REACTION_SHORT")
: short;
if (watchA === watchB) throw new Error("RYD_LIVE_WATCH_A and RYD_LIVE_WATCH_B must be different videos.");
const expectedVersion =
@@ -194,7 +206,14 @@ function readLiveOptions(
(runtime === "userscript" ? userscriptVersion : extensionPackage.version);
return {
cdpEndpoint: environment.RYD_CDP_ENDPOINT?.trim() || "chrome",
cdpEndpoint: resolveEndpoint(environment.RYD_CDP_ENDPOINT?.trim() || "chrome", { environment }),
cdpConnectTimeoutMilliseconds: optionalBoundedInteger(
environment,
"RYD_CDP_CONNECT_TIMEOUT_MS",
DEFAULT_LIVE_CDP_CONNECT_TIMEOUT_MILLISECONDS,
MAX_LIVE_CDP_CONNECT_TIMEOUT_MILLISECONDS,
MIN_LIVE_CDP_CONNECT_TIMEOUT_MILLISECONDS,
),
expectedBuildId: readBuildId(runtime),
expectedChannel: requireChannelHandle(environment),
expectedVersion,
@@ -204,10 +223,18 @@ function readLiveOptions(
{ RYD_LIVE_NAV_SHORT: environment.RYD_LIVE_NAV_SHORT?.trim() || DEFAULT_LIVE_NAV_SHORT },
"RYD_LIVE_NAV_SHORT",
),
watch: optionalVideoId(environment, "RYD_LIVE_NAV_WATCH"),
shortsNextHops: optionalBoundedInteger(
environment,
"RYD_LIVE_SHORTS_NEXT_HOPS",
DEFAULT_LIVE_SHORTS_NEXT_HOPS,
MAX_LIVE_SHORTS_NEXT_HOPS,
MIN_LIVE_SHORTS_NEXT_HOPS,
),
watch: requireVideoId(environment, "RYD_LIVE_NAV_WATCH"),
},
playlistUrl: parsePlaylistUrl(requireValue(environment, "RYD_LIVE_PLAYLIST_URL"), watchA),
productionApiApproved: true,
reactionShort,
runtime,
sidebar: {
hopCount: optionalBoundedInteger(
@@ -227,8 +254,12 @@ module.exports = {
DEFAULT_LIVE_NAV_CHANNEL_URL,
DEFAULT_LIVE_NAV_SHORT,
DEFAULT_LIVE_SIDEBAR_HOPS,
DEFAULT_LIVE_SHORTS_NEXT_HOPS,
DEFAULT_LIVE_CDP_CONNECT_TIMEOUT_MILLISECONDS,
LIVE_VOTE_APPROVALS_DIRECTORY,
LIVE_VOTE_APPROVAL_WINDOW_SECONDS,
MAX_LIVE_SHORTS_NEXT_HOPS,
MIN_LIVE_SHORTS_NEXT_HOPS,
consumeLiveVoteApproval,
hasFreshVoteApproval,
liveVoteApproval,