mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-11-23 06:43:02 +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
@@ -1,8 +1,40 @@
|
||||
const path = require("path");
|
||||
const webpack = require("webpack");
|
||||
const userscriptMeta = require("./Extensions/UserScript/userscript.meta");
|
||||
const {
|
||||
USERSCRIPT_ARTIFACT_RELATIVE_PATH,
|
||||
USERSCRIPT_BUILD_RECEIPT_RELATIVE_PATH,
|
||||
USERSCRIPT_LIVE_ARTIFACT_RELATIVE_PATH,
|
||||
USERSCRIPT_LIVE_BUILD_RECEIPT_RELATIVE_PATH,
|
||||
UserscriptBuildReceiptPlugin,
|
||||
} = require("./userscript-build-receipt");
|
||||
const { LiveBuildMarkerPlugin, createLiveBuildId } = require("./webpack.live-build-marker");
|
||||
|
||||
const USERSCRIPT_ASSET_NAME = "Return Youtube Dislike.user.js";
|
||||
|
||||
class StripWebpackBootstrapWhitespacePlugin {
|
||||
apply(compiler) {
|
||||
compiler.hooks.thisCompilation.tap("StripWebpackBootstrapWhitespacePlugin", (compilation) => {
|
||||
compilation.hooks.processAssets.tap(
|
||||
{
|
||||
name: "StripWebpackBootstrapWhitespacePlugin",
|
||||
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE,
|
||||
},
|
||||
() => {
|
||||
const asset = compilation.getAsset(USERSCRIPT_ASSET_NAME);
|
||||
if (!asset) return;
|
||||
|
||||
const source = asset.source.source().toString();
|
||||
const normalized = source.replace(/^(\/\*{6}\/)[ \t]+(?=\r?$)/gm, "$1");
|
||||
if (normalized === source) return;
|
||||
|
||||
compilation.updateAsset(USERSCRIPT_ASSET_NAME, new webpack.sources.RawSource(normalized));
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function buildUserscriptBanner(liveTestBuild) {
|
||||
const metadata = [
|
||||
"// ==UserScript==",
|
||||
@@ -34,16 +66,23 @@ function buildUserscriptBanner(liveTestBuild) {
|
||||
module.exports = (env = {}, argv = {}) => {
|
||||
const liveTestBuild = env.liveTest === true || env.liveTest === "true";
|
||||
const liveBuildId = createLiveBuildId(liveTestBuild);
|
||||
const mode = argv.mode ?? "production";
|
||||
const artifactRelativePath = liveTestBuild
|
||||
? USERSCRIPT_LIVE_ARTIFACT_RELATIVE_PATH
|
||||
: USERSCRIPT_ARTIFACT_RELATIVE_PATH;
|
||||
const receiptRelativePath = liveTestBuild
|
||||
? USERSCRIPT_LIVE_BUILD_RECEIPT_RELATIVE_PATH
|
||||
: USERSCRIPT_BUILD_RECEIPT_RELATIVE_PATH;
|
||||
|
||||
return {
|
||||
name: "userscript",
|
||||
mode: argv.mode ?? "production",
|
||||
mode,
|
||||
entry: path.resolve(__dirname, "Extensions/UserScript/src/userscript-entry.js"),
|
||||
output: {
|
||||
path: liveTestBuild
|
||||
? path.resolve(__dirname, "test-results/live-build/userscript")
|
||||
: path.resolve(__dirname, "Extensions/UserScript"),
|
||||
filename: "Return Youtube Dislike.user.js",
|
||||
filename: USERSCRIPT_ASSET_NAME,
|
||||
clean: false,
|
||||
iife: true,
|
||||
},
|
||||
@@ -57,6 +96,15 @@ module.exports = (env = {}, argv = {}) => {
|
||||
__RYD_LIVE_TEST_BUILD__: JSON.stringify(liveTestBuild),
|
||||
}),
|
||||
...(liveTestBuild ? [new LiveBuildMarkerPlugin(liveBuildId, ["live-build.json"])] : []),
|
||||
new StripWebpackBootstrapWhitespacePlugin(),
|
||||
new UserscriptBuildReceiptPlugin({
|
||||
artifactPath: path.resolve(__dirname, artifactRelativePath),
|
||||
buildId: liveBuildId,
|
||||
liveTestBuild,
|
||||
mode,
|
||||
receiptPath: path.resolve(__dirname, receiptRelativePath),
|
||||
repositoryRoot: __dirname,
|
||||
}),
|
||||
new webpack.BannerPlugin({
|
||||
banner: buildUserscriptBanner(liveTestBuild),
|
||||
raw: true,
|
||||
|
||||
Reference in new issue
Block a user