2019-07-05 23:45:29 +02:00
|
|
|
// How to use:
|
|
|
|
// version: {ExtensionConf object, but only properties that get overwritten}
|
2021-02-08 23:04:54 +01:00
|
|
|
import StretchType from '../../common/enums/StretchType.enum';
|
|
|
|
import ExtensionMode from '../../common/enums/ExtensionMode.enum';
|
|
|
|
import VideoAlignmentType from '../../common/enums/VideoAlignmentType.enum';
|
2021-04-05 03:30:29 +02:00
|
|
|
import BrowserDetect from './BrowserDetect';
|
2021-10-28 22:53:23 +02:00
|
|
|
import SettingsInterface from '../../common/interfaces/SettingsInterface';
|
2023-01-07 03:05:17 +01:00
|
|
|
import { _cp } from '../../common/js/utils';
|
2019-07-05 23:45:29 +02:00
|
|
|
|
2019-09-03 00:28:35 +02:00
|
|
|
const ExtensionConfPatch = [
|
|
|
|
{
|
2021-07-05 00:51:15 +02:00
|
|
|
forVersion: '5.0.5',
|
|
|
|
sites: {
|
|
|
|
"app.plex.tv": {
|
|
|
|
mode: 3,
|
|
|
|
autoar: 3,
|
2021-07-14 21:17:32 +02:00
|
|
|
type: "community",
|
2021-07-05 00:51:15 +02:00
|
|
|
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}"
|
|
|
|
}
|
|
|
|
}
|
2021-07-14 21:17:32 +02:00
|
|
|
}, {
|
|
|
|
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": ""
|
2021-07-14 22:45:00 +02:00
|
|
|
},
|
|
|
|
"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}"
|
|
|
|
},
|
2021-07-14 21:17:32 +02:00
|
|
|
},
|
|
|
|
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-
|
2021-10-28 22:53:23 +02:00
|
|
|
// changed configuration. Site patches submitted by community should have
|
2021-07-14 21:17:32 +02:00
|
|
|
// 'community' type. extConfPatch for 5.0.5 was also retroactively corrected.
|
|
|
|
userOptions.sites['app.plex.tv'].type = 'community';
|
2021-07-14 22:45:00 +02:00
|
|
|
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}"
|
|
|
|
};
|
2021-07-14 21:17:32 +02:00
|
|
|
}
|
2021-08-17 19:38:45 +02:00
|
|
|
}, {
|
|
|
|
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-
|
2021-10-28 22:53:23 +02:00
|
|
|
// changed configuration. Site patches submitted by community should have
|
2021-08-17 19:38:45 +02:00
|
|
|
// '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: "",
|
|
|
|
}
|
|
|
|
}
|
2021-09-13 22:47:27 +02:00
|
|
|
}, {
|
|
|
|
forVersion: '5.0.8',
|
|
|
|
updateFn: (userOptions, defaultOptions) => {
|
|
|
|
userOptions.sites['www.netflix.com'].DOM.player = {
|
|
|
|
manual: false
|
|
|
|
}
|
|
|
|
}
|
2021-10-28 22:53:23 +02:00
|
|
|
}, {
|
2021-11-02 20:52:01 +01:00
|
|
|
forVersion: '6.0.0-alpha1',
|
2021-10-28 22:53:23 +02:00
|
|
|
updateFn: (userOptions: SettingsInterface, defaultOptions) => {
|
2021-11-02 20:52:01 +01:00
|
|
|
// add new commands
|
|
|
|
userOptions.commands = defaultOptions.commands;
|
2021-10-28 22:53:23 +02:00
|
|
|
}
|
2023-01-07 03:05:17 +01:00
|
|
|
}, {
|
|
|
|
// NOTE - when releasing shit, ensure ALL alpha migrations are combined together in one function
|
|
|
|
forVersion: '6.0.0-alpha2',
|
|
|
|
updateFn: (userOptions, defaultOptions) => {
|
|
|
|
userOptions.commands = defaultOptions.commands;
|
|
|
|
|
|
|
|
// migrates old settings regarding whether extension is enabled or not
|
|
|
|
const copyEnabled = (site) => {
|
|
|
|
userOptions.sites[site].enable = {
|
|
|
|
fullscreen: userOptions.sites[site].mode,
|
|
|
|
theater: userOptions.sites[site].mode,
|
|
|
|
normal: ExtensionMode.Disabled
|
|
|
|
};
|
|
|
|
userOptions.sites[site].enableKeyboard = {
|
|
|
|
fullscreen: userOptions.sites[site].keyboardShortcutsEnabled,
|
|
|
|
theater: userOptions.sites[site].keyboardShortcutsEnabled,
|
|
|
|
normal: ExtensionMode.Disabled
|
|
|
|
};
|
|
|
|
userOptions.sites[site].enableAard = {
|
|
|
|
fullscreen: userOptions.sites[site].autoar,
|
|
|
|
theater: userOptions.sites[site].autoar,
|
|
|
|
normal: ExtensionMode.Disabled
|
|
|
|
};
|
|
|
|
|
|
|
|
userOptions.sites[site].stretchModePersistence = userOptions.sites[site].cropModePersistence;
|
|
|
|
|
|
|
|
// remove old options
|
|
|
|
delete userOptions.sites[site].mode;
|
|
|
|
delete userOptions.sites[site].keyboardShortcutsEnabled;
|
|
|
|
delete userOptions.sites[site].autoar;
|
|
|
|
}
|
|
|
|
|
|
|
|
// globals get carried over before other sites:
|
|
|
|
copyEnabled('@global');
|
|
|
|
|
|
|
|
// we make another guess about a new option we just added
|
|
|
|
|
|
|
|
|
|
|
|
for (const key in userOptions.sites) {
|
|
|
|
// we already had this
|
|
|
|
if (key === '@global') {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
copyEnabled(key);
|
|
|
|
|
|
|
|
userOptions.sites[key].DOMConfig = _cp(defaultOptions.sites[key].DOMConfig)
|
|
|
|
|
|
|
|
// convert old site.DOM to site.DOMConfig[]
|
|
|
|
if (userOptions.sites[key].type === 'user-defined') {
|
|
|
|
const DOM = userOptions.sites[key].DOM;
|
|
|
|
if (DOM) {
|
|
|
|
userOptions.sites[key].DOMConfig['user-defined'] = {
|
|
|
|
type: 'user-1',
|
|
|
|
customCss: DOM?.css,
|
|
|
|
periodicallyRefreshPlayerElement: DOM?.player?.periodicallyRefreshPlayerElement,
|
|
|
|
elements: !(DOM?.player) ? undefined : {
|
|
|
|
player: {
|
|
|
|
manual: DOM?.player?.manual,
|
|
|
|
querySelectors: DOM?.player?.useRelativeAncestor ? undefined : DOM?.player?.querySelectors,
|
|
|
|
index: DOM?.player?.useRelativeAncestor ? DOM?.player?.videoAncestor : undefined,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
userOptions.sites[key].activeDOMConfig = 'user-1';
|
|
|
|
|
|
|
|
// remove old configuration
|
|
|
|
delete userOptions.sites[key].DOM;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-09-03 00:28:35 +02:00
|
|
|
}
|
|
|
|
];
|
2019-07-05 23:45:29 +02:00
|
|
|
|
2019-11-02 01:05:36 +01:00
|
|
|
|
2021-10-28 22:53:23 +02:00
|
|
|
export default ExtensionConfPatch;
|