1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-06-28 15:27:43 +00:00
* Added: New settings for hiding content from the directory based on tag, content flag, or title.
* Fixed: Certain page elements not being hidden correctly.
This commit is contained in:
SirStendec 2023-12-14 18:33:08 -05:00
parent 40865adba7
commit de09ec502d
3 changed files with 22 additions and 7 deletions

View file

@ -1,7 +1,7 @@
{ {
"name": "frankerfacez", "name": "frankerfacez",
"author": "Dan Salvato LLC", "author": "Dan Salvato LLC",
"version": "4.61.0", "version": "4.62.0",
"description": "FrankerFaceZ is a Twitch enhancement suite.", "description": "FrankerFaceZ is a Twitch enhancement suite.",
"private": true, "private": true,
"license": "Apache-2.0", "license": "Apache-2.0",

View file

@ -43,7 +43,7 @@ export default class Twilight extends BaseSite {
} }
async populateModules() { async populateModules() {
const ctx = await require.context('site/modules', true, /(?:^(?:\.\/)?[^/]+|index)\.jsx?$/); const ctx = await require.context('site/modules', true, /(?:^(?:\.\/)?[^/]+|index)\.[jt]sx?$/);
const modules = await this.loadFromContext(ctx, this.log); const modules = await this.loadFromContext(ctx, this.log);
this.log.info(`Loaded descriptions of ${Object.keys(modules).length} modules.`); this.log.info(`Loaded descriptions of ${Object.keys(modules).length} modules.`);
} }

View file

@ -326,6 +326,17 @@ export default class Directory extends Module {
changed: () => this.updateCards() changed: () => this.updateCards()
}); });
this.settings.add('directory.wait-flags', {
default: true,
ui: {
path: 'Directory > Channels >> Appearance',
title: 'Hide Thumbnails for all channels until Content Flags have been loaded.',
description: 'We need to load content flags with a separate query, so they aren\'t immediately available to determine if a given stream should be hidden, or have its thumbnail blurred. This setting will blur ALL thumbnails until after we\'ve finished loading the necessary content flag information, ensuring you don\'t see a flash of anything you would rather not.',
component: 'setting-check-box'
},
changed: () => this.updateCards()
});
this.settings.add('directory.block-flags', { this.settings.add('directory.block-flags', {
default: [], default: [],
type: 'array_merge', type: 'array_merge',
@ -576,13 +587,15 @@ export default class Directory extends Module {
const game = props.gameTitle || props.trackingProps?.categoryName || props.trackingProps?.category || props.contextualCardActionProps?.props?.categoryName, const game = props.gameTitle || props.trackingProps?.categoryName || props.trackingProps?.category || props.contextualCardActionProps?.props?.categoryName,
tags = props.tagListProps?.freeformTags; tags = props.tagListProps?.freeformTags;
const blur_flags = this.settings.get('directory.blur-flags', []), const need_flags = this.settings.get('directory.wait-flags'),
block_flags = this.settings.get('directory.block-flags', []); blur_flags = this.settings.get('directory.blur-flags', []),
block_flags = this.settings.get('directory.block-flags', []),
has_flags = blur_flags.size > 0 || block_flags.size > 0;
if ( el._ffz_flags === undefined && (blur_flags.size || block_flags.size) ) { if ( el._ffz_flags === undefined && has_flags ) {
el._ffz_flags = null; el._ffz_flags = null;
this.twitch_data.getStreamFlags(null, props.channelLogin).then(data => { this.twitch_data.getStreamFlags(null, props.channelLogin).then(data => {
el._ffz_flags = data; el._ffz_flags = data ?? [];
this.updateCard(el); this.updateCard(el);
}); });
} }
@ -610,6 +623,8 @@ export default class Directory extends Module {
} }
let should_blur = blur_tag; let should_blur = blur_tag;
if ( need_flags && has_flags && el._ffz_flags == null )
should_blur = true;
if ( ! should_blur ) if ( ! should_blur )
should_blur = this.settings.provider.get('directory.game.hidden-thumbnails', []).includes(game); should_blur = this.settings.provider.get('directory.game.hidden-thumbnails', []).includes(game);
if ( ! should_blur && blur_flags.size && el._ffz_flags ) { if ( ! should_blur && blur_flags.size && el._ffz_flags ) {