Added a default user handler
This commit is contained in:
parent
b1212467a0
commit
f428c976aa
21
MediaBrowser.Api/HttpHandlers/DefaultUserHandler.cs
Normal file
21
MediaBrowser.Api/HttpHandlers/DefaultUserHandler.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Net.Handlers;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Model.DTO;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Api.HttpHandlers
|
||||
{
|
||||
class DefaultUserHandler : BaseSerializationHandler<DTOUser>
|
||||
{
|
||||
protected override Task<DTOUser> GetObjectToSerialize()
|
||||
{
|
||||
User user = Kernel.Instance.Users.FirstOrDefault();
|
||||
|
||||
DTOUser dto = ApiService.GetDTOUser(user);
|
||||
|
||||
return Task.FromResult<DTOUser>(dto);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -57,6 +57,7 @@
|
|||
<Compile Include="ApiService.cs" />
|
||||
<Compile Include="HttpHandlers\AudioHandler.cs" />
|
||||
<Compile Include="HttpHandlers\BaseMediaHandler.cs" />
|
||||
<Compile Include="HttpHandlers\DefaultUserHandler.cs" />
|
||||
<Compile Include="HttpHandlers\GenreHandler.cs" />
|
||||
<Compile Include="HttpHandlers\GenresHandler.cs" />
|
||||
<Compile Include="HttpHandlers\ImageHandler.cs" />
|
||||
|
|
|
@ -105,10 +105,14 @@ namespace MediaBrowser.Api
|
|||
{
|
||||
return new WeatherHandler();
|
||||
}
|
||||
else if (localPath.EndsWith("/api/cerverconfiguration", StringComparison.OrdinalIgnoreCase))
|
||||
else if (localPath.EndsWith("/api/serverconfiguration", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new ServerConfigurationHandler();
|
||||
}
|
||||
else if (localPath.EndsWith("/api/defaultuser", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new DefaultUserHandler();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user