diff --git a/package.json b/package.json
index 112b38df..5ccdbef1 100755
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "frankerfacez",
"author": "Dan Salvato LLC",
- "version": "4.55.1",
+ "version": "4.55.2",
"description": "FrankerFaceZ is a Twitch enhancement suite.",
"private": true,
"license": "Apache-2.0",
diff --git a/src/experiments.json b/src/experiments.json
index a7fc6a85..68f1ba26 100644
--- a/src/experiments.json
+++ b/src/experiments.json
@@ -12,15 +12,16 @@
"description": "Use the new API to look up links instead of the socket cluster.",
"groups": [
{"value": true, "weight": 30},
- {"value": false, "weight": 70}
+ {"value": "cf", "weight": 5},
+ {"value": false, "weight": 65}
]
},
"pubsub": {
"name": "MQTT-Based PubSub",
"description": "An experimental new pubsub system that should be more reliable than the existing socket cluster.",
"groups": [
- {"value": true, "weight": 25},
- {"value": false, "weight": 75}
+ {"value": true, "weight": 15},
+ {"value": false, "weight": 85}
]
}
}
\ No newline at end of file
diff --git a/src/modules/chat/index.js b/src/modules/chat/index.js
index 62f23e38..641b58be 100644
--- a/src/modules/chat/index.js
+++ b/src/modules/chat/index.js
@@ -25,6 +25,7 @@ import * as RICH_PROVIDERS from './rich_providers';
import * as LINK_PROVIDERS from './link_providers';
import Actions from './actions/actions';
+import { LINK_DATA_HOSTS } from 'src/utilities/constants';
function sortPriorityColorTerms(list) {
@@ -131,6 +132,20 @@ export default class Chat extends Module {
});*/
this.settings.add('debug.link-resolver.source', {
+ process(ctx, val) {
+ if ( val == null ) {
+ const exp = this.experiments.getAssignment('api_links');
+ if ( exp === 'cf' )
+ val = 'test-cf';
+ else if ( exp )
+ val = 'test';
+ else
+ val = 'socket';
+ }
+
+ return LINK_DATA_HOSTS[val] ?? LINK_DATA_HOSTS.test;
+ },
+
default: null,
ui: {
path: 'Debugging > Data Sources >> Links',
@@ -139,11 +154,10 @@ export default class Chat extends Module {
force_seen: true,
data: [
{value: null, title: 'Automatic'},
- {value: 'dev', title: 'localhost'},
- {value: 'test', title: 'API Test'},
- {value: 'prod', title: 'API Production' },
- {value: 'socket', title: 'Socket Cluster (Deprecated)'}
- ]
+ ].concat(Object.entries(LINK_DATA_HOSTS).map(x => ({
+ value: x[0],
+ title: x[1].title
+ })))
},
changed: () => this.clearLinkCache()
@@ -2307,23 +2321,16 @@ export default class Chat extends Module {
}
}
- let provider = this.settings.get('debug.link-resolver.source');
- if ( provider == null )
- provider = this.experiments.getAssignment('api_links') ? 'test' : 'socket';
+ let provider = this.settings.get('debug.link-resolver.source').value;
+ if ( provider === 'special:socket' && ! this.socket )
+ provider = LINK_DATA_HOSTS.test.value;
- if ( provider === 'socket' && ! this.socket )
- provider = 'test';
-
- if ( provider === 'socket' ) {
+ if ( provider === 'special:socket' ) {
timeout(this.socket.call('get_link', url), 15000)
.then(data => handle(true, data))
.catch(err => handle(false, err));
} else {
- const host = provider === 'dev' ? 'https://localhost:8002/' :
- provider === 'test' ? 'https://api-test.frankerfacez.com/v2/link' :
- 'https://api.frankerfacez.com/v2/link';
-
- timeout(fetch(`${host}?url=${encodeURIComponent(url)}`).then(r => r.json()), 15000)
+ timeout(fetch(`${provider}?url=${encodeURIComponent(url)}`).then(r => r.json()), 15000)
.then(data => handle(true, data))
.catch(err => handle(false, err));
}
diff --git a/src/modules/chat/tokenizers.jsx b/src/modules/chat/tokenizers.jsx
index 758211b1..dcbf2ef8 100644
--- a/src/modules/chat/tokenizers.jsx
+++ b/src/modules/chat/tokenizers.jsx
@@ -8,7 +8,7 @@ import {sanitize, createElement} from 'utilities/dom';
import {has, getTwitchEmoteURL, split_chars, getTwitchEmoteSrcSet} from 'utilities/object';
import { NoContent } from 'utilities/tooltip';
-import {EmoteTypes, REPLACEMENT_BASE, REPLACEMENTS, WEIRD_EMOTE_SIZES} from 'utilities/constants';
+import {EmoteTypes, IS_FIREFOX, REPLACEMENT_BASE, REPLACEMENTS, WEIRD_EMOTE_SIZES} from 'utilities/constants';
import {CATEGORIES, JOINER_REPLACEMENT} from './emoji';
import { MODIFIER_FLAGS } from './emotes';
@@ -1230,7 +1230,7 @@ const render_emote = (token, createElement, wrapped) => {
emote = createElement('img', {
class: `${EMOTE_CLASS} ffz-tooltip${hoverSrc ? ' ffz-hover-emote' : ''}${token.provider === 'twitch' ? ' twitch-emote' : token.provider === 'ffz' ? ' ffz-emote' : token.provider === 'emoji' ? ' ffz-emoji' : ''}`,
attrs: {
- src,
+ src: IS_FIREFOX ? undefined : src,
srcSet,
alt: token.text,
height: (token.big && ! token.can_big && token.height) ? `${token.height * 2}px` : undefined,
@@ -1429,7 +1429,7 @@ export const AddonEmotes = {
else
emote = (
this.onFocus(),
+ onTouchStart: () => this.onFocus(),
ignoreFn: e => e.target.closest('.viewer-card-drag-cancel') != null
});
})
diff --git a/src/modules/emote_card/index.jsx b/src/modules/emote_card/index.jsx
index eefd3e49..4b061e63 100644
--- a/src/modules/emote_card/index.jsx
+++ b/src/modules/emote_card/index.jsx
@@ -5,6 +5,7 @@
// ============================================================================
import {createElement} from 'utilities/dom';
+import { getDialogNextZ } from 'utilities/dialog';
import {deep_copy, getTwitchEmoteURL} from 'utilities/object';
import { EmoteTypes, TWITCH_GLOBAL_SETS, TWITCH_POINTS_SETS, TWITCH_PRIME_SETS } from 'utilities/constants';
@@ -61,7 +62,7 @@ export default class EmoteCard extends Module {
this.vue = this.resolve('vue');
- this.last_z = 9000;
+ //this.last_z = 9000;
this.open_cards = {};
this.last_card = null;
}
@@ -463,7 +464,7 @@ export default class EmoteCard extends Module {
old_card = this.open_cards[card_key];
if ( old_card ) {
- old_card.$el.style.zIndex = ++this.last_z;
+ old_card.$el.style.zIndex = getDialogNextZ();
old_card.focus();
return;
}
@@ -512,7 +513,7 @@ export default class EmoteCard extends Module {
getFFZ: () => this,
reportTwitchEmote: (...args) => this.reportTwitchEmote(...args),
- getZ: () => ++this.last_z
+ getZ: getDialogNextZ
},
on: {
diff --git a/src/modules/link_card/components/card.vue b/src/modules/link_card/components/card.vue
index cd3a894d..8bf27783 100644
--- a/src/modules/link_card/components/card.vue
+++ b/src/modules/link_card/components/card.vue
@@ -490,6 +490,8 @@ export default {
handle: this.$el.querySelector('.ffz-viewer-card__header'),
highlightInputs: true,
constrain: true,
+ onMouseDown: () => this.onFocus(),
+ onTouchStart: () => this.onFocus(),
ignoreFn: e => e.target.closest('.viewer-card-drag-cancel') != null
});
})
diff --git a/src/modules/link_card/index.jsx b/src/modules/link_card/index.jsx
index 9e96568a..a2491c38 100644
--- a/src/modules/link_card/index.jsx
+++ b/src/modules/link_card/index.jsx
@@ -5,6 +5,7 @@
// ============================================================================
import { createElement } from 'utilities/dom';
+import { getDialogNextZ } from 'utilities/dialog';
import { deep_copy } from 'utilities/object';
import Module from 'utilities/module';
@@ -44,7 +45,7 @@ export default class LinkCard extends Module {
}
});
- this.last_z = 9000;
+ //this.last_z = 9000;
this.open_cards = {};
this.last_card = null;
}
@@ -106,7 +107,7 @@ export default class LinkCard extends Module {
old_card = this.open_cards[card_key];
if ( old_card ) {
- old_card.$el.style.zIndex = ++this.last_z;
+ old_card.$el.style.zIndex = getDialogNextZ();
old_card.focus();
return;
}
@@ -154,7 +155,7 @@ export default class LinkCard extends Module {
use_dest: this.settings.get('link-cards.use-destination'),
getFFZ: () => this,
- getZ: () => ++this.last_z
+ getZ: getDialogNextZ
},
on: {
diff --git a/src/modules/main_menu/components/link-tester.vue b/src/modules/main_menu/components/link-tester.vue
index 16d0001a..c0d878f3 100644
--- a/src/modules/main_menu/components/link-tester.vue
+++ b/src/modules/main_menu/components/link-tester.vue
@@ -138,6 +138,7 @@
data-is-mail="false"
rel="noopener noreferrer"
target="_blank"
+ @click="handleClick"
>
{{ decodeURI(url) }}
@@ -222,6 +223,7 @@
import { debounce, timeout, pick_random } from 'utilities/object'
import { highlightJson } from 'utilities/dom';
+import { LINK_DATA_HOSTS } from 'src/utilities/constants';
const STOCK_URLS = [
'https://www.twitch.tv/sirstendec',
@@ -274,6 +276,7 @@ export default {
force_tooltip: state?.ffz_lt_tip ?? false,
events: {
+ emit: (...args) => this.item.getChat().emit(...args),
on: (...args) => this.item.getChat().on(...args),
off: (...args) => this.item.getChat().off(...args)
}
@@ -384,6 +387,10 @@ export default {
},
methods: {
+ handleClick(event) {
+ return this.chat.handleLinkClick(event);
+ },
+
changeProvider() {
this.updateEventSource();
this.updateExamples();
@@ -391,7 +398,7 @@ export default {
updateEventSource() {
const provider = this.settings.get('debug.link-resolver.source');
- if ( provider !== 'dev' ) {
+ if ( ! provider.has_sse ) {
if ( this.es ) {
this.es.close();
this.es = null;
@@ -404,7 +411,7 @@ export default {
if ( this.es )
return;
- this.es = new EventSource('https://localhost:8002/sse');
+ this.es = new EventSource(`${provider.value}/sse`);
this.es.addEventListener('error', () => {
this.es_waiting = true;
});
@@ -467,22 +474,15 @@ export default {
return;
this.examples_loading = true;
- const provider = this.settings.get('debug.link-resolver.source');
- let examples;
- if ( provider === 'dev' ) {
- try {
- examples = (await timeout(fetch('https://localhost:8002/examples'), 15000).then(resp => resp.ok ? resp.json() : null)).examples;
- } catch(err) {
- console.error(err);
- }
- }
+ let provider = this.settings.get('debug.link-resolver.source').value;
+ if ( provider === 'special:socket')
+ provider = LINK_DATA_HOSTS.test.value;
- if ( ! examples ) {
- try {
- examples = (await timeout(fetch('https://api-test.frankerfacez.com/v2/link/examples'), 15000).then(resp => resp.ok ? resp.json() : null)).examples;
- } catch(err) {
- console.error(err);
- }
+ let examples;
+ try {
+ examples = (await timeout(fetch(`${provider}/examples`), 15000).then(resp => resp.ok ? resp.json() : null)).examples;
+ } catch(err) {
+ console.error(err);
}
if ( ! examples )
diff --git a/src/modules/main_menu/components/main-menu.vue b/src/modules/main_menu/components/main-menu.vue
index 46094c87..fee567a6 100644
--- a/src/modules/main_menu/components/main-menu.vue
+++ b/src/modules/main_menu/components/main-menu.vue
@@ -1,7 +1,10 @@