From cc36305568917be1bdf1081dceb9c17212e3e344 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Mon, 25 Nov 2019 23:42:22 +0100 Subject: [PATCH 01/29] Readme update --- README.md | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 3c3f825..7043310 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## Super TL;DR: I'm just looking for the install links, thanks -[Firefox](https://addons.mozilla.org/en/firefox/addon/ultrawidify/), [Chrome](https://chrome.google.com/webstore/detail/ultrawidify/dndehlekllfkaijdlokmmicgnlanfjbi), [Edge](#edge-speficic-limitations-important). +[Firefox](https://addons.mozilla.org/en/firefox/addon/ultrawidify/), [Chrome](https://chrome.google.com/webstore/detail/ultrawidify/dndehlekllfkaijdlokmmicgnlanfjbi). ## TL;DR @@ -259,26 +259,22 @@ TODO: see if #3 already loads the extension in FF 5. Select `${ultrawidify_folder}/dist/manifest.json` -# Edge-specific limitations (IMPORTANT!) +# Microsoft Edge -For various reasons — most notably, I refuse to pay Microsoft €14 for the privilege of developing shit for their outright broken browser (and in addition to that, the extension needs to go through review process as well) — this extension isn't going to appear on Microsoft Store. (And I do not permit anyone else to do that in my name either). Full rant on why I've made this decision can be found [here](https://github.com/xternal7/ultrawidify/issues/14#issuecomment-424903335). +With the advent of the new Chromium-based Edge, this extension should work just fine. I don't actively test in Edge, though, so your mileage may vary. -As a result, you'll have to download the extension and install it manually. This approach has some downsides. +## Chromium-based -1. You'll get this popup after starting Edge. If you've already opened Youtube or Netflix, **you will have to reload the page (or navigate to somewhere else) in order for extension to start.** -![slika](https://user-images.githubusercontent.com/12505802/46114175-05912200-c1e1-11e8-91c7-2217f5bf79e3.png) +1. Visit [edge://extensions](edge://extensions/) +2. In the lower right corner of the window, click 'allow extensions from other stores' +3. Install the extension from the [Chrome Web Store](https://chrome.google.com/webstore/detail/ultrawidify/dndehlekllfkaijdlokmmicgnlanfjbi) -2. Certain WebExtension APIs that I rely on are outright broken in Edge. This bug would cause global extension settings (tab: Extension settings) and per-site settings (tab: Site settings) to reset to default values every time you'd open the popup. As a result, _Extension settings_ and _Site settings_ tabs are disabled in Edge: -![Feast on dem popup](https://user-images.githubusercontent.com/12505802/46113923-d1693180-c1df-11e8-82f0-ad64cbc57558.png) -Unfortunate consequence of this is that you won't be able to enable this extension for sites other than Youtube and Netflix, but then again. Let's be honest. You're only using Edge for Netflix, so that's probably no big deal for you. +I might reconsider publishing extension for Chromium-based Microsoft Edge once it's released. Releasing in MS Store appears to be impossible at current time as extension submissions don't appear to be open at all (unless you got a special invite or something). -**It's also worth noting that I'm not actively maintaining the Edge fork, so it's a few versions behind.** +## Old Edge -## Installing Ultrawidify in M$ Edge - -1. Download the zip file from [here](https://github.com/xternal7/ultrawidify/tree/master/releases/edge) -2. Extract contents of the zip file in some folder. It really doesn't matter where, just keep it somewhere that won't be in your way when using your computer. -3. Follow the steps in [this guide](https://docs.microsoft.com/en-us/microsoft-edge/extensions/guides/adding-and-removing-extensions) +1. Get [Chromium-based Edge](https://www.microsoftedgeinsider.com/en-us/) +2. See steps above # Changelog From f469c29cc82f1c341f693f687daa825b732cd1e1 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Mon, 25 Nov 2019 23:45:45 +0100 Subject: [PATCH 02/29] Readme update, pt. 2 --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7043310..7bbcf15 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## Super TL;DR: I'm just looking for the install links, thanks -[Firefox](https://addons.mozilla.org/en/firefox/addon/ultrawidify/), [Chrome](https://chrome.google.com/webstore/detail/ultrawidify/dndehlekllfkaijdlokmmicgnlanfjbi). +[Firefox](https://addons.mozilla.org/en/firefox/addon/ultrawidify/), [Chrome](https://chrome.google.com/webstore/detail/ultrawidify/dndehlekllfkaijdlokmmicgnlanfjbi), [Edge](https://github.com/xternal7/ultrawidify#microsoft-edge) (Chromium-based only) ## TL;DR @@ -51,7 +51,7 @@ You can download this extension from Firefox' and Chrome's extension stores: * [Firefox](https://addons.mozilla.org/en/firefox/addon/ultrawidify/) * [Chrome](https://chrome.google.com/webstore/detail/ultrawidify/dndehlekllfkaijdlokmmicgnlanfjbi) -This extension also has a version for Microsoft Edge, but that requires a bit more effort. [See notes first](#edge-speficic-limitations-important). +Opera users and users of the new, Chromium-based Edge can install Ultrawidify from Chrome Web Store as well. # Beggathon (donations) @@ -266,8 +266,10 @@ With the advent of the new Chromium-based Edge, this extension should work just ## Chromium-based 1. Visit [edge://extensions](edge://extensions/) -2. In the lower right corner of the window, click 'allow extensions from other stores' -3. Install the extension from the [Chrome Web Store](https://chrome.google.com/webstore/detail/ultrawidify/dndehlekllfkaijdlokmmicgnlanfjbi) +2. Go to [Chrome Web Store](https://chrome.google.com/webstore/detail/ultrawidify/dndehlekllfkaijdlokmmicgnlanfjbi) +3. Click 'Allow extensions from other stores' on the blue popup bar at the top of the screen +4. Install Ultrawidify +5. Enjoy I might reconsider publishing extension for Chromium-based Microsoft Edge once it's released. Releasing in MS Store appears to be impossible at current time as extension submissions don't appear to be open at all (unless you got a special invite or something). From 709cb7763c50173ff74c6995c70018da952ee3dd Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Thu, 28 Nov 2019 23:37:26 +0100 Subject: [PATCH 03/29] prepare stuff for CI nightly builds --- webpack.config.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/webpack.config.js b/webpack.config.js index 2f3c359..c0a44ee 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -84,6 +84,21 @@ const config = { jsonContent['content_security_policy'] = "script-src 'self' 'unsafe-eval'; object-src 'self'"; } + if (process.env.CHANNEL === 'nightly') { + jsonContent.name = "Ultrawidify - nightly"; + jsonContent.description = "NIGHTLY BUILD OF ULTRAWIDIFY -- FOR TESTING ONLY."; + + // version numbers for nightly builds: YYMM.DD.BUILD_NUMBER + jsonContent.version = `${new Date() + .toISOString() // YYYY-MM-DDTHH:MM:SS... + .split('T')[0] // gives YYYY-MM-DD + .substr(2) // YYYY -> YY + .replace('-', '') // YY-MM-DD -> YYMM-DD + .replace('-', '.') // YYMM-DD -> YYMM.DD + }.${process.env.BUILD_NUMBER}`; + jsonContent.browser_action.default_title = "Ultrawidify Nightly"; + } + if (process.env.BROWSER !== 'firefox') { jsonContent.version = jsonContent.version.replace(/[a-zA-Z-]/g, ''); } From 62b986575c4593963b89d4b58f62483a804c6ee9 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Thu, 28 Nov 2019 23:52:55 +0100 Subject: [PATCH 04/29] Zip: collapse dashes and spaces into single dash --- package.json | 1 + scripts/build-zip.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 0562f98..3c44b6e 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "build-chrome:dev": "cross-env NODE_ENV=development BROWSER=chrome webpack --hide-modules", "build-edge:dev": "cross-env NODE_ENV=development BROWSER=edge webpack --hide-modules", "build-all": "rm ./dist-zip/uw-amo-source.zip; mv ./dist-zip/*.zip ./dist-zip/old/; npm run build; node scripts/build-zip.js ff; npm run build-chrome; node scripts/build-zip.js chrome; ./scripts/prepare-amo-source.sh", + "build-nightly": "./build-nightly.sh", "build-zip": "node scripts/build-zip.js", "watch": "npm run build -- --watch", "watch-chrome": "npm run build-chrome -- --watch", diff --git a/scripts/build-zip.js b/scripts/build-zip.js index 9f1380a..f27272a 100644 --- a/scripts/build-zip.js +++ b/scripts/build-zip.js @@ -44,7 +44,7 @@ const main = () => { const browser = process.argv[2]; const {name, version} = extractExtensionData(); - const zipFilename = `${name}-${version}-${browser}.zip`; + const zipFilename = `${name.replace(/[ -]+/g, '')}-${version}-${browser}.zip`; makeDestZipDirIfNotExists(); From e51a2f41937a08d3a4667b6242a8d013026b863b Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Fri, 29 Nov 2019 00:12:31 +0100 Subject: [PATCH 05/29] fix build config --- package.json | 4 +++- webpack.config.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 3c44b6e..032b351 100644 --- a/package.json +++ b/package.json @@ -9,10 +9,12 @@ "build-chrome": "cross-env NODE_ENV=production BROWSER=chrome webpack --hide-modules", "build-edge": "cross-env NODE_ENV=production BROWSER=edge webpack --hide-modules", "build:dev": "cross-env NODE_ENV=development BROWSER=firefox webpack --hide-modules", + "build-nightly": "cross-env NODE_ENV=development BROWSER=firefox CHANNEL=nightly webpack --hide-modules", + "build-nightly-chrome": "cross-env NODE_ENV=development BROWSER=chrome CHANNEL=nightly webpack --hide-modules", + "build-nightly-all": "./setup-env.sh; rm /dist-zip/*; npm run build-nightly; node scripts/build-zip.js ff; npm run build-nightly-chrome; node scripts/build-zip.js chrome; web-ext sign", "build-chrome:dev": "cross-env NODE_ENV=development BROWSER=chrome webpack --hide-modules", "build-edge:dev": "cross-env NODE_ENV=development BROWSER=edge webpack --hide-modules", "build-all": "rm ./dist-zip/uw-amo-source.zip; mv ./dist-zip/*.zip ./dist-zip/old/; npm run build; node scripts/build-zip.js ff; npm run build-chrome; node scripts/build-zip.js chrome; ./scripts/prepare-amo-source.sh", - "build-nightly": "./build-nightly.sh", "build-zip": "node scripts/build-zip.js", "watch": "npm run build -- --watch", "watch-chrome": "npm run build-chrome -- --watch", diff --git a/webpack.config.js b/webpack.config.js index c0a44ee..a653115 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -86,7 +86,7 @@ const config = { if (process.env.CHANNEL === 'nightly') { jsonContent.name = "Ultrawidify - nightly"; - jsonContent.description = "NIGHTLY BUILD OF ULTRAWIDIFY -- FOR TESTING ONLY."; + jsonContent.description = "FOR TESTING ONLY -- THIS BUILD USES ONLY THE FRESHEST COMMITS FROM GITHUB AND MAY THEREFORE BE COMPLETELY BROKEN"; // version numbers for nightly builds: YYMM.DD.BUILD_NUMBER jsonContent.version = `${new Date() From 470f5481ee14cfd0c34fdc3f1f6df17d0888b3f7 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Fri, 29 Nov 2019 00:15:48 +0100 Subject: [PATCH 06/29] fix? --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 032b351..b85088a 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "build:dev": "cross-env NODE_ENV=development BROWSER=firefox webpack --hide-modules", "build-nightly": "cross-env NODE_ENV=development BROWSER=firefox CHANNEL=nightly webpack --hide-modules", "build-nightly-chrome": "cross-env NODE_ENV=development BROWSER=chrome CHANNEL=nightly webpack --hide-modules", - "build-nightly-all": "./setup-env.sh; rm /dist-zip/*; npm run build-nightly; node scripts/build-zip.js ff; npm run build-nightly-chrome; node scripts/build-zip.js chrome; web-ext sign", + "build-nightly-all": "./setup-env.sh; rm /dist-zip/* || true; npm run build-nightly; node scripts/build-zip.js ff; npm run build-nightly-chrome; node scripts/build-zip.js chrome; web-ext sign", "build-chrome:dev": "cross-env NODE_ENV=development BROWSER=chrome webpack --hide-modules", "build-edge:dev": "cross-env NODE_ENV=development BROWSER=edge webpack --hide-modules", "build-all": "rm ./dist-zip/uw-amo-source.zip; mv ./dist-zip/*.zip ./dist-zip/old/; npm run build; node scripts/build-zip.js ff; npm run build-chrome; node scripts/build-zip.js chrome; ./scripts/prepare-amo-source.sh", From db5d69d92f9af5523ece94cc81050cdb9cfb331d Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Fri, 29 Nov 2019 00:31:20 +0100 Subject: [PATCH 07/29] fix build --- package.json | 1 - webpack.config.js | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index b85088a..0f18671 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,6 @@ "build:dev": "cross-env NODE_ENV=development BROWSER=firefox webpack --hide-modules", "build-nightly": "cross-env NODE_ENV=development BROWSER=firefox CHANNEL=nightly webpack --hide-modules", "build-nightly-chrome": "cross-env NODE_ENV=development BROWSER=chrome CHANNEL=nightly webpack --hide-modules", - "build-nightly-all": "./setup-env.sh; rm /dist-zip/* || true; npm run build-nightly; node scripts/build-zip.js ff; npm run build-nightly-chrome; node scripts/build-zip.js chrome; web-ext sign", "build-chrome:dev": "cross-env NODE_ENV=development BROWSER=chrome webpack --hide-modules", "build-edge:dev": "cross-env NODE_ENV=development BROWSER=edge webpack --hide-modules", "build-all": "rm ./dist-zip/uw-amo-source.zip; mv ./dist-zip/*.zip ./dist-zip/old/; npm run build; node scripts/build-zip.js ff; npm run build-chrome; node scripts/build-zip.js chrome; ./scripts/prepare-amo-source.sh", diff --git a/webpack.config.js b/webpack.config.js index a653115..474304c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -97,6 +97,9 @@ const config = { .replace('-', '.') // YYMM-DD -> YYMM.DD }.${process.env.BUILD_NUMBER}`; jsonContent.browser_action.default_title = "Ultrawidify Nightly"; + + // otherwise things will get fun! + delete jsonContent.applications; } if (process.env.BROWSER !== 'firefox') { From 51d0cbf16f8c0adc9ef22239c606bc1ea7afec05 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Fri, 29 Nov 2019 00:55:22 +0100 Subject: [PATCH 08/29] Include build number in version scripts --- .gitignore | 2 ++ package.json | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 809f3e2..60f7db8 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ build/ /dist /dist-zip /uw-git_keys + +*.pem diff --git a/package.json b/package.json index 0f18671..6282efe 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,8 @@ "build-chrome": "cross-env NODE_ENV=production BROWSER=chrome webpack --hide-modules", "build-edge": "cross-env NODE_ENV=production BROWSER=edge webpack --hide-modules", "build:dev": "cross-env NODE_ENV=development BROWSER=firefox webpack --hide-modules", - "build-nightly": "cross-env NODE_ENV=development BROWSER=firefox CHANNEL=nightly webpack --hide-modules", - "build-nightly-chrome": "cross-env NODE_ENV=development BROWSER=chrome CHANNEL=nightly webpack --hide-modules", + "build-nightly": "cross-env NODE_ENV=development BROWSER=firefox CHANNEL=nightly BUILD_NUMBER=$BUILD_NUMBER webpack --hide-modules", + "build-nightly-chrome": "cross-env NODE_ENV=development BROWSER=chrome CHANNEL=nightly BUILD_NUMBER=$BUILD_NUMBER webpack --hide-modules", "build-chrome:dev": "cross-env NODE_ENV=development BROWSER=chrome webpack --hide-modules", "build-edge:dev": "cross-env NODE_ENV=development BROWSER=edge webpack --hide-modules", "build-all": "rm ./dist-zip/uw-amo-source.zip; mv ./dist-zip/*.zip ./dist-zip/old/; npm run build; node scripts/build-zip.js ff; npm run build-chrome; node scripts/build-zip.js chrome; ./scripts/prepare-amo-source.sh", From ec36ca1bc8d43d4767fa4cdb1a0e2c7a0467be10 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Fri, 29 Nov 2019 01:00:24 +0100 Subject: [PATCH 09/29] Version number is already in process.env on server, no need for this --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 6282efe..0f18671 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,8 @@ "build-chrome": "cross-env NODE_ENV=production BROWSER=chrome webpack --hide-modules", "build-edge": "cross-env NODE_ENV=production BROWSER=edge webpack --hide-modules", "build:dev": "cross-env NODE_ENV=development BROWSER=firefox webpack --hide-modules", - "build-nightly": "cross-env NODE_ENV=development BROWSER=firefox CHANNEL=nightly BUILD_NUMBER=$BUILD_NUMBER webpack --hide-modules", - "build-nightly-chrome": "cross-env NODE_ENV=development BROWSER=chrome CHANNEL=nightly BUILD_NUMBER=$BUILD_NUMBER webpack --hide-modules", + "build-nightly": "cross-env NODE_ENV=development BROWSER=firefox CHANNEL=nightly webpack --hide-modules", + "build-nightly-chrome": "cross-env NODE_ENV=development BROWSER=chrome CHANNEL=nightly webpack --hide-modules", "build-chrome:dev": "cross-env NODE_ENV=development BROWSER=chrome webpack --hide-modules", "build-edge:dev": "cross-env NODE_ENV=development BROWSER=edge webpack --hide-modules", "build-all": "rm ./dist-zip/uw-amo-source.zip; mv ./dist-zip/*.zip ./dist-zip/old/; npm run build; node scripts/build-zip.js ff; npm run build-chrome; node scripts/build-zip.js chrome; ./scripts/prepare-amo-source.sh", From 6355e31004838a64746c987e3649326825337e6d Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Fri, 29 Nov 2019 01:00:59 +0100 Subject: [PATCH 10/29] Also ignore kate swap files, they're garbage we don't need on git --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 60f7db8..f0e3313 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ build/ /uw-git_keys *.pem + +*.kate-swp From 1581e3382c86f1964093420ee9858fec844e2ff3 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Fri, 29 Nov 2019 01:25:40 +0100 Subject: [PATCH 11/29] Add crx build file --- scripts/build-crx.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 scripts/build-crx.sh diff --git a/scripts/build-crx.sh b/scripts/build-crx.sh new file mode 100644 index 0000000..c176a19 --- /dev/null +++ b/scripts/build-crx.sh @@ -0,0 +1,42 @@ +#!/bin/bash -e +# +# Purpose: Pack a Chromium extension directory into crx format +# gotten from: https://web.archive.org/web/20180114090616/https://developer.chrome.com/extensions/crx#scripts +# +# Script assumes we're in basedir of the repository and that extension has been built and zipped to /dist-zip +# using the crx name we want (same name as zip, except different extension) +# +# also this doesn't check for errors ever so +# + +echo "entering dist-zip" +cd ./dist-zip + +zip=`ls | grep chrome.zip` +name="${name%.*}" +crx="$name.crx" +key="../keys/chrome-nightly.pub" +pub="$name.pub" +sig="$name.sig" +trap 'rm -f "$pub" "$sig" "$zip"' EXIT + +# signature +openssl sha1 -sha1 -binary -sign "$key" < "$zip" > "$sig" + +# public key +openssl rsa -pubout -outform DER < "$key" > "$pub" 2>/dev/null + +byte_swap () { + # Take "abcdefgh" and return it as "ghefcdab" + echo "${1:6:2}${1:4:2}${1:2:2}${1:0:2}" +} + +crmagic_hex="4372 3234" # Cr24 +version_hex="0200 0000" # 2 +pub_len_hex=$(byte_swap $(printf '%08x\n' $(ls -l "$pub" | awk '{print $5}'))) +sig_len_hex=$(byte_swap $(printf '%08x\n' $(ls -l "$sig" | awk '{print $5}'))) +( + echo "$crmagic_hex $version_hex $pub_len_hex $sig_len_hex" | xxd -r -p + cat "$pub" "$sig" "$zip" +) > "$crx" +echo "Wrote $crx" \ No newline at end of file From d359b60bc5b5a04e604bec5c18254bbb2491dec1 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Fri, 29 Nov 2019 01:26:52 +0100 Subject: [PATCH 12/29] don't remain cd'd into folder --- scripts/build-crx.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/build-crx.sh b/scripts/build-crx.sh index c176a19..80359e1 100644 --- a/scripts/build-crx.sh +++ b/scripts/build-crx.sh @@ -39,4 +39,7 @@ sig_len_hex=$(byte_swap $(printf '%08x\n' $(ls -l "$sig" | awk '{print $5}'))) echo "$crmagic_hex $version_hex $pub_len_hex $sig_len_hex" | xxd -r -p cat "$pub" "$sig" "$zip" ) > "$crx" -echo "Wrote $crx" \ No newline at end of file +echo "Wrote $crx" + +echo "exiting dist-zip" +cd .. \ No newline at end of file From 5a6195d36d27b23aa8be98084376ef0f06125cff Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Fri, 29 Nov 2019 01:27:24 +0100 Subject: [PATCH 13/29] fix permissions --- scripts/build-crx.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/build-crx.sh diff --git a/scripts/build-crx.sh b/scripts/build-crx.sh old mode 100644 new mode 100755 From 289baf73e59fd7fc23047758f450b53f135fbe85 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Fri, 29 Nov 2019 01:33:58 +0100 Subject: [PATCH 14/29] Force player re-detection when setting aspect ratio --- src/ext/conf/ExtConfPatches.js | 11 +++++++++ src/ext/conf/ExtensionConf.js | 7 ++++++ src/ext/lib/video-data/PlayerData.js | 34 ++++++++++++++++++---------- src/ext/lib/video-data/VideoData.js | 6 +++++ 4 files changed, 46 insertions(+), 12 deletions(-) diff --git a/src/ext/conf/ExtConfPatches.js b/src/ext/conf/ExtConfPatches.js index 4c2ff52..b14c719 100644 --- a/src/ext/conf/ExtConfPatches.js +++ b/src/ext/conf/ExtConfPatches.js @@ -241,6 +241,17 @@ const ExtensionConfPatch = [ } } } + }, { + forVersion: '4.4.1.1', + sites: { + "www.disneyplus.com": { + DOM: { + player: { + periodicallyRefreshPlayerElement: true, + } + } + }, + } } ]; diff --git a/src/ext/conf/ExtensionConf.js b/src/ext/conf/ExtensionConf.js index f014e23..e9f99c0 100644 --- a/src/ext/conf/ExtensionConf.js +++ b/src/ext/conf/ExtensionConf.js @@ -1083,6 +1083,13 @@ whatsNewChecked: true, }, css: 'video {\n width: 100% !important;\n height: 100% !important;\n}', }, + "www.disneyplus.com": { + DOM: { + player: { + periodicallyRefreshPlayerElement: true, + } + } + }, "imgur.com": { mode: -1, autoar: -1, diff --git a/src/ext/lib/video-data/PlayerData.js b/src/ext/lib/video-data/PlayerData.js index 950466d..168ce55 100644 --- a/src/ext/lib/video-data/PlayerData.js +++ b/src/ext/lib/video-data/PlayerData.js @@ -45,6 +45,13 @@ class PlayerData { this.dimensions = undefined; this.overlayNode = undefined; + this.periodicallyRefreshPlayerElement = false; + try { + this.periodicallyRefreshPlayerElement = this.settings.active.sites[window.location.host].DOM.player.periodicallyRefreshPlayerElement; + } catch (e) { + // no biggie — that means we don't have any special settings for this site. + } + // this happens when we don't find a matching player element if (!this.element) { this.invalid = true; @@ -98,19 +105,19 @@ class PlayerData { } try { - const ths = this; - this.observer = new MutationObserver((m,o) => this.onPlayerDimensionsChanged(m,o,ths)); + const ths = this; + this.observer = new MutationObserver((m,o) => this.onPlayerDimensionsChanged(m,o,ths)); - const observerConf = { - attributes: true, - // attributeFilter: ['style', 'class'], - attributeOldValue: true, - }; - - this.observer.observe(this.element, observerConf); - } catch (e) { - console.error("failed to set observer",e ) - } + const observerConf = { + attributes: true, + // attributeFilter: ['style', 'class'], + attributeOldValue: true, + }; + + this.observer.observe(this.element, observerConf); + } catch (e) { + console.error("failed to set observer",e ) + } // legacy mode still exists, but acts as a fallback for observers and is triggered less // frequently in order to avoid too many pointless checks this.legacyChangeDetection(); @@ -120,6 +127,9 @@ class PlayerData { while (!this.halted) { await this.sleep(1000); try { + if (this.periodicallyRefreshPlayerElement) { + this.forceRefreshPlayerElement(); + } if (this.checkPlayerSizeChange()) { this.videoData.resizer.restore(); } diff --git a/src/ext/lib/video-data/VideoData.js b/src/ext/lib/video-data/VideoData.js index d343f6d..beccc6f 100644 --- a/src/ext/lib/video-data/VideoData.js +++ b/src/ext/lib/video-data/VideoData.js @@ -2,6 +2,7 @@ import Debug from '../../conf/Debug'; import PlayerData from './PlayerData'; import Resizer from '../video-transform/Resizer'; import ArDetector from '../ar-detect/ArDetector'; +import AspectRatio from '../../../common/enums/aspect-ratio.enum'; class VideoData { @@ -300,6 +301,11 @@ class VideoData { if (this.invalid) { return; } + + if (ar.type === AspectRatio.Fixed || ar.type === AspectRatio.FitHeight || ar.type === AspectRatio.FitHeight) { + this.player.forceRefreshPlayerElement(); + } + this.resizer.setAr(ar, lastAr); } From 2675960aa08a4925178a03babc383ad61f296d62 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Fri, 29 Nov 2019 01:39:01 +0100 Subject: [PATCH 15/29] fix key name --- scripts/build-crx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-crx.sh b/scripts/build-crx.sh index 80359e1..ff58532 100755 --- a/scripts/build-crx.sh +++ b/scripts/build-crx.sh @@ -15,7 +15,7 @@ cd ./dist-zip zip=`ls | grep chrome.zip` name="${name%.*}" crx="$name.crx" -key="../keys/chrome-nightly.pub" +key="../keys/chrome-nightly.pem" pub="$name.pub" sig="$name.sig" trap 'rm -f "$pub" "$sig" "$zip"' EXIT From 967a5bf87bd4288860fc4df33d861034fe394034 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Fri, 29 Nov 2019 01:48:30 +0100 Subject: [PATCH 16/29] we don't have background.js file --- scripts/remove-evals.js | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/remove-evals.js b/scripts/remove-evals.js index 1004efe..10b826b 100644 --- a/scripts/remove-evals.js +++ b/scripts/remove-evals.js @@ -5,7 +5,6 @@ const fs = require('fs'); const BUNDLE_DIR = path.join(__dirname, '../dist'); const bundles = [ - 'background.js', 'popup/popup.js', 'options/options.js', ]; From bd38e28610271bc3843ed10ba1027564e7e36b9d Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Fri, 29 Nov 2019 01:53:23 +0100 Subject: [PATCH 17/29] fix --- scripts/build-crx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-crx.sh b/scripts/build-crx.sh index ff58532..2b299a7 100755 --- a/scripts/build-crx.sh +++ b/scripts/build-crx.sh @@ -13,7 +13,7 @@ echo "entering dist-zip" cd ./dist-zip zip=`ls | grep chrome.zip` -name="${name%.*}" +name="${zip%.*}" crx="$name.crx" key="../keys/chrome-nightly.pem" pub="$name.pub" From 30d6338d769160ea29fb48e0faf3de10b72b1693 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Tue, 3 Dec 2019 02:01:29 +0100 Subject: [PATCH 18/29] Separate testing and nightly --- package.json | 2 ++ scripts/build-crx.sh | 2 +- webpack.config.js | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 0f18671..7110c19 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,9 @@ "build-chrome": "cross-env NODE_ENV=production BROWSER=chrome webpack --hide-modules", "build-edge": "cross-env NODE_ENV=production BROWSER=edge webpack --hide-modules", "build:dev": "cross-env NODE_ENV=development BROWSER=firefox webpack --hide-modules", + "build-testing": "cross-env NODE_ENV=development BROWSER=firefox CHANNEL=testing webpack --hide-modules", "build-nightly": "cross-env NODE_ENV=development BROWSER=firefox CHANNEL=nightly webpack --hide-modules", + "build-testing-chrome": "cross-env NODE_ENV=development BROWSER=chrome CHANNEL=testing webpack --hide-modules", "build-nightly-chrome": "cross-env NODE_ENV=development BROWSER=chrome CHANNEL=nightly webpack --hide-modules", "build-chrome:dev": "cross-env NODE_ENV=development BROWSER=chrome webpack --hide-modules", "build-edge:dev": "cross-env NODE_ENV=development BROWSER=edge webpack --hide-modules", diff --git a/scripts/build-crx.sh b/scripts/build-crx.sh index 2b299a7..17ae75a 100755 --- a/scripts/build-crx.sh +++ b/scripts/build-crx.sh @@ -15,7 +15,7 @@ cd ./dist-zip zip=`ls | grep chrome.zip` name="${zip%.*}" crx="$name.crx" -key="../keys/chrome-nightly.pem" +key="../keys/chrome-nightly.pem" # this is also good for testing build pub="$name.pub" sig="$name.sig" trap 'rm -f "$pub" "$sig" "$zip"' EXIT diff --git a/webpack.config.js b/webpack.config.js index 474304c..8a92001 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -98,6 +98,22 @@ const config = { }.${process.env.BUILD_NUMBER}`; jsonContent.browser_action.default_title = "Ultrawidify Nightly"; + // otherwise things will get fun! + delete jsonContent.applications; + } else if (process.env.CHANNEL === 'testing') { + jsonContent.name = "Ultrawidify - testing"; + jsonContent.description = "FOR TESTING ONLY -- this build is intended for testing a fix of certain bugs. It's not fit for normal use."; + + // version numbers for nightly builds: YYMM.DD.BUILD_NUMBER + jsonContent.version = `${new Date() + .toISOString() // YYYY-MM-DDTHH:MM:SS... + .split('T')[0] // gives YYYY-MM-DD + .substr(2) // YYYY -> YY + .replace('-', '') // YY-MM-DD -> YYMM-DD + .replace('-', '.') // YYMM-DD -> YYMM.DD + }.${process.env.BUILD_NUMBER}`; + jsonContent.browser_action.default_title = "Ultrawidify Testing"; + // otherwise things will get fun! delete jsonContent.applications; } From 5d200805f0bd05796c50a24d5d3a6021a5fa52da Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Tue, 3 Dec 2019 02:07:15 +0100 Subject: [PATCH 19/29] build-zip should get data from /dist instead of /src --- scripts/build-zip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-zip.js b/scripts/build-zip.js index f27272a..221ee40 100644 --- a/scripts/build-zip.js +++ b/scripts/build-zip.js @@ -9,7 +9,7 @@ const DEST_ZIP_DIR = path.join(__dirname, '../dist-zip'); const extractExtensionData = () => { - const extPackageJson = require('../src/manifest.json'); + const extPackageJson = require('../dist/manifest.json'); return { name: extPackageJson.name, From a1b89e0fc244dac9d1ee3512b76570bbeab82c5e Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Tue, 3 Dec 2019 02:11:16 +0100 Subject: [PATCH 20/29] This is here mostly to test CI (master commit shouldn't build, merge to testing should) --- webpack.config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 8a92001..ce396ac 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -98,7 +98,7 @@ const config = { }.${process.env.BUILD_NUMBER}`; jsonContent.browser_action.default_title = "Ultrawidify Nightly"; - // otherwise things will get fun! + // because we don't want web-ext to submit this as proper release delete jsonContent.applications; } else if (process.env.CHANNEL === 'testing') { jsonContent.name = "Ultrawidify - testing"; @@ -114,7 +114,7 @@ const config = { }.${process.env.BUILD_NUMBER}`; jsonContent.browser_action.default_title = "Ultrawidify Testing"; - // otherwise things will get fun! + // because we don't want web-ext to submit this as proper release delete jsonContent.applications; } From cc6d08e452d8d0371adb185aeb4c59860041fc02 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Tue, 3 Dec 2019 02:20:59 +0100 Subject: [PATCH 21/29] Readme update to trigger jenkins build --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 7bbcf15..9023f82 100644 --- a/README.md +++ b/README.md @@ -245,6 +245,12 @@ However, I do plan on implementing this feature. Hopefully by the end of the yea ### Installing the current, github version +## Get pre-built version: + +TODO + +## Build from source + Requirements: npm, node. 1. Clone this repo From 291699b925167f2432647abcc7aa14ae19d72290 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Tue, 3 Dec 2019 22:11:29 +0100 Subject: [PATCH 22/29] Build script moved to file --- scripts/build-and-deploy.sh | 74 +++++++++++++++++++++++++++++++++++++ scripts/build-zip.js | 27 ++++++++++---- 2 files changed, 94 insertions(+), 7 deletions(-) create mode 100644 scripts/build-and-deploy.sh diff --git a/scripts/build-and-deploy.sh b/scripts/build-and-deploy.sh new file mode 100644 index 0000000..a652d91 --- /dev/null +++ b/scripts/build-and-deploy.sh @@ -0,0 +1,74 @@ +#!/bin/bash +# env variables to set: +# +# FORCE_BUILD set this variable to "true" if you wanna force build, even if build was +# triggered without any commits pushed to the directory +# +# BUILD_SCRIPT build-testing or build-nightly, could be any other from package.json tho +# +# RELEASE_SERVER target server (where to push built zips after they've been built) +# RELEASE_DIRECTORY base directory on the target server +# BUILD_CHANNEL_DIRECTORY directory for uploads, inside the release directory +# +# AMO_API_KEY needed if you want to sign and push extension to addons.mozilla.org +# AMO_API_SECRET -||- + +# don't build if nothing has changed, unless overriden via env variable +if [ ! -z "$GIT_COMMIT" && ! -z "$GIT_PREVIOUS_COMMIT" ] ; then + if [ "$GIT_COMMIT" == "$GIT_PREVIOUS_COMMIT" ] ; then + if [ $FORCE_BUILD == "true" ] ; then + echo "--------------------------------------------" + echo " Nothing has changed. Aborting build." + echo "--------------------------------------------" + exit 0; + fi + fi +fi + +npm ci + +rm -rf /dist-zip || true # no big deal if ./dist-zip doesn't exist + +# +# build firefox +# +npm run "${BUILD_SCRIPT}" +node scripts/build-zip.js ff +if [ ! -z "${AMO_API_KEY}" ] ; then + if [ ! -z "${AMO_API_SECRET}" ] ; then + web-ext sign --source-dir ./dist --api-key "${AMO_API_KEY}" --api-secret "${AMO_API_SECRET}" + fi +fi + +# +# build chrome +# +npm run "${BUILD_SCRIPT}-chrome" +node scripts/build-zip.js chrome + +# +#./scripts/build-crx.sh +# + +###################################### +# UPLOAD TO WEB SERVER +###################################### + +# add ssh key, if not added +if [ -z "$SSH_AUTH_SOCK" ] ; then + eval `ssh-agent -s` + ssh-add +fi + +# push all built stuff to the server +scp -r ./build-zip/* "ultrawidify-uploader@${RELEASE_SERVER}:${RELEASE_DIRECTORY}${BUILD_CHANNEL_DIRECTORY}" + + + +###################################### +# Build finished message +###################################### + +echo "--------------------------------------------" +echo " Nothing has changed. Aborting build." +echo "--------------------------------------------" diff --git a/scripts/build-zip.js b/scripts/build-zip.js index 221ee40..d7bca36 100644 --- a/scripts/build-zip.js +++ b/scripts/build-zip.js @@ -17,9 +17,9 @@ const extractExtensionData = () => { } }; -const makeDestZipDirIfNotExists = () => { - if(!fs.existsSync(DEST_ZIP_DIR)) { - fs.mkdirSync(DEST_ZIP_DIR); +const makeDirIfNotExists = (dir) => { + if(!fs.existsSync(dir)) { + fs.mkdirSync(dir); } } @@ -42,13 +42,26 @@ const buildZip = (src, dist, zipFilename) => { const main = () => { const browser = process.argv[2]; + const testingOrNightly = process.argv[3]; const {name, version} = extractExtensionData(); - const zipFilename = `${name.replace(/[ -]+/g, '')}-${version}-${browser}.zip`; - - makeDestZipDirIfNotExists(); - buildZip(DEST_DIR, DEST_ZIP_DIR, zipFilename) + // collapse spaces and dashes into single dash + const baseFilename = `${name.replace(/[ -]+/g, '-')}-${version}`; + + let realZipDir; + + if (!!testingOrNightly) { + realZipDir = path.join(DEST_ZIP_DIR, baseFilename); + } else { + realZipDir = DEST_ZIP_DIR; + } + + const zipFilename = `${baseFilename}-${browser}.zip`; + + makeDirIfNotExists(realZipDir); + + buildZip(DEST_DIR, realZipDir, zipFilename) .then(() => console.info('OK')) .catch(console.err); }; From 33d9bbe00b6ebe4b74e471a12ad8570f4c390a5d Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Tue, 3 Dec 2019 22:19:00 +0100 Subject: [PATCH 23/29] +x --- scripts/build-and-deploy.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/build-and-deploy.sh diff --git a/scripts/build-and-deploy.sh b/scripts/build-and-deploy.sh old mode 100644 new mode 100755 From 6283bd74e585475b48e9c25406c330f014587bb6 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Tue, 3 Dec 2019 22:30:26 +0100 Subject: [PATCH 24/29] Fix script --- scripts/build-and-deploy.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/scripts/build-and-deploy.sh b/scripts/build-and-deploy.sh index a652d91..08f327a 100755 --- a/scripts/build-and-deploy.sh +++ b/scripts/build-and-deploy.sh @@ -14,13 +14,15 @@ # AMO_API_SECRET -||- # don't build if nothing has changed, unless overriden via env variable -if [ ! -z "$GIT_COMMIT" && ! -z "$GIT_PREVIOUS_COMMIT" ] ; then - if [ "$GIT_COMMIT" == "$GIT_PREVIOUS_COMMIT" ] ; then - if [ $FORCE_BUILD == "true" ] ; then - echo "--------------------------------------------" - echo " Nothing has changed. Aborting build." - echo "--------------------------------------------" - exit 0; +if [ ! -z "$GIT_COMMIT" ] ; then + if [ ! -z "$GIT_PREVIOUS_COMMIT" ] ; then + if [ "$GIT_COMMIT" == "$GIT_PREVIOUS_COMMIT" ] ; then + if [ $FORCE_BUILD == "true" ] ; then + echo "--------------------------------------------" + echo " Nothing has changed. Aborting build." + echo "--------------------------------------------" + exit 0; + fi fi fi fi @@ -70,5 +72,5 @@ scp -r ./build-zip/* "ultrawidify-uploader@${RELEASE_SERVER}:${RELEASE_DIRECTORY ###################################### echo "--------------------------------------------" -echo " Nothing has changed. Aborting build." +echo " BUILD FINISHED SUCCESSFULLY" echo "--------------------------------------------" From 18cf4e5d0f83478cf8e4a2e67565cd77cb5e0e61 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Tue, 3 Dec 2019 22:39:07 +0100 Subject: [PATCH 25/29] Add logging to build script --- scripts/build-and-deploy.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/build-and-deploy.sh b/scripts/build-and-deploy.sh index 08f327a..d115382 100755 --- a/scripts/build-and-deploy.sh +++ b/scripts/build-and-deploy.sh @@ -13,6 +13,16 @@ # AMO_API_KEY needed if you want to sign and push extension to addons.mozilla.org # AMO_API_SECRET -||- +echo "============= STARTING BUILD SCRIPT =============" +pwd +whoami +echo " ::: env dump" +echo " -> FORCE_BUILD: $FORCE_BUILD" +echo " -> BUILD_SCRIPT: $BUILD_SCRIPT" +echo " -> RELEASE_SERVER: $RELEASE_SERVER" +echo " -> RELEASE_DIRECTORY: $RELEASE_DIRECTORY" +echo " -> BUILD_CHANNEL_DIRECTORY: $BUILD_CHANNEL_DIRECTORY" + # don't build if nothing has changed, unless overriden via env variable if [ ! -z "$GIT_COMMIT" ] ; then if [ ! -z "$GIT_PREVIOUS_COMMIT" ] ; then @@ -29,7 +39,7 @@ fi npm ci -rm -rf /dist-zip || true # no big deal if ./dist-zip doesn't exist +rm -rf ./dist-zip || true # no big deal if ./dist-zip doesn't exist # # build firefox From 4bfb116d4512c2a7b0f30a2033bbe86eb2115c14 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Wed, 4 Dec 2019 18:04:46 +0100 Subject: [PATCH 26/29] fix for build override? --- scripts/build-and-deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-and-deploy.sh b/scripts/build-and-deploy.sh index d115382..acc5120 100755 --- a/scripts/build-and-deploy.sh +++ b/scripts/build-and-deploy.sh @@ -27,7 +27,7 @@ echo " -> BUILD_CHANNEL_DIRECTORY: $BUILD_CHANNEL_DIRECTORY" if [ ! -z "$GIT_COMMIT" ] ; then if [ ! -z "$GIT_PREVIOUS_COMMIT" ] ; then if [ "$GIT_COMMIT" == "$GIT_PREVIOUS_COMMIT" ] ; then - if [ $FORCE_BUILD == "true" ] ; then + if [ $FORCE_BUILD == true ] ; then echo "--------------------------------------------" echo " Nothing has changed. Aborting build." echo "--------------------------------------------" From 0801c122e2d204a3672ab1079285b6e7e2fafe91 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Wed, 4 Dec 2019 18:26:17 +0100 Subject: [PATCH 27/29] disable copy for a bit, we're doing that with plugin now --- scripts/build-and-deploy.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/build-and-deploy.sh b/scripts/build-and-deploy.sh index acc5120..ae7c2d0 100755 --- a/scripts/build-and-deploy.sh +++ b/scripts/build-and-deploy.sh @@ -66,14 +66,14 @@ node scripts/build-zip.js chrome # UPLOAD TO WEB SERVER ###################################### -# add ssh key, if not added -if [ -z "$SSH_AUTH_SOCK" ] ; then - eval `ssh-agent -s` - ssh-add -fi +# # add ssh key, if not added +# if [ -z "$SSH_AUTH_SOCK" ] ; then +# eval `ssh-agent -s` +# ssh-add +# fi -# push all built stuff to the server -scp -r ./build-zip/* "ultrawidify-uploader@${RELEASE_SERVER}:${RELEASE_DIRECTORY}${BUILD_CHANNEL_DIRECTORY}" +# # push all built stuff to the server +# scp -r ./build-zip/* "ultrawidify-uploader@${RELEASE_SERVER}:${RELEASE_DIRECTORY}${BUILD_CHANNEL_DIRECTORY}" From 73b1a57749afe986d53729d00c5d623ddffcf2a7 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Fri, 6 Dec 2019 00:17:09 +0100 Subject: [PATCH 28/29] Added extra stretch/squish options, hopefully fixed disney+, fixed bug that prevented removal of actions added by user --- src/common/components/ActionAlt.vue | 2 +- src/common/enums/stretch.enum.js | 2 + src/ext/conf/ActionList.js | 14 ++++++ src/ext/conf/ExtConfPatches.js | 47 ++++++++++++++++++ src/ext/conf/ExtensionConf.js | 42 +++++++++++++++- src/ext/lib/comms/CommsClient.js | 2 +- src/ext/lib/video-data/PageInfo.js | 6 +-- src/ext/lib/video-data/VideoData.js | 4 +- src/ext/lib/video-transform/Resizer.js | 26 ++++++---- src/ext/lib/video-transform/Stretcher.js | 48 +++++++++++++++++-- .../controls-settings/AddEditActionPopup.vue | 2 +- src/popup/panels/VideoPanel.vue | 4 ++ 12 files changed, 175 insertions(+), 24 deletions(-) diff --git a/src/common/components/ActionAlt.vue b/src/common/components/ActionAlt.vue index 47cf2e2..5964ac2 100644 --- a/src/common/components/ActionAlt.vue +++ b/src/common/components/ActionAlt.vue @@ -5,7 +5,7 @@
- 🗙 + 🗙 🗙     🖉     {{action.name}} diff --git a/src/common/enums/stretch.enum.js b/src/common/enums/stretch.enum.js index a5c0915..130f92b 100644 --- a/src/common/enums/stretch.enum.js +++ b/src/common/enums/stretch.enum.js @@ -3,6 +3,8 @@ var Stretch = Object.freeze({ Basic: 1, Hybrid: 2, Conditional: 3, + Fixed: 4, + FixedSource: 5, Default: -1 }); diff --git a/src/ext/conf/ActionList.js b/src/ext/conf/ActionList.js index c41f906..8032ea1 100644 --- a/src/ext/conf/ActionList.js +++ b/src/ext/conf/ActionList.js @@ -72,6 +72,20 @@ var ActionList = { },{ name: 'Thin borders', arg: Stretch.Conditional, + },{ + name: 'Fixed (source)', + arg: Stretch.FixedSource, + customArg: true, + scopes: { + page: true, + } + },{ + name: 'Fixed (displayed)', + arg: Stretch.Fixed, + customArg: true, + scopes: { + page: true, + } },{ name: 'Default', arg: Stretch.Default, diff --git a/src/ext/conf/ExtConfPatches.js b/src/ext/conf/ExtConfPatches.js index b14c719..8912888 100644 --- a/src/ext/conf/ExtConfPatches.js +++ b/src/ext/conf/ExtConfPatches.js @@ -1,5 +1,6 @@ // How to use: // version: {ExtensionConf object, but only properties that get overwritten} +import Stretch from '../../common/enums/stretch.enum'; const ExtensionConfPatch = [ { @@ -146,6 +147,7 @@ const ExtensionConfPatch = [ show: true, } }, { + userAdded: true, name: 'Persist crop while on page', label: 'Until page load', cmd: [{ @@ -164,6 +166,7 @@ const ExtensionConfPatch = [ show: true, } }, { + userAdded: true, name: 'Persist crop for current session', label: 'Current session', cmd: [{ @@ -252,6 +255,50 @@ const ExtensionConfPatch = [ } }, } + }, { + forVersion: '4.4.2', + updateFn: (userOptions, defaultOptions) => { + try { + userOptions.actions.push( + { + name: 'Stretch source to 4:3', + label: '4:3 stretch (src)', + cmd: [{ + action: 'set-stretch', + arg: Stretch.FixedSource, + customArg: 1.33, + }], + scopes: { + page: { + show: true + } + }, + playerUi: { + show: true, + path: 'crop' + } + }, { + name: 'Stretch source to 16:9', + label: '16:9 stretch (src)', + cmd: [{ + action: 'set-stretch', + arg: Stretch.FixedSource, + customArg: 1.77, + }], + scopes: { + page: { + show: true, + } + }, + playerUi: { + show: true, + path: 'crop' + } + }); + } catch (e) { + console.error("PROBLEM APPLYING SETTINGS", e); + } + } } ]; diff --git a/src/ext/conf/ExtensionConf.js b/src/ext/conf/ExtensionConf.js index e9f99c0..052c2d8 100644 --- a/src/ext/conf/ExtensionConf.js +++ b/src/ext/conf/ExtensionConf.js @@ -285,6 +285,7 @@ var ExtensionConf = { path: 'crop' } }, { + userAdded: true, name: 'Set aspect ratio to 16:9', label: '16:9', cmd: [{ @@ -312,6 +313,7 @@ var ExtensionConf = { path: 'crop' } }, { + userAdded: true, name: 'Set aspect ratio to 21:9 (2.39:1)', label: '21:9', cmd: [{ @@ -339,6 +341,7 @@ var ExtensionConf = { path: 'crop' } }, { + userAdded: true, name: 'Set aspect ratio to 18:9', label: '18:9', cmd: [{ @@ -651,6 +654,41 @@ var ExtensionConf = { show: true, } } + }, // NEW OPTIONS + { + name: 'Stretch source to 4:3', + label: '4:3 stretch (src)', + cmd: [{ + action: 'set-stretch', + arg: Stretch.FixedSource, + customArg: 1.33, + }], + scopes: { + page: { + show: true, + } + }, + playerUi: { + show: true, + path: 'crop' + } + }, { + name: 'Stretch source to 16:9', + label: '16:9 stretch (src)', + cmd: [{ + action: 'set-stretch', + arg: Stretch.FixedSource, + customArg: 1.77, + }], + scopes: { + page: { + show: true, + } + }, + playerUi: { + show: true, + path: 'crop' + } }, // // A L I G N M E N T @@ -920,8 +958,8 @@ var ExtensionConf = { } } }, -], -whatsNewChecked: true, + ], + whatsNewChecked: true, // ----------------------------------------- // ::: SITE CONFIGURATION ::: // ----------------------------------------- diff --git a/src/ext/lib/comms/CommsClient.js b/src/ext/lib/comms/CommsClient.js index cd8c7d9..1f96ed1 100644 --- a/src/ext/lib/comms/CommsClient.js +++ b/src/ext/lib/comms/CommsClient.js @@ -65,7 +65,7 @@ class CommsClient { this.pageInfo.setVideoAlignment(message.arg, message.playing); this.pageInfo.restoreAr(); } else if (message.cmd === "set-stretch") { - this.pageInfo.setStretchMode(message.arg, message.playing); + this.pageInfo.setStretchMode(message.arg, message.playing, message.customArg); } else if (message.cmd === 'set-keyboard') { this.pageInfo.setKeyboardShortcutsEnabled(message.arg) } else if (message.cmd === "autoar-start") { diff --git a/src/ext/lib/video-data/PageInfo.js b/src/ext/lib/video-data/PageInfo.js index 6e055a9..024a6c7 100644 --- a/src/ext/lib/video-data/PageInfo.js +++ b/src/ext/lib/video-data/PageInfo.js @@ -490,18 +490,18 @@ class PageInfo { } } - setStretchMode(sm, playingOnly){ + setStretchMode(stretchMode, playingOnly, fixedStretchRatio){ // TODO: find a way to only change aspect ratio for one video if (playingOnly) { for(var vd of this.videos){ if (vd.isPlaying()) { - vd.setStretchMode(sm) + vd.setStretchMode(stretchMode, fixedStretchRatio) } } } else { for(var vd of this.videos){ - vd.setStretchMode(sm) + vd.setStretchMode(stretchMode, fixedStretchRatio) } } } diff --git a/src/ext/lib/video-data/VideoData.js b/src/ext/lib/video-data/VideoData.js index beccc6f..11eb481 100644 --- a/src/ext/lib/video-data/VideoData.js +++ b/src/ext/lib/video-data/VideoData.js @@ -359,11 +359,11 @@ class VideoData { this.resizer.restore(); } - setStretchMode(stretchMode){ + setStretchMode(stretchMode, fixedStretchRatio){ if (this.invalid) { return; } - this.resizer.setStretchMode(stretchMode); + this.resizer.setStretchMode(stretchMode, fixedStretchRatio); } setZoom(zoomLevel, no_announce){ diff --git a/src/ext/lib/video-transform/Resizer.js b/src/ext/lib/video-transform/Resizer.js index dd87f6b..5b6c1af 100644 --- a/src/ext/lib/video-transform/Resizer.js +++ b/src/ext/lib/video-transform/Resizer.js @@ -242,7 +242,9 @@ class Resizer { } // do stretch thingy - if (this.stretcher.mode === Stretch.NoStretch || this.stretcher.mode === Stretch.Conditional){ + if (this.stretcher.mode === Stretch.NoStretch + || this.stretcher.mode === Stretch.Conditional + || this.stretcher.mode === Stretch.FixedSource){ var stretchFactors = this.scaler.calculateCrop(ar); if(! stretchFactors || stretchFactors.error){ @@ -255,15 +257,23 @@ class Resizer { } return; } - if(this.stretcher.mode === Stretch.Conditional){ - this.stretcher.applyConditionalStretch(stretchFactors, ar.ratio); - } - this.logger.log('info', 'debug', "[Resizer::setAr] Processed stretch factors for ", this.stretcher.mode === Stretch.NoStretch ? 'stretch-free crop.' : 'crop with conditional stretch.', 'Stretch factors are:', stretchFactors); + if (this.stretcher.mode === Stretch.Conditional){ + this.stretcher.applyConditionalStretch(stretchFactors, ar.ratio); + } else if (this.stretcher.mode === Stretch.FixedSource) { + this.stretcher.applyStretchFixedSource(stretchFactors); + } + this.logger.log('info', 'debug', "[Resizer::setAr] Processed stretch factors for ", + this.stretcher.mode === Stretch.NoStretch ? 'stretch-free crop.' : + this.stretcher.mode === Stretch.Conditional ? 'crop with conditional stretch.' : 'crop with fixed stretch', + 'Stretch factors are:', stretchFactors + ); } else if (this.stretcher.mode === Stretch.Hybrid) { var stretchFactors = this.stretcher.calculateStretch(ar.ratio); this.logger.log('info', 'debug', '[Resizer::setAr] Processed stretch factors for hybrid stretch/crop. Stretch factors are:', stretchFactors); + } else if (this.stretcher.mode === Stretch.Fixed) { + var stretchFactors = this.stretchFactors.calculateStretchFixed(ar.ratio) } else if (this.stretcher.mode === Stretch.Basic) { var stretchFactors = this.stretcher.calculateBasicStretch(); this.logger.log('info', 'debug', '[Resizer::setAr] Processed stretch factors for basic stretch. Stretch factors are:', stretchFactors); @@ -296,8 +306,8 @@ class Resizer { return this.lastAr; } - setStretchMode(stretchMode){ - this.stretcher.setStretchMode(stretchMode); + setStretchMode(stretchMode, fixedStretchRatio){ + this.stretcher.setStretchMode(stretchMode, fixedStretchRatio); this.restore(); } @@ -459,8 +469,6 @@ class Resizer { '\nwdiff, hdiffAfterZoom:', wdiffAfterZoom, 'x', hdiffAfterZoom, '\n\n---- data out ----\n', 'translate:', translate); - console.trace(); - return translate; } diff --git a/src/ext/lib/video-transform/Stretcher.js b/src/ext/lib/video-transform/Stretcher.js index b54f94d..2a5f48f 100644 --- a/src/ext/lib/video-transform/Stretcher.js +++ b/src/ext/lib/video-transform/Stretcher.js @@ -15,12 +15,16 @@ class Stretcher { this.logger = videoData.logger; this.settings = videoData.settings; this.mode = this.settings.getDefaultStretchMode(window.location.hostname); + this.fixedStretchRatio = undefined; } - setStretchMode(stretchMode) { + setStretchMode(stretchMode, fixedStretchRatio) { if (stretchMode === Stretch.Default) { this.mode = this.settings.getDefaultStretchMode(window.location.hostname); } else { + if (stretchMode === Stretch.Fixed || stretchMode == Stretch.FixedSource) { + this.fixedStretchRatio = fixedStretchRatio; + } this.mode = stretchMode; } } @@ -95,9 +99,43 @@ class Stretcher { }; } - calculateStretch(actualAr) { - var playerAr = this.conf.player.dimensions.width / this.conf.player.dimensions.height; - var videoAr = this.conf.video.videoWidth / this.conf.video.videoHeight; + applyStretchFixedSource(postCropStretchFactors) { + const videoAr = this.conf.video.videoWidth / this.conf.video.videoHeight; + const playerAr = this.conf.player.dimensions.width / this.conf.player.dimensions.height; + + const squezeFactor = this.fixedStretchRatio / videoAr; + + // Whether squeezing happens on X or Y axis depends on whether required AR is wider or narrower than + // the player, in which the video is displayed + // * we squeeze X axis, if target AR is narrower than player size + // * we squeeze Y axis, if target AR is wider than the player size + + this.logger.log('info', 'stretcher', `[Stretcher::applyStretchFixedSource] here's what we got: +postCropStretchFactors: x=${postCropStretchFactors.xFactor} y=${postCropStretchFactors.yFactor} +fixedStretchRatio: ${this.fixedStretchRatio} +videoAr: ${videoAr} +playerAr: ${playerAr} +squeezeFactor: ${squezeFactor}`, '\nvideo', this.conf.video); + + + if (this.fixedStretchRatio < playerAr) { + postCropStretchFactors.xFactor *= squezeFactor; + } else { + postCropStretchFactors.yFactor *= squezeFactor; + } + + this.logger.log('info', 'stretcher', `[Stretcher::applyStretchFixedSource] here's what we'll apply:\npostCropStretchFactors: x=${postCropStretchFactors.x} y=${postCropStretchFactors.y}`); + + return postCropStretchFactors; + } + + calculateStretchFixed(actualAr) { + return this.calculateStretch(actualAr, this.fixedStretchRatio); + } + + calculateStretch(actualAr, playerArOverride) { + const playerAr = playerArOverride || this.conf.player.dimensions.width / this.conf.player.dimensions.height; + const videoAr = this.conf.video.videoWidth / this.conf.video.videoHeight; if (! actualAr){ actualAr = playerAr; @@ -158,7 +196,7 @@ class Stretcher { // video is letterboxed by player // actual is pillarboxed by video stretchFactors.xFactor = actualAr / playerAr; - stretchFActors.yFactor = actualAr / playerAr; + stretchFactors.yFactor = actualAr / playerAr; this.logger.log('info', 'stretcher', "[Stretcher.js::calculateStretch] stretching strategy 5") } else { diff --git a/src/options/controls-settings/AddEditActionPopup.vue b/src/options/controls-settings/AddEditActionPopup.vue index 10a929f..b390da7 100644 --- a/src/options/controls-settings/AddEditActionPopup.vue +++ b/src/options/controls-settings/AddEditActionPopup.vue @@ -229,7 +229,7 @@ export default { }, saveSettings() { if (this.currentCmdIndex < 0) { - this.settings.active.actions.push(this.action); + this.settings.active.actions.push({...this.action, ...{userAdded: true}}); } this.settings.save(); this.close(); diff --git a/src/popup/panels/VideoPanel.vue b/src/popup/panels/VideoPanel.vue index 3e66185..a75d401 100644 --- a/src/popup/panels/VideoPanel.vue +++ b/src/popup/panels/VideoPanel.vue @@ -22,6 +22,7 @@ >
+
You can change or add additional aspect ratios on the settings page (in 'actions&shortcuts' menu).
Date: Fri, 6 Dec 2019 00:17:20 +0100 Subject: [PATCH 29/29] Version update stuff --- package.json | 2 +- src/manifest.json | 2 +- src/popup/panels/WhatsNewPanel.vue | 21 ++++++++++++++++----- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 7110c19..9e9476b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ultravidify", - "version": "4.4.1", + "version": "4.4.2", "description": "Aspect ratio fixer for youtube that works around some people's disability to properly encode 21:9 (and sometimes, 16:9) videos.", "author": "Tamius Han ", "scripts": { diff --git a/src/manifest.json b/src/manifest.json index 4ea382a..46818da 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "Ultrawidify", "description": "Removes black bars on ultrawide videos and offers advanced options to fix aspect ratio.", - "version": "4.4.1", + "version": "4.4.2", "applications": { "gecko": { "id": "{cf02b1a7-a01a-4e37-a609-516a283f1ed3}" diff --git a/src/popup/panels/WhatsNewPanel.vue b/src/popup/panels/WhatsNewPanel.vue index 855ce55..fa23145 100644 --- a/src/popup/panels/WhatsNewPanel.vue +++ b/src/popup/panels/WhatsNewPanel.vue @@ -2,12 +2,23 @@

What's new

Full changelog for older versions is available here.

-

4.4.1

+

4.4.2

    -
  • Changes to player detection that fix issues with vk
  • -
  • Extension tries to avoid setting aspect ratio pointlessly
  • -
  • Fixed (hopefully) mailto: and reddit compose links.
  • -
  • When reporting bugs, email/reddit template now automatically gathers browser, extension version and OS.
  • +
  • Stretching supports two new kinds of stretching (both hybrid). One stretches (or squishes) the video before + applying any possible crop, the other option first crops and then stretches/squishes to specified aspect ratio.
    + Especially the first option should be great for all men of culture who prefer watching content in its native aspect + ratio (even if that means seeing black bars) who get outright triggered when some uncivilized barbarians stretch 4:3 + content to 16:9. You're welcome.
    Okay maybe I shouldn't soapboax like that in my patch notes.
    + There's two new buttons in 'stretch' section (video only). You can add more in extension settings if you want.
    + This is experimental af and wasn't tested thoroughly — feedback welcome. Links in 'report a problem' tab of + this popup. +
  • +
  • Disney+ didn't work for some. I've attempted to do a fix, but I am unable to test it (by the virtue of D+ not + being available in my country). If Disney+ continues to be problematic, I will probably need some help with it. + I would love to hear some feedback on whether extension works on Disney+ or not — please consider contacting me + via email or reddit. +
  • +
  • Fixed a bug where user added actions would not be removable the nice way.