From 7db461ad73e60ed8b9f42da141a75d2830bbd9c5 Mon Sep 17 00:00:00 2001 From: Cody Brittain <1779662+Generalcamo@users.noreply.github.com> Date: Sat, 17 May 2025 20:08:39 -0400 Subject: [PATCH] Offline Authentication Fixes (For real this time) (#20769) Thanks to harry for pointing me in the right direction here. The way this worked previously, is that it bypassed the UI initialization. I ended up moving all of that into a seperate proc, which is now also called upon logging in with the offline authenticator (after prefs are loaded). In addition, I improved the login window. Instead of having a closable pop-up window (which was only made closable due to a bug with it staying open), it is now integrated into the game window itself (and I fixed the bug requiring it to be closable). There was also an unclosed `
` tag which I closed, and all the elements previously sent to the (now blocked) chat window, instead appear on the window itself. --- code/modules/client/client_procs.dm | 37 ++++++------ code/modules/mob/abstract/unauthed/login.dm | 24 ++++++-- .../GeneralCamo - Offline Login Fix.yml | 60 +++++++++++++++++++ interface/skin.dmf | 8 +++ 4 files changed, 105 insertions(+), 24 deletions(-) create mode 100644 html/changelogs/GeneralCamo - Offline Login Fix.yml diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index 15957d821ca..a09f530dd1a 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -383,6 +383,9 @@ GLOBAL_LIST_INIT(localhost_addresses, list( tgui_panel = new(src, "browseroutput") tgui_say = new(src, "tgui_say") + // Forcibly enable hardware-accelerated graphics, as we need them for the lighting overlays. + winset(src, null, "command=\".configure graphics-hwmode on\"") + if(IsGuestKey(key) && GLOB.config.external_auth) src.authed = FALSE var/mob/abstract/unauthed/m = new() @@ -395,26 +398,9 @@ GLOBAL_LIST_INIT(localhost_addresses, list( . = ..() src.InitClient() src.InitPrefs() + src.InitUI() mob.LateLogin() - // Initialize stat panel - stat_panel.initialize( - inline_html = file("html/statbrowser.html"), - inline_js = file("html/statbrowser.js"), - inline_css = file("html/statbrowser.css"), - ) - addtimer(CALLBACK(src, PROC_REF(check_panel_loaded)), 30 SECONDS) - - INVOKE_ASYNC(src, PROC_REF(acquire_dpi)) - - // Initialize tgui panel - tgui_panel.initialize() - - tgui_say.initialize() - - // Forcibly enable hardware-accelerated graphics, as we need them for the lighting overlays. - winset(src, null, "command=\".configure graphics-hwmode on\"") - send_resources() if(!winexists(src, "asset_cache_browser")) // The client is using a custom skin, tell them. @@ -445,6 +431,21 @@ GLOBAL_LIST_INIT(localhost_addresses, list( if(prefs.toggles_secondary & CLIENT_PREFERENCE_HIDE_MENU) addtimer(CALLBACK(src, VERB_REF(toggle_menu), 1 SECONDS)) +/client/proc/InitUI() + INVOKE_ASYNC(src, PROC_REF(acquire_dpi)) + + // Initialize tgui panel + tgui_panel.initialize() + tgui_say.initialize() + + // Initialize stat panel + stat_panel.initialize( + inline_html = file("html/statbrowser.html"), + inline_js = file("html/statbrowser.js"), + inline_css = file("html/statbrowser.css"), + ) + addtimer(CALLBACK(src, PROC_REF(check_panel_loaded)), 30 SECONDS) + /client/proc/InitClient() SHOULD_NOT_SLEEP(TRUE) diff --git a/code/modules/mob/abstract/unauthed/login.dm b/code/modules/mob/abstract/unauthed/login.dm index e2942e7ba1e..23a41eeb25c 100644 --- a/code/modules/mob/abstract/unauthed/login.dm +++ b/code/modules/mob/abstract/unauthed/login.dm @@ -11,24 +11,33 @@ GLOBAL_LIST_EMPTY(unauthed) /mob/abstract/unauthed/LateLogin() SHOULD_CALL_PARENT(FALSE) + //Don't redo this if they have already been authenticated + if(client?.authed) + return + update_Login_details() - to_chat(src, SPAN_DANGER("You need to authenticate before you can continue.")) token = md5("[client.ckey][client.computer_id][world.time][rand()]") GLOB.unauthed[token] = src remove_verb(client, typesof(/client/verb)) - var/uihtml = "Please select:
" + var/uihtml = "" + uihtml += "Please select:
" if(GLOB.config.guests_allowed) uihtml += "Login as guest" if(GLOB.config.webint_url && GLOB.config.external_auth) uihtml += "Login via forums" if(!GLOB.config.guests_allowed && GLOB.config.webint_url && GLOB.config.external_auth) src.OpenForumAuthWindow() - show_browser(src, uihtml, "window=externalauth;size=300x300;border=0;can_close=1;can_resize=0;can_minimize=0;titlebar=1") - timeout_timer = addtimer(CALLBACK(src, PROC_REF(timeout)), 900, TIMER_STOPPABLE) + uihtml += "" + show_browser(src, uihtml, "window=mainwindow.guestbrowser") + winset(src, "mainwindow.guestbrowser", "is-visible=true") + winset(src, "mainwindow.guestbrowser", "is-disabled=false") + timeout_timer = addtimer(CALLBACK(src, PROC_REF(timeout)), 90 SECONDS, TIMER_STOPPABLE) /mob/abstract/unauthed/proc/timeout() if (client) - to_chat_immediate(client, "Your login time has expired. Please relog and try again.") + var/alert = "