diff --git a/src/Config.js b/src/Config.js index 00985bc..afded07 100644 --- a/src/Config.js +++ b/src/Config.js @@ -428,7 +428,7 @@ export class ConfigUI extends PureComponent {

新功能建议或问题反馈请在  Gitea diff --git a/src/Flows.js b/src/Flows.js index da5cfeb..115b0d1 100644 --- a/src/Flows.js +++ b/src/Flows.js @@ -566,7 +566,7 @@ class FlowSidebar extends PureComponent { API.block(type, id, this.props.token) .then((json) => { let data = json.data; - alert(`操作成功,其成为危险用户进度 ${data.curr}/${data.threshold}`); + alert(`操作成功,当前拉黑数 ${data.curr}`); !!on_complete && on_complete(); }) .catch((e) => { @@ -1355,6 +1355,7 @@ class SubFlow extends PureComponent { localStorage['_LATEST_POST_ID'] = '' + max_id; } window.TITLE = json.custom_title; + window.AUTO_BLCOK = json.auto_block_rank; json.data.forEach((x) => { if (x.comments) { let comment_json = { diff --git a/src/UserAction.js b/src/UserAction.js index f7e8e2a..7cf2a72 100644 --- a/src/UserAction.js +++ b/src/UserAction.js @@ -12,7 +12,7 @@ import { ColorPicker } from './color_picker'; import { ConfigUI } from './Config'; import copy from 'copy-to-clipboard'; import { cache } from './cache'; -import { API, get_json } from './flows_api'; +import { get_json } from './flows_api'; import { save_attentions } from './Attention'; import './UserAction.css'; @@ -42,7 +42,7 @@ export function InfoSidebar(props) { }} > - +    @@ -150,6 +150,7 @@ export class LoginForm extends Component { super(props); this.state = { custom_title: window.TITLE || '', + auto_block_rank: window.AUTO_BLCOK || 2, }; } @@ -158,16 +159,43 @@ export class LoginForm extends Component { alert('无变化'); return; } - API.set_title(title, token) - .then((json) => { - if (json.code === 0) { - window.TITLE = title; - alert('专属头衔设置成功'); + let data = new FormData(); + data.append('title', title); + fetch(API_BASE + '/title', { + method: 'POST', + headers: { 'User-Token': token }, + body: data, + }) + .then(get_json) + .then((j) => { + if (j.code !== 0) { + throw new Error(j.msg); } + window.TITLE = title; + alert('专属头衔设置成功'); }) .catch((err) => alert('设置头衔出错了:\n' + err)); } + update_auto_block(rank, token) { + let data = new FormData(); + data.append('rank', rank); + fetch(API_BASE + '/auto_block', { + method: 'POST', + headers: { 'User-Token': token }, + body: data, + }) + .then(get_json) + .then((j) => { + if (j.code !== 0) { + throw new Error(j.msg); + } + window.AUTO_BLCOK = rank; + alert('设置自动拉黑阈值成功'); + }) + .catch((err) => alert('设置自动拉黑出错了:\n' + err)); + } + copy_token(token) { if (copy(token)) alert('复制成功!\n请一定不要泄露哦'); } @@ -232,12 +260,48 @@ export class LoginForm extends Component { onClick={(e) => { this.update_title(this.state.custom_title, token.value); }} + disabled={!this.state.custom_title} > 提交
设置专属头衔后,可在发言时选择使用。重置后需重新设置。临时用户如需保持头衔请使用相同后缀。

+

+ 自动拉黑阈值: + + {this.state.auto_block_rank * 5} + + { + this.setState({ auto_block_rank: e.target.value }); + }} + /> + + + + + + +
+ 自动不展示被拉黑次数较多用户发布的内容,包括自己。对每个洞及其评论的可见性会有1小时缓存,频繁修改无效。 +

) : (