new set title api with title secret
This commit is contained in:
@@ -24,6 +24,7 @@ class App extends Component {
|
||||
window.AS_BACKUP = localStorage['DEFAULT_ALLOW_SEARCH'] ? true : false;
|
||||
window.ANN = localStorage['ANN'];
|
||||
window.LAST_ANN = localStorage['LAST_ANN'];
|
||||
window.TITLE_SECRET = localStorage['TITLE_SECRET'] || '';
|
||||
listen_darkmode(
|
||||
{ default: undefined, light: false, dark: true }[
|
||||
window.config.color_scheme
|
||||
|
||||
@@ -1475,6 +1475,13 @@ class SubFlow extends PureComponent {
|
||||
}
|
||||
window.TITLE = json.custom_title;
|
||||
window.AUTO_BLCOK = json.auto_block_rank;
|
||||
if (
|
||||
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) => {
|
||||
if (x.comments) {
|
||||
let comment_json = {
|
||||
|
||||
@@ -151,7 +151,8 @@ export class LoginForm extends Component {
|
||||
}
|
||||
let data = new FormData();
|
||||
data.append('title', title);
|
||||
fetch(get_api_base() + '/title', {
|
||||
data.append('secret', window.TITLE_SECRET);
|
||||
fetch(get_api_base_2() + '/set-title', {
|
||||
method: 'POST',
|
||||
headers: { 'User-Token': token },
|
||||
body: data,
|
||||
@@ -162,6 +163,8 @@ export class LoginForm extends Component {
|
||||
throw new Error(j.msg);
|
||||
}
|
||||
window.TITLE = title;
|
||||
window.TITLE_SECRET = j.data;
|
||||
localStorage['TITLE_SECRET'] = j.data;
|
||||
alert('专属头衔设置成功');
|
||||
})
|
||||
.catch((err) => alert('设置头衔出错了:\n' + err));
|
||||
|
||||
Reference in New Issue
Block a user