mirror of
https://github.com/SteamRE/DepotDownloader.git
synced 2026-10-19 15:51:50 +00:00
Add support for remembering password (loginkey).
This commit is contained in:
1 parent
35aa666ea5
commit
6e4a764bb9
5 files changed
+18
-1
No files matched your search
@@ -20,6 +20,9 @@ namespace DepotDownloader
|
||||
[ProtoMember(4, IsRequired = false)]
|
||||
public System.Collections.Concurrent.ConcurrentDictionary<string, int> ContentServerPenalty { get; private set; }
|
||||
|
||||
[ProtoMember(5, IsRequired = false)]
|
||||
public Dictionary<string, string> LoginKeys { get; private set; }
|
||||
|
||||
string FileName = null;
|
||||
|
||||
ConfigStore()
|
||||
|
||||
@@ -339,6 +339,8 @@ namespace DepotDownloader
|
||||
{
|
||||
Username = username,
|
||||
Password = password,
|
||||
ShouldRememberPassword = Config.RememberPassword,
|
||||
LoginKey = ConfigStore.TheConfig.LoginKeys.ContainsKey(username) ? ConfigStore.TheConfig.LoginKeys[username] : null,
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -24,5 +24,7 @@ namespace DepotDownloader
|
||||
|
||||
public int MaxServers { get; set; }
|
||||
public int MaxDownloads { get; set; }
|
||||
|
||||
public bool RememberPassword { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -87,6 +87,7 @@ namespace DepotDownloader
|
||||
|
||||
string username = GetParameter<string>(args, "-username") ?? GetParameter<string>(args, "-user");
|
||||
string password = GetParameter<string>(args, "-password") ?? GetParameter<string>(args, "-pass");
|
||||
ContentDownloader.Config.RememberPassword = HasParameter(args, "-remember-password");
|
||||
ContentDownloader.Config.InstallDirectory = GetParameter<string>(args, "-dir");
|
||||
ContentDownloader.Config.DownloadAllPlatforms = HasParameter(args, "-all-platforms");
|
||||
ContentDownloader.Config.VerifyAll = HasParameter(args, "-verify-all") || HasParameter(args, "-verify_all") || HasParameter(args, "-validate");
|
||||
@@ -97,7 +98,7 @@ namespace DepotDownloader
|
||||
|
||||
ContentDownloader.Config.MaxServers = Math.Max(ContentDownloader.Config.MaxServers, ContentDownloader.Config.MaxDownloads);
|
||||
|
||||
if (username != null && password == null)
|
||||
if (username != null && password == null && !ConfigStore.TheConfig.LoginKeys.ContainsKey(username))
|
||||
{
|
||||
Console.Write("Enter account password for \"{0}\": ", username);
|
||||
password = Util.ReadPassword();
|
||||
|
||||
@@ -94,6 +94,7 @@ namespace DepotDownloader
|
||||
this.callbacks.Subscribe<SteamUser.SessionTokenCallback>(SessionTokenCallback);
|
||||
this.callbacks.Subscribe<SteamApps.LicenseListCallback>(LicenseListCallback);
|
||||
this.callbacks.Subscribe<SteamUser.UpdateMachineAuthCallback>(UpdateMachineAuthCallback);
|
||||
this.callbacks.Subscribe<SteamUser.LoginKeyCallback>(LoginKeyCallback);
|
||||
|
||||
Console.Write( "Connecting to Steam3..." );
|
||||
|
||||
@@ -563,6 +564,14 @@ namespace DepotDownloader
|
||||
steamUser.SendMachineAuthResponse( authResponse );
|
||||
}
|
||||
|
||||
private void LoginKeyCallback(SteamUser.LoginKeyCallback loginKey)
|
||||
{
|
||||
ConfigStore.TheConfig.LoginKeys[logonDetails.Username] = loginKey.LoginKey;
|
||||
ConfigStore.Save();
|
||||
|
||||
steamUser.AcceptNewLoginKey(loginKey);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user