mirror of
https://github.com/lidarr/Lidarr
synced 2025-01-03 05:25:10 +00:00
Remove legacy code that accessed config.xml without a lock
This commit is contained in:
parent
7b4b4ef32d
commit
cb62775e6b
1 changed files with 2 additions and 32 deletions
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using NzbDrone.Common.Disk;
|
||||
|
@ -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