Browse Source

可屏蔽临时帐号

pull/16/head
hole-thu 3 years ago
parent
commit
66d7d3da38
  1. 12
      src/Config.js
  2. 17
      src/Flows.js

12
src/Config.js

@ -29,7 +29,8 @@ const DEFAULT_CONFIG = {
pressure: false,
easter_egg: true,
color_scheme: 'default',
block_words_v3: ['蜘蛛'],
block_tmp: false,
block_words_v3: ['🕷'],
whitelist_cw: [],
ipfs_gateway_list: [
'https://<hash>.ipfs.dweb.link/',
@ -373,10 +374,13 @@ export class ConfigUI extends PureComponent {
callback={this.save_changes_bound}
/>
<hr />
{/* <ConfigBlockWords
id="block-words"
<ConfigSwitch
callback={this.save_changes_bound}
/> */}
id="block_tmp"
name="屏蔽临时帐号"
description="屏蔽所有临时帐号的发言"
/>
<hr />
<ConfigTextArea
id="block_words_v3"
callback={this.save_changes_bound}

17
src/Flows.js

@ -32,6 +32,14 @@ window.LATEST_POST_ID = parseInt(localStorage['_LATEST_POST_ID'], 10) || 0;
const DZ_NAME = '洞主';
function check_block(info) {
return (
((window.config.block_tmp && info.is_tmp) ||
window.config.block_words_v3.some((word) => info.text.includes(word))) &&
!info.can_del
);
}
function load_single_meta(show_sidebar, token) {
return async (pid, replace = false) => {
let color_picker = new ColorPicker();
@ -100,9 +108,7 @@ class Reply extends PureComponent {
} = this.props;
const author = info.name,
replyText = info.text,
has_block_words =
window.config.block_words_v3.some((word) => info.text.includes(word)) &&
!info.can_del;
has_block_words = check_block(info);
this.color_picker = new ColorPicker();
return (
<div
@ -851,10 +857,7 @@ class FlowItemRow extends PureComponent {
window.config.whitelist_cw.indexOf('*') == -1 &&
window.config.whitelist_cw.indexOf(props.info.cw) == -1 &&
props.mode === 'list';
this.has_block_words =
window.config.block_words_v3.some((word) =>
props.info.text.includes(word),
) && !props.info.can_del;
this.has_block_words = check_block(props.info);
this.color_picker = new ColorPicker();
this.state = {
replies: props.info.comments

Loading…
Cancel
Save