You are using a temporary account and logging out will erase all your data.
`, buttons:[ { label: i18n('save_account'), value: 'save_account', type: 'primary', }, { label: i18n('log_out'), value: 'log_out', type: 'danger', }, { label: i18n('cancel'), }, ] }) if(alert_resp === 'save_account'){ let saved = await UIWindowSaveAccount({ send_confirmation_code: false, default_username: window.user.username }); if(saved) logout(); }else if (alert_resp === 'log_out'){ logout(); } else{ return; } } // logout try{ await $.ajax({ url: gui_origin + "/logout", type: 'POST', async: true, contentType: "application/json", headers: { "Authorization": "Bearer " + auth_token }, statusCode: { 401: function () { }, }, }) }catch(e){ } // remove this user from the array of logged_in_users for (let i = 0; i < window.logged_in_users.length; i++) { if(window.logged_in_users[i].uuid === window.user.uuid){ window.logged_in_users.splice(i, 1); break; } } // update logged_in_users in local storage localStorage.setItem('logged_in_users', JSON.stringify(window.logged_in_users)); // delete this user from local storage window.user = null; localStorage.removeItem('user'); window.auth_token = null; localStorage.removeItem('auth_token'); // close all windows $('.window').close(); // close all ctxmenus $('.context-menu').remove(); // remove desktop $('.desktop').remove(); // remove taskbar $('.taskbar').remove(); // disable native browser exit confirmation window.onbeforeunload = null; // go to home page window.location.replace("/"); }); } function requestOpenerOrigin() { return new Promise((resolve, reject) => { if (!window.opener) { reject(new Error("No window.opener available")); return; } // Function to handle the message event const handleMessage = (event) => { // Check if the message is the expected response if (event.data.msg === 'originResponse') { // Clean up by removing the event listener window.removeEventListener('message', handleMessage); resolve(event.origin); } }; // Set up the listener for the response window.addEventListener('message', handleMessage, false); // Send the request to the opener window.opener.postMessage({ msg: 'requestOrigin' }, '*'); // Optional: Reject the promise if no response is received within a timeout setTimeout(() => { window.removeEventListener('message', handleMessage); reject(new Error("Response timed out")); }, 5000); // Timeout after 5 seconds }); } $(document).on('click', '.generic-close-window-button', function(e){ $(this).closest('.window').close(); }); // Re-calculate desktop height and width on window resize and re-position the login and signup windows $(window).on("resize", function () { // If host env is popup, don't continue because the popup window has its own resize requirements. if (window.embedded_in_popup) return; const ratio = window.desktop_width / window.innerWidth; window.desktop_height = window.innerHeight - window.toolbar_height - window.taskbar_height; window.desktop_width = window.innerWidth; // Re-center the login window const top = $(".window-login").position()?.top; const width = $(".window-login").width(); $(".window-login").css({ left: (window.desktop_width - width) / 2, top: top / ratio, }); // Re-center the create account window const top2 = $(".window-signup").position()?.top; const width2 = $(".window-signup").width(); $(".window-signup").css({ left: (window.desktop_width - width2) / 2, top: top2 / ratio, }); });