diff --git a/src/common/interfaces/SettingsInterface.ts b/src/common/interfaces/SettingsInterface.ts index e6c6dd2..c1bd538 100644 --- a/src/common/interfaces/SettingsInterface.ts +++ b/src/common/interfaces/SettingsInterface.ts @@ -185,6 +185,12 @@ interface SettingsInterface { } }, + ui: { + inPlayer: { + enabled: boolean + } + } + restrictions?: RestrictionsSettings; crop: { @@ -310,52 +316,6 @@ interface SettingsInterface { sites: { [x: string]: SiteSettingsInterface, } - // sites: { - // [x: string]: { - // defaultCrop?: any, // v6 new - // defaultStretch?: any, // v6 new - // enabled: ExtensionEnvironmentSettingsInterface, // v6 new - // enabledAard: ExtensionEnvironmentSettingsInterface,// v6 new - - // // everything 'superseded by' needs to be implemented - // // as well as ported from the old settings - // mode?: ExtensionMode, // v6 — superseded by looking at enableIn - // autoar?: ExtensionMode, // v6 — superseded by looking at enableIn - // autoarFallback?: ExtensionMode, // v6 — deprecated, no replacement - // stretch?: StretchType, // v6 — superseded by defaultStretch - // videoAlignment?: VideoAlignmentType, - // keyboardShortcutsEnabled?: ExtensionMode, - // type?: string, - // override?: boolean, - // arPersistence?: boolean, - // actions?: any; - - // cropModePersistence?: CropModePersistence; - - // DOM?: { - // player?: { - // manual?: boolean, - // querySelectors?: string, - // additionalCss?: string, - // useRelativeAncestor?: boolean, - // videoAncestor?: any, - // playerNodeCss?: string, - // periodicallyRefreshPlayerElement?: boolean - // }, - // video?: { - // manual?: boolean, - // querySelectors?: string, - // additionalCss?: string, - // useRelativeAncestor?: boolean, - // playerNodeCss?: string - // } - // }, - // css?: string; - // usePlayerArInFullscreen?: boolean; - - // restrictions?: RestrictionsSettings; - // } - // } } export interface SiteSettingsInterface { diff --git a/src/csui/src/PlayerUiPanels/ChangelogPanel.vue b/src/csui/src/PlayerUiPanels/ChangelogPanel.vue index 12fe76f..c7ebf20 100644 --- a/src/csui/src/PlayerUiPanels/ChangelogPanel.vue +++ b/src/csui/src/PlayerUiPanels/ChangelogPanel.vue @@ -5,6 +5,9 @@
Full changelog for older versions is available here.
+Fixed external links.
+I don't think I need to write a changelog for this one. I've also been working on this, on and (mostly) off, for ... a long time, so I might have "kinda forgot" some minor things. diff --git a/src/ext/conf/ExtConfPatches.ts b/src/ext/conf/ExtConfPatches.ts index df98788..0875c39 100644 --- a/src/ext/conf/ExtConfPatches.ts +++ b/src/ext/conf/ExtConfPatches.ts @@ -11,129 +11,14 @@ import AspectRatioType from '../../common/enums/AspectRatioType.enum'; const ExtensionConfPatch = [ { - forVersion: '5.0.5', - sites: { - "app.plex.tv": { - mode: 3, - autoar: 3, - type: "community", - stretch: -1, - videoAlignment: -1, - keyboardShortcutsEnabled: 0, - DOM: { - player: { - manual: false, - querySelectors: "", - additionalCss: "", - useRelativeAncestor: false, - playerNodeCss: "" - } - }, - css: "body {\n background-color: #000;\n}\n\n.application {\n background-color: #000;\n}" - } - } - }, { - forVersion: '5.0.6', - sites: { - "metaivi.com": { - mode: 0, - autoar: 0, - type: "community", - stretch: -1, - videoAlignment: -1, - DOM: { - video: { - manual: false, - querySelectors: "", - additionalCss: "position: absolute !important;" - }, - player: { - manual: false, - querySelectors: "", - additionalCss: "", - useRelativeAncestor: false, - playerNodeCss: "" - } - }, - "css": "" - }, - "piped.kavin.rocks": { - mode: 0, - autoar: 0, - type: 'community', - autoarFallback: 0, - stretch: 0, - videoAlignment: -1, - keyboardShortcutsEnabled: 0, - DOM: { - player: { - manual: false, - querySelectors: "", - additionalCss: "", - useRelativeAncestor: false, - playerNodeCss: "" - } - }, - css: ".shaka-video-container {\n flex-direction: column !important;\n}" - }, - }, - updateFn: (userOptions, defaultOptions) => { - // 5.0.5 initially incorrectly had app.plex.tv marked as 'user-added' - // when 'user-added' is generally reserved for marking sites with user- - // changed configuration. Site patches submitted by community should have - // 'community' type. extConfPatch for 5.0.5 was also retroactively corrected. - userOptions.sites['app.plex.tv'].type = 'community'; - userOptions.sites['piped.kavin.rocks'] = { - mode: 0, - autoar: 0, - type: 'community', - autoarFallback: 0, - stretch: 0, - videoAlignment: -1, - keyboardShortcutsEnabled: 0, - DOM: { - player: { - manual: false, - querySelectors: "", - additionalCss: "", - useRelativeAncestor: false, - playerNodeCss: "" - } - }, - css: ".shaka-video-container {\n flex-direction: column !important;\n}" - }; - } - }, { - forVersion: '5.0.7', - updateFn: (userOptions, defaultOptions) => { - // 5.0.5 initially incorrectly had app.plex.tv marked as 'user-added' - // when 'user-added' is generally reserved for marking sites with user- - // changed configuration. Site patches submitted by community should have - // 'community' type. extConfPatch for 5.0.5 was also retroactively corrected. - userOptions.sites['www.youtube.com'].DOM.player = { - manual: true, - querySelectors: "#movie_player, #player, #c4-player", - additionalCss: "", - useRelativeAncestor: false, - playerNodeCss: "", - } - } - }, { - forVersion: '5.0.8', - updateFn: (userOptions, defaultOptions) => { - userOptions.sites['www.netflix.com'].DOM.player = { - manual: false - } - } - }, { - forVersion: '5.99.0-1', + forVersion: '6.0.1-1', updateFn: (userOptions: SettingsInterface, defaultOptions) => { // add new commands userOptions.commands = defaultOptions.commands; } }, { // NOTE - when releasing shit, ensure ALL alpha migrations are combined together in one function - forVersion: '5.99.0-2', + forVersion: '6.0.1-2', updateFn: (userOptions, defaultOptions) => { userOptions.commands = defaultOptions.commands; @@ -204,7 +89,7 @@ const ExtensionConfPatch = [ } } }, { - forVersion: '5.99.0-3', + forVersion: '6.0.1-3', updateFn: (userOptions: SettingsInterface, defaultOptions) => { delete (userOptions as any).sites['@global'].persistOption; delete (userOptions as any).sites['@empty'].persistOption; @@ -213,7 +98,7 @@ const ExtensionConfPatch = [ userOptions.sites['@empty'].persistCSA = CropModePersistence.Disabled; } }, { - forVersion: '5.99.0-4', + forVersion: '6.0.1-4', updateFn: (userOptions: SettingsInterface, defaultOptions) => { // deprecated much? @@ -254,7 +139,7 @@ const ExtensionConfPatch = [ }) } }, { - forVersion: '5.99.5', + forVersion: '6.0.1-5', updateFn: (userOptions: SettingsInterface, defaultOptions) => { if (!userOptions.sites['@global'].defaults.alignment || !userOptions.sites['@global'].defaults.alignment.x || !userOptions.sites['@global'].defaults.alignment.y) { userOptions.sites['@global'].defaults.alignment = { @@ -265,7 +150,7 @@ const ExtensionConfPatch = [ userOptions.sites['@empty'].defaults.alignment = {x: VideoAlignmentType.Default, y: VideoAlignmentType.Default}; } }, { - forVersion: '5.99.6', + forVersion: '6.0.1-6', updateFn: (userOptions: SettingsInterface, defaultOptions) => { for (const site in userOptions.sites) { userOptions.sites[site].defaultType = userOptions.sites[site].type as any; @@ -274,13 +159,18 @@ const ExtensionConfPatch = [ userOptions.sites['@empty'].defaultType = 'modified'; } }, { - forVersion: '6.0.0', + forVersion: '6.0.1-7', updateFn: (userOptions: SettingsInterface, defaultOptions) => { // remove custom CSS, as it is no longer needed for (const site in userOptions.sites) { for (const domOption in userOptions.sites[site].DOMConfig) userOptions.sites[site].DOMConfig[domOption].customCss; } + userOptions.ui = { + inPlayer: { + enabled: false, // keep disabled for existing users + } + } } } ]; diff --git a/src/ext/conf/ExtensionConf.ts b/src/ext/conf/ExtensionConf.ts index 02f4891..bfcd27c 100644 --- a/src/ext/conf/ExtensionConf.ts +++ b/src/ext/conf/ExtensionConf.ts @@ -141,6 +141,13 @@ const ExtensionConf: SettingsInterface = { testRowOffset: 0.02 // we test this % of height from detected edge } }, + + ui: { + inPlayer: { + enabled: true, // enable by default on new installs + } + }, + crop: { default: { type: AspectRatioType.Automatic, diff --git a/src/ext/lib/video-data/PlayerData.ts b/src/ext/lib/video-data/PlayerData.ts index f257e15..b8bc14d 100644 --- a/src/ext/lib/video-data/PlayerData.ts +++ b/src/ext/lib/video-data/PlayerData.ts @@ -152,7 +152,15 @@ class PlayerData { this.initEventBus(); // this.notificationService = new PlayerNotificationUi(this.element, this.settings, this.eventBus); - this.ui = new UI('ultrawidifyUi', {parentElement: this.element, eventBus: this.eventBus}); + if (this.videoData.settings.active.ui?.inPlayer?.enabled) { + this.ui = new UI( + 'ultrawidifyUi', + { + parentElement: this.element, + eventBus: this.eventBus + } + ); + } this.dimensions = undefined; this.overlayNode = undefined; @@ -215,7 +223,6 @@ class PlayerData { destroy() { document.removeEventListener('fullscreenchange', this.dimensionChangeListener); this.stopChangeDetection(); - this.destroyOverlay(); this.notificationService?.destroy(); } //#endregion @@ -326,11 +333,14 @@ class PlayerData { const canEnable = this.siteSettings.isEnabledForEnvironment(this.isFullscreen, this.isTheaterMode) === ExtensionMode.Enabled; if (this.runLevel === RunLevel.Off && canEnable) { + console.log('runLevel: off -> [anything]'); this.eventBus.send('restore-ar', null); // must be called after this.handleDimensionChanges(currentPlayerDimensions, this.dimensions); } else if (!canEnable && this.runLevel !== RunLevel.Off) { // must be called before + console.log('runLevel: [anything] -> off'); + this.handleDimensionChanges(currentPlayerDimensions, this.dimensions); this.setRunLevel(RunLevel.Off); } @@ -338,8 +348,8 @@ class PlayerData { private handleDimensionChanges(newDimensions: PlayerDimensions, oldDimensions: PlayerDimensions) { - console.log('handling dimension changes'); - if (!this.enabled) { + console.log('handling dimension changes\n\nold dimensions:', oldDimensions, '\nnew dimensions:', newDimensions, '\n\nis enabled:', this.enabled, this.runLevel, RunLevel); + if (this.runLevel === RunLevel.Off ) { this.logger.log('info', 'debug', "[PlayerDetect] player size changed, but PlayerDetect is in disabled state. The player element is probably too small."); return; } @@ -354,8 +364,10 @@ class PlayerData { || newDimensions?.height != oldDimensions?.height || newDimensions?.fullscreen != oldDimensions?.fullscreen ){ + console.log('dimensions changed + we are enabled. Sending restore-ar ...'); // If player size changes, we restore aspect ratio this.eventBus.send('restore-ar', null); + this.eventBus.send('delayed-restore-ar', {delay: 500}); // this.videoData.resizer?.restore(); } } @@ -424,59 +436,6 @@ class PlayerData { this.observer.disconnect(); } - //#region interface - makeOverlay() { - if (!this.overlayNode) { - this.destroyOverlay(); - } - - let overlay = document.createElement('div'); - overlay.style.width = '100%'; - overlay.style.height = '100%'; - overlay.style.position = 'absolute'; - overlay.style.top = '0'; - overlay.style.left = '0'; - overlay.style.zIndex = '1000000000'; - overlay.style.pointerEvents = 'none'; - - this.overlayNode = overlay; - this.element.appendChild(overlay); - } - - destroyOverlay() { - if(this.playerIdElement) { - this.playerIdElement.remove(); - this.playerIdElement = undefined; - } - if (this.overlayNode) { - this.overlayNode.remove(); - this.overlayNode = undefined; - } - } - - markPlayer(name, color) { - if (!this.overlayNode) { - this.makeOverlay(); - } - if (this.playerIdElement) { - this.playerIdElement.remove(); - } - this.playerIdElement = document.createElement('div'); - this.playerIdElement.innerHTML = `