diff --git a/src/Ombi/ClientApp/src/app/services/system.service.ts b/src/Ombi/ClientApp/src/app/services/system.service.ts index 20f60c8d8..ef6f947a8 100644 --- a/src/Ombi/ClientApp/src/app/services/system.service.ts +++ b/src/Ombi/ClientApp/src/app/services/system.service.ts @@ -18,4 +18,7 @@ export class SystemService extends ServiceHelpers { public getLog(logName: string): Observable { return this.http.get(`${this.url}logs/${logName}`, {responseType: 'text'}); } + public getNews(): Observable { + return this.http.get(`${this.url}news`, {responseType: 'text'}); + } } diff --git a/src/Ombi/ClientApp/src/app/settings/about/about.component.html b/src/Ombi/ClientApp/src/app/settings/about/about.component.html index b52d00c43..a9e1028d1 100644 --- a/src/Ombi/ClientApp/src/app/settings/about/about.component.html +++ b/src/Ombi/ClientApp/src/app/settings/about/about.component.html @@ -1,7 +1,8 @@ 
About - +
+
NOT SUPPORTED OS. Please use the docker image available on the Container Station (It's free)
@@ -91,6 +92,11 @@
- +
+
+
+

News

+
+
diff --git a/src/Ombi/ClientApp/src/app/settings/about/about.component.scss b/src/Ombi/ClientApp/src/app/settings/about/about.component.scss index 5afb20333..daeccd03a 100644 --- a/src/Ombi/ClientApp/src/app/settings/about/about.component.scss +++ b/src/Ombi/ClientApp/src/app/settings/about/about.component.scss @@ -23,4 +23,18 @@ margin: auto; width: 85%; margin-top:10px; + } + + :host ::ng-deep strong { + color: #fff; + background-color: #007bff; + display: inline-block; + padding: 0.25em 0.4em; + font-size: 75%; + font-weight: 700; + line-height: 1; + text-align: center; + white-space: nowrap; + vertical-align: baseline; + border-radius: 0.25rem; } \ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/settings/about/about.component.ts b/src/Ombi/ClientApp/src/app/settings/about/about.component.ts index f1ea6c29d..c3fd4b056 100644 --- a/src/Ombi/ClientApp/src/app/settings/about/about.component.ts +++ b/src/Ombi/ClientApp/src/app/settings/about/about.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from "@angular/core"; import { IAbout } from "../../interfaces/ISettings"; -import { JobService, SettingsService, HubService } from "../../services"; +import { JobService, SettingsService, HubService, SystemService } from "../../services"; import { IConnectedUser } from "../../interfaces"; @Component({ @@ -12,14 +12,16 @@ export class AboutComponent implements OnInit { public about: IAbout; public newUpdate: boolean; public connectedUsers: IConnectedUser[]; + public newsHtml: string; constructor(private readonly settingsService: SettingsService, - private readonly jobService: JobService, - private readonly hubService: HubService) { } + private readonly jobService: JobService, + private readonly hubService: HubService, + private readonly systemService: SystemService) { } public async ngOnInit() { this.settingsService.about().subscribe(x => this.about = x); - + this.newsHtml = await this.systemService.getNews().toPromise(); // TODO // this.jobService.getCachedUpdate().subscribe(x => { diff --git a/src/Ombi/Controllers/V2/SystemController.cs b/src/Ombi/Controllers/V2/SystemController.cs index 924532eda..d172eb37a 100644 --- a/src/Ombi/Controllers/V2/SystemController.cs +++ b/src/Ombi/Controllers/V2/SystemController.cs @@ -1,7 +1,9 @@ using System.IO; using System.Linq; +using System.Net.Http; using System.Threading; using System.Threading.Tasks; +using Markdig; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Ombi.Attributes; @@ -12,16 +14,27 @@ namespace Ombi.Controllers.V2 public class SystemController : V2Controller { private readonly IWebHostEnvironment _hosting; + private readonly HttpClient _client; - public SystemController(IWebHostEnvironment hosting) + public SystemController(IWebHostEnvironment hosting, IHttpClientFactory httpClientFactory) { _hosting = hosting; + _client = httpClientFactory.CreateClient(); + } + + [HttpGet("news")] + public async Task GetNews() + { + var result = await _client.GetAsync("https://raw.githubusercontent.com/tidusjar/Ombi.News/main/README.md"); + var content = await result.Content.ReadAsStringAsync(); + var md = Markdown.ToHtml(content); + return Ok(md); } [HttpGet("logs")] public IActionResult GetLogFiles() { - var logsFolder = Path.Combine(_hosting.ContentRootPath, "Logs"); + var logsFolder = Path.Combine(string.IsNullOrEmpty(Ombi.Helpers.StartupSingleton.Instance.StoragePath) ? _hosting.ContentRootPath : Helpers.StartupSingleton.Instance.StoragePath, "Logs"); var files = Directory .EnumerateFiles(logsFolder, "*.txt", SearchOption.TopDirectoryOnly) .Select(Path.GetFileName) @@ -33,7 +46,7 @@ namespace Ombi.Controllers.V2 [HttpGet("logs/{logFileName}")] public async Task ReadLogFile(string logFileName, CancellationToken token) { - var logFile = Path.Combine(_hosting.ContentRootPath, "Logs", logFileName); + var logFile = Path.Combine(string.IsNullOrEmpty(Ombi.Helpers.StartupSingleton.Instance.StoragePath) ? _hosting.ContentRootPath : Helpers.StartupSingleton.Instance.StoragePath, "Logs", logFileName); using (var fs = new FileStream(logFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) using (StreamReader reader = new StreamReader(fs)) { @@ -44,7 +57,7 @@ namespace Ombi.Controllers.V2 [HttpGet("logs/download/{logFileName}")] public IActionResult Download(string logFileName, CancellationToken token) { - var logFile = Path.Combine(_hosting.ContentRootPath, "Logs", logFileName); + var logFile = Path.Combine(string.IsNullOrEmpty(Ombi.Helpers.StartupSingleton.Instance.StoragePath) ? _hosting.ContentRootPath : Helpers.StartupSingleton.Instance.StoragePath, "Logs", logFileName); using (var fs = new FileStream(logFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) using (StreamReader reader = new StreamReader(fs)) { diff --git a/src/Ombi/Startup.cs b/src/Ombi/Startup.cs index 2df39a7bf..49227a344 100644 --- a/src/Ombi/Startup.cs +++ b/src/Ombi/Startup.cs @@ -84,6 +84,7 @@ namespace Ombi // setup.AddHealthCheckEndpoint("Ombi", "/health"); //}); services.AddMemoryCache(); + services.AddHttpClient(); services.AddJwtAuthentication(Configuration); diff --git a/src/Ombi/databasej.json b/src/Ombi/databasej.json new file mode 100644 index 000000000..7c77dd61a --- /dev/null +++ b/src/Ombi/databasej.json @@ -0,0 +1,14 @@ +{ + "OmbiDatabase": { + "Type": "MySQL", + "ConnectionString": "Server=192.168.68.118;Database=app.ombi.io;User=ombi" + }, + "SettingsDatabase": { + "Type": "MySQL", + "ConnectionString": "Server=192.168.68.118;Database=app.ombi.io;User=ombi" + }, + "ExternalDatabase": { + "Type": "MySQL", + "ConnectionString": "Server=192.168.68.118;Database=app.ombi.io;User=ombi" + } + } \ No newline at end of file