From 53b22d8a09d2962a5c4a8562c8e8aa9b8cf2af1e Mon Sep 17 00:00:00 2001 From: SirStendec Date: Mon, 5 Oct 2020 20:42:57 -0400 Subject: [PATCH] 4.20.41 * Added: Including `?ffz-no-settings` in the URL will prevent FrankerFaceZ from enabling any settings profiles. This should allow users to recover without resetting their settings if they somehow break FFZ and/or Twitch by changing settings. * Changed: Limit the maximum font size to 25 for the main page. --- package.json | 2 +- .../main_menu/components/setting-text-box.vue | 12 ++++++++++++ src/settings/context.js | 12 +++++++----- src/settings/index.js | 9 +++++++++ .../twitch-twilight/modules/menu_button.jsx | 8 ++++++++ .../twitch-twilight/modules/theme/index.js | 18 +++++++++++++++--- 6 files changed, 52 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index b20f733f..2a1f92e3 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "frankerfacez", "author": "Dan Salvato LLC", - "version": "4.20.40", + "version": "4.20.41", "description": "FrankerFaceZ is a Twitch enhancement suite.", "license": "Apache-2.0", "scripts": { diff --git a/src/modules/main_menu/components/setting-text-box.vue b/src/modules/main_menu/components/setting-text-box.vue index 9b6d4fb9..53eee8c8 100644 --- a/src/modules/main_menu/components/setting-text-box.vue +++ b/src/modules/main_menu/components/setting-text-box.vue @@ -12,6 +12,8 @@ this.updateRoutes(), 50, false); + // Do we want to not enable any profiles? + try { + const params = new URL(window.location).searchParams; + if ( params ) { + if ( params.has('ffz-no-settings') ) + this.disable_profiles = true; + } + } catch(err) { /* no-op */ } + // State this.__contexts = []; this.__profiles = []; diff --git a/src/sites/twitch-twilight/modules/menu_button.jsx b/src/sites/twitch-twilight/modules/menu_button.jsx index b0d3ba9a..2adbafeb 100644 --- a/src/sites/twitch-twilight/modules/menu_button.jsx +++ b/src/sites/twitch-twilight/modules/menu_button.jsx @@ -161,6 +161,9 @@ export default class MenuButton extends SiteModule { if ( this.has_update ) return null; + if ( this.settings.disable_profiles ) + return
; + if ( this.has_strings ) return this.i18n.formatNumber(this.i18n.new_strings + this.i18n.changed_strings); @@ -326,6 +329,11 @@ export default class MenuButton extends SiteModule { {this.has_update && (
{this.i18n.t('site.menu_button.update-desc', 'There is an update available. Please refresh your page.')}
)} + {this.settings.disable_profiles && (
+ {this.i18n.tList('site.menu_button.no-settings', 'Settings are disabled in this tab due to the inclusion of "{param}" in the URL.', { + param: ?ffz-no-settings + })} +
)} {this._new_settings > 0 && (
{this.i18n.t('site.menu_button.new-desc', 'There {count,plural,one {is one new setting} other {are # new settings}}.', {count: this._new_settings})}
)} diff --git a/src/sites/twitch-twilight/modules/theme/index.js b/src/sites/twitch-twilight/modules/theme/index.js index 9754e076..2cc17a53 100644 --- a/src/sites/twitch-twilight/modules/theme/index.js +++ b/src/sites/twitch-twilight/modules/theme/index.js @@ -46,11 +46,23 @@ export default class ThemeEngine extends Module { this.settings.add('theme.font.size', { default: 13, + process(ctx, val) { + if ( typeof val !== 'number' ) + try { + val = parseFloat(val); + } catch(err) { val = null; } + + if ( ! val || val < 1 || isNaN(val) || ! isFinite(val) || val > 25 ) + val = 13; + + return val; + }, ui: { path: 'Appearance > Theme >> Fonts', title: 'Font Size', - description: 'How large should normal text be, in pixels. This may be affected by your browser\'s zoom and font settings. The old default was: `12`', - component: 'setting-text-box' + description: '**Minimum:** `1`, **Maximum:** `25`, *Old Default:* `12`\n\nHow large should normal text be, in pixels. This may be affected by your browser\'s zoom and font settings.', + component: 'setting-text-box', + type: 'number' }, changed: () => this.updateFont() }); @@ -187,7 +199,7 @@ The CSS loaded by this setting is far too heavy and can cause performance issues let size = this.settings.get('theme.font.size'); if ( typeof size === 'string' && /^[0-9.]+$/.test(size) ) size = parseFloat(size); - else + else if ( typeof size !== 'number' ) size = null; if ( ! size || isNaN(size) || ! isFinite(size) || size < 1 || size === 13 ) {