mirror of
https://github.com/Readarr/Readarr
synced 2026-05-09 05:21:41 +02:00
Remove legacy code that accessed config.xml without a lock
(cherry picked from commit 7a4adea14ae18a5204226237eded56005a76893e) (cherry picked from commit ba9aab1640358b4097997b6cd32e2edc36a5f696)
This commit is contained in:
parent
4f40ad0480
commit
a8388e12c1
1 changed files with 1 additions and 31 deletions
|
|
@ -19,7 +19,7 @@ public interface IUserService
|
|||
User FindUser(Guid identifier);
|
||||
}
|
||||
|
||||
public class UserService : IUserService, IHandle<ApplicationStartedEvent>
|
||||
public class UserService : IUserService
|
||||
{
|
||||
private readonly IUserRepository _repo;
|
||||
private readonly IAppFolderInfo _appFolderInfo;
|
||||
|
|
@ -97,35 +97,5 @@ public User FindUser(Guid identifier)
|
|||
{
|
||||
return _repo.FindUser(identifier);
|
||||
}
|
||||
|
||||
public void Handle(ApplicationStartedEvent message)
|
||||
{
|
||||
if (_repo.All().Any())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var configFile = _appFolderInfo.GetConfigPath();
|
||||
|
||||
if (!_diskProvider.FileExists(configFile))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var xDoc = XDocument.Load(configFile);
|
||||
var config = xDoc.Descendants("Config").Single();
|
||||
var usernameElement = config.Descendants("Username").FirstOrDefault();
|
||||
var passwordElement = config.Descendants("Password").FirstOrDefault();
|
||||
|
||||
if (usernameElement == null || passwordElement == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var username = usernameElement.Value;
|
||||
var password = passwordElement.Value;
|
||||
|
||||
Add(username, password);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue