Merge branch 'master' into stable
This commit is contained in:
commit
1268c2b0cc
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,6 +4,7 @@ build/
|
||||
/*.log
|
||||
/dist*
|
||||
/uw-git_keys
|
||||
/untracked-assets
|
||||
|
||||
*.pem
|
||||
|
||||
|
@ -13,7 +13,12 @@ QoL improvements for me:
|
||||
|
||||
* logging: allow to enable logging at will and export said logs to a file
|
||||
|
||||
### v4.4.6 (current)
|
||||
### v4.4.7 (current)
|
||||
|
||||
* Removed unnecessary font files and image files from the package.
|
||||
* LoggerUI is now functional.
|
||||
|
||||
### v4.4.6
|
||||
|
||||
* Ensured that Vue part of the content script (logger UI) only loads when necessary in order to fix breakage on certain sites (#96).
|
||||
* Disabling (or enabling, if running in whitelist-only mode) specific sites used to not work (#91). This issue appears to have been fixed.
|
||||
|
@ -14,4 +14,4 @@ Run `npm ci`
|
||||
|
||||
`npm run build`
|
||||
|
||||
The compiled code pops up in /dist-ff.
|
||||
The compiled code pops up in /dist-ff (/dist-chrome for Chromium-based browsers).
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ultravidify",
|
||||
"version": "4.4.6",
|
||||
"version": "4.4.7",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ultravidify",
|
||||
"version": "4.4.6",
|
||||
"version": "4.4.7",
|
||||
"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": {
|
||||
|
84
src/common/components/JsonEditor/JsonArray.vue
Normal file
84
src/common/components/JsonEditor/JsonArray.vue
Normal file
@ -0,0 +1,84 @@
|
||||
<template>
|
||||
<div class="flex flex-column json-level-indent">
|
||||
<div class="flex flex-row" @click="expanded_internal = !expanded_internal">
|
||||
<div v-if="value_internal.key" class="item-key">
|
||||
"{{value_internal.key}}" <b>:</b>
|
||||
<span v-if="!expanded_internal"><b> [</b> ... <b>]</b>,</span>
|
||||
<template v-else><b>[</b></template>
|
||||
</div>
|
||||
</div>
|
||||
<div v-for="(row, key) of value_internal.value"
|
||||
:key="key"
|
||||
>
|
||||
<JsonArray v-if="Array.isArray(row)"
|
||||
:value="row"
|
||||
:ignoreKeys="ignoreKeys"
|
||||
@change="changeItem(rowKey, $event)"
|
||||
>
|
||||
</JsonArray>
|
||||
<JsonObject v-else-if="typeof row === 'object' && row !== null"
|
||||
:value="row"
|
||||
:label="rowKey"
|
||||
:ignoreKeys="ignoreKeys"
|
||||
@change="changeItem(rowKey, $event)"
|
||||
>
|
||||
</JsonObject>
|
||||
<JsonElement v-else
|
||||
:value="row"
|
||||
:label="rowKey"
|
||||
@change="changeItem(rowKey, $event)"
|
||||
>
|
||||
</JsonElement>
|
||||
</div>
|
||||
<div v-if="expanded_internal"><b>],</b></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import JsonObject from './JsonObject';
|
||||
import JsonElement from './JsonElement';
|
||||
|
||||
export default {
|
||||
name: 'JsonArray',
|
||||
props: [
|
||||
'value',
|
||||
'expanded',
|
||||
'ignoreKeys', // this prop is passthrough for JsonArray
|
||||
],
|
||||
components: {
|
||||
JsonObject,
|
||||
JsonElement,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
value_internal: undefined,
|
||||
expanded_internal: true,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.value_internal = this.value;
|
||||
},
|
||||
watch: {
|
||||
value: function(val) {
|
||||
this.value_internal = val;
|
||||
},
|
||||
expanded: function(val) {
|
||||
if (val !== undefined && val !== null) {
|
||||
this.expanded_internal = !!val;
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeItem(key, value) {
|
||||
this.value_internal[key] = value;
|
||||
this.$emit('change', this.value_internal);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import url('./json.scss');
|
||||
@import url('../../../res/css/flex.scss');
|
||||
|
||||
</style>
|
91
src/common/components/JsonEditor/JsonElement.vue
Normal file
91
src/common/components/JsonEditor/JsonElement.vue
Normal file
@ -0,0 +1,91 @@
|
||||
<template>
|
||||
<div class="flex flex-row json-level-indent">
|
||||
<div>
|
||||
<b>
|
||||
<span v-if="label" class="item-key"
|
||||
:class="{'item-key-boolean-false': typeof value_internal === 'boolean' && !value_internal}"
|
||||
>
|
||||
"{{label}}"
|
||||
</span>
|
||||
:
|
||||
</b>
|
||||
</div>
|
||||
<div v-if="typeof value_internal === 'boolean'"
|
||||
:class="{'json-value-boolean-true': value_internal, 'json-value-boolean-false': !value_internal}"
|
||||
@click="toggleBoolean"
|
||||
>
|
||||
<template v-if="value_internal">true</template>
|
||||
<template v-else>false</template>
|
||||
</div>
|
||||
<div v-else
|
||||
class="flex flex-row inline-edit"
|
||||
:class="{
|
||||
'json-value-number': typeof value_internal === 'number',
|
||||
'json-value-string': typeof value_internal === 'string'
|
||||
}"
|
||||
>
|
||||
<template v-if="typeof value_internal === 'string'">
|
||||
"<div ref="element-edit-area"
|
||||
contenteditable="true"
|
||||
@keydown.enter="changeValue"
|
||||
>
|
||||
{{value_internal}}
|
||||
</div>"
|
||||
</template>
|
||||
<template v-else>
|
||||
<div ref="element-edit-area"
|
||||
contenteditable="true"
|
||||
@keydown.enter="changeValue"
|
||||
>
|
||||
{{value_internal}}
|
||||
</div>
|
||||
</template>,
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'json-element',
|
||||
props: [
|
||||
'value',
|
||||
'label',
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
value_internal: undefined,
|
||||
editing: false,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.value_internal = this.value;
|
||||
},
|
||||
watch: {
|
||||
value: function(val) {
|
||||
this.value_internal = val;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toggleBoolean() {
|
||||
this.value_internal = !this.value_internal;
|
||||
this.$emit('change', this.value_internal);
|
||||
},
|
||||
changeValue() {
|
||||
this.$refs['element-edit-area'].blur();
|
||||
const newValue = this.$refs['element-edit-area'].textContent.replace(/\n/g, '');
|
||||
if (isNaN(newValue)) {
|
||||
this.value_internal = newValue;
|
||||
this.$emit('change', newValue);
|
||||
} else {
|
||||
this.value_internal = +newValue;
|
||||
this.$emit('change', +newValue);
|
||||
}
|
||||
this.editing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import url('./json.scss');
|
||||
</style>
|
92
src/common/components/JsonEditor/JsonObject.vue
Normal file
92
src/common/components/JsonEditor/JsonObject.vue
Normal file
@ -0,0 +1,92 @@
|
||||
<template>
|
||||
<div class="flex flex-column json-level-indent">
|
||||
<div class="flex flex-row" @click="expanded_internal = !expanded_internal">
|
||||
<div class="item-key-line">
|
||||
<template v-if="label">
|
||||
<b>
|
||||
<span class="item-key">"{{label}}"</span>
|
||||
:
|
||||
</b>
|
||||
</template>
|
||||
<span v-if="!expanded_internal"><b> {</b> ... <b>}</b>,</span>
|
||||
<template v-else><b>{</b></template>
|
||||
</div>
|
||||
</div>
|
||||
<template v-if="expanded_internal">
|
||||
<div v-for="(row, rowKey) of value_internal"
|
||||
:key="rowKey"
|
||||
>
|
||||
<template v-if="(ignoreKeys || {})[rowKey] !== true">
|
||||
<JsonArray v-if="Array.isArray(row)"
|
||||
:value="row"
|
||||
:ignoreKeys="(ignoreKeys || {})[rowKey]"
|
||||
@change="changeItem(rowKey, $event)"
|
||||
>
|
||||
</JsonArray>
|
||||
<JsonObject v-else-if="typeof row === 'object' && row !== null"
|
||||
:value="row"
|
||||
:label="rowKey"
|
||||
:ignoreKeys="(ignoreKeys || {})[rowKey]"
|
||||
@change="changeItem(rowKey, $event)"
|
||||
>
|
||||
</JsonObject>
|
||||
<JsonElement v-else
|
||||
:value="row"
|
||||
:label="rowKey"
|
||||
@change="changeItem(rowKey, $event)"
|
||||
>
|
||||
</JsonElement>
|
||||
</template>
|
||||
</div>
|
||||
<div><b>},</b></div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import JsonArray from './JsonArray';
|
||||
import JsonElement from './JsonElement';
|
||||
|
||||
export default {
|
||||
name: 'JsonObject',
|
||||
props: [
|
||||
'value',
|
||||
'label',
|
||||
'expanded',
|
||||
'ignoreKeys',
|
||||
],
|
||||
components: {
|
||||
JsonArray,
|
||||
JsonElement,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
value_internal: undefined,
|
||||
expanded_internal: true,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.value_internal = this.value;
|
||||
},
|
||||
watch: {
|
||||
value: function(val) {
|
||||
this.value_internal = val;
|
||||
},
|
||||
expanded: function(val) {
|
||||
if (val !== undefined && val !== null) {
|
||||
this.expanded_internal = !!val;
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeItem(key, value) {
|
||||
this.value_internal[key] = value;
|
||||
this.$emit('change', this.value_internal);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import url('./json.scss');
|
||||
</style>
|
23
src/common/components/JsonEditor/json.scss
Normal file
23
src/common/components/JsonEditor/json.scss
Normal file
@ -0,0 +1,23 @@
|
||||
.json-level-indent {
|
||||
padding-left: 2em !important;
|
||||
font-family: 'Overpass Mono', monospace;
|
||||
}
|
||||
.item-key {
|
||||
color: rgb(255, 196, 148);
|
||||
}
|
||||
.item-key-boolean-false {
|
||||
color: rgb(207, 149, 101)
|
||||
}
|
||||
|
||||
.json-value-boolean-true {
|
||||
color: rgb(150, 240, 198);
|
||||
}
|
||||
.json-value-boolean-false {
|
||||
color: rgb(241, 21, 21);
|
||||
}
|
||||
.json-value-number {
|
||||
color: rgb(121, 121, 238);
|
||||
}
|
||||
.json-value-string {
|
||||
color: rgb(226, 175, 7);
|
||||
}
|
@ -1,5 +1,9 @@
|
||||
<template>
|
||||
<div v-if="showLoggerUi" class="root-window flex flex-column overflow-hidden">
|
||||
<div v-if="showLoggerUi" class="root-window flex flex-column overflow-hidden"
|
||||
@keyup.stop
|
||||
@keydown.stop
|
||||
@keypress.stop
|
||||
>
|
||||
<div class="header">
|
||||
<div class="header-top flex flex-row">
|
||||
<div class="flex-grow">
|
||||
@ -27,25 +31,44 @@
|
||||
<div class="settings-panel flex flex-noshrink flex-column">
|
||||
<div class="panel-top flex-nogrow">
|
||||
<h2>Logger configuration</h2>
|
||||
<p>Paste logger configuration in this box</p>
|
||||
</div>
|
||||
|
||||
<div class="panel-middle scrollable flex-grow p-t-025em">
|
||||
<div ref="settingsEditArea"
|
||||
style="white-space: pre-wrap; border: 1px solid orange; padding: 10px;"
|
||||
class="monospace h100"
|
||||
:class="{'jsonbg': !confHasError, 'jsonbg-error': confHasError}"
|
||||
contenteditable="true"
|
||||
@input="updateSettings"
|
||||
>
|
||||
{{parsedSettings}}
|
||||
<div class="flex flex-row flex-end w100">
|
||||
<div v-if="!showTextMode" class="button" @click="showTextMode = true">
|
||||
Paste config ...
|
||||
</div>
|
||||
<div v-else class="button" @click="showTextMode = false">
|
||||
Back
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-noshrink flex flex-row flex-cross-center p-t-025em">
|
||||
<div class="button button-bar"
|
||||
@click="restoreLoggerSettings()"
|
||||
>
|
||||
Revert logger config
|
||||
|
||||
<div class="panel-middle scrollable flex-grow log-config-margin">
|
||||
<template v-if="showTextMode">
|
||||
<div ref="settingsEditArea"
|
||||
style="white-space: pre-wrap; border: 1px solid orange; padding: 10px;"
|
||||
class="monospace h100"
|
||||
:class="{'jsonbg': !confHasError, 'jsonbg-error': confHasError}"
|
||||
contenteditable="true"
|
||||
@input="updateSettings"
|
||||
>
|
||||
{{parsedSettings}}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<JsonObject label="logger-settings"
|
||||
:value="currentSettings"
|
||||
:ignoreKeys="{'allowLogging': true}"
|
||||
@change="updateSettingsUi"
|
||||
></JsonObject>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="flex flex-row flex-end">
|
||||
<div class="button" @click="restoreLoggerSettings()">
|
||||
Revert
|
||||
</div>
|
||||
<div class="button button-primary" @click="saveLoggerSettings()">
|
||||
Save
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -102,11 +125,21 @@
|
||||
>
|
||||
Stop logging
|
||||
</div>
|
||||
<p v-if="lastSettings && lastSettings.timeout"
|
||||
class="m-025em"
|
||||
<template v-if="lastSettings && lastSettings.timeout"
|
||||
class="m-025em"
|
||||
>
|
||||
... or wait until logging ends.
|
||||
</p>
|
||||
<p>
|
||||
... or wait until logging ends.
|
||||
</p>
|
||||
<p>
|
||||
You can <a @click="hidePopup()">hide popup</a> — it will automatically re-appear when logging finishes.
|
||||
</p>
|
||||
</template>
|
||||
<template v-else-if="lastSettings">
|
||||
<p>
|
||||
You can <a @click="hidePopup()">hide popup</a> — the logging will continue until you re-open the popup and stop it.
|
||||
</p>
|
||||
</template>
|
||||
</div>
|
||||
<div v-else class="flex flex-column flex-center flex-cross-center w100 h100">
|
||||
<div class="button button-big button-primary"
|
||||
@ -130,8 +163,12 @@ import { mapState } from 'vuex';
|
||||
import Logger from '../ext/lib/Logger';
|
||||
import Comms from '../ext/lib/comms/Comms';
|
||||
import IO from '../common/js/IO';
|
||||
import JsonObject from '../common/components/JsonEditor/JsonObject';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
JsonObject,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showLoggerUi: false,
|
||||
@ -141,8 +178,10 @@ export default {
|
||||
},
|
||||
parsedSettings: '',
|
||||
lastSettings: {},
|
||||
currentSettings: {},
|
||||
confHasError: false,
|
||||
logStringified: '',
|
||||
showTextMode: false,
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
@ -164,7 +203,8 @@ export default {
|
||||
computed: {
|
||||
...mapState([
|
||||
'uwLog',
|
||||
'showLogger'
|
||||
'showLogger',
|
||||
'loggingEnded',
|
||||
]),
|
||||
},
|
||||
watch: {
|
||||
@ -181,22 +221,43 @@ export default {
|
||||
if (newValue) {
|
||||
this.getLoggerSettings();
|
||||
}
|
||||
},
|
||||
loggingEnded(newValue) {
|
||||
// note — the value of loggingEnded never actually matters. Even if this value is 'true'
|
||||
// internally, vuexStore.dspatch() will still do its job and give us the signal we want
|
||||
if (newValue) {
|
||||
this.stopLogging();
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getLoggerSettings() {
|
||||
this.lastSettings = await Logger.getConfig() || {};
|
||||
this.parsedSettings = JSON.stringify(this.lastSettings, null, 2) || '';
|
||||
this.currentSettings = JSON.parse(JSON.stringify(this.lastSettings));
|
||||
},
|
||||
updateSettings(val) {
|
||||
try {
|
||||
this.parsedSettings = JSON.stringify(JSON.parse(val.target.textContent.trim()), null, 2);
|
||||
this.lastSettings = JSON.parse(val.target.textContent.trim());
|
||||
this.currentSettings = JSON.parse(JSON.stringify(this.lastSettings));
|
||||
this.confHasError = false;
|
||||
} catch (e) {
|
||||
this.confHasError = true;
|
||||
}
|
||||
},
|
||||
updateSettingsUi(val) {
|
||||
try {
|
||||
this.parsedSettings = JSON.stringify(val, null, 2);
|
||||
this.lastSettings = val;
|
||||
this.currentSettings = JSON.parse(JSON.stringify(this.lastSettings));
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
},
|
||||
saveLoggerSettings() {
|
||||
Logger.saveConfig({...this.lastSettings});
|
||||
},
|
||||
restoreLoggerSettings() {
|
||||
this.getLoggerSettings();
|
||||
this.confHasError = false;
|
||||
@ -368,4 +429,9 @@ pre {
|
||||
background-color: #884420;
|
||||
}
|
||||
|
||||
.log-config-margin {
|
||||
margin-top: 3em;
|
||||
margin-bottom: 3em;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
@ -320,7 +320,7 @@ const ExtensionConfPatch = [
|
||||
}
|
||||
}
|
||||
}, {
|
||||
forVersion: '4.4.6',
|
||||
forVersion: '4.4.7',
|
||||
updateFn: (userOptions, defaultOptions) => {
|
||||
if (!userOptions.sites['www.netflix.com'].DOM) {
|
||||
userOptions.sites['www.netflix.com']['DOM'] = {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import currentBrowser from '../conf/BrowserDetect';
|
||||
import { decycle } from 'json-cyclic';
|
||||
import Comms from './comms/Comms';
|
||||
|
||||
class Logger {
|
||||
constructor(options) {
|
||||
@ -104,8 +105,8 @@ class Logger {
|
||||
// console.info('[Logger::<storage/on change> No new logger settings!');
|
||||
}
|
||||
if (changes['uwLogger'] && changes['uwLogger'].newValue) {
|
||||
console.log("[Logger::<storage/on change>] Logger have been changed outside of here. Updating active settings. Changes:", changes, "storage area:", area);
|
||||
console.info("[Logger::<storage/on change>] new logger settings object (parsed):", JSON.parse(changes.uwLogger.newValue));
|
||||
// console.log("[Logger::<storage/on change>] Logger have been changed outside of here. Updating active settings. Changes:", changes, "storage area:", area);
|
||||
// console.info("[Logger::<storage/on change>] new logger settings object (parsed):", JSON.parse(changes.uwLogger.newValue));
|
||||
}
|
||||
}
|
||||
if (!changes['uwLogger']) {
|
||||
@ -202,7 +203,7 @@ class Logger {
|
||||
// } else {
|
||||
// this.exportLogToFile();
|
||||
}
|
||||
this.saveToVuex();
|
||||
this.saveViaBgScript();
|
||||
}
|
||||
|
||||
parseStack() {
|
||||
@ -457,6 +458,10 @@ class Logger {
|
||||
}
|
||||
}
|
||||
|
||||
appendLog(logs) {
|
||||
this.history = this.history.concat(logs);
|
||||
}
|
||||
|
||||
addLogFromPage(host, tabId, frameId, pageHistory) {
|
||||
if (! this.globalHistory[host]) {
|
||||
this.globalHistory[host] = {};
|
||||
@ -471,6 +476,34 @@ class Logger {
|
||||
}
|
||||
}
|
||||
|
||||
saveViaBgScript() {
|
||||
console.info('[info] will attempt to save. Issuing "show-logger"');
|
||||
if (!this.conf?.fileOptions?.enabled || this.isBackgroundScript) {
|
||||
console.info('[info] Logging to file is either disabled or we\'re not on the content script. Not saving.');
|
||||
return;
|
||||
}
|
||||
|
||||
Comms.sendMessage({cmd: 'show-logger', forwardToSameFramePort: true, port: 'content-ui-port'});
|
||||
|
||||
let exportObject;
|
||||
try {
|
||||
exportObject = {
|
||||
pageLogs: decycle(this.history),
|
||||
backgroundLogs: decycle(this.globalHistory),
|
||||
loggerFileOptions: this.conf.fileOptions,
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("[fail] error parsing logs!", e)
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
Comms.sendMessage({cmd: 'emit-logs', payload: JSON.stringify(exportObject), forwardToSameFramePort: true, port: 'content-ui-port'})
|
||||
} catch (e) {
|
||||
console.log("failed to send message")
|
||||
}
|
||||
}
|
||||
|
||||
saveToVuex() {
|
||||
console.info('[info] will attempt to save to vuex store.');
|
||||
if (!this.conf?.fileOptions?.enabled || this.isBackgroundScript) {
|
||||
|
@ -186,13 +186,21 @@ class CommsServer {
|
||||
}
|
||||
}
|
||||
|
||||
async sendToContentScripts(message, tab, frame) {
|
||||
// if port is NOT defined, send to all content scripts of a given frame
|
||||
// if port is defined, send just to that particular script of a given frame
|
||||
async sendToFrameContentScripts(message, tab, frame, port) {
|
||||
if (port !== undefined) {
|
||||
// note: 'port' is _not_ shadowed here.
|
||||
this.ports[tab][frame][port].postMessage(message);
|
||||
return;
|
||||
}
|
||||
for (const port in this.ports[tab][frame]) {
|
||||
// note: 'port' is shadowed here!
|
||||
this.ports[tab][frame][port].postMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
async sendToFrame(message, tab, frame) {
|
||||
async sendToFrame(message, tab, frame, port) {
|
||||
this.logger.log('info', 'comms', `%c[CommsServer::sendToFrame] attempting to send message to tab ${tab}, frame ${frame}`, "background: #dda; color: #11D", message);
|
||||
|
||||
if (isNaN(tab)) {
|
||||
@ -210,12 +218,18 @@ class CommsServer {
|
||||
this.logger.log('info', 'comms', `%c[CommsServer::sendToFrame] attempting to send message to tab ${tab}, frame ${frame}`, "background: #dda; color: #11D", message);
|
||||
|
||||
try {
|
||||
this.sendToContentScripts(message, tab, frame);
|
||||
this.sendToFrameContentScripts(message, tab, frame, port);
|
||||
} catch (e) {
|
||||
this.logger.log('error', 'comms', `%c[CommsServer::sendToFrame] Sending message failed. Reason:`, "background: #dda; color: #11D", e);
|
||||
}
|
||||
}
|
||||
|
||||
async sendToAllFrames(message, tab, port) {
|
||||
for (const frame in this.ports[tab]) {
|
||||
this.sendToFrameContentScripts(message, tab, frame, port);
|
||||
}
|
||||
}
|
||||
|
||||
async sendToActive(message) {
|
||||
this.logger.log('info', 'comms', "%c[CommsServer::sendToActive] trying to send a message to active tab. Message:", "background: #dda; color: #11D", message);
|
||||
|
||||
@ -227,7 +241,7 @@ class CommsServer {
|
||||
}
|
||||
|
||||
for (const frame in this.ports[tabs[0].id]) {
|
||||
this.sendToContentScripts(message, tabs[0].id, frame);
|
||||
this.sendToFrameContentScripts(message, tabs[0].id, frame);
|
||||
}
|
||||
}
|
||||
|
||||
@ -286,6 +300,9 @@ class CommsServer {
|
||||
async handleMessage(message, portOrSender, sendResponse) {
|
||||
await this.execCmd(message, portOrSender, sendResponse);
|
||||
|
||||
if (message.forwardToSameFramePort) {
|
||||
this.sendToFrameContentScripts(message, portOrSender.tab.id, portOrSender.frameId, message.port)
|
||||
}
|
||||
if (message.forwardToContentScript) {
|
||||
this.logger.log('info', 'comms', "[CommsServer.js::processReceivedMessage] Message has 'forward to content script' flag set. Forwarding message as is. Message:", message);
|
||||
this.sendToFrame(message, message.targetTab, message.targetFrame);
|
||||
|
@ -64,6 +64,7 @@ class UWServer {
|
||||
this.comms.subscribe('show-logger', async () => await this.initUiAndShowLogger());
|
||||
this.comms.subscribe('init-vue', async () => await this.initUi());
|
||||
this.comms.subscribe('uwui-vue-initialized', () => this.uiLoggerInitialized = true);
|
||||
this.comms.subscribe('emit-logs', () => {}); // we don't need to do anything, this gets forwarded to UI content script as is
|
||||
|
||||
|
||||
if(BrowserDetect.firefox) {
|
||||
|
@ -22,6 +22,7 @@ class UwUi {
|
||||
this.commsHandlers = {
|
||||
'show-logger': [() => this.showLogger()],
|
||||
'hide-logger': [() => this.hideLogger()],
|
||||
'emit-logs' : [(message) => this.addLogs(message)]
|
||||
}
|
||||
}
|
||||
|
||||
@ -122,42 +123,54 @@ class UwUi {
|
||||
return;
|
||||
}
|
||||
|
||||
Vue.prototype.$browser = global.browser;
|
||||
Vue.use(Vuex);
|
||||
this.vuexStore = new Vuex.Store({
|
||||
plugins: [VuexWebExtensions({
|
||||
persistentStates: [
|
||||
'uwLog',
|
||||
'showLogger',
|
||||
],
|
||||
})],
|
||||
state: {
|
||||
uwLog: '',
|
||||
showLogger: false,
|
||||
},
|
||||
mutations: {
|
||||
'uw-set-log'(state, payload) {
|
||||
state['uwLog'] = payload;
|
||||
try {
|
||||
Vue.prototype.$browser = global.browser;
|
||||
Vue.use(Vuex);
|
||||
this.vuexStore = new Vuex.Store({
|
||||
plugins: [VuexWebExtensions({
|
||||
persistentStates: [
|
||||
'uwLog',
|
||||
'showLogger',
|
||||
'loggingEnded',
|
||||
],
|
||||
})],
|
||||
state: {
|
||||
uwLog: '',
|
||||
showLogger: false,
|
||||
loggingEnded: false,
|
||||
},
|
||||
'uw-show-logger'(state) {
|
||||
state['showLogger'] = true;
|
||||
mutations: {
|
||||
'uw-set-log'(state, payload) {
|
||||
state['uwLog'] = payload;
|
||||
},
|
||||
'uw-show-logger'(state) {
|
||||
state['showLogger'] = true;
|
||||
},
|
||||
'uw-hide-logger'(state) {
|
||||
state['showLogger'] = false;
|
||||
},
|
||||
'uw-logging-ended'(state) {
|
||||
state['loggingEnded'] = state;
|
||||
}
|
||||
},
|
||||
'uw-hide-logger'(state) {
|
||||
state['showLogger'] = false;
|
||||
actions: {
|
||||
'uw-set-log' ({commit}, payload) {
|
||||
commit('uw-set-log', payload);
|
||||
},
|
||||
'uw-show-logger'({commit}) {
|
||||
commit('uw-show-logger');
|
||||
},
|
||||
'uw-hide-logger'({commit}) {
|
||||
commit('uw-hide-logger');
|
||||
},
|
||||
'uw-logging-ended'({commit}, payload) {
|
||||
commit('uw-logging-ended', payload);
|
||||
}
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
'uw-set-log' ({commit}, payload) {
|
||||
commit('uw-set-log', payload);
|
||||
},
|
||||
'uw-show-logger'({commit}) {
|
||||
commit('uw-show-logger');
|
||||
},
|
||||
'uw-hide-logger'({commit}) {
|
||||
commit('uw-hide-logger');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
} catch (e) {
|
||||
console.error("Ultrawidify failed to initialize vue. Error:", e);
|
||||
}
|
||||
|
||||
// make sure we don't init twice
|
||||
this.vueInitiated = true;
|
||||
@ -211,6 +224,17 @@ class UwUi {
|
||||
this.vuexStore.dispatch('uw-hide-logger');
|
||||
}
|
||||
}
|
||||
|
||||
addLogs(message) {
|
||||
this.logger.appendLog(JSON.parse(message.payload));
|
||||
|
||||
// since this gets called _after_ logging has been finished,
|
||||
// we also inform logger UI to save current settings
|
||||
if (this.vueInitiated && this.vuexStore !== undefined) {
|
||||
console.log("got add logs. payload:", message.payload);
|
||||
this.vuexStore.dispatch('uw-logging-ended', true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// leave a mark, so this script won't get executed more than once on a given page
|
||||
|
@ -1,8 +1,9 @@
|
||||
import Debug from './conf/Debug';
|
||||
import BrowserDetect from './conf/BrowserDetect';
|
||||
import ExtensionMode from '../common/enums/extension-mode.enum'
|
||||
import ExtensionMode from '../common/enums/extension-mode.enum';
|
||||
import Settings from './lib/Settings';
|
||||
import ActionHandler from './lib/ActionHandler';
|
||||
import Comms from './lib/comms/Comms';
|
||||
import CommsClient from './lib/comms/CommsClient';
|
||||
import PageInfo from './lib/video-data/PageInfo';
|
||||
import Logger from './lib/Logger';
|
||||
@ -111,18 +112,12 @@ class UW {
|
||||
this.logger = new Logger();
|
||||
await this.logger.init(loggingOptions);
|
||||
|
||||
if (this.logger.isLoggingAllowed()) {
|
||||
console.info("[uw::init] Logging is allowed! Initalizing vue and UI!");
|
||||
}
|
||||
|
||||
// show popup if logging to file is enabled
|
||||
if (this.logger.isLoggingToFile()) {
|
||||
console.info('[uw::init] Logging to file is enabled. Will show popup!');
|
||||
try {
|
||||
this.vuexStore.dispatch('uw-show-logger');
|
||||
} catch (e) {
|
||||
console.error('[uw::init] Failed to open popup!', e)
|
||||
}
|
||||
if (this.logger.isLoggingAllowed() && this.logger.isLoggingToFile()) {
|
||||
console.info("[uw::init] Logging is allowed! Initalizing vue and UI!");
|
||||
|
||||
// CommsClient is not initiated yet, so we use static comms to send the command
|
||||
Comms.sendMessage({cmd: 'show-logger'});
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
@ -2,7 +2,7 @@
|
||||
"manifest_version": 2,
|
||||
"name": "Ultrawidify",
|
||||
"description": "Removes black bars on ultrawide videos and offers advanced options to fix aspect ratio.",
|
||||
"version": "4.4.6.1",
|
||||
"version": "4.4.7",
|
||||
"applications": {
|
||||
"gecko": {
|
||||
"id": "{cf02b1a7-a01a-4e37-a609-516a283f1ed3}"
|
||||
@ -23,7 +23,7 @@
|
||||
"ext/uw.js"
|
||||
],
|
||||
"css": [
|
||||
"ext/uw.css"
|
||||
"ext/uw-ui.css"
|
||||
],
|
||||
"all_frames": true
|
||||
}],
|
||||
@ -46,14 +46,7 @@
|
||||
"ext/*",
|
||||
"res/fonts/*",
|
||||
"res/css/*",
|
||||
|
||||
"res/img/ytplayer-icons/zoom.png",
|
||||
"res/img/ytplayer-icons/unzoom.png",
|
||||
"res/img/ytplayer-icons/fitw.png",
|
||||
"res/img/ytplayer-icons/fith.png",
|
||||
"res/img/ytplayer-icons/reset.png",
|
||||
"res/img/ytplayer-icons/settings.png",
|
||||
|
||||
|
||||
"res/img/settings/about-bg.png"
|
||||
],
|
||||
"permissions": [
|
||||
|
@ -484,6 +484,7 @@ html, body {
|
||||
|
||||
#tablist {
|
||||
min-width: 275px;
|
||||
max-width: 300px;
|
||||
}
|
||||
|
||||
.header {
|
||||
|
@ -25,7 +25,7 @@
|
||||
<div><small>You can change or add additional aspect ratios on <a href="#" @click="openOptionsPage()">the settings page</a> (in 'actions&shortcuts' menu).</small></div>
|
||||
</div>
|
||||
|
||||
<div v-if="true"
|
||||
<div v-if="false"
|
||||
class="">
|
||||
<div class="label experimental">Zooming and panning</div>
|
||||
<div class="row"
|
||||
|
@ -2,30 +2,30 @@
|
||||
<div>
|
||||
<h2>What's new</h2>
|
||||
<p>Full changelog for older versions <a href="https://github.com/tamius-han/ultrawidify/blob/master/CHANGELOG.md">is available here</a>.</p>
|
||||
<p class="label">4.4.6</p>
|
||||
<p class="label">4.4.7</p>
|
||||
<ul>
|
||||
<li>Ensured that Vue part of the content script (logger UI) only loads when necessary in order to fix breakage on certain sites (<a href="https://github.com/tamius-han/ultrawidify/issues/96">#96</a>).</li>
|
||||
<li>Disabling (or enabling, if running in whitelist-only mode) specific sites used to not work (<a href="https://github.com/tamius-han/ultrawidify/issues/91">#91</a>). This issue appears to have been fixed.</li>
|
||||
<li>Default stretch mode for sites is now probably being observed, too (<a href="https://github.com/tamius-han/ultrawidify/issues/94">#94</a>).</li>
|
||||
<li>Fixed netflix (and possibly disney+ — please provide feedback for disney+ as I am unable to test it due to regional restrictions)</li>
|
||||
<li>Removed unnecessary font files and image files from the package.</li>
|
||||
<li>(For testing/debugging purposes) Logger UI in swatter mode is now somewhat functional and user-friendly.</li>
|
||||
</ul>
|
||||
|
||||
<template v-if="BrowserDetect.chrome">
|
||||
<p>Due to factors beyond my control, Chrome version of this extension has missed the last three patches.</p>
|
||||
|
||||
<ul>
|
||||
<li><b>4.4.6</b>
|
||||
<ul>
|
||||
<li>Ensured that Vue part of the content script (logger UI) only loads when necessary in order to fix breakage on certain sites (<a href="https://github.com/tamius-han/ultrawidify/issues/96">#96</a>).</li>
|
||||
<li>Disabling (or enabling, if running in whitelist-only mode) specific sites used to not work (<a href="https://github.com/tamius-han/ultrawidify/issues/91">#91</a>). This issue appears to have been fixed.</li>
|
||||
<li>Default stretch mode for sites is now probably being observed, too (<a href="https://github.com/tamius-han/ultrawidify/issues/94">#94</a>).</li>
|
||||
<li>Fixed netflix (and possibly disney+ — please provide feedback for disney+ as I am unable to test it due to regional restrictions)</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><b>4.4.5</b>
|
||||
<ul>
|
||||
<li>Extension no longer requires <code>allTabs</code> and <code>webNavigation</code> permissions</li>
|
||||
<li>Some CSS on the logger popup was not scoped, causing display issues with some sites (<a href="https://github.com/tamius-han/ultrawidify/issues/92">#92</a>)</li>
|
||||
<li>Fix some additional issues with video alignment when changing videos on autoplay</li>
|
||||
</ul></li>
|
||||
<li><b>4.4.4<small>.1, .2</small></b>
|
||||
<ul>
|
||||
<li><b>[4.4.4.1]</b> There were multiple reports about popup being broken. This issue should be resolved.</li>
|
||||
<li><b>[4.4.4.1]</b> Setting global/site defaults should no longer require page reloads.</li>
|
||||
<li><b>[4.4.4.2]</b> Fix problem with video being offset while switching between full screen and non-fullscreen non-theater mode on Youtube</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</template>
|
||||
</div>
|
||||
|
@ -76,9 +76,6 @@
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@font-face {
|
||||
font-family: 'overpass';
|
||||
src: url('../../fonts/overpass-webfont/overpass-bold.woff2') format('woff2');
|
||||
@ -91,35 +88,4 @@
|
||||
src: url('../../fonts/overpass-webfont/overpass-bold-italic.woff2') format('woff2');
|
||||
font-weight: 700;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@font-face {
|
||||
font-family: 'overpass';
|
||||
src: url('../../fonts/overpass-webfont/overpass-extrabold.woff2') format('woff2');
|
||||
font-weight: 800;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'overpass';
|
||||
src: url('../../fonts/overpass-webfont/overpass-extrabold-italic.woff2') format('woff2');
|
||||
font-weight: 800;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
|
||||
@font-face {
|
||||
font-family: 'overpass';
|
||||
src: url('../../fonts/overpass-webfont/overpass-heavy.woff2') format('woff2');
|
||||
font-weight: 900;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'overpass';
|
||||
src: url('../../fonts/overpass-webfont/overpass-heavy-italic.woff2') format('woff2');
|
||||
font-weight: 900;
|
||||
font-style: italic;
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.6 KiB |
@ -75,12 +75,12 @@ const config = {
|
||||
filename: '[name].css',
|
||||
}),
|
||||
new CopyWebpackPlugin([
|
||||
{ from: 'res', to: 'res'},
|
||||
{ from: 'res', to: 'res', ignore: ['css', 'css/**']},
|
||||
{ from: 'ext', to: 'ext', ignore: ['conf/*', 'lib/**']},
|
||||
{ from: 'icons', to: 'icons', ignore: ['icon.xcf'] },
|
||||
{ from: 'popup/popup.html', to: 'popup/popup.html', transform: transformHtml },
|
||||
{ from: 'options/options.html', to: 'options/options.html', transform: transformHtml },
|
||||
{ from: 'install/first-time/first-time.html', to: 'install/first-time/first-time.html', transform: transformHtml},
|
||||
// { from: 'install/first-time/first-time.html', to: 'install/first-time/first-time.html', transform: transformHtml},
|
||||
{
|
||||
from: 'manifest.json',
|
||||
to: 'manifest.json',
|
||||
@ -128,6 +128,8 @@ const config = {
|
||||
|
||||
if (process.env.BROWSER !== 'firefox') {
|
||||
jsonContent.version = jsonContent.version.replace(/[a-zA-Z-]/g, '');
|
||||
delete jsonContent.applications;
|
||||
delete jsonContent.options_ui.browser_style;
|
||||
}
|
||||
|
||||
return JSON.stringify(jsonContent, null, 2);
|
||||
|
Loading…
Reference in New Issue
Block a user