diff --git a/src/Ombi/ClientApp/src/app/settings/settingsmenu.component.html b/src/Ombi/ClientApp/src/app/settings/settingsmenu.component.html
index 7685236ce..8280a711d 100644
--- a/src/Ombi/ClientApp/src/app/settings/settingsmenu.component.html
+++ b/src/Ombi/ClientApp/src/app/settings/settingsmenu.component.html
@@ -55,7 +55,8 @@
-
+
+
\ No newline at end of file
diff --git a/src/Ombi/Controllers/V2/CalendarController.cs b/src/Ombi/Controllers/V2/CalendarController.cs
index 61bc8897c..41c6f52b2 100644
--- a/src/Ombi/Controllers/V2/CalendarController.cs
+++ b/src/Ombi/Controllers/V2/CalendarController.cs
@@ -9,10 +9,7 @@ using Ombi.Core.Models.Search.V2;
namespace Ombi.Controllers.V2
{
- [ApiV2]
- [Authorize]
- [ApiController]
- public class CalendarController : ControllerBase
+ public class CalendarController : V2Controller
{
public CalendarController(ICalendarEngine calendarEngine)
{
diff --git a/src/Ombi/Controllers/V2/HubController.cs b/src/Ombi/Controllers/V2/HubController.cs
index b49226a4e..73804531a 100644
--- a/src/Ombi/Controllers/V2/HubController.cs
+++ b/src/Ombi/Controllers/V2/HubController.cs
@@ -10,10 +10,8 @@ using Ombi.Models;
namespace Ombi.Controllers.V2
{
- [ApiV2]
[Admin]
- [ApiController]
- public class HubController : ControllerBase
+ public class HubController : V2Controller
{
public HubController(OmbiUserManager um)
{
diff --git a/src/Ombi/Controllers/V2/RequestsController.cs b/src/Ombi/Controllers/V2/RequestsController.cs
index 8c8c5bc5f..082525509 100644
--- a/src/Ombi/Controllers/V2/RequestsController.cs
+++ b/src/Ombi/Controllers/V2/RequestsController.cs
@@ -12,10 +12,7 @@ using Ombi.Store.Entities.Requests;
namespace Ombi.Controllers.V2
{
- [ApiV2]
- [Authorize]
- [ApiController]
- public class RequestsController : ControllerBase
+ public class RequestsController : V2Controller
{
public RequestsController(IMovieRequestEngine movieRequestEngine, ITvRequestEngine tvRequestEngine)
{
diff --git a/src/Ombi/Controllers/V2/SearchController.cs b/src/Ombi/Controllers/V2/SearchController.cs
index 2f5db154d..9476299b4 100644
--- a/src/Ombi/Controllers/V2/SearchController.cs
+++ b/src/Ombi/Controllers/V2/SearchController.cs
@@ -16,10 +16,7 @@ using Ombi.Models;
namespace Ombi.Controllers.V2
{
- [ApiV2]
- [Authorize]
- [ApiController]
- public class SearchController : ControllerBase
+ public class SearchController : V2Controller
{
public SearchController(IMultiSearchEngine multiSearchEngine, ITvSearchEngine tvSearchEngine,
IMovieEngineV2 v2Movie, ITVSearchEngineV2 v2Tv, IMusicSearchEngineV2 musicEngine)
diff --git a/src/Ombi/Controllers/V2/SystemController.cs b/src/Ombi/Controllers/V2/SystemController.cs
new file mode 100644
index 000000000..e9d57e14d
--- /dev/null
+++ b/src/Ombi/Controllers/V2/SystemController.cs
@@ -0,0 +1,56 @@
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Mvc;
+using Ombi.Attributes;
+
+namespace Ombi.Controllers.V2
+{
+ [Admin]
+ public class SystemController : V2Controller
+ {
+ private readonly IHostingEnvironment _hosting;
+
+ public SystemController(IHostingEnvironment hosting)
+ {
+ _hosting = hosting;
+ }
+
+ [HttpGet("logs")]
+ public IActionResult GetLogFiles()
+ {
+ var logsFolder = Path.Combine(_hosting.ContentRootPath, "Logs");
+ var files = Directory
+ .EnumerateFiles(logsFolder, "*.txt", SearchOption.TopDirectoryOnly)
+ .Select(Path.GetFileName);
+
+ return Ok(files);
+ }
+
+ [HttpGet("logs/{logFileName}")]
+ public async Task ReadLogFile(string logFileName, CancellationToken token)
+ {
+ var logFile = Path.Combine(_hosting.ContentRootPath, "Logs", logFileName);
+ using (var fs = new FileStream(logFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+ using (StreamReader reader = new StreamReader(fs))
+ {
+ return Ok(await reader.ReadToEndAsync());
+ }
+ }
+
+ [HttpGet("logs/download/{logFileName}")]
+ public IActionResult Download(string logFileName, CancellationToken token)
+ {
+ var logFile = Path.Combine(_hosting.ContentRootPath, "Logs", logFileName);
+ using (var fs = new FileStream(logFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+ using (StreamReader reader = new StreamReader(fs))
+ {
+ return File(reader.BaseStream, "application/octet-stream", logFileName);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Ombi/Controllers/V2/V2Controller.cs b/src/Ombi/Controllers/V2/V2Controller.cs
new file mode 100644
index 000000000..0165512d1
--- /dev/null
+++ b/src/Ombi/Controllers/V2/V2Controller.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+
+namespace Ombi.Controllers.V2
+{
+
+ [ApiV2]
+ [Authorize]
+ [ApiController]
+ public class V2Controller : ControllerBase
+ {
+
+ }
+}
\ No newline at end of file