forked from OpenWF/SpaceNinjaServer
		
	fix(webui): handle config get request failing due to expired authz (#1716)
Reviewed-on: OpenWF/SpaceNinjaServer#1716 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									bc5dc02fc9
								
							
						
					
					
						commit
						6394adb0f0
					
				@ -1315,7 +1315,7 @@ single.getRoute("/webui/cheats").on("beforeload", function () {
 | 
				
			|||||||
    interval = setInterval(() => {
 | 
					    interval = setInterval(() => {
 | 
				
			||||||
        if (window.authz) {
 | 
					        if (window.authz) {
 | 
				
			||||||
            clearInterval(interval);
 | 
					            clearInterval(interval);
 | 
				
			||||||
            fetch("/custom/config?" + window.authz).then(res => {
 | 
					            fetch("/custom/config?" + window.authz).then(async res => {
 | 
				
			||||||
                if (res.status == 200) {
 | 
					                if (res.status == 200) {
 | 
				
			||||||
                    $("#server-settings-no-perms").addClass("d-none");
 | 
					                    $("#server-settings-no-perms").addClass("d-none");
 | 
				
			||||||
                    $("#server-settings").removeClass("d-none");
 | 
					                    $("#server-settings").removeClass("d-none");
 | 
				
			||||||
@ -1334,10 +1334,18 @@ single.getRoute("/webui/cheats").on("beforeload", function () {
 | 
				
			|||||||
                            }
 | 
					                            }
 | 
				
			||||||
                        })
 | 
					                        })
 | 
				
			||||||
                    );
 | 
					                    );
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    if ((await res.text()) == "Log-in expired") {
 | 
				
			||||||
 | 
					                        revalidateAuthz(() => {
 | 
				
			||||||
 | 
					                            if (single.getCurrentPath() == "/webui/cheats") {
 | 
				
			||||||
 | 
					                                single.loadRoute("/webui/cheats");
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                        });
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        $("#server-settings-no-perms").removeClass("d-none");
 | 
					                        $("#server-settings-no-perms").removeClass("d-none");
 | 
				
			||||||
                        $("#server-settings").addClass("d-none");
 | 
					                        $("#server-settings").addClass("d-none");
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }, 10);
 | 
					    }, 10);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user