diff --git a/.eslintrc.js b/.eslintrc.js index f696d688..35c80a84 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -36,6 +36,7 @@ module.exports = { "FrankerFaceZ": false }, "rules": { + "require-atomic-updates": "off", "accessor-pairs": ["error"], "block-scoped-var": ["error"], "class-methods-use-this": ["error"], diff --git a/package.json b/package.json index 0c511957..b02872ab 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "frankerfacez", "author": "Dan Salvato LLC", - "version": "4.11.0", + "version": "4.12.0", "description": "FrankerFaceZ is a Twitch enhancement suite.", "license": "Apache-2.0", "scripts": { diff --git a/src/modules/main_menu/components/home-page.vue b/src/modules/main_menu/components/home-page.vue index e1174580..f1ccdccb 100644 --- a/src/modules/main_menu/components/home-page.vue +++ b/src/modules/main_menu/components/home-page.vue @@ -2,9 +2,9 @@
-

+

FrankerFaceZ -

+ {{ t('home.tag-line', 'The Twitch Enhancement Suite') }} diff --git a/src/modules/metadata.jsx b/src/modules/metadata.jsx index 57ae1cdf..8a453f5e 100644 --- a/src/modules/metadata.jsx +++ b/src/modules/metadata.jsx @@ -79,8 +79,7 @@ export default class Metadata extends Module { setup(data) { const socket = this.resolve('socket'), - apollo = this.resolve('site.apollo'), - created_at = apollo.getFromQuery(data.legacy ? 'ChannelPage_ChannelHeader' : 'ChannelPage_User', 'data.user.stream.createdAt'); + created_at = data?.meta?.createdAt; if ( ! created_at ) return {}; @@ -288,7 +287,7 @@ export default class Metadata extends Module { } - async render(key, data, container, timers, refresh_fn) { + /*async render(key, data, container, timers, refresh_fn) { if ( timers[key] ) clearTimeout(timers[key]); @@ -613,7 +612,7 @@ export default class Metadata extends Module { this.log.error(`Error rendering metadata for ${key}`, err); return destroy(); } - } + }*/ async renderLegacy(key, data, container, timers, refresh_fn) { @@ -678,17 +677,25 @@ export default class Metadata extends Module { button = true; let btn, popup; - let cls = maybe_call(def.button, this, data); + const border = maybe_call(def.border, this, data); + + /* let cls = maybe_call(def.button, this, data); + + if ( typeof cls !== 'string' ) + cls = cls ? 'tw-border-t tw-border-l tw-border-b ' + if ( typeof cls !== 'string' ) cls = cls ? 'ffz-button--hollow' : 'tw-button--text'; - const fix = cls === 'tw-button--text'; + const fix = cls === 'tw-button--text';*/ if ( typeof icon === 'string' ) - icon = (
); + icon = ( +
+ ); if ( def.popup && def.click ) { - el = ( )} - ); + );*/ + + el = (
+ {btn = ()} + {popup = ()} +
); } else btn = popup = el = (); + + /*btn = popup = el = (); + );*/ if ( def.click ) btn.addEventListener('click', e => { @@ -802,7 +847,7 @@ export default class Metadata extends Module { icon = (
); el = (
@@ -824,12 +869,12 @@ export default class Metadata extends Module { if ( order != null ) el.style.order = order; - let subcontainer; + let subcontainer = container; - if ( button ) + /*if ( button ) subcontainer = container.querySelector('.tw-flex:last-child') || container; else - subcontainer = container.querySelector('.tw-flex:first-child') || container; + subcontainer = container.querySelector('.tw-flex:first-child') || container;*/ subcontainer.appendChild(el); diff --git a/src/sites/twitch-twilight/modules/channel_bar.jsx b/src/sites/twitch-twilight/modules/channel_bar.jsx index 669b70dc..48418772 100644 --- a/src/sites/twitch-twilight/modules/channel_bar.jsx +++ b/src/sites/twitch-twilight/modules/channel_bar.jsx @@ -21,6 +21,7 @@ export default class ChannelBar extends Module { this.inject('site.fine'); this.inject('site.web_munch'); this.inject('site.apollo'); + this.inject('site.twitch_data'); this.inject('metadata'); this.inject('socket'); @@ -84,6 +85,7 @@ export default class ChannelBar extends Module { inst._ffz_old_login = login; } + this.updateUptime(inst); this.updateMetadata(inst); } @@ -103,6 +105,34 @@ export default class ChannelBar extends Module { } + async updateUptime(inst) { + const current_id = inst?.props?.channel?.id; + if ( current_id === inst._ffz_uptime_id ) { + if ( Date.now() - inst._ffz_uptime_saved < 60000 ) + return; + } + + if ( inst._ffz_uptime_updating ) + return; + + inst._ffz_uptime_updating = true; + inst._ffz_uptime_id = current_id; + + try { + inst._ffz_meta = await this.twitch_data.getStreamMeta(current_id, inst?.props?.channel?.login); + } catch(err) { + this.log.capture(err); + this.log.error('Error fetching uptime:', err); + inst._ffz_meta = null; + } + + inst._ffz_uptime_saved = Date.now(); + inst._ffz_uptime_updating = false; + + this.updateMetadata(inst); + } + + updateMetadata(inst, keys) { const container = this.fine.getChildNode(inst), metabar = container?.querySelector?.('.channel-info-bar__viewers-count-wrapper > .tw-flex:last-child'); @@ -119,6 +149,7 @@ export default class ChannelBar extends Module { refresh_func = key => this.updateMetadata(inst, key), data = { channel: inst.props.channel, + meta: inst._ffz_meta, hosting: false, legacy: true, _inst: inst diff --git a/src/sites/twitch-twilight/modules/css_tweaks/styles/portrait-swapped.scss b/src/sites/twitch-twilight/modules/css_tweaks/styles/portrait-swapped.scss index 3130e6c6..75cdb5f7 100644 --- a/src/sites/twitch-twilight/modules/css_tweaks/styles/portrait-swapped.scss +++ b/src/sites/twitch-twilight/modules/css_tweaks/styles/portrait-swapped.scss @@ -1,5 +1,5 @@ // Unnecessarily expressive rule to make it more important. -#root .right-column .right-column__toggle-visibility { +/*#root .right-column .right-column__toggle-visibility { right: unset !important; left: 0.5rem !important; -} \ No newline at end of file +}*/ \ No newline at end of file diff --git a/src/sites/twitch-twilight/modules/css_tweaks/styles/portrait.scss b/src/sites/twitch-twilight/modules/css_tweaks/styles/portrait.scss index f593c119..bc5a9934 100644 --- a/src/sites/twitch-twilight/modules/css_tweaks/styles/portrait.scss +++ b/src/sites/twitch-twilight/modules/css_tweaks/styles/portrait.scss @@ -81,9 +81,9 @@ } .right-column__toggle-visibility { - position: fixed !important; + //position: fixed !important; - body:not(.ffz--portrait-invert) & { + /*body:not(.ffz--portrait-invert) & { top: 6.5rem; } @@ -92,7 +92,7 @@ } right: .5rem; - left: unset !important; + left: unset !important;*/ transform: rotate(90deg); } diff --git a/src/sites/twitch-twilight/modules/css_tweaks/styles/swap-sidebars.scss b/src/sites/twitch-twilight/modules/css_tweaks/styles/swap-sidebars.scss index 530c213d..f0513476 100644 --- a/src/sites/twitch-twilight/modules/css_tweaks/styles/swap-sidebars.scss +++ b/src/sites/twitch-twilight/modules/css_tweaks/styles/swap-sidebars.scss @@ -13,10 +13,24 @@ } .right-column__toggle-visibility { - left: unset !important; - right: -2.5rem; - z-index: 10 !important; + //left: unset !important; + //right: -2.5rem; + //z-index: 10 !important; svg { transform: rotate(180deg) } + + .right-column--collapsed & { + left: unset !important; + right: -4rem !important; + } +} + +.channel-header { + padding-left: 4rem !important; + + .tw-sm-pd-r-4 { + padding-right: 1rem !important; + } + } .side-nav__theme-wrapper.tw-border-r { diff --git a/src/sites/twitch-twilight/modules/host_button.js b/src/sites/twitch-twilight/modules/host_button.js index 26ed5b4f..9adb1292 100644 --- a/src/sites/twitch-twilight/modules/host_button.js +++ b/src/sites/twitch-twilight/modules/host_button.js @@ -54,6 +54,7 @@ export default class HostButton extends Module { this.metadata.definitions.host = { order: 150, + border: true, button: true, fade_in: true, diff --git a/src/sites/twitch-twilight/modules/menu_button.jsx b/src/sites/twitch-twilight/modules/menu_button.jsx index 09cfa3a2..cfc54969 100644 --- a/src/sites/twitch-twilight/modules/menu_button.jsx +++ b/src/sites/twitch-twilight/modules/menu_button.jsx @@ -137,7 +137,42 @@ export default class MenuButton extends SiteModule { const pill = this.formatPill(); - el = (
+ // TODO: Pill. + + el = (
+
+ {btn = ()} +
+ {this.i18n.t('site.menu_button', 'FrankerFaceZ Control Center')} + {this.has_update && (
+ {this.i18n.t('site.menu_button.update-desc', 'There is an update available. Please refresh your page.')} +
)} + {this.has_new && (
+ {this.i18n.t('site.menu_button.new-desc', 'There {count,plural,one {is one new setting} other {are # new settings}}.', {count: this._new_settings})} +
)} + {DEBUG && (
+ {this.i18n.t('site.menu_button.main-dev-desc', 'You are running a developer build of FrankerFaceZ.')} +
)} + {this.addons.has_dev && (
+ {this.i18n.t('site.menu_button.addon-dev-desc', 'You have loaded add-on data from a local development server.')} +
)} +
+
+ +
) + + /*el = (
{btn = (
)} -
); +
);*/ container.insertBefore(el, container.lastElementChild); } diff --git a/src/sites/twitch-twilight/styles/channel.scss b/src/sites/twitch-twilight/styles/channel.scss index 72c1de93..ea0b0434 100644 --- a/src/sites/twitch-twilight/styles/channel.scss +++ b/src/sites/twitch-twilight/styles/channel.scss @@ -39,10 +39,15 @@ .ffz-stat.tw-button--text { color: inherit; } +} - .ffz-stat { - margin-left: 1rem; - } +.ffz-stat--fix-padding { + margin-top: -.7rem !important; + margin-bottom: -.7rem !important; +} + +.ffz-stat { + font-variant-numeric: tabular-nums; } .ffz--fade-in { diff --git a/src/utilities/compat/apollo.js b/src/utilities/compat/apollo.js index 8d119b63..8d70f6fd 100644 --- a/src/utilities/compat/apollo.js +++ b/src/utilities/compat/apollo.js @@ -189,11 +189,26 @@ export default class Apollo extends Module { this.old_link = this.client.link; this.old_qm_link = this.client.queryManager.link; - this.old_qm_dedup = this.client.queryManager.deduplicator; + //this.old_qm_dedup = this.client.queryManager.deduplicator; - this.client.link = this.link.concat(this.old_link); + this.client.link = ApolloLink.from([ + this.link, + this.old_link + ]); + + this.client.queryManager.link = ApolloLink.from([ + this.link, + this.old_qm_link + ]); + + /*this.client.queryManager.deduplicator = ApolloLink.from([ + this.link, + this.old_qm_dedup + ]);*/ + + /*this.client.link = this.link.concat(this.old_link); this.client.queryManager.link = this.link.concat(this.old_qm_link); - this.client.queryManager.deduplicator = this.link.concat(this.old_qm_dedup); + this.client.queryManager.deduplicator = this.link.concat(this.old_qm_dedup);*/ }