mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-11-30 09:57:52 +01:00
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:
1 parent
3657de9b2c
commit
e500088e65
196 files changed
+39706
-2694
No files matched your search
@@ -0,0 +1,49 @@
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const API_METHODS_BY_PATH = Object.freeze({
|
||||
"/configs/selectors": Object.freeze(["GET"]),
|
||||
"/interact/confirmVote": Object.freeze(["POST"]),
|
||||
"/interact/vote": Object.freeze(["POST"]),
|
||||
"/puzzle/registration": Object.freeze(["GET", "POST"]),
|
||||
"/votes": Object.freeze(["GET"]),
|
||||
});
|
||||
|
||||
const WORKER_SIGNAL_PATH = "/__ryd_e2e/worker-signal";
|
||||
|
||||
function allowedMethodsForPath(pathname) {
|
||||
if (pathname === WORKER_SIGNAL_PATH) return ["POST"];
|
||||
return API_METHODS_BY_PATH[pathname] ?? [];
|
||||
}
|
||||
|
||||
function isAllowedApiPreflight(pathname, requestedMethod) {
|
||||
if (typeof requestedMethod !== "string" || requestedMethod.trim() === "") return false;
|
||||
return allowedMethodsForPath(pathname).includes(requestedMethod.toUpperCase());
|
||||
}
|
||||
|
||||
function assertExactSuccessfulVotesTraffic(records, expectedVideoIds, label = "The hermetic runtime") {
|
||||
assert.ok(Array.isArray(records), `${label} has no recorded API traffic.`);
|
||||
assert.ok(Array.isArray(expectedVideoIds), `${label} has no expected /votes request sequence.`);
|
||||
const votes = records.filter((record) => record.method === "GET" && record.pathname === "/votes");
|
||||
assert.deepEqual(
|
||||
votes.map((record) => record.query?.videoId),
|
||||
expectedVideoIds,
|
||||
`${label} emitted a missing, duplicate, or stale /votes request.`,
|
||||
);
|
||||
for (const [index, record] of votes.entries()) {
|
||||
const videoId = expectedVideoIds[index];
|
||||
assert.equal(record.responseStatus, 200, `${label} /votes request for ${videoId} did not receive HTTP 200.`);
|
||||
assert.ok(
|
||||
Number.isFinite(record.respondedAt),
|
||||
`${label} /votes request for ${videoId} did not finish before the contract completed.`,
|
||||
);
|
||||
}
|
||||
return votes;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
API_METHODS_BY_PATH,
|
||||
WORKER_SIGNAL_PATH,
|
||||
allowedMethodsForPath,
|
||||
assertExactSuccessfulVotesTraffic,
|
||||
isAllowedApiPreflight,
|
||||
};
|
||||
Reference in new issue
Block a user