mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-08 23:30:53 +00:00
4.19.4
* Fixed: Error loading bits configuration after a Twitch update changed the format, causing an exception that prevents the add-on from initializing fully.
This commit is contained in:
parent
09d4961eaf
commit
0c1e9c5204
3 changed files with 52 additions and 18 deletions
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "frankerfacez",
|
"name": "frankerfacez",
|
||||||
"author": "Dan Salvato LLC",
|
"author": "Dan Salvato LLC",
|
||||||
"version": "4.19.3",
|
"version": "4.19.4",
|
||||||
"description": "FrankerFaceZ is a Twitch enhancement suite.",
|
"description": "FrankerFaceZ is a Twitch enhancement suite.",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -513,8 +513,8 @@ export default class Room {
|
||||||
return this.style.delete('bits');
|
return this.style.delete('bits');
|
||||||
|
|
||||||
const animated = this.manager.context.get('chat.bits.animated') ? 'animated' : 'static',
|
const animated = this.manager.context.get('chat.bits.animated') ? 'animated' : 'static',
|
||||||
theme = this.manager.context.get('theme.is-dark') ? 'DARK' : 'LIGHT',
|
theme = this.manager.context.get('theme.is-dark') ? 'dark' : 'light',
|
||||||
tt_theme = this.manager.context.get('theme.tooltips-dark') ? 'DARK' : 'LIGHT',
|
tt_theme = this.manager.context.get('theme.tooltips-dark') ? 'dark' : 'light',
|
||||||
out = [];
|
out = [];
|
||||||
|
|
||||||
for(const key in this.bitsConfig)
|
for(const key in this.bitsConfig)
|
||||||
|
@ -529,7 +529,7 @@ export default class Room {
|
||||||
tt_images = tiers[i].images[tt_theme][animated];
|
tt_images = tiers[i].images[tt_theme][animated];
|
||||||
|
|
||||||
out.push(`.ffz-cheer[data-prefix="${prefix}"][data-tier="${i}"] {
|
out.push(`.ffz-cheer[data-prefix="${prefix}"][data-tier="${i}"] {
|
||||||
color: ${tiers[i].color};
|
color: ${tiers[i].color || 'inherit'};
|
||||||
background-image: url("${images[1]}");
|
background-image: url("${images[1]}");
|
||||||
background-image: ${WEBKIT}image-set(
|
background-image: ${WEBKIT}image-set(
|
||||||
url("${images[1]}") 1x,
|
url("${images[1]}") 1x,
|
||||||
|
|
|
@ -2336,7 +2336,12 @@ export function formatBitsConfig(config) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const out = {},
|
const out = {},
|
||||||
actions = config.indexedActions;
|
actions = config.indexedActions,
|
||||||
|
tier_colors = {};
|
||||||
|
|
||||||
|
if ( Array.isArray(config.tiers) )
|
||||||
|
for(const tier of config.tiers)
|
||||||
|
tier_colors[tier.bits] = tier.color;
|
||||||
|
|
||||||
for(const key in actions)
|
for(const key in actions)
|
||||||
if ( has(actions, key) ) {
|
if ( has(actions, key) ) {
|
||||||
|
@ -2347,22 +2352,51 @@ export function formatBitsConfig(config) {
|
||||||
tiers: []
|
tiers: []
|
||||||
};
|
};
|
||||||
|
|
||||||
for(const tier of action.orderedTiers) {
|
if ( config?.getImage ) {
|
||||||
const images = {};
|
for(const tier of action.orderedTiers) {
|
||||||
for(const im of tier.images) {
|
const images = {};
|
||||||
const themed = images[im.theme] = images[im.theme] || [],
|
|
||||||
ak = im.isAnimated ? 'animated' : 'static',
|
|
||||||
anim = themed[ak] = themed[ak] || {};
|
|
||||||
|
|
||||||
anim[im.dpiScale] = im.url;
|
for(const theme of ['light', 'dark']) {
|
||||||
|
const themed = images[theme] = images[theme] || {},
|
||||||
|
stat = themed.static = themed.static || {},
|
||||||
|
animated = themed.animated = themed.animated || {};
|
||||||
|
|
||||||
|
for(const scale of [1, 2, 4]) {
|
||||||
|
// Static Images
|
||||||
|
stat[scale] = config.getImage(action.prefix, theme, 'static', tier.bits, scale, 'png');
|
||||||
|
|
||||||
|
// Animated Images
|
||||||
|
animated[scale] = config.getImage(action.prefix, theme, 'animated', tier.bits, scale, 'gif');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
new_act.tiers.push({
|
||||||
|
amount: tier.bits,
|
||||||
|
color: tier.color || tier_colors[tier.bits] || 'inherit',
|
||||||
|
id: tier.id,
|
||||||
|
images
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
new_act.tiers.push({
|
} else if ( action.orderedTiers[0]?.images ) {
|
||||||
amount: tier.bits,
|
for(const tier of action.orderedTiers) {
|
||||||
color: tier.color,
|
const images = {};
|
||||||
id: tier.id,
|
|
||||||
images
|
for(const im of tier.images) {
|
||||||
})
|
const themed = images[im.theme] = images[im.theme] || [],
|
||||||
|
ak = im.isAnimated ? 'animated' : 'static',
|
||||||
|
anim = themed[ak] = themed[ak] || {};
|
||||||
|
|
||||||
|
anim[im.dpiScale] = im.url;
|
||||||
|
}
|
||||||
|
|
||||||
|
new_act.tiers.push({
|
||||||
|
amount: tier.bits,
|
||||||
|
color: tier.color || tier_colors[tier.bits] || 'inherit',
|
||||||
|
id: tier.id,
|
||||||
|
images
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue