RynthCore as of 2026-10-05 (internal 0d3c210): dashboard slide-outs on the left (Ranges with the selected monster, Files, Patrol), fixed draggable vital bar, click an item to add a loot rule, loot rules by WCID, chat and loot editor typing no longer leaks into the game, title-bar text size, plugin API v76 (close container), plugin exception traces, plates drawn under the game UI (in testing), launcher account passwords encrypted with Windows DPAPI (in testing), release 2026.10.5.1

This commit is contained in:
Tom Bohar 2026-10-05 08:03:08 -04:00
commit c3e15480e5
50 changed files with 3315 additions and 490 deletions

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace RynthCore.App;
@ -12,7 +13,26 @@ internal sealed class LaunchAccountProfile
public string Id { get; set; } = Guid.NewGuid().ToString("N");
public string AccountName { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
/// The saved password, DPAPI-encrypted for the current Windows user (base64, see
/// AccountPasswordProtection). Empty = no password saved. Decrypt only when launching:
/// TryGetPasswordForLaunch.
public string PasswordProtected { get; set; } = string.Empty;
/// Plain-text "Password" from a settings file written before passwords were encrypted.
/// Read only: AppSettingsStore.Load encrypts it into PasswordProtected and clears this, so it
/// is never written again (null is skipped on save). Stays set only if encryption failed.
[JsonPropertyName("Password")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? LegacyPlainPassword { get; set; }
/// Set when the saved password can't be decrypted on this Windows user (settings copied
/// from another user or PC). The UI asks for the password again; launching is refused.
[JsonIgnore]
public bool PasswordNeedsReentry { get; set; }
[JsonIgnore]
public bool HasSavedPassword => !string.IsNullOrEmpty(PasswordProtected) || !string.IsNullOrEmpty(LegacyPlainPassword);
public string CharacterName { get; set; } = string.Empty;
public string Alias { get; set; } = string.Empty;
public string ServerId { get; set; } = string.Empty;
@ -65,7 +85,9 @@ internal sealed class LaunchAccountProfile
{
Id = Id,
AccountName = AccountName,
Password = Password,
PasswordProtected = PasswordProtected,
LegacyPlainPassword = LegacyPlainPassword,
PasswordNeedsReentry = PasswordNeedsReentry,
CharacterName = CharacterName,
Alias = Alias,
ServerId = ServerId,
@ -84,7 +106,9 @@ internal sealed class LaunchAccountProfile
{
Id = source.Id;
AccountName = source.AccountName;
Password = source.Password;
PasswordProtected = source.PasswordProtected;
LegacyPlainPassword = source.LegacyPlainPassword;
PasswordNeedsReentry = source.PasswordNeedsReentry;
CharacterName = source.CharacterName;
Alias = source.Alias;
ServerId = source.ServerId;
@ -98,6 +122,55 @@ internal sealed class LaunchAccountProfile
OnLoginWaitMs = source.OnLoginWaitMs;
}
/// <summary>Saves a new password (encrypted at once; the plain text is not kept).</summary>
public void SetPassword(string? plainText)
{
PasswordProtected = AccountPasswordProtection.Protect(plainText);
LegacyPlainPassword = null;
PasswordNeedsReentry = false;
}
public void ClearPassword()
{
PasswordProtected = string.Empty;
LegacyPlainPassword = null;
PasswordNeedsReentry = false;
}
/// <summary>
/// The password to hand the client, decrypted now. True with "" when none is saved. False
/// (and PasswordNeedsReentry set) when the saved one can't be decrypted on this Windows user;
/// the caller must not launch with an empty password instead. Use the result at once and
/// don't store it.
/// </summary>
public bool TryGetPasswordForLaunch(out string password, out string problem)
{
problem = string.Empty;
if (!string.IsNullOrEmpty(LegacyPlainPassword))
{
password = LegacyPlainPassword;
return true;
}
if (string.IsNullOrEmpty(PasswordProtected))
{
password = string.Empty;
return true;
}
if (AccountPasswordProtection.TryUnprotect(PasswordProtected, out password))
{
PasswordNeedsReentry = false;
return true;
}
PasswordNeedsReentry = true;
problem = PasswordNeedsReentryMessage(AccountName);
return false;
}
public static string PasswordNeedsReentryMessage(string? accountName) =>
$"The saved password for account '{accountName}' can't be read on this Windows user " +
"(settings copied from another user or PC?). Password needs re-entering: edit the account and type it again.";
public override string ToString()
{
return DisplayName;