aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Api')
-rw-r--r--MediaBrowser.Api/ChannelService.cs2
-rw-r--r--MediaBrowser.Api/Images/ImageService.cs1
-rw-r--r--MediaBrowser.Api/MediaBrowser.Api.csproj11
-rw-r--r--MediaBrowser.Api/Session/SessionInfoWebSocketListener.cs (renamed from MediaBrowser.Api/WebSocket/SessionInfoWebSocketListener.cs)2
-rw-r--r--MediaBrowser.Api/Session/SessionsService.cs (renamed from MediaBrowser.Api/SessionsService.cs)2
-rw-r--r--MediaBrowser.Api/System/ActivityLogService.cs44
-rw-r--r--MediaBrowser.Api/System/SystemInfoWebSocketListener.cs (renamed from MediaBrowser.Api/WebSocket/SystemInfoWebSocketListener.cs)2
-rw-r--r--MediaBrowser.Api/System/SystemService.cs (renamed from MediaBrowser.Api/SystemService.cs)9
-rw-r--r--MediaBrowser.Api/UserService.cs21
9 files changed, 75 insertions, 19 deletions
diff --git a/MediaBrowser.Api/ChannelService.cs b/MediaBrowser.Api/ChannelService.cs
index 2cc046f1d..3736814e5 100644
--- a/MediaBrowser.Api/ChannelService.cs
+++ b/MediaBrowser.Api/ChannelService.cs
@@ -230,7 +230,7 @@ namespace MediaBrowser.Api
SortOrder = request.SortOrder,
SortBy = (request.SortBy ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToArray(),
Filters = request.GetFilters().ToArray(),
- Fields = request.GetItemFields().ToList()
+ Fields = request.GetItemFields().ToArray()
}, CancellationToken.None).Result;
diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs
index ea7eaa947..43e9ad3ef 100644
--- a/MediaBrowser.Api/Images/ImageService.cs
+++ b/MediaBrowser.Api/Images/ImageService.cs
@@ -40,6 +40,7 @@ namespace MediaBrowser.Api.Images
[Route("/Items/{Id}/Images/{Type}", "GET")]
[Route("/Items/{Id}/Images/{Type}/{Index}", "GET")]
[Route("/Items/{Id}/Images/{Type}/{Index}/{Tag}/{Format}/{MaxWidth}/{MaxHeight}", "GET")]
+ [Route("/Items/{Id}/Images/{Type}/{Index}/{Tag}/{Format}/{MaxWidth}/{MaxHeight}", "HEAD")]
[Api(Description = "Gets an item image")]
public class GetItemImage : ImageRequest
{
diff --git a/MediaBrowser.Api/MediaBrowser.Api.csproj b/MediaBrowser.Api/MediaBrowser.Api.csproj
index 9a7d28ec4..df689cb24 100644
--- a/MediaBrowser.Api/MediaBrowser.Api.csproj
+++ b/MediaBrowser.Api/MediaBrowser.Api.csproj
@@ -118,10 +118,11 @@
<Compile Include="ScheduledTasks\ScheduledTasksWebSocketListener.cs" />
<Compile Include="ApiEntryPoint.cs" />
<Compile Include="SearchService.cs" />
- <Compile Include="SessionsService.cs" />
+ <Compile Include="Session\SessionsService.cs" />
<Compile Include="SimilarItemsHelper.cs" />
<Compile Include="Sync\SyncService.cs" />
- <Compile Include="SystemService.cs" />
+ <Compile Include="System\ActivityLogService.cs" />
+ <Compile Include="System\SystemService.cs" />
<Compile Include="Movies\TrailersService.cs" />
<Compile Include="TvShowsService.cs" />
<Compile Include="UserLibrary\ArtistsService.cs" />
@@ -139,8 +140,8 @@
<Compile Include="UserService.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="VideosService.cs" />
- <Compile Include="WebSocket\SessionInfoWebSocketListener.cs" />
- <Compile Include="WebSocket\SystemInfoWebSocketListener.cs" />
+ <Compile Include="Session\SessionInfoWebSocketListener.cs" />
+ <Compile Include="System\SystemInfoWebSocketListener.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj">
@@ -173,4 +174,4 @@
<Target Name="AfterBuild">
</Target>
-->
-</Project>
+</Project> \ No newline at end of file
diff --git a/MediaBrowser.Api/WebSocket/SessionInfoWebSocketListener.cs b/MediaBrowser.Api/Session/SessionInfoWebSocketListener.cs
index 600d9e405..e6b525e53 100644
--- a/MediaBrowser.Api/WebSocket/SessionInfoWebSocketListener.cs
+++ b/MediaBrowser.Api/Session/SessionInfoWebSocketListener.cs
@@ -7,7 +7,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-namespace MediaBrowser.Api.WebSocket
+namespace MediaBrowser.Api.Session
{
/// <summary>
/// Class SessionInfoWebSocketListener
diff --git a/MediaBrowser.Api/SessionsService.cs b/MediaBrowser.Api/Session/SessionsService.cs
index 8017f3523..e2c95eba9 100644
--- a/MediaBrowser.Api/SessionsService.cs
+++ b/MediaBrowser.Api/Session/SessionsService.cs
@@ -10,7 +10,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
-namespace MediaBrowser.Api
+namespace MediaBrowser.Api.Session
{
/// <summary>
/// Class GetSessions
diff --git a/MediaBrowser.Api/System/ActivityLogService.cs b/MediaBrowser.Api/System/ActivityLogService.cs
new file mode 100644
index 000000000..0ccc28c6f
--- /dev/null
+++ b/MediaBrowser.Api/System/ActivityLogService.cs
@@ -0,0 +1,44 @@
+using MediaBrowser.Controller.Activity;
+using MediaBrowser.Controller.Net;
+using MediaBrowser.Model.Activity;
+using MediaBrowser.Model.Querying;
+using ServiceStack;
+
+namespace MediaBrowser.Api.System
+{
+ [Route("/System/ActivityLog/Entries", "GET", Summary = "Gets activity log entries")]
+ public class GetActivityLogs : IReturn<QueryResult<ActivityLogEntry>>
+ {
+ /// <summary>
+ /// Skips over a given number of items within the results. Use for paging.
+ /// </summary>
+ /// <value>The start index.</value>
+ [ApiMember(Name = "StartIndex", Description = "Optional. The record index to start at. All items with a lower index will be dropped from the results.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
+ public int? StartIndex { get; set; }
+
+ /// <summary>
+ /// The maximum number of items to return
+ /// </summary>
+ /// <value>The limit.</value>
+ [ApiMember(Name = "Limit", Description = "Optional. The maximum number of records to return", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
+ public int? Limit { get; set; }
+ }
+
+ [Authenticated]
+ public class ActivityLogService : BaseApiService
+ {
+ private readonly IActivityManager _activityManager;
+
+ public ActivityLogService(IActivityManager activityManager)
+ {
+ _activityManager = activityManager;
+ }
+
+ public object Get(GetActivityLogs request)
+ {
+ var result = _activityManager.GetActivityLogEntries(request.StartIndex, request.Limit);
+
+ return ToOptimizedResult(result);
+ }
+ }
+}
diff --git a/MediaBrowser.Api/WebSocket/SystemInfoWebSocketListener.cs b/MediaBrowser.Api/System/SystemInfoWebSocketListener.cs
index 2940bcef0..c20cef3b3 100644
--- a/MediaBrowser.Api/WebSocket/SystemInfoWebSocketListener.cs
+++ b/MediaBrowser.Api/System/SystemInfoWebSocketListener.cs
@@ -4,7 +4,7 @@ using MediaBrowser.Model.Logging;
using MediaBrowser.Model.System;
using System.Threading.Tasks;
-namespace MediaBrowser.Api.WebSocket
+namespace MediaBrowser.Api.System
{
/// <summary>
/// Class SystemInfoWebSocketListener
diff --git a/MediaBrowser.Api/SystemService.cs b/MediaBrowser.Api/System/SystemService.cs
index 259b1d892..3913275ee 100644
--- a/MediaBrowser.Api/SystemService.cs
+++ b/MediaBrowser.Api/System/SystemService.cs
@@ -4,12 +4,13 @@ using MediaBrowser.Controller;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.System;
using ServiceStack;
+using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
-namespace MediaBrowser.Api
+namespace MediaBrowser.Api.System
{
/// <summary>
/// Class GetSystemInfo
@@ -73,7 +74,7 @@ namespace MediaBrowser.Api
/// <param name="appHost">The app host.</param>
/// <param name="appPaths">The application paths.</param>
/// <param name="fileSystem">The file system.</param>
- /// <exception cref="System.ArgumentNullException">jsonSerializer</exception>
+ /// <exception cref="ArgumentNullException">jsonSerializer</exception>
public SystemService(IServerApplicationHost appHost, IApplicationPaths appPaths, IFileSystem fileSystem)
{
_appHost = appHost;
@@ -89,7 +90,7 @@ namespace MediaBrowser.Api
{
files = new DirectoryInfo(_appPaths.LogDirectoryPath)
.EnumerateFiles("*", SearchOption.AllDirectories)
- .Where(i => string.Equals(i.Extension, ".txt", System.StringComparison.OrdinalIgnoreCase))
+ .Where(i => string.Equals(i.Extension, ".txt", global::System.StringComparison.OrdinalIgnoreCase))
.ToList();
}
catch (DirectoryNotFoundException)
@@ -116,7 +117,7 @@ namespace MediaBrowser.Api
{
var file = new DirectoryInfo(_appPaths.LogDirectoryPath)
.EnumerateFiles("*", SearchOption.AllDirectories)
- .First(i => string.Equals(i.Name, request.Name, System.StringComparison.OrdinalIgnoreCase));
+ .First(i => string.Equals(i.Name, request.Name, global::System.StringComparison.OrdinalIgnoreCase));
return ResultFactory.GetStaticFileResult(Request, file.FullName, FileShare.ReadWrite);
}
diff --git a/MediaBrowser.Api/UserService.cs b/MediaBrowser.Api/UserService.cs
index f5a1f54cb..4ffe5b391 100644
--- a/MediaBrowser.Api/UserService.cs
+++ b/MediaBrowser.Api/UserService.cs
@@ -195,7 +195,7 @@ namespace MediaBrowser.Api
var authInfo = AuthorizationContext.GetAuthorizationInfo(Request);
var isDashboard = string.Equals(authInfo.Client, "Dashboard", StringComparison.OrdinalIgnoreCase);
- if ((Request.IsLocal && isDashboard) ||
+ if ((Request.IsLocal && isDashboard) ||
!_config.Configuration.IsStartupWizardCompleted)
{
return Get(new GetUsers
@@ -327,7 +327,7 @@ namespace MediaBrowser.Api
var revokeTask = _sessionMananger.RevokeUserTokens(user.Id.ToString("N"));
Task.WaitAll(revokeTask);
-
+
var task = _userManager.DeleteUser(user);
Task.WaitAll(task);
@@ -374,8 +374,17 @@ namespace MediaBrowser.Api
auth.DeviceId = "Unknown device id";
}
- var result = _sessionMananger.AuthenticateNewSession(request.Username, request.Password, auth.Client, auth.Version,
- auth.DeviceId, auth.Device, Request.RemoteIp, Request.IsLocal).Result;
+ var result = _sessionMananger.AuthenticateNewSession(new AuthenticationRequest
+ {
+ App = auth.Client,
+ AppVersion = auth.Version,
+ DeviceId = auth.DeviceId,
+ DeviceName = auth.Device,
+ Password = request.Password,
+ RemoteEndPoint = Request.RemoteIp,
+ Username = request.Username
+
+ }, Request.IsLocal).Result;
return ToOptimizedResult(result);
}
@@ -457,8 +466,8 @@ namespace MediaBrowser.Api
Task.WaitAll(revokeTask);
}
- var task = user.Name.Equals(dtoUser.Name, StringComparison.Ordinal) ?
- _userManager.UpdateUser(user) :
+ var task = user.Name.Equals(dtoUser.Name, StringComparison.Ordinal) ?
+ _userManager.UpdateUser(user) :
_userManager.RenameUser(user, dtoUser.Name);
Task.WaitAll(task);