diff --git a/package.json b/package.json index d60bc165..ea92705b 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "frankerfacez", "author": "Dan Salvato LLC", - "version": "4.20.68", + "version": "4.20.69", "description": "FrankerFaceZ is a Twitch enhancement suite.", "license": "Apache-2.0", "scripts": { diff --git a/src/experiments.js b/src/experiments.js index d3793644..fcd3b5c3 100644 --- a/src/experiments.js +++ b/src/experiments.js @@ -58,18 +58,17 @@ export default class ExperimentManager extends Module { getExtraTerms: () => { const values = []; - for(const [key,val] of Object.entries(this.experiments)) { - values.push(key); - if ( val.name ) - values.push(val.name); - if ( val.description ) - values.push(val.description); - } + for(const exps of [this.experiments, this.getTwitchExperiments()]) { + if ( ! exps ) + continue; - for(const [key, val] of Object.entries(this.getTwitchExperiments())) { - values.push(key); - if ( val.name ) - values.push(val.name); + for(const [key, val] of Object.entries(exps)) { + values.push(key); + if ( val.name ) + values.push(val.name); + if ( val.description ) + values.push(val.description); + } } return values; diff --git a/src/experiments.json b/src/experiments.json index 3593ec5f..1edc1968 100644 --- a/src/experiments.json +++ b/src/experiments.json @@ -1,12 +1,4 @@ { - "new_links": { - "name": "New Link Tokenization", - "description": "Update to Twitch's latest link regex. Experiment while this is checked for bugs.", - "groups": [ - {"value": true, "weight": 100}, - {"value": false, "weight": 0} - ] - }, "api_load": { "name": "New API Stress Testing", "description": "Send duplicate requests to the new API server for load testing.", diff --git a/src/modules/chat/badges.jsx b/src/modules/chat/badges.jsx index 84394174..0190592a 100644 --- a/src/modules/chat/badges.jsx +++ b/src/modules/chat/badges.jsx @@ -242,7 +242,7 @@ export default class Badges extends Module { path: 'Chat > Badges >> tabs ~> Visibility', title: 'Visibility', component: 'badge-visibility', - data: () => this.getSettingsBadges(true) + getBadges: cb => this.getSettingsBadges(true, cb) } }); @@ -276,7 +276,7 @@ export default class Badges extends Module { this.handleClick = this.handleClick.bind(this); } - getSettingsBadges(include_addons) { + getSettingsBadges(include_addons, callback) { const twitch = [], owl = [], tcon = [], @@ -284,6 +284,16 @@ export default class Badges extends Module { ffz = [], addon = []; + const twitch_keys = Object.keys(this.twitch_badges); + if ( ! twitch_keys.length && callback ) { + const td = this.resolve('site.twitch_data'); + if ( td ) + td.getBadges().then(data => { + this.updateTwitchBadges(data); + callback(); + }); + } + for(const key in this.twitch_badges) if ( has(this.twitch_badges, key) ) { const badge = this.twitch_badges[key], @@ -334,6 +344,9 @@ export default class Badges extends Module { const badge = this.badges[key], image = badge.urls ? (badge.urls[2] || badge.urls[1]) : badge.image; + if ( badge.no_visibility ) + continue; + (badge.addon ? addon : ffz).push({ id: key, provider: 'ffz', @@ -1070,6 +1083,9 @@ export function fixBadgeData(badge) { return badge; // Click Behavior + if ( ! badge.clickAction && badge.onClickAction ) + badge.clickAction = badge.onClickAction; + if ( badge.clickAction === 'VISIT_URL' && badge.clickURL ) badge.click_url = badge.clickURL; diff --git a/src/modules/chat/index.js b/src/modules/chat/index.js index a3e81298..9e4efb10 100644 --- a/src/modules/chat/index.js +++ b/src/modules/chat/index.js @@ -500,7 +500,7 @@ export default class Chat extends Module { type: 'array_merge', always_inherit: true, ui: { - path: 'Chat > Filtering >> Blocked Badges', + path: 'Chat > Filtering >> Blocked Badges @{"description": "**Note:** This section is for filtering messages out of chat from users with specific badges. If you wish to hide a badge, go to [Chat > Badges >> Visibility](~chat.badges.tabs.visibility)."}', component: 'badge-highlighting', removable: true, data: () => this.badges.getSettingsBadges() diff --git a/src/modules/chat/tokenizers.jsx b/src/modules/chat/tokenizers.jsx index 1c33084c..b8133b8b 100644 --- a/src/modules/chat/tokenizers.jsx +++ b/src/modules/chat/tokenizers.jsx @@ -12,8 +12,8 @@ import {CATEGORIES} from './emoji'; const EMOTE_CLASS = 'chat-image chat-line__message--emote', - WHITESPACE = /^\s*$/, - LINK_REGEX = /([^\w@#%\-+=:~])?((?:(https?:\/\/)?(?:[\w@#%\-+=:~]+\.)+[a-z]{2,6}(?:\/[\w./@#%&()\-+=:?~]*)?))([^\w./@#%&()\-+=:?~]|\s|$)/g, + //WHITESPACE = /^\s*$/, + //LINK_REGEX = /([^\w@#%\-+=:~])?((?:(https?:\/\/)?(?:[\w@#%\-+=:~]+\.)+[a-z]{2,6}(?:\/[\w./@#%&()\-+=:?~]*)?))([^\w./@#%&()\-+=:?~]|\s|$)/g, NEW_LINK_REGEX = /(?:(https?:\/\/)?((?:[\w#%\-+=:~]+\.)+[a-z]{2,10}(?:\/[\w./#%&@()\-+=:?~]*)?))/g, //MENTION_REGEX = /([^\w@#%\-+=:~])?(@([^\u0000-\u007F]+|\w+)+)([^\w./@#%&()\-+=:?~]|\s|$)/g; // eslint-disable-line no-control-regex MENTION_REGEX = /^(['"*([{<\\/]*)(@)((?:[^\u0000-\u007F]|[\w-])+)(?:\b|$)/; // eslint-disable-line no-control-regex @@ -148,7 +148,7 @@ export const Links = { if ( ! tokens || ! tokens.length ) return tokens; - const use_new = this.experiments.getAssignment('new_links'); + //const use_new = this.experiments.getAssignment('new_links'); const out = []; for(const token of tokens) { @@ -157,28 +157,28 @@ export const Links = { continue; } - LINK_REGEX.lastIndex = 0; + //LINK_REGEX.lastIndex = 0; NEW_LINK_REGEX.lastIndex = 0; const text = token.text; let idx = 0, match; - if ( use_new ) { - while((match = NEW_LINK_REGEX.exec(text))) { - const nix = match.index; - if ( idx !== nix ) - out.push({type: 'text', text: text.slice(idx, nix)}); + //if ( use_new ) { + while((match = NEW_LINK_REGEX.exec(text))) { + const nix = match.index; + if ( idx !== nix ) + out.push({type: 'text', text: text.slice(idx, nix)}); - out.push({ - type: 'link', - url: `${match[1] ? '' : 'https://'}${match[0]}`, - is_mail: false, - text: match[0] - }); + out.push({ + type: 'link', + url: `${match[1] ? '' : 'https://'}${match[0]}`, + is_mail: false, + text: match[0] + }); - idx = nix + match[0].length; - } + idx = nix + match[0].length; + } - } else { + /*} else { while((match = LINK_REGEX.exec(text))) { const nix = match.index + (match[1] ? match[1].length : 0); if ( idx !== nix ) @@ -195,7 +195,7 @@ export const Links = { idx = nix + match[2].length; } - } + }*/ if ( idx < text.length ) out.push({type: 'text', text: text.slice(idx)}); diff --git a/src/modules/main_menu/components/addon-list.vue b/src/modules/main_menu/components/addon-list.vue index 1017c7d4..81adf7b4 100644 --- a/src/modules/main_menu/components/addon-list.vue +++ b/src/modules/main_menu/components/addon-list.vue @@ -28,6 +28,7 @@ :key="addon.id" :addon="addon" :item="item" + :context="context" @navigate="navigate" /> diff --git a/src/modules/main_menu/components/addon.vue b/src/modules/main_menu/components/addon.vue index fb615a0f..b8fb5577 100644 --- a/src/modules/main_menu/components/addon.vue +++ b/src/modules/main_menu/components/addon.vue @@ -124,7 +124,7 @@