From ffd9c6fb7a32284745fdbc29e536e4e75c613e6f Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Thu, 28 Oct 2021 22:53:23 +0200 Subject: [PATCH] ExtConfPatches to typescrtipt --- .../{ExtConfPatches.js => ExtConfPatches.ts} | 134 ++---------------- 1 file changed, 11 insertions(+), 123 deletions(-) rename src/ext/conf/{ExtConfPatches.js => ExtConfPatches.ts} (54%) diff --git a/src/ext/conf/ExtConfPatches.js b/src/ext/conf/ExtConfPatches.ts similarity index 54% rename from src/ext/conf/ExtConfPatches.js rename to src/ext/conf/ExtConfPatches.ts index fa2f87f..00d8658 100644 --- a/src/ext/conf/ExtConfPatches.js +++ b/src/ext/conf/ExtConfPatches.ts @@ -4,129 +4,10 @@ import StretchType from '../../common/enums/StretchType.enum'; import ExtensionMode from '../../common/enums/ExtensionMode.enum'; import VideoAlignmentType from '../../common/enums/VideoAlignmentType.enum'; import BrowserDetect from './BrowserDetect'; +import SettingsInterface from '../../common/interfaces/SettingsInterface'; const ExtensionConfPatch = [ { - forVersion: '4.5.0', - sites: { - "www.wakanim.tv": { - type: 'community', - DOM: { - player: { - manual: true, - querySelectors: "#jwplayer-container", - additionalCss: "", - useRelativeAncestor: false, - playerNodeCss: "", - } - } - } - } - }, { - forVersion: '4.5.1', - updateFn: (userOptions, defaultOptions) => { - for (const site in userOptions.sites) { - try { - delete userOptions[sites].autoarPreventConditions - } catch (e) { - // doesn't matter if site doesn't have that option, - // everything is still fine - } - } - } - }, { - forVersion: '4.5.1.1', - updateFn: (userOptions, defaultOptions) => { - if (!userOptions.sites['streamable.com']) { - userOptions.sites['streamable.com'] = { - mode: 3, - autoar: 3, - type: 'official', - stretch: -1, - videoAlignment: -1, - keyboardShortcutsEnabled: 0, - css: ".player {text-align: left}" - }; - } - if (!userOptions.sites['streamable.com'].css) { - userOptions.sites['streamable.com'].css = '.player {text-align: left}' - }; - } - }, { - forVersion: '4.5.1.3', - updateFn: (userOptions, defaultOptions) => { - try { - userOptions.sites['wwww.disneyplus.com']['css'] = ".hudson-container {\n height: 100%;\n}"; - } catch (e) { - // do nothing if disney+ is missing - } - } - }, { - forVersion: '5.0.1', - updateFn: (userOptions, defaultOptions) => { - try { - userOptions.mitigations = { - zoomLimit: { - enabled: BrowserDetect.edge || BrowserDetect.isEdgeUA, - limit: 0.997, - fullscreenOnly: true - } - } - } catch (e) { - // do nothing - } - } - }, { - forVersion: '5.0.1.1', - updateFn: (userOptions, defaultOptions) => { - try { - userOptions.mitigations = { - zoomLimit: { - enabled: true, - limit: 0.997, - fullscreenOnly: true - } - } - } catch (e) { - // do nothing - } - } - }, { - forVersion: '5.0.2', - updateFn: (userOptions, defaultOptions) => { - try { - if (! userOptions.mitigations) { - userOptions.mitigations = { - zoomLimit: { - enabled: true, - limit: 0.997, - fullscreenOnly: true - } - } - } else if (BrowserDetect.chrome) { - userOptions.mitigations = { - zoomLimit: { - enabled: true, - limit: 0.997, - fullscreenOnly: true - } - } - } - } catch (e) { - // do nothing - } - } - }, { - forVersion: '5.0.4', - updateFn: (userOptions, defaultOptions) => { - userOptions.sites['www.disneyplus.com'].DOM.player = { - ... userOptions.sites['www.disneyplus.com'].DOM.player, - querySelectors: ".btm-media-client-element", - useRelativeAncestor: true, - videoAncestor: 1 - } - } - }, { forVersion: '5.0.5', sites: { "app.plex.tv": { @@ -196,7 +77,7 @@ const ExtensionConfPatch = [ 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 + // 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'] = { @@ -224,7 +105,7 @@ const ExtensionConfPatch = [ 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 + // 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, @@ -241,8 +122,15 @@ const ExtensionConfPatch = [ manual: false } } + }, { + forVersion: '6.0.0', + updateFn: (userOptions: SettingsInterface, defaultOptions) => { + // migrate keyboard settings to the new format: + + // userOptions.actions + } } ]; -export default ExtensionConfPatch; \ No newline at end of file +export default ExtensionConfPatch;