Skip to content

Commit b510bca

Browse files
committed
some changes
1 parent d5c37af commit b510bca

File tree

5 files changed

+25
-3
lines changed

5 files changed

+25
-3
lines changed

src/webpage/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ stickerTB.onclick = (e) => {
429429
};
430430
const updateIcon = document.getElementById("updateIcon");
431431
if (updateIcon) {
432-
new Hover(() => updateIcon.textContent).addEvent(updateIcon);
432+
new Hover(() => updateIcon.textContent || "").addEvent(updateIcon);
433433
updateIcon.onclick = () => {
434434
window.location.reload();
435435
};

src/webpage/jsontypes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ interface readyjson {
4444
timezone_offset: number;
4545
view_nsfw_guilds: boolean;
4646
};
47+
auth_token?: string;
4748
guilds: guildjson[];
4849
relationships: {
4950
id: string;

src/webpage/localuser.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ class Localuser {
5656
][],
5757
);
5858
lastSequence: number | null = null;
59-
token!: string;
59+
get token() {
60+
return this.headers.Authorization;
61+
}
6062
userinfo!: Specialuser;
6163
serverurls!: Specialuser["serverurls"];
6264
initialized!: boolean;
@@ -212,7 +214,6 @@ class Localuser {
212214
this.rights = new Rights("");
213215
return;
214216
}
215-
this.token = userinfo.token;
216217
this.userinfo = userinfo;
217218
this.perminfo.guilds ??= {};
218219
this.perminfo.user ??= {};
@@ -348,6 +349,12 @@ class Localuser {
348349
this.userinfo.id = this.user.id;
349350
this.userinfo.pfpsrc = this.user.getpfpsrc();
350351

352+
if (ready.d.auth_token) {
353+
this.userinfo.token = ready.d.auth_token;
354+
this.headers.Authorization = ready.d.auth_token;
355+
this.userinfo.updateLocal();
356+
}
357+
351358
this.status = this.ready.d.user_settings.status;
352359
this.channelfocus = undefined;
353360
this.lookingguild = undefined;

src/webpage/user.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,14 +510,27 @@ class User extends SnowFlake {
510510
this.contextmenu.addButton(
511511
() => I18n.user.instanceBan(),
512512
function (this: User) {
513+
const params = {
514+
reason: "",
515+
persistInstanceBan: true,
516+
};
513517
const menu = new Dialog("");
514518
const options = menu.float.options;
515519
options.addTitle(I18n.user.confirmInstBan(this.name));
520+
options.addTextInput(I18n.member["reason:"](), () => {}, {}).onchange = (txt) => {
521+
params.reason = txt;
522+
};
523+
options.addCheckboxInput(I18n.member.persist(), () => {}, {
524+
initState: false,
525+
}).onchange = (checked) => {
526+
params.persistInstanceBan = !checked;
527+
};
516528
const opt = options.addOptions("", {ltr: true});
517529
opt.addButtonInput("", I18n.yes(), () => {
518530
fetch(this.info.api + "/users/" + this.id + "/delete", {
519531
headers: this.localuser.headers,
520532
method: "POST",
533+
body: JSON.stringify(params),
521534
});
522535
menu.hide();
523536
});

translations/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,7 @@
734734
"kick": "Kick $1 from $2",
735735
"timeout":"Timeout $1",
736736
"reason:": "Reason:",
737+
"persist":"Only delete user:",
737738
"timeoutTime":"Timeout Time:",
738739
"ban": "Ban $1 from $2",
739740
"nick:": "Nickname:"

0 commit comments

Comments
 (0)