Move edge warning popup into the starting phase of autodetection

This commit is contained in:
Tamius Han 2020-12-22 23:23:03 +01:00
parent bcc3d89342
commit 75ec1969c0
4 changed files with 31 additions and 6 deletions

View File

@ -83,6 +83,7 @@
import { mapState } from 'vuex';
import Icon from '../common/components/Icon';
import BrowserDetect from '../ext/conf/BrowserDetect';
import Settings from '../ext/lib/Settings';
export default {
components: {
@ -110,6 +111,25 @@ export default {
methods: {
getUrl(url) {
return BrowserDetect.firefox ? browser.runtime.getURL(url) : chrome.runtime.getURL(url);
},
async hidePopupForever() {
const settings = new Settings();
await settings.init();
if (!settings.active.mutedNotifications) {
settings.active.mutedNotifications = {};
}
if (!settings.active.mutedNotifications?.browserSpecific) {
settings.active.mutedNotifications.browserSpecific = {
edge: {
brokenDrm: {
}
}
};
}
settings.active.mutedNotifications.browserSpecific.edge.brokenDrm[window.location.hostname] = true;
await settings.saveWithoutReload();
}
}
}

View File

@ -407,7 +407,7 @@ const ExtensionConfPatch = [
}
}
}, {
forVersion: '4.5.0.1',
forVersion: '4.5.1',
updateFn: (userOptions, defaultOptions) => {
for (const site in userOptions.sites) {
try {

View File

@ -9,6 +9,7 @@ import GuardLine from './GuardLine';
import VideoAlignment from '../../../common/enums/video-alignment.enum';
import AspectRatio from '../../../common/enums/aspect-ratio.enum';
import {sleep} from '../../lib/Util';
import BrowserDetect from '../../conf/BrowserDetect';
class ArDetector {
@ -557,10 +558,18 @@ class ArDetector {
} catch (e) {
this.logger.log('error', 'arDetect', `%c[ArDetect::frameCheck] <@${this.arid}> %c[ArDetect::frameCheck] can't draw image on canvas. ${this.canDoFallbackMode ? 'Trying canvas.drawWindow instead' : 'Doing nothing as browser doesn\'t support fallback mode.'}`, "color:#000; backgroud:#f51;", e);
console.log('video is protected by DRM', this.drmNotificationShown)
// nothing to see here, really, if fallback mode isn't supported by browser
if (!this.drmNotificationShown) {
this.drmNotificationShown = true;
// if we detect Edge, we'll throw the aggressive popup
if (BrowserDetect.isEdgeUA() && !this.settings.active.mutedNotifications?.browserSpecific?.edge?.brokenDrm?.[window.hostname]) {
new PlayerUi(this.element, this.settings);
} else {
this.conf.player.showNotification('AARD_DRM');
}
this.conf.resizer.setAr({type: AspectRatio.Reset});
return;
}

View File

@ -49,10 +49,6 @@ class PlayerData {
this.notificationService = new PlayerNotificationUi(this.element, this.settings);
if (BrowserDetect.isEdgeUA()) {
this.ui = new PlayerUi(this.element, this.settings);
}
this.dimensions = undefined;
this.overlayNode = undefined;