Skip to content

Commit 894fbfb

Browse files
Release build patch [ci release]
1 parent d145336 commit 894fbfb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+726
-103
lines changed

.autorc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@
66
"repo": "content-scope-scripts",
77
"name": "dax",
88
"email": "[email protected]",
9-
"baseBranch": "releases",
10-
"onlyPublishWithReleaseLabel": true
9+
"baseBranch": "releases"
1110
}

.github/workflows/build.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Release
22

33
on:
4+
push:
5+
branches:
6+
- main
47
workflow_dispatch:
58

69
jobs:
@@ -19,6 +22,7 @@ jobs:
1922
run: |
2023
git fetch --all
2124
git checkout releases
25+
git checkout main .
2226
2327
- name: Build release
2428
run: |
@@ -27,7 +31,6 @@ jobs:
2731
2832
- name: Check in files
2933
run: |
30-
git checkout releases
3134
git add -f build/ Sources/
3235
3336
- name: Get version
@@ -49,4 +52,4 @@ jobs:
4952
env:
5053
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5154
run: |
52-
npx auto shipit
55+
npx auto release

Sources/ContentScopeScripts/dist/contentScope.js

Lines changed: 79 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1895,6 +1895,7 @@
18951895

18961896
for (const featureName of featureNames) {
18971897
const filename = featureName.replace(/([a-zA-Z])(?=[A-Z0-9])/g, '$1-').toLowerCase();
1898+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
18981899
const feature = __variableDynamicImportRuntime0__(`./features/${filename}.js`).then(({ init, load, update }) => {
18991900
if (load) {
19001901
load(args);
@@ -2973,6 +2974,8 @@
29732974
return { config, sharedStrings }
29742975
}
29752976

2977+
// @ts-nocheck
2978+
29762979
let devMode = false;
29772980
let isYoutubePreviewsEnabled = false;
29782981
let appID;
@@ -4695,6 +4698,7 @@
46954698
case 'closest-empty':
46964699
// hide the outermost empty node so that we may unhide if ad loads
46974700
if (isDomNodeEmpty(element)) {
4701+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
46984702
collapseDomNode(element.parentNode, rule, element);
46994703
} else if (previousElement) {
47004704
hideNode(previousElement);
@@ -4729,6 +4733,7 @@
47294733
} else if (type === 'closest-empty') {
47304734
// iterate upwards from matching DOM elements until we arrive at previously
47314735
// hidden element. Unhide element if it contains visible content.
4736+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
47324737
expandNonEmptyDomNode(element.parentNode, rule);
47334738
}
47344739
break
@@ -4832,6 +4837,7 @@
48324837
// check at 750ms, 1500ms, 2250ms, 3000ms
48334838
unhideTimeouts.forEach((timeout) => {
48344839
setTimeout(() => {
4840+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
48354841
unhideLoadedAds();
48364842
}, timeout);
48374843
});
@@ -4905,6 +4911,7 @@
49054911
rules.forEach((rule) => {
49064912
const matchingElementArray = [...document.querySelectorAll(rule.selector)];
49074913
matchingElementArray.forEach((element) => {
4914+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
49084915
collapseDomNode(element, rule);
49094916
});
49104917
});
@@ -5069,6 +5076,7 @@
50695076
const channelData = DDGReflect.apply(target, thisArg, args);
50705077
// Anything we do here should be caught and ignored silently
50715078
try {
5079+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
50725080
transformArrayData(channelData, domainKey, sessionKey, thisArg, args);
50735081
} catch {
50745082
}
@@ -5084,6 +5092,7 @@
50845092
DDGReflect.apply(target, thisArg, args);
50855093
// Anything we do here should be caught and ignored silently
50865094
try {
5095+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
50875096
transformArrayData(args[0], domainKey, sessionKey, thisArg, args);
50885097
} catch {
50895098
}
@@ -5104,6 +5113,7 @@
51045113
* as well as prevent any script from listening to events.
51055114
*/
51065115
function init$b (args) {
5116+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
51075117
if (globalThis.navigator.getBattery) {
51085118
const BatteryManager = globalThis.BatteryManager;
51095119

@@ -6461,6 +6471,7 @@
64616471

64626472
overrideProperty('keyboard', {
64636473
object: Navigator.prototype,
6474+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
64646475
origValue: navigator.keyboard,
64656476
targetValue: getFeatureAttr(featureName$2, args, 'keyboard')
64666477
});
@@ -6471,6 +6482,7 @@
64716482
});
64726483
overrideProperty('deviceMemory', {
64736484
object: Navigator.prototype,
6485+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
64746486
origValue: navigator.deviceMemory,
64756487
targetValue: getFeatureAttr(featureName$2, args, 'deviceMemory', 8)
64766488
});
@@ -6571,11 +6583,13 @@
65716583

65726584
origPropertyValues.availTop = overrideProperty('availTop', {
65736585
object: Screen.prototype,
6586+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
65746587
origValue: screen.availTop,
65756588
targetValue: getFeatureAttr(featureName$1, args, 'availTop', 0)
65766589
});
65776590
origPropertyValues.availLeft = overrideProperty('availLeft', {
65786591
object: Screen.prototype,
6592+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
65796593
origValue: screen.availLeft,
65806594
targetValue: getFeatureAttr(featureName$1, args, 'availLeft', 0)
65816595
});
@@ -6620,16 +6634,20 @@
66206634
* This will limit the max storage to 4GB without completely disabling the
66216635
* feature.
66226636
*/
6637+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
66236638
if (navigator.webkitTemporaryStorage) {
66246639
try {
6640+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
66256641
const org = navigator.webkitTemporaryStorage.queryUsageAndQuota;
6642+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
66266643
const tStorage = navigator.webkitTemporaryStorage;
66276644
tStorage.queryUsageAndQuota = function queryUsageAndQuota (callback, err) {
66286645
const modifiedCallback = function (usedBytes, grantedBytes) {
66296646
const maxBytesGranted = 4 * 1024 * 1024 * 1024;
66306647
const spoofedGrantedBytes = Math.min(grantedBytes, maxBytesGranted);
66316648
callback(usedBytes, spoofedGrantedBytes);
66326649
};
6650+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
66336651
org.call(navigator.webkitTemporaryStorage, modifiedCallback, err);
66346652
};
66356653
defineProperty(Navigator.prototype, 'webkitTemporaryStorage', { get: () => tStorage });
@@ -6677,6 +6695,7 @@
66776695
try {
66786696
// If GPC on, set DOM property prototype to true if not already true
66796697
if (args.globalPrivacyControlValue) {
6698+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
66806699
if (navigator.globalPrivacyControl) return
66816700
defineProperty(Navigator.prototype, 'globalPrivacyControl', {
66826701
get: () => true,
@@ -6686,6 +6705,7 @@
66866705
} else {
66876706
// If GPC off & unsupported by browser, set DOM property prototype to false
66886707
// this may be overwritten by the user agent or other extensions
6708+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
66896709
if (typeof navigator.globalPrivacyControl !== 'undefined') return
66906710
defineProperty(Navigator.prototype, 'globalPrivacyControl', {
66916711
get: () => false,
@@ -6705,6 +6725,7 @@
67056725

67066726
function init$4 (args) {
67076727
try {
6728+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
67086729
if (navigator.duckduckgo) {
67096730
return
67106731
}
@@ -7083,6 +7104,7 @@
70837104

70847105
function safariObjectFix () {
70857106
try {
7107+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
70867108
if (window.safari) {
70877109
return
70887110
}
@@ -7092,12 +7114,14 @@
70927114
configurable: true,
70937115
enumerable: true
70947116
});
7117+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
70957118
defineProperty(window.safari, 'pushNotification', {
70967119
value: {
70977120
},
70987121
configurable: true,
70997122
enumerable: true
71007123
});
7124+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
71017125
defineProperty(window.safari.pushNotification, 'toString', {
71027126
value: () => { return '[object SafariRemoteNotification]' },
71037127
configurable: true,
@@ -7109,13 +7133,15 @@
71097133
this.permission = 'denied';
71107134
}
71117135
}
7136+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
71127137
defineProperty(window.safari.pushNotification, 'permission', {
71137138
value: (name) => {
71147139
return new SafariRemoteNotificationPermission()
71157140
},
71167141
configurable: true,
71177142
enumerable: true
71187143
});
7144+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
71197145
defineProperty(window.safari.pushNotification, 'requestPermission', {
71207146
value: (name, domain, options, callback) => {
71217147
if (typeof callback === 'function') {
@@ -7172,6 +7198,7 @@
71727198
const isFrameInsideFrame = window.self !== window.top && window.parent !== window.top;
71737199

71747200
function windowsPostMessage (name, data) {
7201+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
71757202
window.chrome.webview.postMessage({
71767203
Feature: 'Permissions',
71777204
Name: name,
@@ -7184,6 +7211,7 @@
71847211
console.debug(`Permission '${permission}' is ${status}`);
71857212
}
71867213

7214+
let pauseWatchedPositions = false;
71877215
const watchedPositions = new Set();
71887216
// proxy for navigator.geolocation.watchPosition -> show red geolocation indicator
71897217
const watchPositionProxy = new DDGProxy(featureName, Geolocation.prototype, 'watchPosition', {
@@ -7195,8 +7223,12 @@
71957223

71967224
const successHandler = args[0];
71977225
args[0] = function (position) {
7198-
signalPermissionStatus(Permission.Geolocation, Status.Active);
7199-
successHandler?.(position);
7226+
if (pauseWatchedPositions) {
7227+
signalPermissionStatus(Permission.Geolocation, Status.Paused);
7228+
} else {
7229+
signalPermissionStatus(Permission.Geolocation, Status.Active);
7230+
successHandler?.(position);
7231+
}
72007232
};
72017233
const id = DDGReflect.apply(target, thisArg, args);
72027234
watchedPositions.add(id);
@@ -7251,17 +7283,37 @@
72517283
}
72527284

72537285
function pause (permission) {
7254-
const streamTracks = getTracks(permission);
7255-
streamTracks?.forEach(track => {
7256-
track.enabled = false;
7257-
});
7286+
switch (permission) {
7287+
case Permission.Camera:
7288+
case Permission.Microphone: {
7289+
const streamTracks = getTracks(permission);
7290+
streamTracks?.forEach(track => {
7291+
track.enabled = false;
7292+
});
7293+
break
7294+
}
7295+
case Permission.Geolocation:
7296+
pauseWatchedPositions = true;
7297+
signalPermissionStatus(Permission.Geolocation, Status.Paused);
7298+
break
7299+
}
72587300
}
72597301

72607302
function resume (permission) {
7261-
const streamTracks = getTracks(permission);
7262-
streamTracks?.forEach(track => {
7263-
track.enabled = true;
7264-
});
7303+
switch (permission) {
7304+
case Permission.Camera:
7305+
case Permission.Microphone: {
7306+
const streamTracks = getTracks(permission);
7307+
streamTracks?.forEach(track => {
7308+
track.enabled = true;
7309+
});
7310+
break
7311+
}
7312+
case Permission.Geolocation:
7313+
pauseWatchedPositions = false;
7314+
signalPermissionStatus(Permission.Geolocation, Status.Active);
7315+
break
7316+
}
72657317
}
72667318

72677319
function stop (permission) {
@@ -7273,6 +7325,7 @@
72737325
stopTracks(audioTracks);
72747326
break
72757327
case Permission.Geolocation:
7328+
pauseWatchedPositions = false;
72767329
clearAllGeolocationWatch();
72777330
break
72787331
}
@@ -7438,6 +7491,12 @@
74387491

74397492
const videoRequested = args[0]?.video;
74407493
const audioRequested = args[0]?.audio;
7494+
7495+
if (videoRequested && (videoRequested.pan || videoRequested.tilt || videoRequested.zoom)) {
7496+
// WebView2 doesn't support acquiring pan-tilt-zoom from its API at the moment
7497+
return Promise.reject(new DOMException('Pan-tilt-zoom is not supported'))
7498+
}
7499+
74417500
return DDGReflect.apply(target, thisArg, args).then(function (stream) {
74427501
console.debug(`User stream ${stream.id} has been acquired`);
74437502
userMediaStreams.add(stream);
@@ -7480,6 +7539,7 @@
74807539
}
74817540

74827541
// handle actions from browser
7542+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
74837543
window.chrome.webview.addEventListener('message', function ({ data }) {
74847544
if (data?.action && data?.permission) {
74857545
performAction(data?.action, data?.permission);
@@ -7488,10 +7548,15 @@
74887548

74897549
// these permissions cannot be disabled using WebView2 or DevTools protocol
74907550
const permissionsToDisable = [
7551+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
74917552
{ name: 'Bluetooth', prototype: Bluetooth.prototype, method: 'requestDevice' },
7553+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
74927554
{ name: 'USB', prototype: USB.prototype, method: 'requestDevice' },
7555+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
74937556
{ name: 'Serial', prototype: Serial.prototype, method: 'requestPort' },
7494-
{ name: 'HID', prototype: HID.prototype, method: 'requestDevice' }
7557+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
7558+
{ name: 'HID', prototype: HID.prototype, method: 'requestDevice' },
7559+
{ name: 'Protocol handler', prototype: Navigator.prototype, method: 'registerProtocolHandler' }
74957560
];
74967561
for (const { name, prototype, method } of permissionsToDisable) {
74977562
try {
@@ -7522,15 +7587,16 @@
75227587

75237588

75247589
function init () {
7590+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
75257591
const processedConfig = processConfig($CONTENT_SCOPE$, $USER_UNPROTECTED_DOMAINS$, $USER_PREFERENCES$);
75267592
if (isGloballyDisabled(processedConfig)) {
75277593
return
75287594
}
7529-
7595+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
75307596
contentScopeFeatures.load({
75317597
platform: processedConfig.platform
75327598
});
7533-
7599+
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
75347600
contentScopeFeatures.init(processedConfig);
75357601

75367602
// Not supported:

0 commit comments

Comments
 (0)