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",
|
||||
"version": "6.3.9",
|
||||
"version": "6.3.92",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"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.",
|
||||
"author": "Tamius Han <tamius.han@gmail.com>",
|
||||
"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 AspectRatioType from '../enums/AspectRatioType.enum'
|
||||
import CropModePersistence from '../enums/CropModePersistence.enum'
|
||||
import EmbeddedContentSettingsOverridePolicy from '../enums/EmbeddedContentSettingsOverridePolicy.enum'
|
||||
import ExtensionMode from '../enums/ExtensionMode.enum'
|
||||
import StretchType from '../enums/StretchType.enum'
|
||||
import VideoAlignmentType from '../enums/VideoAlignmentType.enum'
|
||||
@ -308,7 +309,8 @@ export interface SiteSettingsInterface {
|
||||
enableKeyboard: ExtensionEnvironmentSettingsInterface;
|
||||
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;
|
||||
|
||||
@ -165,7 +165,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<div class="field">
|
||||
<div class="label">
|
||||
Use these settings for <span class="color-emphasis">embedded content</span>?
|
||||
<!-- <span class="sub-label"><br/>under the following conditions:</span> -->
|
||||
@ -174,12 +174,35 @@
|
||||
<select
|
||||
:value="siteDefaultForEmbedded"
|
||||
@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">
|
||||
Unless overridden
|
||||
Yes
|
||||
</option>
|
||||
<option :value="false">
|
||||
Never
|
||||
No
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
@ -290,12 +313,14 @@
|
||||
import ExtensionMode from '@src/common/enums/ExtensionMode.enum';
|
||||
import VideoAlignmentType from '@src/common/enums/VideoAlignmentType.enum';
|
||||
import CropModePersistence from '@src/common/enums/CropModePersistence.enum';
|
||||
import EmbeddedContentSettingsOverridePolicy from '@src/common/enums/EmbeddedContentSettingsOverridePolicy.enum';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
CropModePersistence: CropModePersistence,
|
||||
ExtensionMode,
|
||||
EmbeddedContentSettingsOverridePolicy,
|
||||
alignmentOptions: [
|
||||
{label: 'Top left', arguments: {x: VideoAlignmentType.Left, y: VideoAlignmentType.Top}},
|
||||
{label: 'Top center', arguments: {x: VideoAlignmentType.Center, y: VideoAlignmentType.Top}},
|
||||
@ -346,7 +371,10 @@ export default {
|
||||
};
|
||||
},
|
||||
siteDefaultForEmbedded() {
|
||||
return this.siteSettings.raw?.applyToEmbeddedContent ?? true;
|
||||
return this.siteSettings.raw?.applyToEmbeddedContent;
|
||||
},
|
||||
siteDefaultOverrideEmbedded() {
|
||||
return this.siteSettings.raw?.overrideWhenEmbedded ?? false;
|
||||
},
|
||||
siteDefaultCrop() {
|
||||
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());
|
||||
},
|
||||
|
||||
setSiteOption(optionPath, event) {
|
||||
const value = event.target.value;
|
||||
this.siteSettings.set(optionPath, value);
|
||||
},
|
||||
|
||||
setExtensionMode(component, event) {
|
||||
const option = event.target.value;
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ import { _cp } from '../../common/js/utils';
|
||||
import CropModePersistence from '../../common/enums/CropModePersistence.enum';
|
||||
import AspectRatioType from '../../common/enums/AspectRatioType.enum';
|
||||
import { update } from 'lodash';
|
||||
import EmbeddedContentSettingsOverridePolicy from '../../common/enums/EmbeddedContentSettingsOverridePolicy.enum';
|
||||
|
||||
const ExtensionConfPatch = Object.freeze([
|
||||
{
|
||||
@ -35,8 +36,7 @@ const ExtensionConfPatch = Object.freeze([
|
||||
}, {
|
||||
forVersion: '6.2.6',
|
||||
updateFn: (userOptions: SettingsInterface, defaultOptions) => {
|
||||
|
||||
console.warn('[ultrawidify] STARTING SETTINGS MIGRATION TO 6.2.6');
|
||||
console.log('[ultrawidify] Migrating settings — applying patches for version 6.2.6');
|
||||
|
||||
if (!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 BrowserDetect from './BrowserDetect';
|
||||
import { Extension } from 'typescript';
|
||||
import EmbeddedContentSettingsOverridePolicy from '../../common/enums/EmbeddedContentSettingsOverridePolicy.enum';
|
||||
|
||||
if(Debug.debug)
|
||||
console.log("Loading: ExtensionConf.js");
|
||||
@ -739,6 +740,7 @@ const ExtensionConf: SettingsInterface = {
|
||||
theater: ExtensionMode.Disabled, // Lies! means 'theater-ish'
|
||||
normal: ExtensionMode.Disabled // Not actually used.
|
||||
},
|
||||
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Always,
|
||||
|
||||
defaultType: 'unknown',
|
||||
persistCSA: CropModePersistence.Disabled,
|
||||
@ -770,6 +772,7 @@ const ExtensionConf: SettingsInterface = {
|
||||
theater: ExtensionMode.Default,
|
||||
normal: ExtensionMode.Disabled
|
||||
},
|
||||
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Always,
|
||||
|
||||
type: 'user-defined',
|
||||
defaultType: 'user-defined',
|
||||
@ -801,7 +804,8 @@ const ExtensionConf: SettingsInterface = {
|
||||
theater: ExtensionMode.Enabled,
|
||||
normal: ExtensionMode.Disabled
|
||||
},
|
||||
|
||||
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Always,
|
||||
overrideWhenEmbedded: true,
|
||||
override: false, // ignore value localStorage in favour of this
|
||||
type: 'official', // is officially supported? (Alternatives are 'community' and '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,
|
||||
normal: ExtensionMode.Disabled
|
||||
},
|
||||
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Always,
|
||||
overrideWhenEmbedded: true,
|
||||
|
||||
override: false, // ignore value localStorage in favour of this
|
||||
type: 'official', // is officially supported? (Alternatives are 'community' and 'user-defined')
|
||||
@ -881,7 +887,7 @@ const ExtensionConf: SettingsInterface = {
|
||||
theater: ExtensionMode.Enabled,
|
||||
normal: ExtensionMode.Disabled
|
||||
},
|
||||
|
||||
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Always,
|
||||
override: false,
|
||||
type: 'community',
|
||||
defaultType: 'community',
|
||||
@ -907,6 +913,7 @@ const ExtensionConf: SettingsInterface = {
|
||||
theater: ExtensionMode.Enabled,
|
||||
normal: ExtensionMode.Default
|
||||
},
|
||||
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Always,
|
||||
type: 'community',
|
||||
defaultType: 'community',
|
||||
activeDOMConfig: 'community-mstefan99',
|
||||
@ -948,6 +955,7 @@ const ExtensionConf: SettingsInterface = {
|
||||
theater: ExtensionMode.Enabled,
|
||||
normal: ExtensionMode.Enabled
|
||||
},
|
||||
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Always,
|
||||
type: 'official',
|
||||
defaultType: 'official',
|
||||
},
|
||||
@ -972,6 +980,7 @@ const ExtensionConf: SettingsInterface = {
|
||||
theater: ExtensionMode.Disabled,
|
||||
normal: ExtensionMode.Disabled
|
||||
},
|
||||
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Never,
|
||||
type: 'officially-disabled',
|
||||
defaultType: 'officially-disabled',
|
||||
activeDOMConfig: 'official',
|
||||
@ -1009,6 +1018,7 @@ const ExtensionConf: SettingsInterface = {
|
||||
theater: ExtensionMode.Disabled,
|
||||
normal: ExtensionMode.Disabled
|
||||
},
|
||||
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Never,
|
||||
type: 'officially-disabled',
|
||||
defaultType: 'officially-disabled',
|
||||
activeDOMConfig: 'official',
|
||||
@ -1046,54 +1056,7 @@ const ExtensionConf: SettingsInterface = {
|
||||
theater: ExtensionMode.Disabled,
|
||||
normal: ExtensionMode.Disabled
|
||||
},
|
||||
type: 'officially-disabled',
|
||||
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
|
||||
},
|
||||
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Never,
|
||||
type: 'officially-disabled',
|
||||
defaultType: 'officially-disabled',
|
||||
},
|
||||
@ -1118,6 +1081,7 @@ const ExtensionConf: SettingsInterface = {
|
||||
theater: ExtensionMode.Enabled,
|
||||
normal: ExtensionMode.Enabled
|
||||
},
|
||||
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Always,
|
||||
type: 'community',
|
||||
defaultType: 'community',
|
||||
activeDOMConfig: 'community',
|
||||
@ -1154,6 +1118,7 @@ const ExtensionConf: SettingsInterface = {
|
||||
theater: ExtensionMode.Enabled,
|
||||
normal: ExtensionMode.Disabled
|
||||
},
|
||||
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Always,
|
||||
type: 'community',
|
||||
defaultType: 'community',
|
||||
activeDOMConfig: 'community',
|
||||
@ -1185,6 +1150,7 @@ const ExtensionConf: SettingsInterface = {
|
||||
theater: ExtensionMode.Enabled,
|
||||
normal: ExtensionMode.Disabled
|
||||
},
|
||||
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Always,
|
||||
type: "community",
|
||||
defaultType: "community",
|
||||
activeDOMConfig: 'community',
|
||||
@ -1220,6 +1186,7 @@ const ExtensionConf: SettingsInterface = {
|
||||
theater: ExtensionMode.Enabled,
|
||||
normal: ExtensionMode.Disabled
|
||||
},
|
||||
applyToEmbeddedContent: EmbeddedContentSettingsOverridePolicy.Always,
|
||||
type: "community",
|
||||
defaultType: "community",
|
||||
activeDOMConfig: 'community',
|
||||
|
||||
@ -5,6 +5,7 @@ import { _cp } from '../../../common/js/utils';
|
||||
import Settings from './Settings';
|
||||
import StretchType from '../../../common/enums/StretchType.enum';
|
||||
import VideoAlignmentType from '../../../common/enums/VideoAlignmentType.enum';
|
||||
import EmbeddedContentSettingsOverridePolicy from '../../../common/enums/EmbeddedContentSettingsOverridePolicy.enum';
|
||||
|
||||
|
||||
export interface GetSiteSettingsOptions {
|
||||
@ -79,30 +80,36 @@ export class SiteSettings {
|
||||
* | different subdomain? |
|
||||
* | |
|
||||
* no yes ————————> return settings for matching subdomain
|
||||
* |
|
||||
* V
|
||||
* [ are we inside of an iframe? ]
|
||||
* | |
|
||||
* no yes
|
||||
* V V
|
||||
* return default | exact parent |
|
||||
* settings | hostname match? |
|
||||
* A | |
|
||||
* | no yes ————> [ applyToEmbeddedContent set? ]
|
||||
* | V | |
|
||||
* | | parent matches hostname | no yes
|
||||
* | | on different subdomain? | V V
|
||||
* | | | use default use parent settings
|
||||
* +———<——————— no yes
|
||||
* | |
|
||||
* +———<—— no ——[ applyToEmbeddedContent set? ]
|
||||
* |
|
||||
* yes
|
||||
* V
|
||||
* use settings for matching subdomain of parent
|
||||
* return default settings
|
||||
*
|
||||
*
|
||||
* Inside iframes, we also get priorities. We fetch settings for both iframe and the parent page.
|
||||
*
|
||||
* START HERE
|
||||
* |
|
||||
* | are there settings for | +——> | does iframe host have |
|
||||
* | iframe host? | | | overrideWhenEmbedded set? |
|
||||
* | | | | |
|
||||
* no yes —————+ no yes —-> return iframe settings
|
||||
* V V
|
||||
* | does parent host have | | does parent use settings for @global ? |
|
||||
* | applyToEmbeddedContent | | |
|
||||
* | set to Never? | no yes ——> return iframe settings
|
||||
* | | V
|
||||
* no no | what's applyToEmbeddedContent |
|
||||
* | | | set to on parent host? |
|
||||
* V V | | |
|
||||
* return parent return default Always UseAsDefault Never
|
||||
* settings settings | | |
|
||||
* V V V
|
||||
* return parent return iframe
|
||||
* settings settings
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
private getSettingsForSite(options: GetSiteSettingsOptions) {
|
||||
private getSettingsForSite(options: GetSiteSettingsOptions): {siteSettings: SiteSettingsInterface, usesSettingsFor: string | undefined} {
|
||||
if (!options.site) {
|
||||
return {
|
||||
siteSettings: this.settings.active.sites['@global'],
|
||||
@ -110,52 +117,60 @@ export class SiteSettings {
|
||||
};
|
||||
}
|
||||
|
||||
if (this.settings.active.sites[options.site]) {
|
||||
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 {
|
||||
const defaultSettings = {
|
||||
siteSettings: this.settings.active.sites['@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
|
||||
|
||||
//#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.
|
||||
* @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
|
||||
*/
|
||||
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 this function is not being called in response to user actin,
|
||||
// create fake settings object.
|
||||
if (options.scripted && !this.settings.active.sites[this.site]) {
|
||||
this.settings.active.sites[this.site] = _cp(this.settings.active.sites['@global']);
|
||||
this.settings.active.sites[this.site].autocreated = true;
|
||||
this.settings.active.sites[this.site].type = 'unknown';
|
||||
if (options.scripted && !this.settings.active.sites[targetSite]) {
|
||||
this.settings.active.sites[targetSite] = _cp(this.settings.active.sites['@global']);
|
||||
this.settings.active.sites[targetSite].autocreated = true;
|
||||
this.settings.active.sites[targetSite].type = 'unknown';
|
||||
} else {
|
||||
if (!this.settings.active.sites[this.site] || this.settings.active.sites[this.site].autocreated) {
|
||||
this.settings.active.sites[this.site] = _cp(this.data);
|
||||
this.settings.active.sites[this.site].type = 'user-defined';
|
||||
if (!this.settings.active.sites[targetSite] || this.settings.active.sites[targetSite].autocreated) {
|
||||
this.settings.active.sites[targetSite] = _cp(this.data);
|
||||
this.settings.active.sites[targetSite].type = 'user-defined';
|
||||
}
|
||||
}
|
||||
|
||||
const pathParts = optionPath.split('.');
|
||||
|
||||
if (pathParts.length === 1) {
|
||||
this.settings.active.sites[this.site][optionPath] = optionValue;
|
||||
this.settings.active.sites[targetSite][optionPath] = optionValue;
|
||||
} else {
|
||||
let iterator = this.settings.active.sites[this.site];
|
||||
let iterator = this.settings.active.sites[targetSite];
|
||||
let i;
|
||||
let iterated = '';
|
||||
|
||||
@ -474,7 +505,6 @@ export class SiteSettings {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets temporary option value (for Persistence.UntilReload)
|
||||
* @param optionPath path to value in object notation (dot separated)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"manifest_version": 3,
|
||||
"name": "Ultrawidify",
|
||||
"description": "Removes black bars on ultrawide videos and offers advanced options to fix aspect ratio.",
|
||||
"version": "6.3.9",
|
||||
"version": "6.3.92",
|
||||
"icons": {
|
||||
"32":"res/icons/uw-32.png",
|
||||
"64":"res/icons/uw-64.png"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user