mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-21 23:09:27 +02:00
Admin stuff
This commit is contained in:
parent
2c0fc385bd
commit
b802229e60
@ -1,6 +1,6 @@
|
||||
VITE_BYPASS_LOGIN=1
|
||||
VITE_BYPASS_LOGIN=0
|
||||
VITE_BYPASS_TUTORIAL=0
|
||||
VITE_SERVER_URL=http://localhost:8001
|
||||
VITE_SERVER_URL=http://192.168.1.101:8001
|
||||
VITE_DISCORD_CLIENT_ID=1234567890
|
||||
VITE_GOOGLE_CLIENT_ID=1234567890
|
||||
VITE_I18N_DEBUG=1
|
||||
|
@ -7,6 +7,8 @@ import { Button } from "#app/enums/buttons";
|
||||
|
||||
export default class AdminUiHandler extends FormModalUiHandler {
|
||||
|
||||
private adminMode: string;
|
||||
|
||||
private unlinkAction: Function;
|
||||
|
||||
constructor(scene: BattleScene, mode: Mode | null = null) {
|
||||
@ -14,7 +16,7 @@ export default class AdminUiHandler extends FormModalUiHandler {
|
||||
}
|
||||
|
||||
setup(): void {
|
||||
super.setup();
|
||||
|
||||
}
|
||||
|
||||
getModalTitle(config?: ModalConfig): string {
|
||||
@ -22,7 +24,7 @@ export default class AdminUiHandler extends FormModalUiHandler {
|
||||
}
|
||||
|
||||
getFields(config?: ModalConfig): string[] {
|
||||
return ["Username", "Discord ID"];
|
||||
return this.adminMode === "link" ? ["Username", "Discord ID"] : ["Test", "Hello"];
|
||||
}
|
||||
|
||||
getWidth(config?: ModalConfig): number {
|
||||
@ -34,7 +36,7 @@ export default class AdminUiHandler extends FormModalUiHandler {
|
||||
}
|
||||
|
||||
getButtonLabels(config?: ModalConfig): string[] {
|
||||
return ["Link account", "Unlink account", "Cancel"];
|
||||
return ["Link account", "Cancel"];
|
||||
}
|
||||
|
||||
processInput(button: Button): boolean {
|
||||
@ -47,7 +49,10 @@ export default class AdminUiHandler extends FormModalUiHandler {
|
||||
}
|
||||
|
||||
show(args: any[]): boolean {
|
||||
if (super.show(args)) {
|
||||
this.adminMode = args[args.length - 1];
|
||||
super.setup();
|
||||
|
||||
if (super.show(args.slice(0, -1))) {
|
||||
const config = args[0] as ModalConfig;
|
||||
const originalSubmitAction = this.submitAction;
|
||||
let originAction: number = 0; // this is used to keep track of which button has been pressed
|
||||
|
@ -397,7 +397,7 @@ export default class MenuUiHandler extends MessageUiHandler {
|
||||
ui.revertMode();
|
||||
}
|
||||
]
|
||||
});
|
||||
}, "link");
|
||||
return true;
|
||||
},
|
||||
keepOpen: true
|
||||
|
@ -283,16 +283,16 @@ export const isBeta = import.meta.env.MODE === "beta"; // this checks to see if
|
||||
export function setCookie(cName: string, cValue: string): void {
|
||||
const expiration = new Date();
|
||||
expiration.setTime(new Date().getTime() + 3600000 * 24 * 30 * 3/*7*/);
|
||||
document.cookie = `${cName}=${cValue};Secure;SameSite=Strict;Domain=${window.location.hostname};Path=/;Expires=${expiration.toUTCString()}`;
|
||||
document.cookie = `${cName}=${cValue};SameSite=Strict;Domain=${window.location.hostname};Path=/;Expires=${expiration.toUTCString()}`;
|
||||
}
|
||||
|
||||
export function removeCookie(cName: string): void {
|
||||
if (isBeta) {
|
||||
document.cookie = `${cName}=;Secure;SameSite=Strict;Domain=pokerogue.net;Path=/;Max-Age=-1`; // we need to remove the cookie from the main domain as well
|
||||
document.cookie = `${cName}=;SameSite=Strict;Domain=pokerogue.net;Path=/;Max-Age=-1`; // we need to remove the cookie from the main domain as well
|
||||
}
|
||||
|
||||
document.cookie = `${cName}=;Secure;SameSite=Strict;Domain=${window.location.hostname};Path=/;Max-Age=-1`;
|
||||
document.cookie = `${cName}=;Secure;SameSite=Strict;Path=/;Max-Age=-1`; // legacy cookie without domain, for older cookies to prevent a login loop
|
||||
document.cookie = `${cName}=;SameSite=Strict;Domain=${window.location.hostname};Path=/;Max-Age=-1`;
|
||||
document.cookie = `${cName}=;SameSite=Strict;Path=/;Max-Age=-1`; // legacy cookie without domain, for older cookies to prevent a login loop
|
||||
}
|
||||
|
||||
export function getCookie(cName: string): string {
|
||||
|
Loading…
Reference in New Issue
Block a user