New iframe inheritance should somewhat work now
This commit is contained in:
parent
30e5bce38f
commit
8c96e2fd90
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ultrawidify",
|
"name": "ultrawidify",
|
||||||
"version": "6.3.9",
|
"version": "6.3.92",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ultrawidify",
|
"name": "ultrawidify",
|
||||||
"version": "6.3.9",
|
"version": "6.3.92",
|
||||||
"description": "Aspect ratio fixer for youtube and other sites, with automatic aspect ratio detection. Supports ultrawide and other ratios.",
|
"description": "Aspect ratio fixer for youtube and other sites, with automatic aspect ratio detection. Supports ultrawide and other ratios.",
|
||||||
"author": "Tamius Han <tamius.han@gmail.com>",
|
"author": "Tamius Han <tamius.han@gmail.com>",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@ -0,0 +1,7 @@
|
|||||||
|
enum EmbeddedContentSettingsOverridePolicy {
|
||||||
|
Always = 2,
|
||||||
|
UseAsDefault = 1,
|
||||||
|
Never = 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
export default EmbeddedContentSettingsOverridePolicy;
|
||||||
@ -2,6 +2,7 @@ import { Action } from '../../../node_modules/vuex/types/index'
|
|||||||
import AntiGradientMode from '../enums/AntiGradientMode.enum'
|
import AntiGradientMode from '../enums/AntiGradientMode.enum'
|
||||||
import AspectRatioType from '../enums/AspectRatioType.enum'
|
import AspectRatioType from '../enums/AspectRatioType.enum'
|
||||||
import CropModePersistence from '../enums/CropModePersistence.enum'
|
import CropModePersistence from '../enums/CropModePersistence.enum'
|
||||||
|
import EmbeddedContentSettingsOverridePolicy from '../enums/EmbeddedContentSettingsOverridePolicy.enum'
|
||||||
import ExtensionMode from '../enums/ExtensionMode.enum'
|
import ExtensionMode from '../enums/ExtensionMode.enum'
|
||||||
import StretchType from '../enums/StretchType.enum'
|
import StretchType from '../enums/StretchType.enum'
|
||||||
import VideoAlignmentType from '../enums/VideoAlignmentType.enum'
|
import VideoAlignmentType from '../enums/VideoAlignmentType.enum'
|
||||||
@ -308,7 +309,8 @@ export interface SiteSettingsInterface {
|
|||||||
enableKeyboard: ExtensionEnvironmentSettingsInterface;
|
enableKeyboard: ExtensionEnvironmentSettingsInterface;
|
||||||
enableUI: ExtensionEnvironmentSettingsInterface; // Lies! enableUI doesn't use 'theater' property (but uses the other two)
|
enableUI: ExtensionEnvironmentSettingsInterface; // Lies! enableUI doesn't use 'theater' property (but uses the other two)
|
||||||
|
|
||||||
applyToEmbeddedContent?: boolean; // presumed to be 'true' if not defined
|
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy; // presumed to be 'Always' if not defined
|
||||||
|
overrideWhenEmbedded?: boolean;
|
||||||
|
|
||||||
|
|
||||||
autocreated?: boolean;
|
autocreated?: boolean;
|
||||||
|
|||||||
@ -165,7 +165,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<div class="label">
|
<div class="label">
|
||||||
Use these settings for <span class="color-emphasis">embedded content</span>?
|
Use these settings for <span class="color-emphasis">embedded content</span>?
|
||||||
<!-- <span class="sub-label"><br/>under the following conditions:</span> -->
|
<!-- <span class="sub-label"><br/>under the following conditions:</span> -->
|
||||||
@ -174,12 +174,35 @@
|
|||||||
<select
|
<select
|
||||||
:value="siteDefaultForEmbedded"
|
:value="siteDefaultForEmbedded"
|
||||||
@click="setSiteOption('applyToEmbeddedContent', $event)"
|
@click="setSiteOption('applyToEmbeddedContent', $event)"
|
||||||
|
>
|
||||||
|
<option :value="EmbeddedContentSettingsOverridePolicy.Always">
|
||||||
|
Always(-ish)
|
||||||
|
</option>
|
||||||
|
<option :value="EmbeddedContentSettingsOverridePolicy.UseAsDefault">
|
||||||
|
Use as default
|
||||||
|
</option>
|
||||||
|
<option :value="EmbeddedContentSettingsOverridePolicy.Never">
|
||||||
|
Never
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<div class="label">
|
||||||
|
Force these settings <span class="color-emphasis">when embedded</span>?
|
||||||
|
<!-- <span class="sub-label"><br/>under the following conditions:</span> -->
|
||||||
|
</div>
|
||||||
|
<div class="select">
|
||||||
|
<select
|
||||||
|
:value="siteDefaultOverrideEmbedded"
|
||||||
|
@click="setSiteOption('overrideWhenEmbedded', $event)"
|
||||||
>
|
>
|
||||||
<option :value="true">
|
<option :value="true">
|
||||||
Unless overridden
|
Yes
|
||||||
</option>
|
</option>
|
||||||
<option :value="false">
|
<option :value="false">
|
||||||
Never
|
No
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -290,12 +313,14 @@
|
|||||||
import ExtensionMode from '@src/common/enums/ExtensionMode.enum';
|
import ExtensionMode from '@src/common/enums/ExtensionMode.enum';
|
||||||
import VideoAlignmentType from '@src/common/enums/VideoAlignmentType.enum';
|
import VideoAlignmentType from '@src/common/enums/VideoAlignmentType.enum';
|
||||||
import CropModePersistence from '@src/common/enums/CropModePersistence.enum';
|
import CropModePersistence from '@src/common/enums/CropModePersistence.enum';
|
||||||
|
import EmbeddedContentSettingsOverridePolicy from '@src/common/enums/EmbeddedContentSettingsOverridePolicy.enum';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
CropModePersistence: CropModePersistence,
|
CropModePersistence: CropModePersistence,
|
||||||
ExtensionMode,
|
ExtensionMode,
|
||||||
|
EmbeddedContentSettingsOverridePolicy,
|
||||||
alignmentOptions: [
|
alignmentOptions: [
|
||||||
{label: 'Top left', arguments: {x: VideoAlignmentType.Left, y: VideoAlignmentType.Top}},
|
{label: 'Top left', arguments: {x: VideoAlignmentType.Left, y: VideoAlignmentType.Top}},
|
||||||
{label: 'Top center', arguments: {x: VideoAlignmentType.Center, y: VideoAlignmentType.Top}},
|
{label: 'Top center', arguments: {x: VideoAlignmentType.Center, y: VideoAlignmentType.Top}},
|
||||||
@ -346,7 +371,10 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
siteDefaultForEmbedded() {
|
siteDefaultForEmbedded() {
|
||||||
return this.siteSettings.raw?.applyToEmbeddedContent ?? true;
|
return this.siteSettings.raw?.applyToEmbeddedContent;
|
||||||
|
},
|
||||||
|
siteDefaultOverrideEmbedded() {
|
||||||
|
return this.siteSettings.raw?.overrideWhenEmbedded ?? false;
|
||||||
},
|
},
|
||||||
siteDefaultCrop() {
|
siteDefaultCrop() {
|
||||||
return this.siteSettings.raw?.defaults?.crop ? JSON.stringify(this.siteSettings.raw?.defaults?.crop) : JSON.stringify({useDefault: true});
|
return this.siteSettings.raw?.defaults?.crop ? JSON.stringify(this.siteSettings.raw?.defaults?.crop) : JSON.stringify({useDefault: true});
|
||||||
@ -558,6 +586,11 @@ export default {
|
|||||||
this.$nextTick( () => this.$forceUpdate());
|
this.$nextTick( () => this.$forceUpdate());
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setSiteOption(optionPath, event) {
|
||||||
|
const value = event.target.value;
|
||||||
|
this.siteSettings.set(optionPath, value);
|
||||||
|
},
|
||||||
|
|
||||||
setExtensionMode(component, event) {
|
setExtensionMode(component, event) {
|
||||||
const option = event.target.value;
|
const option = event.target.value;
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import { _cp } from '../../common/js/utils';
|
|||||||
import CropModePersistence from '../../common/enums/CropModePersistence.enum';
|
import CropModePersistence from '../../common/enums/CropModePersistence.enum';
|
||||||
import AspectRatioType from '../../common/enums/AspectRatioType.enum';
|
import AspectRatioType from '../../common/enums/AspectRatioType.enum';
|
||||||
import { update } from 'lodash';
|
import { update } from 'lodash';
|
||||||
|
import EmbeddedContentSettingsOverridePolicy from '../../common/enums/EmbeddedContentSettingsOverridePolicy.enum';
|
||||||
|
|
||||||
const ExtensionConfPatch = Object.freeze([
|
const ExtensionConfPatch = Object.freeze([
|
||||||
{
|
{
|
||||||
@ -35,8 +36,7 @@ const ExtensionConfPatch = Object.freeze([
|
|||||||
}, {
|
}, {
|
||||||
forVersion: '6.2.6',
|
forVersion: '6.2.6',
|
||||||
updateFn: (userOptions: SettingsInterface, defaultOptions) => {
|
updateFn: (userOptions: SettingsInterface, defaultOptions) => {
|
||||||
|
console.log('[ultrawidify] Migrating settings — applying patches for version 6.2.6');
|
||||||
console.warn('[ultrawidify] STARTING SETTINGS MIGRATION TO 6.2.6');
|
|
||||||
|
|
||||||
if (!userOptions.commands) {
|
if (!userOptions.commands) {
|
||||||
userOptions.commands = {
|
userOptions.commands = {
|
||||||
@ -239,6 +239,18 @@ const ExtensionConfPatch = Object.freeze([
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
forVersion: '6.3.92',
|
||||||
|
updateFn: (userOptions: SettingsInterface) => {
|
||||||
|
// applyToEmbeddedContent is now an enum, and also no longer optional
|
||||||
|
for (const site in userOptions.sites) {
|
||||||
|
if (userOptions.sites[site].applyToEmbeddedContent === undefined) {
|
||||||
|
userOptions.sites[site].applyToEmbeddedContent = EmbeddedContentSettingsOverridePolicy.Always;
|
||||||
|
} else {
|
||||||
|
userOptions.sites[site].applyToEmbeddedContent = userOptions.sites[site].applyToEmbeddedContent ? EmbeddedContentSettingsOverridePolicy.Always : EmbeddedContentSettingsOverridePolicy.Never;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import CropModePersistence from '../../common/enums/CropModePersistence.enum';
|
|||||||
import SettingsInterface from '../../common/interfaces/SettingsInterface';
|
import SettingsInterface from '../../common/interfaces/SettingsInterface';
|
||||||
import BrowserDetect from './BrowserDetect';
|
import BrowserDetect from './BrowserDetect';
|
||||||
import { Extension } from 'typescript';
|
import { Extension } from 'typescript';
|
||||||
|
import EmbeddedContentSettingsOverridePolicy from '../../common/enums/EmbeddedContentSettingsOverridePolicy.enum';
|
||||||
|
|
||||||
if(Debug.debug)
|
if(Debug.debug)
|
||||||
console.log("Loading: ExtensionConf.js");
|
console.log("Loading: ExtensionConf.js");
|
||||||
@ -739,6 +740,7 @@ const ExtensionConf: SettingsInterface = {
|
|||||||
theater: ExtensionMode.Disabled, // Lies! means 'theater-ish'
|
theater: ExtensionMode.Disabled, // Lies! means 'theater-ish'
|
||||||
normal: ExtensionMode.Disabled // Not actually used.
|
normal: ExtensionMode.Disabled // Not actually used.
|
||||||
},
|
},
|
||||||
|
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Always,
|
||||||
|
|
||||||
defaultType: 'unknown',
|
defaultType: 'unknown',
|
||||||
persistCSA: CropModePersistence.Disabled,
|
persistCSA: CropModePersistence.Disabled,
|
||||||
@ -770,6 +772,7 @@ const ExtensionConf: SettingsInterface = {
|
|||||||
theater: ExtensionMode.Default,
|
theater: ExtensionMode.Default,
|
||||||
normal: ExtensionMode.Disabled
|
normal: ExtensionMode.Disabled
|
||||||
},
|
},
|
||||||
|
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Always,
|
||||||
|
|
||||||
type: 'user-defined',
|
type: 'user-defined',
|
||||||
defaultType: 'user-defined',
|
defaultType: 'user-defined',
|
||||||
@ -801,7 +804,8 @@ const ExtensionConf: SettingsInterface = {
|
|||||||
theater: ExtensionMode.Enabled,
|
theater: ExtensionMode.Enabled,
|
||||||
normal: ExtensionMode.Disabled
|
normal: ExtensionMode.Disabled
|
||||||
},
|
},
|
||||||
|
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Always,
|
||||||
|
overrideWhenEmbedded: true,
|
||||||
override: false, // ignore value localStorage in favour of this
|
override: false, // ignore value localStorage in favour of this
|
||||||
type: 'official', // is officially supported? (Alternatives are 'community' and 'user-defined')
|
type: 'official', // is officially supported? (Alternatives are 'community' and 'user-defined')
|
||||||
defaultType: 'official', // if user mucks around with settings, type changes to 'user-defined'.
|
defaultType: 'official', // if user mucks around with settings, type changes to 'user-defined'.
|
||||||
@ -841,6 +845,8 @@ const ExtensionConf: SettingsInterface = {
|
|||||||
theater: ExtensionMode.Enabled,
|
theater: ExtensionMode.Enabled,
|
||||||
normal: ExtensionMode.Disabled
|
normal: ExtensionMode.Disabled
|
||||||
},
|
},
|
||||||
|
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Always,
|
||||||
|
overrideWhenEmbedded: true,
|
||||||
|
|
||||||
override: false, // ignore value localStorage in favour of this
|
override: false, // ignore value localStorage in favour of this
|
||||||
type: 'official', // is officially supported? (Alternatives are 'community' and 'user-defined')
|
type: 'official', // is officially supported? (Alternatives are 'community' and 'user-defined')
|
||||||
@ -881,7 +887,7 @@ const ExtensionConf: SettingsInterface = {
|
|||||||
theater: ExtensionMode.Enabled,
|
theater: ExtensionMode.Enabled,
|
||||||
normal: ExtensionMode.Disabled
|
normal: ExtensionMode.Disabled
|
||||||
},
|
},
|
||||||
|
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Always,
|
||||||
override: false,
|
override: false,
|
||||||
type: 'community',
|
type: 'community',
|
||||||
defaultType: 'community',
|
defaultType: 'community',
|
||||||
@ -907,6 +913,7 @@ const ExtensionConf: SettingsInterface = {
|
|||||||
theater: ExtensionMode.Enabled,
|
theater: ExtensionMode.Enabled,
|
||||||
normal: ExtensionMode.Default
|
normal: ExtensionMode.Default
|
||||||
},
|
},
|
||||||
|
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Always,
|
||||||
type: 'community',
|
type: 'community',
|
||||||
defaultType: 'community',
|
defaultType: 'community',
|
||||||
activeDOMConfig: 'community-mstefan99',
|
activeDOMConfig: 'community-mstefan99',
|
||||||
@ -948,6 +955,7 @@ const ExtensionConf: SettingsInterface = {
|
|||||||
theater: ExtensionMode.Enabled,
|
theater: ExtensionMode.Enabled,
|
||||||
normal: ExtensionMode.Enabled
|
normal: ExtensionMode.Enabled
|
||||||
},
|
},
|
||||||
|
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Always,
|
||||||
type: 'official',
|
type: 'official',
|
||||||
defaultType: 'official',
|
defaultType: 'official',
|
||||||
},
|
},
|
||||||
@ -972,6 +980,7 @@ const ExtensionConf: SettingsInterface = {
|
|||||||
theater: ExtensionMode.Disabled,
|
theater: ExtensionMode.Disabled,
|
||||||
normal: ExtensionMode.Disabled
|
normal: ExtensionMode.Disabled
|
||||||
},
|
},
|
||||||
|
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Never,
|
||||||
type: 'officially-disabled',
|
type: 'officially-disabled',
|
||||||
defaultType: 'officially-disabled',
|
defaultType: 'officially-disabled',
|
||||||
activeDOMConfig: 'official',
|
activeDOMConfig: 'official',
|
||||||
@ -1009,6 +1018,7 @@ const ExtensionConf: SettingsInterface = {
|
|||||||
theater: ExtensionMode.Disabled,
|
theater: ExtensionMode.Disabled,
|
||||||
normal: ExtensionMode.Disabled
|
normal: ExtensionMode.Disabled
|
||||||
},
|
},
|
||||||
|
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Never,
|
||||||
type: 'officially-disabled',
|
type: 'officially-disabled',
|
||||||
defaultType: 'officially-disabled',
|
defaultType: 'officially-disabled',
|
||||||
activeDOMConfig: 'official',
|
activeDOMConfig: 'official',
|
||||||
@ -1046,54 +1056,7 @@ const ExtensionConf: SettingsInterface = {
|
|||||||
theater: ExtensionMode.Disabled,
|
theater: ExtensionMode.Disabled,
|
||||||
normal: ExtensionMode.Disabled
|
normal: ExtensionMode.Disabled
|
||||||
},
|
},
|
||||||
type: 'officially-disabled',
|
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Never,
|
||||||
defaultType: 'officially-disabled',
|
|
||||||
},
|
|
||||||
"gfycat.com": {
|
|
||||||
enable: {
|
|
||||||
fullscreen: ExtensionMode.Disabled,
|
|
||||||
theater: ExtensionMode.Disabled,
|
|
||||||
normal: ExtensionMode.Disabled,
|
|
||||||
},
|
|
||||||
enableAard: {
|
|
||||||
fullscreen: ExtensionMode.Disabled,
|
|
||||||
theater: ExtensionMode.Disabled,
|
|
||||||
normal: ExtensionMode.Disabled,
|
|
||||||
},
|
|
||||||
enableKeyboard: {
|
|
||||||
fullscreen: ExtensionMode.Disabled,
|
|
||||||
theater: ExtensionMode.Disabled,
|
|
||||||
normal: ExtensionMode.Disabled,
|
|
||||||
},
|
|
||||||
enableUI: {
|
|
||||||
fullscreen: ExtensionMode.Default,
|
|
||||||
theater: ExtensionMode.Default,
|
|
||||||
normal: ExtensionMode.Default
|
|
||||||
},
|
|
||||||
type: 'officially-disabled',
|
|
||||||
defaultType: 'officially-disabled',
|
|
||||||
},
|
|
||||||
"giant.gfycat.com": {
|
|
||||||
enable: {
|
|
||||||
fullscreen: ExtensionMode.Disabled,
|
|
||||||
theater: ExtensionMode.Disabled,
|
|
||||||
normal: ExtensionMode.Disabled,
|
|
||||||
},
|
|
||||||
enableAard: {
|
|
||||||
fullscreen: ExtensionMode.Disabled,
|
|
||||||
theater: ExtensionMode.Disabled,
|
|
||||||
normal: ExtensionMode.Disabled,
|
|
||||||
},
|
|
||||||
enableKeyboard: {
|
|
||||||
fullscreen: ExtensionMode.Disabled,
|
|
||||||
theater: ExtensionMode.Disabled,
|
|
||||||
normal: ExtensionMode.Disabled,
|
|
||||||
},
|
|
||||||
enableUI: {
|
|
||||||
fullscreen: ExtensionMode.Default,
|
|
||||||
theater: ExtensionMode.Default,
|
|
||||||
normal: ExtensionMode.Default
|
|
||||||
},
|
|
||||||
type: 'officially-disabled',
|
type: 'officially-disabled',
|
||||||
defaultType: 'officially-disabled',
|
defaultType: 'officially-disabled',
|
||||||
},
|
},
|
||||||
@ -1118,6 +1081,7 @@ const ExtensionConf: SettingsInterface = {
|
|||||||
theater: ExtensionMode.Enabled,
|
theater: ExtensionMode.Enabled,
|
||||||
normal: ExtensionMode.Enabled
|
normal: ExtensionMode.Enabled
|
||||||
},
|
},
|
||||||
|
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Always,
|
||||||
type: 'community',
|
type: 'community',
|
||||||
defaultType: 'community',
|
defaultType: 'community',
|
||||||
activeDOMConfig: 'community',
|
activeDOMConfig: 'community',
|
||||||
@ -1154,6 +1118,7 @@ const ExtensionConf: SettingsInterface = {
|
|||||||
theater: ExtensionMode.Enabled,
|
theater: ExtensionMode.Enabled,
|
||||||
normal: ExtensionMode.Disabled
|
normal: ExtensionMode.Disabled
|
||||||
},
|
},
|
||||||
|
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Always,
|
||||||
type: 'community',
|
type: 'community',
|
||||||
defaultType: 'community',
|
defaultType: 'community',
|
||||||
activeDOMConfig: 'community',
|
activeDOMConfig: 'community',
|
||||||
@ -1185,6 +1150,7 @@ const ExtensionConf: SettingsInterface = {
|
|||||||
theater: ExtensionMode.Enabled,
|
theater: ExtensionMode.Enabled,
|
||||||
normal: ExtensionMode.Disabled
|
normal: ExtensionMode.Disabled
|
||||||
},
|
},
|
||||||
|
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Always,
|
||||||
type: "community",
|
type: "community",
|
||||||
defaultType: "community",
|
defaultType: "community",
|
||||||
activeDOMConfig: 'community',
|
activeDOMConfig: 'community',
|
||||||
@ -1220,6 +1186,7 @@ const ExtensionConf: SettingsInterface = {
|
|||||||
theater: ExtensionMode.Enabled,
|
theater: ExtensionMode.Enabled,
|
||||||
normal: ExtensionMode.Disabled
|
normal: ExtensionMode.Disabled
|
||||||
},
|
},
|
||||||
|
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Always,
|
||||||
type: "community",
|
type: "community",
|
||||||
defaultType: "community",
|
defaultType: "community",
|
||||||
activeDOMConfig: 'community',
|
activeDOMConfig: 'community',
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import { _cp } from '../../../common/js/utils';
|
|||||||
import Settings from './Settings';
|
import Settings from './Settings';
|
||||||
import StretchType from '../../../common/enums/StretchType.enum';
|
import StretchType from '../../../common/enums/StretchType.enum';
|
||||||
import VideoAlignmentType from '../../../common/enums/VideoAlignmentType.enum';
|
import VideoAlignmentType from '../../../common/enums/VideoAlignmentType.enum';
|
||||||
|
import EmbeddedContentSettingsOverridePolicy from '../../../common/enums/EmbeddedContentSettingsOverridePolicy.enum';
|
||||||
|
|
||||||
|
|
||||||
export interface GetSiteSettingsOptions {
|
export interface GetSiteSettingsOptions {
|
||||||
@ -79,30 +80,36 @@ export class SiteSettings {
|
|||||||
* | different subdomain? |
|
* | different subdomain? |
|
||||||
* | |
|
* | |
|
||||||
* no yes ————————> return settings for matching subdomain
|
* no yes ————————> return settings for matching subdomain
|
||||||
|
* |
|
||||||
* V
|
* V
|
||||||
* [ are we inside of an iframe? ]
|
* return default settings
|
||||||
* | |
|
*
|
||||||
* no yes
|
*
|
||||||
* V V
|
* Inside iframes, we also get priorities. We fetch settings for both iframe and the parent page.
|
||||||
* return default | exact parent |
|
*
|
||||||
* settings | hostname match? |
|
* START HERE
|
||||||
* A | |
|
* |
|
||||||
* | no yes ————> [ applyToEmbeddedContent set? ]
|
* | are there settings for | +——> | does iframe host have |
|
||||||
* | V | |
|
* | iframe host? | | | overrideWhenEmbedded set? |
|
||||||
* | | parent matches hostname | no yes
|
* | | | | |
|
||||||
* | | on different subdomain? | V V
|
* no yes —————+ no yes —-> return iframe settings
|
||||||
* | | | use default use parent settings
|
* V V
|
||||||
* +———<——————— no yes
|
* | does parent host have | | does parent use settings for @global ? |
|
||||||
* | |
|
* | applyToEmbeddedContent | | |
|
||||||
* +———<—— no ——[ applyToEmbeddedContent set? ]
|
* | set to Never? | no yes ——> return iframe settings
|
||||||
* |
|
* | | V
|
||||||
* yes
|
* no no | what's applyToEmbeddedContent |
|
||||||
* V
|
* | | | set to on parent host? |
|
||||||
* use settings for matching subdomain of parent
|
* V V | | |
|
||||||
|
* return parent return default Always UseAsDefault Never
|
||||||
|
* settings settings | | |
|
||||||
|
* V V V
|
||||||
|
* return parent return iframe
|
||||||
|
* settings settings
|
||||||
*
|
*
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
private getSettingsForSite(options: GetSiteSettingsOptions) {
|
private getSettingsForSite(options: GetSiteSettingsOptions): {siteSettings: SiteSettingsInterface, usesSettingsFor: string | undefined} {
|
||||||
if (!options.site) {
|
if (!options.site) {
|
||||||
return {
|
return {
|
||||||
siteSettings: this.settings.active.sites['@global'],
|
siteSettings: this.settings.active.sites['@global'],
|
||||||
@ -110,52 +117,60 @@ export class SiteSettings {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.settings.active.sites[options.site]) {
|
const defaultSettings = {
|
||||||
return {
|
|
||||||
siteSettings: this.settings.active.sites[options.site],
|
|
||||||
usesSettingsFor: undefined
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const urlSegments = this.site.split('.').reverse();
|
|
||||||
|
|
||||||
siteLoop:
|
|
||||||
for (const cs in this.settings.active.sites) {
|
|
||||||
const configUrlSegments = cs.split('.').reverse();
|
|
||||||
|
|
||||||
// Match site with wildcard site definitions
|
|
||||||
// Also, if definition starts with 'www', match also other subdomains — e.g. if we have a configuration for
|
|
||||||
// `www.example.com`, this will also match `example.com`, `subdomain.example.com`, `nested.subdomain.example.com` ...
|
|
||||||
if (configUrlSegments[configUrlSegments.length - 1] === '*' || (configUrlSegments[configUrlSegments.length - 1] === 'www')) {
|
|
||||||
|
|
||||||
for (let i = 0; i < configUrlSegments.length - 1 && i < urlSegments.length; i++) {
|
|
||||||
if (configUrlSegments[i] !== urlSegments[i]) {
|
|
||||||
continue siteLoop;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
siteSettings: this.settings.active.sites[cs],
|
|
||||||
usesSettingsFor: cs
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we're inside of an iframe, let's see whether we can use parent settings
|
|
||||||
if (options.isIframe) {
|
|
||||||
const potentialSettings = this.getSettingsForSite({site: options.parentHostname});
|
|
||||||
|
|
||||||
if (potentialSettings.siteSettings.applyToEmbeddedContent !== false) {
|
|
||||||
if (!potentialSettings.usesSettingsFor) {
|
|
||||||
potentialSettings.usesSettingsFor = options.parentHostname;
|
|
||||||
}
|
|
||||||
return potentialSettings;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
siteSettings: this.settings.active.sites['@global'],
|
siteSettings: this.settings.active.sites['@global'],
|
||||||
usesSettingsFor: '@global'
|
usesSettingsFor: '@global'
|
||||||
};
|
};
|
||||||
|
let siteSettings: {siteSettings: SiteSettingsInterface, usesSettingsFor: string | undefined};
|
||||||
|
|
||||||
|
if (this.settings.active.sites[options.site]) {
|
||||||
|
siteSettings = {
|
||||||
|
siteSettings: this.settings.active.sites[options.site],
|
||||||
|
usesSettingsFor: undefined
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
const urlSegments = this.site.split('.').reverse();
|
||||||
|
|
||||||
|
siteLoop:
|
||||||
|
for (const cs in this.settings.active.sites) {
|
||||||
|
const configUrlSegments = cs.split('.').reverse();
|
||||||
|
|
||||||
|
// Match site with wildcard site definitions
|
||||||
|
// Also, if definition starts with 'www', match also other subdomains — e.g. if we have a configuration for
|
||||||
|
// `www.example.com`, this will also match `example.com`, `subdomain.example.com`, `nested.subdomain.example.com` ...
|
||||||
|
if (configUrlSegments[configUrlSegments.length - 1] === '*' || (configUrlSegments[configUrlSegments.length - 1] === 'www')) {
|
||||||
|
|
||||||
|
for (let i = 0; i < configUrlSegments.length - 1 && i < urlSegments.length; i++) {
|
||||||
|
if (configUrlSegments[i] !== urlSegments[i]) {
|
||||||
|
continue siteLoop;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
siteSettings = {
|
||||||
|
siteSettings: this.settings.active.sites[cs],
|
||||||
|
usesSettingsFor: cs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!options.isIframe) {
|
||||||
|
return siteSettings ?? defaultSettings;
|
||||||
|
} else {
|
||||||
|
const parentSettings = this.getSettingsForSite({site: options.parentHostname});
|
||||||
|
|
||||||
|
if (siteSettings) {
|
||||||
|
return (
|
||||||
|
siteSettings.siteSettings.overrideWhenEmbedded || parentSettings.usesSettingsFor === '@global' || (
|
||||||
|
parentSettings.siteSettings.applyToEmbeddedContent && parentSettings.siteSettings.applyToEmbeddedContent !== EmbeddedContentSettingsOverridePolicy.Always
|
||||||
|
)
|
||||||
|
) ? siteSettings : parentSettings;
|
||||||
|
} else {
|
||||||
|
if (parentSettings.usesSettingsFor !== '@global' && parentSettings.siteSettings.applyToEmbeddedContent === EmbeddedContentSettingsOverridePolicy.Never) {
|
||||||
|
return defaultSettings;
|
||||||
|
}
|
||||||
|
return parentSettings;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -414,6 +429,19 @@ export class SiteSettings {
|
|||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region set shit
|
//#region set shit
|
||||||
|
/**
|
||||||
|
* Returns target site for settings application
|
||||||
|
*/
|
||||||
|
private getTargetSite() {
|
||||||
|
if (!this.usesSettingsFor || this.usesSettingsFor === '@global') {
|
||||||
|
return this.site;
|
||||||
|
}
|
||||||
|
if (this.settings.active.sites[this.usesSettingsFor].applyToEmbeddedContent === EmbeddedContentSettingsOverridePolicy.Always) {
|
||||||
|
return this.usesSettingsFor;
|
||||||
|
}
|
||||||
|
return this.site;
|
||||||
|
}
|
||||||
|
0
|
||||||
/**
|
/**
|
||||||
* Sets option value.
|
* Sets option value.
|
||||||
* @param optionPath path to value in object notation (dot separated)
|
* @param optionPath path to value in object notation (dot separated)
|
||||||
@ -421,26 +449,29 @@ export class SiteSettings {
|
|||||||
* @param reload whether we should trigger a reload in components that require it
|
* @param reload whether we should trigger a reload in components that require it
|
||||||
*/
|
*/
|
||||||
async set(optionPath: string, optionValue: any, options: {reload?: boolean, noSave?: boolean, scripted?: boolean} = {reload: false}) {
|
async set(optionPath: string, optionValue: any, options: {reload?: boolean, noSave?: boolean, scripted?: boolean} = {reload: false}) {
|
||||||
|
// const targetSite = this.getTargetSite();
|
||||||
|
const targetSite = this.site;
|
||||||
|
|
||||||
// if no settings exist for this site, create an empty object.
|
// if no settings exist for this site, create an empty object.
|
||||||
// If this function is not being called in response to user actin,
|
// If this function is not being called in response to user actin,
|
||||||
// create fake settings object.
|
// create fake settings object.
|
||||||
if (options.scripted && !this.settings.active.sites[this.site]) {
|
if (options.scripted && !this.settings.active.sites[targetSite]) {
|
||||||
this.settings.active.sites[this.site] = _cp(this.settings.active.sites['@global']);
|
this.settings.active.sites[targetSite] = _cp(this.settings.active.sites['@global']);
|
||||||
this.settings.active.sites[this.site].autocreated = true;
|
this.settings.active.sites[targetSite].autocreated = true;
|
||||||
this.settings.active.sites[this.site].type = 'unknown';
|
this.settings.active.sites[targetSite].type = 'unknown';
|
||||||
} else {
|
} else {
|
||||||
if (!this.settings.active.sites[this.site] || this.settings.active.sites[this.site].autocreated) {
|
if (!this.settings.active.sites[targetSite] || this.settings.active.sites[targetSite].autocreated) {
|
||||||
this.settings.active.sites[this.site] = _cp(this.data);
|
this.settings.active.sites[targetSite] = _cp(this.data);
|
||||||
this.settings.active.sites[this.site].type = 'user-defined';
|
this.settings.active.sites[targetSite].type = 'user-defined';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const pathParts = optionPath.split('.');
|
const pathParts = optionPath.split('.');
|
||||||
|
|
||||||
if (pathParts.length === 1) {
|
if (pathParts.length === 1) {
|
||||||
this.settings.active.sites[this.site][optionPath] = optionValue;
|
this.settings.active.sites[targetSite][optionPath] = optionValue;
|
||||||
} else {
|
} else {
|
||||||
let iterator = this.settings.active.sites[this.site];
|
let iterator = this.settings.active.sites[targetSite];
|
||||||
let i;
|
let i;
|
||||||
let iterated = '';
|
let iterated = '';
|
||||||
|
|
||||||
@ -474,7 +505,6 @@ export class SiteSettings {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets temporary option value (for Persistence.UntilReload)
|
* Sets temporary option value (for Persistence.UntilReload)
|
||||||
* @param optionPath path to value in object notation (dot separated)
|
* @param optionPath path to value in object notation (dot separated)
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "Ultrawidify",
|
"name": "Ultrawidify",
|
||||||
"description": "Removes black bars on ultrawide videos and offers advanced options to fix aspect ratio.",
|
"description": "Removes black bars on ultrawide videos and offers advanced options to fix aspect ratio.",
|
||||||
"version": "6.3.9",
|
"version": "6.3.92",
|
||||||
"icons": {
|
"icons": {
|
||||||
"32":"res/icons/uw-32.png",
|
"32":"res/icons/uw-32.png",
|
||||||
"64":"res/icons/uw-64.png"
|
"64":"res/icons/uw-64.png"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user