show admin list & you are admin
This commit is contained in:
22
src/Flows.js
22
src/Flows.js
@@ -1473,15 +1473,21 @@ class SubFlow extends PureComponent {
|
|||||||
});
|
});
|
||||||
localStorage['_LATEST_POST_ID'] = '' + max_id;
|
localStorage['_LATEST_POST_ID'] = '' + max_id;
|
||||||
}
|
}
|
||||||
window.TITLE = json.custom_title;
|
|
||||||
window.AUTO_BLCOK = json.auto_block_rank;
|
if (page === 1) {
|
||||||
if (
|
window.IS_ADMIN = json.is_admin;
|
||||||
json.custom_title &&
|
window.IS_CANDIDATE = json.is_candidate;
|
||||||
window.TITLE_SECRET !== json.title_secret
|
window.TITLE = json.custom_title;
|
||||||
) {
|
window.AUTO_BLCOK = json.auto_block_rank;
|
||||||
window.TITLE_SECRET = json.title_secret;
|
if (
|
||||||
localStorage['TITLE_SECRET'] = json.title_secret;
|
json.custom_title &&
|
||||||
|
window.TITLE_SECRET !== json.title_secret
|
||||||
|
) {
|
||||||
|
window.TITLE_SECRET = json.title_secret;
|
||||||
|
localStorage['TITLE_SECRET'] = json.title_secret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
json.data.forEach((x) => {
|
json.data.forEach((x) => {
|
||||||
if (x.comments) {
|
if (x.comments) {
|
||||||
let comment_json = {
|
let comment_json = {
|
||||||
|
|||||||
@@ -16,3 +16,11 @@
|
|||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.admin-card {
|
||||||
|
display: inline-block;
|
||||||
|
background: #3332;
|
||||||
|
margin-left: 7px;
|
||||||
|
padding: 1px 5px;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ export class MessageViewer extends PureComponent {
|
|||||||
msg: json.data,
|
msg: json.data,
|
||||||
start_time: json.start_time,
|
start_time: json.start_time,
|
||||||
salt: json.salt,
|
salt: json.salt,
|
||||||
|
admin_list: json.admin_list,
|
||||||
|
candidate_list: json.candidate_list,
|
||||||
tmp_token: json.tmp_token,
|
tmp_token: json.tmp_token,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
@@ -107,6 +109,24 @@ export class MessageViewer extends PureComponent {
|
|||||||
使用
|
使用
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<br />
|
||||||
|
<div>
|
||||||
|
当前管理员:
|
||||||
|
{this.state.admin_list.map((admin) => (
|
||||||
|
<span className="admin-card" key={admin}>
|
||||||
|
{admin}
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<div>
|
||||||
|
当前候选管理员:
|
||||||
|
{this.state.candidate_list.map((admin) => (
|
||||||
|
<span className="admin-card" key={admin}>
|
||||||
|
{admin}
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
{this.state.msg.map((msg) => (
|
{this.state.msg.map((msg) => (
|
||||||
<div className="box" key={msg.type + msg.timestamp}>
|
<div className="box" key={msg.type + msg.timestamp}>
|
||||||
<div className="box-header">
|
<div className="box-header">
|
||||||
|
|||||||
@@ -155,3 +155,9 @@
|
|||||||
.update-title-btn {
|
.update-title-btn {
|
||||||
margin-top: 6px;
|
margin-top: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.role-card {
|
||||||
|
padding: 5px;
|
||||||
|
background: #d33a;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ export class LoginForm extends Component {
|
|||||||
this.state = {
|
this.state = {
|
||||||
custom_title: window.TITLE || '',
|
custom_title: window.TITLE || '',
|
||||||
auto_block_rank: window.AUTO_BLCOK || 2,
|
auto_block_rank: window.AUTO_BLCOK || 2,
|
||||||
|
is_admin: window.IS_ADMIN,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,6 +167,9 @@ export class LoginForm extends Component {
|
|||||||
window.TITLE_SECRET = j.data;
|
window.TITLE_SECRET = j.data;
|
||||||
localStorage['TITLE_SECRET'] = j.data;
|
localStorage['TITLE_SECRET'] = j.data;
|
||||||
alert('专属头衔设置成功');
|
alert('专属头衔设置成功');
|
||||||
|
window.IS_ADMIN = false;
|
||||||
|
window.IS_CANDIDATE = false;
|
||||||
|
this.setState({ is_admin: false });
|
||||||
})
|
})
|
||||||
.catch((err) => alert('设置头衔出错了:\n' + err));
|
.catch((err) => alert('设置头衔出错了:\n' + err));
|
||||||
}
|
}
|
||||||
@@ -243,6 +247,10 @@ export class LoginForm extends Component {
|
|||||||
Token仅用于开发bot,切勿告知他人。若怀疑被盗号请刷新Token(刷新功能即将上线)。
|
Token仅用于开发bot,切勿告知他人。若怀疑被盗号请刷新Token(刷新功能即将上线)。
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
{this.state.is_admin && (
|
||||||
|
<span className="role-card">你是管理员</span>
|
||||||
|
)}
|
||||||
|
<br />
|
||||||
专属头衔:
|
专属头衔:
|
||||||
<input
|
<input
|
||||||
value={this.state.custom_title}
|
value={this.state.custom_title}
|
||||||
@@ -343,6 +351,7 @@ export class ReplyForm extends Component {
|
|||||||
this.global_keypress_handler_bound =
|
this.global_keypress_handler_bound =
|
||||||
this.global_keypress_handler.bind(this);
|
this.global_keypress_handler.bind(this);
|
||||||
this.color_picker = new ColorPicker();
|
this.color_picker = new ColorPicker();
|
||||||
|
this.forced_use_title = window.IS_ADMIN || window.IS_CANDIDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
global_keypress_handler(e) {
|
global_keypress_handler(e) {
|
||||||
@@ -492,7 +501,8 @@ export class ReplyForm extends Component {
|
|||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
onChange={this.on_use_title_change_bound}
|
onChange={this.on_use_title_change_bound}
|
||||||
checked={this.state.use_title}
|
checked={this.forced_use_title || this.state.use_title}
|
||||||
|
disabled={this.forced_use_title}
|
||||||
/>{' '}
|
/>{' '}
|
||||||
使用头衔
|
使用头衔
|
||||||
</label>
|
</label>
|
||||||
@@ -527,6 +537,7 @@ export class PostForm extends Component {
|
|||||||
this.on_cw_change_bound = this.on_cw_change.bind(this);
|
this.on_cw_change_bound = this.on_cw_change.bind(this);
|
||||||
this.on_poll_option_change_bound = this.on_poll_option_change.bind(this);
|
this.on_poll_option_change_bound = this.on_poll_option_change.bind(this);
|
||||||
this.color_picker = new ColorPicker();
|
this.color_picker = new ColorPicker();
|
||||||
|
this.forced_use_title = window.IS_ADMIN || window.IS_CANDIDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
@@ -784,7 +795,8 @@ export class PostForm extends Component {
|
|||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
onChange={this.on_use_title_change_bound}
|
onChange={this.on_use_title_change_bound}
|
||||||
checked={this.state.use_title}
|
checked={this.forced_use_title || this.state.use_title}
|
||||||
|
disabled={this.forced_use_title}
|
||||||
/>{' '}
|
/>{' '}
|
||||||
使用头衔
|
使用头衔
|
||||||
</label>
|
</label>
|
||||||
|
|||||||
Reference in New Issue
Block a user