mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-11-24 07:13:02 +01:00
Fix Shorts support and add userscript voting
Harden Shorts controls, reaction state, and navigation; share voting logic with the extension; improve ratio-bar rendering; and add comprehensive Jest, Playwright, artifact, and live-browser regression coverage.
This commit is contained in:
1 parent
4e6dfd1977
commit
3657de9b2c
74 files changed
+23328
-588
No files matched your search
@@ -0,0 +1,71 @@
|
||||
const path = require("path");
|
||||
const webpack = require("webpack");
|
||||
const userscriptMeta = require("./Extensions/UserScript/userscript.meta");
|
||||
const { LiveBuildMarkerPlugin, createLiveBuildId } = require("./webpack.live-build-marker");
|
||||
|
||||
function buildUserscriptBanner(liveTestBuild) {
|
||||
const metadata = [
|
||||
"// ==UserScript==",
|
||||
`// @name ${userscriptMeta.name}${liveTestBuild ? " [Live Test]" : ""}`,
|
||||
`// @namespace ${userscriptMeta.namespace}`,
|
||||
`// @homepage ${userscriptMeta.homepage}`,
|
||||
`// @version ${userscriptMeta.version}`,
|
||||
`// @encoding ${userscriptMeta.encoding}`,
|
||||
`// @description ${userscriptMeta.description}`,
|
||||
`// @icon ${userscriptMeta.icon}`,
|
||||
`// @author ${userscriptMeta.author}`,
|
||||
...userscriptMeta.match.map((value) => `// @match ${value}`),
|
||||
...userscriptMeta.exclude.map((value) => `// @exclude ${value}`),
|
||||
...userscriptMeta.compatible.map((value) => `// @compatible ${value}`),
|
||||
...(liveTestBuild
|
||||
? []
|
||||
: [`// @downloadURL ${userscriptMeta.downloadURL}`, `// @updateURL ${userscriptMeta.updateURL}`]),
|
||||
...userscriptMeta.grants.map((value) => `// @grant ${value}`),
|
||||
`// @run-at ${userscriptMeta.runAt}`,
|
||||
"// ==/UserScript==",
|
||||
"",
|
||||
"// This file is generated by `npm run build:userscript`.",
|
||||
"// Edit Extensions/UserScript/src instead of the generated file.",
|
||||
];
|
||||
|
||||
return metadata.join("\n");
|
||||
}
|
||||
|
||||
module.exports = (env = {}, argv = {}) => {
|
||||
const liveTestBuild = env.liveTest === true || env.liveTest === "true";
|
||||
const liveBuildId = createLiveBuildId(liveTestBuild);
|
||||
|
||||
return {
|
||||
name: "userscript",
|
||||
mode: argv.mode ?? "production",
|
||||
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",
|
||||
clean: false,
|
||||
iife: true,
|
||||
},
|
||||
cache: false,
|
||||
optimization: {
|
||||
minimize: false,
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
__RYD_LIVE_BUILD_ID__: JSON.stringify(liveBuildId),
|
||||
__RYD_LIVE_TEST_BUILD__: JSON.stringify(liveTestBuild),
|
||||
}),
|
||||
...(liveTestBuild ? [new LiveBuildMarkerPlugin(liveBuildId, ["live-build.json"])] : []),
|
||||
new webpack.BannerPlugin({
|
||||
banner: buildUserscriptBanner(liveTestBuild),
|
||||
raw: true,
|
||||
entryOnly: true,
|
||||
}),
|
||||
],
|
||||
devtool: false,
|
||||
performance: {
|
||||
hints: false,
|
||||
},
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user