Compare commits
6 Commits
a5fdef0196
...
d34c975eaa
| Author | SHA1 | Date | |
|---|---|---|---|
| d34c975eaa | |||
| 14f8453067 | |||
| 090f112463 | |||
| 01d569f1b5 | |||
| 75670ef3f9 | |||
| f88f703e84 |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ultrawidify",
|
"name": "ultrawidify",
|
||||||
"version": "6.3.0",
|
"version": "6.3.9",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ultrawidify",
|
"name": "ultrawidify",
|
||||||
"version": "6.3.0",
|
"version": "6.3.9",
|
||||||
"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": {
|
||||||
|
|||||||
@ -308,6 +308,9 @@ 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
|
||||||
|
|
||||||
|
|
||||||
autocreated?: boolean;
|
autocreated?: boolean;
|
||||||
type?: 'official' | 'community' | 'user-defined' | 'testing' | 'officially-disabled' | 'unknown' | 'modified';
|
type?: 'official' | 'community' | 'user-defined' | 'testing' | 'officially-disabled' | 'unknown' | 'modified';
|
||||||
defaultType: 'official' | 'community' | 'user-defined' | 'testing' | 'officially-disabled' | 'unknown' | 'modified';
|
defaultType: 'official' | 'community' | 'user-defined' | 'testing' | 'officially-disabled' | 'unknown' | 'modified';
|
||||||
|
|||||||
@ -205,7 +205,7 @@ import GhettoContextMenuItem from '@csui/src/components/GhettoContextMenuItem.vu
|
|||||||
import GhettoContextMenuOption from '@csui/src/components/GhettoContextMenuOption.vue';
|
import GhettoContextMenuOption from '@csui/src/components/GhettoContextMenuOption.vue';
|
||||||
import AlignmentOptionsControlComponent from '@csui/src/PlayerUiPanels/AlignmentOptionsControlComponent.vue';
|
import AlignmentOptionsControlComponent from '@csui/src/PlayerUiPanels/AlignmentOptionsControlComponent.vue';
|
||||||
import BrowserDetect from '@src/ext/conf/BrowserDetect';
|
import BrowserDetect from '@src/ext/conf/BrowserDetect';
|
||||||
import Settings from '@src/ext/lib/Settings';
|
import Settings from '@src/ext/lib/settings/Settings';
|
||||||
import EventBus from '@src/ext/lib/EventBus';
|
import EventBus from '@src/ext/lib/EventBus';
|
||||||
import UIProbeMixin from '@csui/src/utils/UIProbeMixin';
|
import UIProbeMixin from '@csui/src/utils/UIProbeMixin';
|
||||||
import KeyboardShortcutParserMixin from '@csui/src/utils/KeyboardShortcutParserMixin';
|
import KeyboardShortcutParserMixin from '@csui/src/utils/KeyboardShortcutParserMixin';
|
||||||
@ -463,7 +463,7 @@ export default {
|
|||||||
if (!this.site) {
|
if (!this.site) {
|
||||||
this.origin = event.origin;
|
this.origin = event.origin;
|
||||||
this.site = event.origin.split('//')[1];
|
this.site = event.origin.split('//')[1];
|
||||||
this.siteSettings = this.settings.getSiteSettings(this.site);
|
this.siteSettings = this.settings.getSiteSettings({site: this.site});
|
||||||
}
|
}
|
||||||
return this.handleProbe(event.data, event.origin); // handleProbe is defined in UIProbeMixin
|
return this.handleProbe(event.data, event.origin); // handleProbe is defined in UIProbeMixin
|
||||||
case 'uw-bus-tunnel':
|
case 'uw-bus-tunnel':
|
||||||
|
|||||||
@ -123,7 +123,7 @@ import AboutPanel from '@csui/src/popup/panels/AboutPanel.vue'
|
|||||||
import Debug from '../ext/conf/Debug';
|
import Debug from '../ext/conf/Debug';
|
||||||
import BrowserDetect from '../ext/conf/BrowserDetect';
|
import BrowserDetect from '../ext/conf/BrowserDetect';
|
||||||
import CommsClient, {CommsOrigin} from '../ext/lib/comms/CommsClient';
|
import CommsClient, {CommsOrigin} from '../ext/lib/comms/CommsClient';
|
||||||
import Settings from '../ext/lib/Settings';
|
import Settings from '../ext/lib/settings/Settings';
|
||||||
import EventBus from '../ext/lib/EventBus';
|
import EventBus from '../ext/lib/EventBus';
|
||||||
import {ChromeShittinessMitigations as CSM} from '../common/js/ChromeShittinessMitigations';
|
import {ChromeShittinessMitigations as CSM} from '../common/js/ChromeShittinessMitigations';
|
||||||
import SupportLevelIndicator from '@csui/src/components/SupportLevelIndicator.vue'
|
import SupportLevelIndicator from '@csui/src/components/SupportLevelIndicator.vue'
|
||||||
@ -193,8 +193,6 @@ export default {
|
|||||||
{
|
{
|
||||||
source: this,
|
source: this,
|
||||||
function: (config, context) => {
|
function: (config, context) => {
|
||||||
console.log('set-current-site | this.site:', this.site, 'config.site:', config.site);
|
|
||||||
|
|
||||||
if (this.site) {
|
if (this.site) {
|
||||||
if (!this.site.host) {
|
if (!this.site.host) {
|
||||||
// dunno why this fix is needed, but sometimes it is
|
// dunno why this fix is needed, but sometimes it is
|
||||||
@ -203,7 +201,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.site = config.site;
|
this.site = config.site;
|
||||||
// this.selectedSite = this.selectedSite || config.site.host;
|
// this.selectedSite = this.selectedSite || config.site.host;
|
||||||
this.siteSettings = this.settings.getSiteSettings(this.site.host);
|
this.siteSettings = this.settings.getSiteSettings({site: this.site.host});
|
||||||
this.eventBus.setupPopupTunnelWorkaround({
|
this.eventBus.setupPopupTunnelWorkaround({
|
||||||
origin: CommsOrigin.Popup,
|
origin: CommsOrigin.Popup,
|
||||||
comms: {
|
comms: {
|
||||||
|
|||||||
@ -376,6 +376,9 @@ button,
|
|||||||
padding-left: 35px;
|
padding-left: 35px;
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
.info-color {
|
||||||
|
color: $info-color;
|
||||||
|
}
|
||||||
|
|
||||||
.info::before {
|
.info::before {
|
||||||
content: "ⓘ";
|
content: "ⓘ";
|
||||||
|
|||||||
@ -205,7 +205,7 @@ export default {
|
|||||||
if (this.defaultTab) {
|
if (this.defaultTab) {
|
||||||
this.selectedTab = this.defaultTab;
|
this.selectedTab = this.defaultTab;
|
||||||
}
|
}
|
||||||
this.siteSettings = this.settings.getSiteSettings(this.site);
|
this.siteSettings = this.settings.getSiteSettings({site: this.site});
|
||||||
this.tabs.find(x => x.id === 'changelog').highlight = !this.settings.active?.whatsNewChecked;
|
this.tabs.find(x => x.id === 'changelog').highlight = !this.settings.active?.whatsNewChecked;
|
||||||
|
|
||||||
this.eventBus.subscribe(
|
this.eventBus.subscribe(
|
||||||
|
|||||||
@ -41,6 +41,7 @@
|
|||||||
<template v-if="hosts && tab === 'embeddedSites' && globalSettings">
|
<template v-if="hosts && tab === 'embeddedSites' && globalSettings">
|
||||||
<FrameSiteSettings
|
<FrameSiteSettings
|
||||||
v-if="settings"
|
v-if="settings"
|
||||||
|
:parentHost="site"
|
||||||
:hosts="hosts"
|
:hosts="hosts"
|
||||||
:settings="settings"
|
:settings="settings"
|
||||||
></FrameSiteSettings>
|
></FrameSiteSettings>
|
||||||
@ -196,7 +197,7 @@ export default {
|
|||||||
},
|
},
|
||||||
siteSettings() {
|
siteSettings() {
|
||||||
if (this.site) {
|
if (this.site) {
|
||||||
return this.settings?.getSiteSettings(this.site) ?? null;
|
return this.settings?.getSiteSettings({site: this.site}) ?? null;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
<li>Subdomains now inherit same settings as their parent domain by default</li>
|
<li>Subdomains now inherit same settings as their parent domain by default</li>
|
||||||
<li>Extension attempts to detect embedded content.</li>
|
<li>Extension attempts to detect embedded content.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div style="width: 1rem; height: 0px;"></div>
|
<div style="width: 1rem; height: 0px;"></div>
|
||||||
<div class="min-w-[400px] max-w-[520px] grow shrink">
|
<div class="min-w-[400px] max-w-[520px] grow shrink">
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-for="host of hosts" :key="host" @click="selectedSite = host" class="flex flex-col container pointer hoverable" style="margin-top: 4px; padding: 0.5rem 1rem;">
|
<div v-for="host of hosts" :key="host" @click="selectedSite = host" class="flex flex-col container pointer hoverable" style="margin-top: 4px; padding: 0.5rem 1rem;">
|
||||||
<SiteListItem
|
<SiteListItem
|
||||||
|
:parentHost="parentHost"
|
||||||
:host="host"
|
:host="host"
|
||||||
:settings="settings"
|
:settings="settings"
|
||||||
></SiteListItem>
|
></SiteListItem>
|
||||||
@ -48,6 +49,7 @@ export default {
|
|||||||
},
|
},
|
||||||
props: [
|
props: [
|
||||||
'settings',
|
'settings',
|
||||||
|
'parentHost',
|
||||||
'hosts',
|
'hosts',
|
||||||
],
|
],
|
||||||
data() {
|
data() {
|
||||||
@ -81,7 +83,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
selectedSiteSettings() {
|
selectedSiteSettings() {
|
||||||
return this.settings?.getSiteSettings(this.selectedSite) ?? null;
|
return this.settings?.getSiteSettings({site: this.selectedSite}) ?? null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@ -121,7 +121,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
selectedSiteSettings() {
|
selectedSiteSettings() {
|
||||||
return this.settings?.getSiteSettings(this.selectedSite) ?? null;
|
return this.settings?.getSiteSettings({site: this.selectedSite}) ?? null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -140,13 +140,13 @@ export default {
|
|||||||
return status === 'disabled' ? 'color: #f00' : 'color: #1f8';
|
return status === 'disabled' ? 'color: #f00' : 'color: #1f8';
|
||||||
},
|
},
|
||||||
getSiteEnabledModes(site, component) {
|
getSiteEnabledModes(site, component) {
|
||||||
if (this.settings?.getSiteSettings(site).data[component]?.normal === ExtensionMode.Enabled) {
|
if (this.settings?.getSiteSettings({site: site}).data[component]?.normal === ExtensionMode.Enabled) {
|
||||||
return 'always';
|
return 'always';
|
||||||
}
|
}
|
||||||
if (this.settings?.getSiteSettings(site).data[component]?.theater === ExtensionMode.Enabled) {
|
if (this.settings?.getSiteSettings({site: site}).data[component]?.theater === ExtensionMode.Enabled) {
|
||||||
return 'T + FS';
|
return 'T + FS';
|
||||||
}
|
}
|
||||||
if (this.settings?.getSiteSettings(site).data[component]?.fullscreen === ExtensionMode.Enabled) {
|
if (this.settings?.getSiteSettings({site: site}).data[component]?.fullscreen === ExtensionMode.Enabled) {
|
||||||
return 'fullscreen';
|
return 'fullscreen';
|
||||||
}
|
}
|
||||||
return 'disabled';
|
return 'disabled';
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-if="this.siteSettings?.usesSettingsFor">
|
<div v-if="this.siteSettings?.usesSettingsFor">
|
||||||
<div v-if="this.siteSettings.usesSettingsFor === '@global'">Uses default settings</div>
|
<div v-if="this.siteSettings.usesSettingsFor === '@global'">Uses default settings</div>
|
||||||
<div v-else>Uses settings for: {{this.siteSettings.usesSettingsFor}}</div>
|
<div v-else>Uses settings for: <span class="info-color">{{this.siteSettings.usesSettingsFor}}</span></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-row">
|
<div class="flex flex-row">
|
||||||
<small>
|
<small>
|
||||||
@ -35,10 +35,11 @@ export default {
|
|||||||
},
|
},
|
||||||
props: [
|
props: [
|
||||||
'settings',
|
'settings',
|
||||||
|
'parentHost',
|
||||||
'host',
|
'host',
|
||||||
],
|
],
|
||||||
created() {
|
created() {
|
||||||
this.siteSettings = this.settings.getSiteSettings(this.host);
|
this.siteSettings = this.settings.getSiteSettings({site: this.host, isIframe: this.parentHost && this.host !== this.parentHost, parentHostname: this.parentHost});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getSiteTypeColor(siteType) {
|
getSiteTypeColor(siteType) {
|
||||||
|
|||||||
@ -175,7 +175,7 @@ export default {
|
|||||||
this.enabledHosts = [];
|
this.enabledHosts = [];
|
||||||
|
|
||||||
for (const host of val) {
|
for (const host of val) {
|
||||||
const siteSettings = new SiteSettings(this.settings, host);
|
const siteSettings = new SiteSettings(this.settings, {site: host});
|
||||||
|
|
||||||
if (siteSettings.isEnabledForEnvironment(false, true) === ExtensionMode.Enabled) {
|
if (siteSettings.isEnabledForEnvironment(false, true) === ExtensionMode.Enabled) {
|
||||||
this.enabledHosts.push(host);
|
this.enabledHosts.push(host);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import Debug from './conf/Debug';
|
import Debug from './conf/Debug';
|
||||||
import Settings from './lib/Settings';
|
import Settings from './lib/settings/Settings';
|
||||||
import CommsClient from './lib/comms/CommsClient';
|
import CommsClient from './lib/comms/CommsClient';
|
||||||
import PageInfo from './lib/video-data/PageInfo';
|
import PageInfo from './lib/video-data/PageInfo';
|
||||||
import EventBus from './lib/EventBus';
|
import EventBus from './lib/EventBus';
|
||||||
@ -8,6 +8,7 @@ import { SiteSettings } from './lib/settings/SiteSettings';
|
|||||||
import UI from './lib/uwui/UI';
|
import UI from './lib/uwui/UI';
|
||||||
import { BLANK_LOGGER_CONFIG, LogAggregator } from './lib/logging/LogAggregator';
|
import { BLANK_LOGGER_CONFIG, LogAggregator } from './lib/logging/LogAggregator';
|
||||||
import { ComponentLogger } from './lib/logging/ComponentLogger';
|
import { ComponentLogger } from './lib/logging/ComponentLogger';
|
||||||
|
import { getIframeParentHost, setupHostnameReporting } from './util/getHost';
|
||||||
|
|
||||||
export default class UWContent {
|
export default class UWContent {
|
||||||
pageInfo: PageInfo;
|
pageInfo: PageInfo;
|
||||||
@ -19,6 +20,7 @@ export default class UWContent {
|
|||||||
logger: ComponentLogger;
|
logger: ComponentLogger;
|
||||||
eventBus: EventBus;
|
eventBus: EventBus;
|
||||||
isIframe: boolean = false;
|
isIframe: boolean = false;
|
||||||
|
parentHostname: string;
|
||||||
|
|
||||||
globalUi: any;
|
globalUi: any;
|
||||||
|
|
||||||
@ -28,7 +30,8 @@ export default class UWContent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructor(){
|
constructor(){
|
||||||
this.isIframe = window.self !== window.top
|
setupHostnameReporting();
|
||||||
|
this.isIframe = window.self !== window.top;
|
||||||
}
|
}
|
||||||
|
|
||||||
reloadSettings() {
|
reloadSettings() {
|
||||||
@ -41,6 +44,11 @@ export default class UWContent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async init(){
|
async init(){
|
||||||
|
if (this.isIframe) {
|
||||||
|
this.parentHostname = await getIframeParentHost();
|
||||||
|
console.warn('[uw-content] got iframe parent:', this.parentHostname);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (Debug.debug) {
|
if (Debug.debug) {
|
||||||
console.log("[uw::main] loading configuration ...");
|
console.log("[uw::main] loading configuration ...");
|
||||||
@ -57,6 +65,7 @@ export default class UWContent {
|
|||||||
console.error("logger init failed!", e)
|
console.error("logger init failed!", e)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// init() is re-run any time settings change
|
// init() is re-run any time settings change
|
||||||
if (this.comms) {
|
if (this.comms) {
|
||||||
this.comms.destroy();
|
this.comms.destroy();
|
||||||
@ -70,7 +79,7 @@ export default class UWContent {
|
|||||||
logAggregator: this.logAggregator
|
logAggregator: this.logAggregator
|
||||||
});
|
});
|
||||||
await this.settings.init();
|
await this.settings.init();
|
||||||
this.siteSettings = this.settings.getSiteSettings();
|
this.siteSettings = this.settings.getSiteSettings({site: window.location.hostname, isIframe: this.isIframe, parentHostname: this.parentHostname});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.eventBus = new EventBus();
|
this.eventBus = new EventBus();
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import Debug from './conf/Debug.js';
|
import Debug from './conf/Debug.js';
|
||||||
import BrowserDetect from './conf/BrowserDetect';
|
import BrowserDetect from './conf/BrowserDetect';
|
||||||
import CommsServer from './lib/comms/CommsServer';
|
import CommsServer from './lib/comms/CommsServer';
|
||||||
import Settings from './lib/Settings';
|
import Settings from './lib/settings/Settings';
|
||||||
import { sleep } from '../common/js/utils';
|
import { sleep } from '../common/js/utils';
|
||||||
import EventBus, { EventBusCommand } from './lib/EventBus';
|
import EventBus, { EventBusCommand } from './lib/EventBus';
|
||||||
import { ComponentLogger } from './lib/logging/ComponentLogger';
|
import { ComponentLogger } from './lib/logging/ComponentLogger';
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import ExtensionMode from '@src/common/enums/ExtensionMode.enum';
|
|||||||
import { ArVariant } from '@src/common/interfaces/ArInterface';
|
import { ArVariant } from '@src/common/interfaces/ArInterface';
|
||||||
import { ExtensionEnvironment } from '@src/common/interfaces/SettingsInterface';
|
import { ExtensionEnvironment } from '@src/common/interfaces/SettingsInterface';
|
||||||
import EventBus from '../EventBus';
|
import EventBus from '../EventBus';
|
||||||
import Settings from '../Settings';
|
import Settings from '../settings/Settings';
|
||||||
import { SiteSettings } from '../settings/SiteSettings';
|
import { SiteSettings } from '../settings/SiteSettings';
|
||||||
import VideoData from '../video-data/VideoData';
|
import VideoData from '../video-data/VideoData';
|
||||||
import { AardDebugUi } from './AardDebugUi';
|
import { AardDebugUi } from './AardDebugUi';
|
||||||
@ -2049,7 +2049,7 @@ export class Aard {
|
|||||||
* Calculates video's current aspect ratio based on data in testResults.
|
* Calculates video's current aspect ratio based on data in testResults.
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
private getAr() {
|
private getAr(): number {
|
||||||
const fileAr = this.video.videoWidth / this.video.videoHeight;
|
const fileAr = this.video.videoWidth / this.video.videoHeight;
|
||||||
const canvasAr = this.canvasStore.main.width / this.canvasStore.main.height;
|
const canvasAr = this.canvasStore.main.width / this.canvasStore.main.height;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ComponentLogger } from './../logging/ComponentLogger';
|
import { ComponentLogger } from './../logging/ComponentLogger';
|
||||||
import Settings from '../Settings';
|
import Settings from '../settings/Settings';
|
||||||
import EventBus from '../EventBus';
|
import EventBus from '../EventBus';
|
||||||
import { CommsOrigin } from './CommsClient';
|
import { CommsOrigin } from './CommsClient';
|
||||||
|
|
||||||
@ -148,7 +148,6 @@ class CommsServer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('uniq hosts:', hosts)
|
|
||||||
return hosts;
|
return hosts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import EventBus, { EventBusCommand } from '../EventBus';
|
import EventBus, { EventBusCommand } from '../EventBus';
|
||||||
import { ComponentLogger } from '../logging/ComponentLogger';
|
import { ComponentLogger } from '../logging/ComponentLogger';
|
||||||
import Settings from '../Settings';
|
import Settings from '../settings/Settings';
|
||||||
import { SiteSettings } from '../settings/SiteSettings';
|
import { SiteSettings } from '../settings/SiteSettings';
|
||||||
|
|
||||||
export class KbmBase {
|
export class KbmBase {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import ExtensionMode from '../../../common/enums/ExtensionMode.enum';
|
import ExtensionMode from '../../../common/enums/ExtensionMode.enum';
|
||||||
import Settings from '../Settings';
|
import Settings from '../settings/Settings';
|
||||||
import EventBus, { EventBusCommand } from '../EventBus';
|
import EventBus, { EventBusCommand } from '../EventBus';
|
||||||
import KbmBase from './KbmBase';
|
import KbmBase from './KbmBase';
|
||||||
import { SiteSettings } from '../settings/SiteSettings';
|
import { SiteSettings } from '../settings/SiteSettings';
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { LogAggregator } from './../logging/LogAggregator';
|
import { LogAggregator } from './../logging/LogAggregator';
|
||||||
import EventBus, { EventBusCommand } from '../EventBus';
|
import EventBus, { EventBusCommand } from '../EventBus';
|
||||||
import { ComponentLogger } from '../logging/ComponentLogger';
|
import { ComponentLogger } from '../logging/ComponentLogger';
|
||||||
import Settings from '../Settings';
|
import Settings from '../settings/Settings';
|
||||||
import { SiteSettings } from '../settings/SiteSettings';
|
import { SiteSettings } from '../settings/SiteSettings';
|
||||||
import KbmBase from './KbmBase';
|
import KbmBase from './KbmBase';
|
||||||
|
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
import Debug from '../conf/Debug';
|
import Debug from '../../conf/Debug';
|
||||||
import ExtensionConf from '../conf/ExtensionConf';
|
import ExtensionConf from '../../conf/ExtensionConf';
|
||||||
import ObjectCopy from './ObjectCopy';
|
import ObjectCopy from '../ObjectCopy';
|
||||||
import StretchType from '../../common/enums/StretchType.enum';
|
import StretchType from '../../../common/enums/StretchType.enum';
|
||||||
import ExtensionConfPatch from '../conf/ExtConfPatches';
|
import ExtensionConfPatch from '../../conf/ExtConfPatches';
|
||||||
import SettingsInterface from '../../common/interfaces/SettingsInterface';
|
import SettingsInterface from '../../../common/interfaces/SettingsInterface';
|
||||||
import AspectRatioType from '../../common/enums/AspectRatioType.enum';
|
import AspectRatioType from '../../../common/enums/AspectRatioType.enum';
|
||||||
import { SiteSettings } from './settings/SiteSettings';
|
import { GetSiteSettingsOptions, SiteSettings } from './SiteSettings';
|
||||||
import { SettingsSnapshotManager } from './settings/SettingsSnapshotManager';
|
import { SettingsSnapshotManager } from './SettingsSnapshotManager';
|
||||||
import { ComponentLogger } from './logging/ComponentLogger';
|
import { ComponentLogger } from '../logging/ComponentLogger';
|
||||||
import { LogAggregator } from './logging/LogAggregator';
|
import { LogAggregator } from '../logging/LogAggregator';
|
||||||
|
|
||||||
if(process.env.CHANNEL !== 'stable'){
|
if(process.env.CHANNEL !== 'stable'){
|
||||||
console.info("Loading Settings");
|
console.info("Loading Settings");
|
||||||
@ -25,6 +25,7 @@ interface SetSettingsOptions {
|
|||||||
forcePreserveVersion?: boolean,
|
forcePreserveVersion?: boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const SETTINGS_LOGGER_STYLES = {
|
const SETTINGS_LOGGER_STYLES = {
|
||||||
log: 'color: #81d288',
|
log: 'color: #81d288',
|
||||||
}
|
}
|
||||||
@ -413,8 +414,8 @@ class Settings {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getSiteSettings(site: string = window.location.hostname): SiteSettings {
|
getSiteSettings(options: GetSiteSettingsOptions = {site: window.location.hostname}): SiteSettings {
|
||||||
return new SiteSettings(this, site);
|
return new SiteSettings(this, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
listenOnChange(fn: () => void): void {
|
listenOnChange(fn: () => void): void {
|
||||||
@ -2,10 +2,17 @@ import CropModePersistence from '../../../common/enums/CropModePersistence.enum'
|
|||||||
import ExtensionMode from '../../../common/enums/ExtensionMode.enum';
|
import ExtensionMode from '../../../common/enums/ExtensionMode.enum';
|
||||||
import { SettingsReloadComponent, SettingsReloadFlags, SiteSettingsInterface } from '../../../common/interfaces/SettingsInterface';
|
import { SettingsReloadComponent, SettingsReloadFlags, SiteSettingsInterface } from '../../../common/interfaces/SettingsInterface';
|
||||||
import { _cp } from '../../../common/js/utils';
|
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';
|
||||||
|
|
||||||
|
|
||||||
|
export interface GetSiteSettingsOptions {
|
||||||
|
site: string,
|
||||||
|
isIframe?: boolean,
|
||||||
|
parentHostname?: string,
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains settings that are currently in effect for a given site. If a certain option
|
* Contains settings that are currently in effect for a given site. If a certain option
|
||||||
* doesn't have a value — or if it has 'default' option, SiteSettings.data will contain
|
* doesn't have a value — or if it has 'default' option, SiteSettings.data will contain
|
||||||
@ -22,6 +29,7 @@ export class SiteSettings {
|
|||||||
public get site() {
|
public get site() {
|
||||||
return this._site;
|
return this._site;
|
||||||
}
|
}
|
||||||
|
private options: GetSiteSettingsOptions;
|
||||||
|
|
||||||
raw: SiteSettingsInterface; // actual settings
|
raw: SiteSettingsInterface; // actual settings
|
||||||
data: SiteSettingsInterface; // effective settings
|
data: SiteSettingsInterface; // effective settings
|
||||||
@ -33,10 +41,12 @@ export class SiteSettings {
|
|||||||
storageChangeSubscriptions: {[x: string]: ((newSiteConf, changes, area) => void)[]} = {};
|
storageChangeSubscriptions: {[x: string]: ((newSiteConf, changes, area) => void)[]} = {};
|
||||||
|
|
||||||
//#region lifecycle
|
//#region lifecycle
|
||||||
constructor(settings: Settings, site: string) {
|
constructor(settings: Settings, options: GetSiteSettingsOptions) {
|
||||||
|
this.options = options;
|
||||||
|
this.site = options.site;
|
||||||
|
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
this.raw = settings.active.sites[site];
|
this.raw = settings.active.sites[this.site];
|
||||||
this.site = site;
|
|
||||||
this.defaultSettings = settings.active.sites['@global'];
|
this.defaultSettings = settings.active.sites['@global'];
|
||||||
|
|
||||||
this.compileSettingsObject();
|
this.compileSettingsObject();
|
||||||
@ -56,19 +66,53 @@ export class SiteSettings {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Tries to match websites, even if we're on a different subdomain.
|
* Tries to match websites, even if we're on a different subdomain.
|
||||||
|
*
|
||||||
|
* Priority chain:
|
||||||
|
*
|
||||||
|
* START HERE
|
||||||
|
* |
|
||||||
|
* [ exact hostname match ]
|
||||||
|
* | |
|
||||||
|
* no yes ————————> return settings for hostname
|
||||||
|
* V
|
||||||
|
* | matches hostname on |
|
||||||
|
* | 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
|
||||||
|
*
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
private getSettingsForSite() {
|
private getSettingsForSite(options: GetSiteSettingsOptions) {
|
||||||
if (!this.site) {
|
if (!options.site) {
|
||||||
return {
|
return {
|
||||||
siteSettings: this.settings.active.sites['@global'],
|
siteSettings: this.settings.active.sites['@global'],
|
||||||
usesSettingsFor: '@global'
|
usesSettingsFor: '@global'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.settings.active.sites[this.site]) {
|
if (this.settings.active.sites[options.site]) {
|
||||||
return {
|
return {
|
||||||
siteSettings: this.settings.active.sites[this.site],
|
siteSettings: this.settings.active.sites[options.site],
|
||||||
usesSettingsFor: undefined
|
usesSettingsFor: undefined
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -84,7 +128,6 @@ export class SiteSettings {
|
|||||||
// `www.example.com`, this will also match `example.com`, `subdomain.example.com`, `nested.subdomain.example.com` ...
|
// `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')) {
|
if (configUrlSegments[configUrlSegments.length - 1] === '*' || (configUrlSegments[configUrlSegments.length - 1] === 'www')) {
|
||||||
|
|
||||||
console.log('ss: comparing', configUrlSegments, urlSegments);
|
|
||||||
for (let i = 0; i < configUrlSegments.length - 1 && i < urlSegments.length; i++) {
|
for (let i = 0; i < configUrlSegments.length - 1 && i < urlSegments.length; i++) {
|
||||||
if (configUrlSegments[i] !== urlSegments[i]) {
|
if (configUrlSegments[i] !== urlSegments[i]) {
|
||||||
continue siteLoop;
|
continue siteLoop;
|
||||||
@ -97,6 +140,18 @@ export class SiteSettings {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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 {
|
return {
|
||||||
siteSettings: this.settings.active.sites['@global'],
|
siteSettings: this.settings.active.sites['@global'],
|
||||||
usesSettingsFor: '@global'
|
usesSettingsFor: '@global'
|
||||||
@ -108,7 +163,7 @@ export class SiteSettings {
|
|||||||
* Alan pls ensure default settings object follows the correct structure
|
* Alan pls ensure default settings object follows the correct structure
|
||||||
*/
|
*/
|
||||||
private compileSettingsObject() {
|
private compileSettingsObject() {
|
||||||
const {siteSettings, usesSettingsFor} = this.getSettingsForSite();
|
const {siteSettings, usesSettingsFor} = this.getSettingsForSite(this.options);
|
||||||
this.data = _cp(siteSettings);
|
this.data = _cp(siteSettings);
|
||||||
this.usesSettingsFor = usesSettingsFor;
|
this.usesSettingsFor = usesSettingsFor;
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,6 @@ class UI {
|
|||||||
this.extensionBase = chrome.runtime.getURL('').replace(/\/$/, "");
|
this.extensionBase = chrome.runtime.getURL('').replace(/\/$/, "");
|
||||||
|
|
||||||
// UI will be initialized when setUiVisibility is called
|
// UI will be initialized when setUiVisibility is called
|
||||||
console.log('ui config:', uiConfig);
|
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import VideoData from './VideoData';
|
import VideoData from './VideoData';
|
||||||
import RescanReason from './enums/RescanReason.enum';
|
import RescanReason from './enums/RescanReason.enum';
|
||||||
import Settings from '../Settings';
|
import Settings from '../settings/Settings';
|
||||||
import CommsClient from '../comms/CommsClient';
|
import CommsClient from '../comms/CommsClient';
|
||||||
import EventBus from '../EventBus';
|
import EventBus from '../EventBus';
|
||||||
import { SiteSettings } from '../settings/SiteSettings';
|
import { SiteSettings } from '../settings/SiteSettings';
|
||||||
|
|||||||
@ -24,10 +24,16 @@ interface PlayerDimensions {
|
|||||||
|
|
||||||
interface ElementData {
|
interface ElementData {
|
||||||
element: HTMLElement,
|
element: HTMLElement,
|
||||||
type: string,
|
type: string, // kinda forgot what this is being used for
|
||||||
tagName?: string,
|
tagName?: string,
|
||||||
classList?: any,
|
classList?: any,
|
||||||
id?: string
|
id?: string
|
||||||
|
|
||||||
|
width?: number;
|
||||||
|
height?: number;
|
||||||
|
heuristics?: any;
|
||||||
|
index?: number,
|
||||||
|
autoScore?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
type ElementStack = ElementData[];
|
type ElementStack = ElementData[];
|
||||||
@ -272,7 +278,6 @@ class PlayerData {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.isFullscreen
|
this.isFullscreen
|
||||||
|| (
|
|| (
|
||||||
@ -382,6 +387,8 @@ class PlayerData {
|
|||||||
try {
|
try {
|
||||||
// get player dimensions _once_
|
// get player dimensions _once_
|
||||||
let currentPlayerDimensions;
|
let currentPlayerDimensions;
|
||||||
|
let fsChanged = this.isFullscreen !== !!document.fullscreenElement;
|
||||||
|
|
||||||
this.isFullscreen = !!document.fullscreenElement;
|
this.isFullscreen = !!document.fullscreenElement;
|
||||||
|
|
||||||
if (this.isFullscreen) {
|
if (this.isFullscreen) {
|
||||||
@ -424,6 +431,10 @@ class PlayerData {
|
|||||||
|
|
||||||
// Save current dimensions to avoid triggering this function pointlessly
|
// Save current dimensions to avoid triggering this function pointlessly
|
||||||
this.dimensions = currentPlayerDimensions;
|
this.dimensions = currentPlayerDimensions;
|
||||||
|
|
||||||
|
if (fsChanged) {
|
||||||
|
this.updatePlayer();
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -562,19 +573,21 @@ class PlayerData {
|
|||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
private getElementStack(): ElementStack {
|
private getElementStack(): ElementStack {
|
||||||
const elementStack: any[] = [{
|
const elementStack: ElementStack = [{
|
||||||
element: this.videoElement,
|
element: this.videoElement,
|
||||||
type: 'video',
|
type: 'video',
|
||||||
tagName: 'video',
|
tagName: 'video',
|
||||||
classList: this.videoElement.classList,
|
classList: this.videoElement.classList,
|
||||||
id: this.videoElement.id,
|
id: this.videoElement.id,
|
||||||
}];
|
}];
|
||||||
|
|
||||||
let element = this.videoElement.parentNode as HTMLElement;
|
let element = this.videoElement.parentNode as HTMLElement;
|
||||||
|
|
||||||
// first pass to generate the element stack and translate it into array
|
// first pass to generate the element stack and translate it into array
|
||||||
while (element) {
|
while (element) {
|
||||||
elementStack.push({
|
elementStack.push({
|
||||||
element,
|
element,
|
||||||
|
type: '',
|
||||||
tagName: element.tagName,
|
tagName: element.tagName,
|
||||||
classList: element.classList,
|
classList: element.classList,
|
||||||
id: element.id,
|
id: element.id,
|
||||||
@ -705,21 +718,31 @@ class PlayerData {
|
|||||||
* @param videoHeight
|
* @param videoHeight
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
private getPlayerAuto(elementStack: any[], videoWidth, videoHeight) {
|
private getPlayerAuto(elementStack: ElementStack, videoWidth, videoHeight) {
|
||||||
let penaltyMultiplier = 1;
|
let penaltyMultiplier = 2;
|
||||||
const sizePenaltyMultiplier = 0.1;
|
const sizePenaltyMultiplier = 0.1;
|
||||||
const perLevelScorePenalty = 10;
|
const perLevelScorePenalty = 10;
|
||||||
let sameSizeBonus = 0;
|
let sameSizeBonus = 0;
|
||||||
|
|
||||||
for (const [index, element] of elementStack.entries()) {
|
const fullscreenElement = document.fullscreenElement;
|
||||||
element.index = index;
|
|
||||||
|
for (const [index, elementData] of elementStack.entries()) {
|
||||||
|
elementData.index = index;
|
||||||
|
|
||||||
// ignore weird elements, those would break our stuff
|
// ignore weird elements, those would break our stuff
|
||||||
if (element.width == 0 || element.height == 0) {
|
if (elementData.width == 0 || elementData.height == 0) {
|
||||||
element.heuristics['invalidSize'] = true;
|
elementData.heuristics['invalidSize'] = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (elementData.element === fullscreenElement) {
|
||||||
|
// reset penalty multiplier if current element is full screen element
|
||||||
|
// penaltyMultiplier here must be smaller than initial penalty multiplier,
|
||||||
|
// so that playerElement is not above fullscreenElement. Player element must
|
||||||
|
// be a descendant of fullscreenElement for the UI to show up
|
||||||
|
penaltyMultiplier = 1;
|
||||||
|
}
|
||||||
|
|
||||||
// element is player, if at least one of the sides is as long as the video
|
// element is player, if at least one of the sides is as long as the video
|
||||||
// note that we can't make any additional assumptions with regards to player
|
// note that we can't make any additional assumptions with regards to player
|
||||||
// size, since there are both cases where the other side is bigger _and_ cases
|
// size, since there are both cases where the other side is bigger _and_ cases
|
||||||
@ -728,8 +751,8 @@ class PlayerData {
|
|||||||
// Don't bother thinking about this too much, as any "thinking" was quickly
|
// Don't bother thinking about this too much, as any "thinking" was quickly
|
||||||
// corrected by bugs caused by various edge cases.
|
// corrected by bugs caused by various edge cases.
|
||||||
if (
|
if (
|
||||||
this.equalish(element.height, videoHeight, 5)
|
this.equalish(elementData.height, videoHeight, 5)
|
||||||
|| this.equalish(element.width, videoWidth, 5)
|
|| this.equalish(elementData.width, videoWidth, 5)
|
||||||
) {
|
) {
|
||||||
let score = 1000;
|
let score = 1000;
|
||||||
|
|
||||||
@ -740,8 +763,8 @@ class PlayerData {
|
|||||||
// Our ideal player will be as close to the video element, and it will als
|
// Our ideal player will be as close to the video element, and it will als
|
||||||
// be as close to the size of the video.
|
// be as close to the size of the video.
|
||||||
|
|
||||||
const diffX = (element.width - videoWidth);
|
const diffX = (elementData.width - videoWidth);
|
||||||
const diffY = (element.height - videoHeight);
|
const diffY = (elementData.height - videoHeight);
|
||||||
|
|
||||||
// we have a minimal amount of grace before we start dinking scores for
|
// we have a minimal amount of grace before we start dinking scores for
|
||||||
// mismatched dimensions. The size of the dimension mismatch dink is
|
// mismatched dimensions. The size of the dimension mismatch dink is
|
||||||
@ -760,14 +783,14 @@ class PlayerData {
|
|||||||
// candidate gets dinked a bit
|
// candidate gets dinked a bit
|
||||||
// score -= perLevelScorePenalty * penaltyMultiplier;
|
// score -= perLevelScorePenalty * penaltyMultiplier;
|
||||||
|
|
||||||
if (element.width === elementStack[index - 1].width && element.height === elementStack[index - 1].height) {
|
if (elementData.width === elementStack[index - 1].width && elementData.height === elementStack[index - 1].height) {
|
||||||
score += ++sameSizeBonus;
|
score += ++sameSizeBonus;
|
||||||
} else {
|
} else {
|
||||||
sameSizeBonus = 0;
|
sameSizeBonus = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
element.autoScore = score;
|
elementData.autoScore = score;
|
||||||
element.heuristics['autoScoreDetails'] = {
|
elementData.heuristics['autoScoreDetails'] = {
|
||||||
playerSizePenalty,
|
playerSizePenalty,
|
||||||
diffX,
|
diffX,
|
||||||
diffY,
|
diffY,
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import PlayerData from './PlayerData';
|
|||||||
import Resizer from '../video-transform/Resizer';
|
import Resizer from '../video-transform/Resizer';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import BrowserDetect from '../../conf/BrowserDetect';
|
import BrowserDetect from '../../conf/BrowserDetect';
|
||||||
import Settings from '../Settings';
|
import Settings from '../settings/Settings';
|
||||||
import PageInfo from './PageInfo';
|
import PageInfo from './PageInfo';
|
||||||
import { sleep } from '../../../common/js/utils';
|
import { sleep } from '../../../common/js/utils';
|
||||||
import { hasDrm } from '../ar-detect/DrmDetecor';
|
import { hasDrm } from '../ar-detect/DrmDetecor';
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import AspectRatioType from '../../../common/enums/AspectRatioType.enum';
|
|||||||
import VideoData from '../video-data/VideoData';
|
import VideoData from '../video-data/VideoData';
|
||||||
import EventBus from '../EventBus';
|
import EventBus from '../EventBus';
|
||||||
import { _cp } from '../../../common/js/utils';
|
import { _cp } from '../../../common/js/utils';
|
||||||
import Settings from '../Settings';
|
import Settings from '../settings/Settings';
|
||||||
import { Ar, ArVariant } from '../../../common/interfaces/ArInterface';
|
import { Ar, ArVariant } from '../../../common/interfaces/ArInterface';
|
||||||
import { RunLevel } from '../../enum/run-level.enum';
|
import { RunLevel } from '../../enum/run-level.enum';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
@ -233,7 +233,7 @@ class Resizer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
prepareCss(css) {
|
prepareCss(css: string): string {
|
||||||
return `.${this.userCssClassName} {${css}}`;
|
return `.${this.userCssClassName} {${css}}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,11 +242,11 @@ class Resizer {
|
|||||||
this.destroyed = true;
|
this.destroyed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
getFileAr() {
|
getFileAr(): number {
|
||||||
return this.videoData.video.videoWidth / this.videoData.video.videoHeight;
|
return this.videoData.video.videoWidth / this.videoData.video.videoHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
calculateRatioForLegacyOptions(ar){
|
calculateRatioForLegacyOptions(ar: Ar): Ar | null {
|
||||||
// also present as modeToAr in Scaler.js
|
// also present as modeToAr in Scaler.js
|
||||||
if (ar.type !== AspectRatioType.FitWidth && ar.type !== AspectRatioType.FitHeight && ar.ratio) {
|
if (ar.type !== AspectRatioType.FitWidth && ar.type !== AspectRatioType.FitHeight && ar.ratio) {
|
||||||
return ar;
|
return ar;
|
||||||
@ -358,7 +358,7 @@ class Resizer {
|
|||||||
this.videoData.videoUnloaded();
|
this.videoData.videoUnloaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.info('setAr', `<rid:${this.resizerId}> trying to set ar. New ar:`, ar);
|
this.logger.info('setAr', `<rid:${this.resizerId}> trying to set ar. New ar:`, ar, 'last ar override was', lastAr ? '' : 'NOT', 'provided:', lastAr);
|
||||||
|
|
||||||
let stretchFactors: VideoDimensions | any;
|
let stretchFactors: VideoDimensions | any;
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { SiteSettings } from './../settings/SiteSettings';
|
import { SiteSettings } from './../settings/SiteSettings';
|
||||||
import BrowserDetect from '../../conf/BrowserDetect';
|
import BrowserDetect from '../../conf/BrowserDetect';
|
||||||
import VideoData from '../video-data/VideoData';
|
import VideoData from '../video-data/VideoData';
|
||||||
import Settings from '../Settings';
|
import Settings from '../settings/Settings';
|
||||||
import { Stretch } from '../../../common/interfaces/StretchInterface';
|
import { Stretch } from '../../../common/interfaces/StretchInterface';
|
||||||
import { ComponentLogger } from '../logging/ComponentLogger';
|
import { ComponentLogger } from '../logging/ComponentLogger';
|
||||||
|
|
||||||
|
|||||||
49
src/ext/util/getHost.ts
Normal file
49
src/ext/util/getHost.ts
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
* Reqzests iframe parent hostname
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export async function getIframeParentHost(): Promise<string> {
|
||||||
|
return new Promise<any>((resolve) => {
|
||||||
|
let resolved = false;
|
||||||
|
let resendInterval;
|
||||||
|
|
||||||
|
function handleMessage(event) {
|
||||||
|
if (event.data.action === 'uw-parent-hostname') {
|
||||||
|
resolved = true;
|
||||||
|
clearInterval(resendInterval);
|
||||||
|
|
||||||
|
window.removeEventListener('message', handleMessage);
|
||||||
|
resolve(event.data.hostname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener('message', handleMessage);
|
||||||
|
resendInterval = setInterval(
|
||||||
|
() => {
|
||||||
|
if (!resolved) {
|
||||||
|
window.parent.postMessage(
|
||||||
|
{ action: 'uw-get-parent-hostname' },
|
||||||
|
'*'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
500
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function handleMessage(event) {
|
||||||
|
if (event.data.action === 'uw-get-parent-hostname') {
|
||||||
|
event.source.postMessage(
|
||||||
|
{action: 'uw-parent-hostname', hostname: window.location.hostname},
|
||||||
|
'*' as any
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function setupHostnameReporting() {
|
||||||
|
window.removeEventListener('message', handleMessage); // setupHostnameReporting may run more than once
|
||||||
|
window.addEventListener('message', handleMessage);
|
||||||
|
}
|
||||||
@ -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.0",
|
"version": "6.3.9",
|
||||||
"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"
|
||||||
|
|||||||
@ -111,7 +111,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import Donate from '../common/misc/Donate.vue';
|
import Donate from '../common/misc/Donate.vue';
|
||||||
import SuperAdvancedSettings from './SuperAdvancedSettings.vue';
|
import SuperAdvancedSettings from './SuperAdvancedSettings.vue';
|
||||||
import Settings from '../ext/lib/Settings';
|
import Settings from '../ext/lib/settings/Settings';
|
||||||
import GeneralSettings from './GeneralSettings';
|
import GeneralSettings from './GeneralSettings';
|
||||||
import ControlsSettings from './controls-settings/ControlsSettings';
|
import ControlsSettings from './controls-settings/ControlsSettings';
|
||||||
import AddEditActionPopup from './controls-settings/AddEditActionPopup';
|
import AddEditActionPopup from './controls-settings/AddEditActionPopup';
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import BrowserDetect from '../ext/conf/BrowserDetect';
|
import BrowserDetect from '../ext/conf/BrowserDetect';
|
||||||
import Settings from '../ext/lib/Settings';
|
import Settings from '../ext/lib/settings/Settings';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user