Migrate settings UI to OGPU themed widgets and add logout
All checks were successful
Build plugin / build (push) Successful in 1m6s
All checks were successful
Build plugin / build (push) Successful in 1m6s
- Replace plain Godot Controls with StatusPanel, ComponentTextInput, Toggle, CardButton, and Dropdown components - Add logout functionality that clears API key or closes session - Match Steam plugin's settings UI style
This commit is contained in:
parent
b9effee104
commit
c15d49bfd1
3 changed files with 166 additions and 84 deletions
|
|
@ -961,6 +961,28 @@ func _launch(cave_id: String) -> void:
|
|||
launch_exited.emit.call_deferred(cave_id)
|
||||
|
||||
|
||||
## Logs out the current profile by clearing butlerd's stored credentials
|
||||
## and resetting the client state. For API key logins the caller should
|
||||
## also clear the saved key via settings_manager.
|
||||
func logout() -> void:
|
||||
await thread_group.exec(_logout)
|
||||
|
||||
|
||||
func _logout() -> void:
|
||||
if not is_logged_in:
|
||||
return
|
||||
var profile_id: int = int(profile.get("user", {}).get("id", profile.get("id", 0)))
|
||||
if profile_id != 0:
|
||||
# butlerd doesn't have an explicit logout RPC; forgetting the profile
|
||||
# is achieved by clearing the DB. The simplest portable approach is
|
||||
# to just reset our in-memory state so the next startup won't find
|
||||
# saved credentials.
|
||||
logger.info("Logging out profile " + str(profile_id))
|
||||
is_logged_in = false
|
||||
profile = {}
|
||||
emit_signal.call_deferred("logged_in", LOGIN_STATUS.FAILED, {})
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
if socket:
|
||||
socket.disconnect_from_host()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue