diff --git a/src/Ombi/ClientApp/app/services/applications/tester.service.ts b/src/Ombi/ClientApp/app/services/applications/tester.service.ts index 433576eb8..7d3c87ad5 100644 --- a/src/Ombi/ClientApp/app/services/applications/tester.service.ts +++ b/src/Ombi/ClientApp/app/services/applications/tester.service.ts @@ -15,6 +15,7 @@ import { IPushbulletNotificationSettings, IPushoverNotificationSettings, IRadarrSettings, + ISickRageSettings, ISlackNotificationSettings, ISonarrSettings, ITelegramNotifcationSettings, @@ -48,22 +49,32 @@ export class TesterService extends ServiceAuthHelpers { public emailTest(settings: IEmailNotificationSettings): Observable { return this.http.post(`${this.url}email`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); } + public plexTest(settings: IPlexServer): Observable { return this.http.post(`${this.url}plex`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); } + public embyTest(settings: IEmbyServer): Observable { return this.http.post(`${this.url}emby`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); } + public radarrTest(settings: IRadarrSettings): Observable { return this.http.post(`${this.url}radarr`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); } + public sonarrTest(settings: ISonarrSettings): Observable { return this.http.post(`${this.url}sonarr`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); - } + } + public couchPotatoTest(settings: ICouchPotatoSettings): Observable { return this.http.post(`${this.url}couchpotato`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); - } + } + public telegramTest(settings: ITelegramNotifcationSettings): Observable { return this.http.post(`${this.url}telegram`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); } + + public sickrageTest(settings: ISickRageSettings): Observable { + return this.http.post(`${this.url}sickrage`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); + } } diff --git a/src/Ombi/ClientApp/app/settings/sickrage/sickrage.component.ts b/src/Ombi/ClientApp/app/settings/sickrage/sickrage.component.ts index 3f34e0674..9576fd60b 100644 --- a/src/Ombi/ClientApp/app/settings/sickrage/sickrage.component.ts +++ b/src/Ombi/ClientApp/app/settings/sickrage/sickrage.component.ts @@ -3,9 +3,8 @@ import { FormBuilder, FormGroup, Validators } from "@angular/forms"; import { ISonarrProfile, ISonarrRootFolder } from "../../interfaces"; -// import { ISickRageSettings } from "../../interfaces"; -// import { SonarrService } from "../../services"; -// import { TesterService } from "../../services"; +import { ISickRageSettings } from "../../interfaces"; +import { TesterService } from "../../services"; import { NotificationService } from "../../services"; import { SettingsService } from "../../services"; @@ -25,6 +24,7 @@ export class SickRageComponent implements OnInit { constructor(private settingsService: SettingsService, private notificationService: NotificationService, + private testerService: TesterService, private fb: FormBuilder) { } public ngOnInit() { @@ -49,14 +49,14 @@ export class SickRageComponent implements OnInit { this.notificationService.error("Please check your entered values"); return; } - // const settings = form.value; - // this.testerService.sonarrTest(settings).subscribe(x => { - // if (x) { - // this.notificationService.success("Successfully connected to SickRage!"); - // } else { - // this.notificationService.error("We could not connect to SickRage!"); - // } - // }); + const settings = form.value; + this.testerService.sickrageTest(settings).subscribe(x => { + if (x) { + this.notificationService.success("Successfully connected to SickRage!"); + } else { + this.notificationService.error("We could not connect to SickRage!"); + } + }); } public onSubmit(form: FormGroup) { diff --git a/src/Ombi/Controllers/External/TesterController.cs b/src/Ombi/Controllers/External/TesterController.cs index c85f248cf..ba62b05c1 100644 --- a/src/Ombi/Controllers/External/TesterController.cs +++ b/src/Ombi/Controllers/External/TesterController.cs @@ -8,6 +8,7 @@ using Ombi.Api.CouchPotato; using Ombi.Api.Emby; using Ombi.Api.Plex; using Ombi.Api.Radarr; +using Ombi.Api.SickRage; using Ombi.Api.Sonarr; using Ombi.Api.Telegram; using Ombi.Attributes; @@ -34,24 +35,10 @@ namespace Ombi.Controllers.External /// /// Initializes a new instance of the class. /// - /// The service. - /// The notification. - /// The notification. - /// The pushbullet. - /// The slack. - /// The plex. - /// The emby. - /// The radarr. - /// The sonarr. - /// The pushover. - /// The mattermost. - /// The logger. - /// The email provider - /// The couch potato API public TesterController(INotificationService service, IDiscordNotification notification, IEmailNotification emailN, IPushbulletNotification pushbullet, ISlackNotification slack, IPushoverNotification po, IMattermostNotification mm, IPlexApi plex, IEmbyApi emby, IRadarrApi radarr, ISonarrApi sonarr, ILogger log, IEmailProvider provider, - ICouchPotatoApi cpApi, ITelegramNotification telegram) + ICouchPotatoApi cpApi, ITelegramNotification telegram, ISickRageApi srApi) { Service = service; DiscordNotification = notification; @@ -68,6 +55,7 @@ namespace Ombi.Controllers.External EmailProvider = provider; CouchPotatoApi = cpApi; TelegramNotification = telegram; + SickRageApi = srApi; } private INotificationService Service { get; } @@ -85,6 +73,7 @@ namespace Ombi.Controllers.External private ILogger Log { get; } private IEmailProvider EmailProvider { get; } private ITelegramNotification TelegramNotification { get; } + private ISickRageApi SickRageApi { get; } /// @@ -297,7 +286,7 @@ namespace Ombi.Controllers.External } /// - /// Sends a test message to Slack using the provided settings + /// Sends a test message to Telegram using the provided settings /// /// The settings. /// @@ -310,5 +299,17 @@ namespace Ombi.Controllers.External return true; } + /// + /// Sends a test message to Slack using the provided settings + /// + /// The settings. + /// + [HttpPost("sickrage")] + public async Task SickRage([FromBody] SickRageSettings settings) + { + settings.Enabled = true; + var result = await SickRageApi.Ping(settings.ApiKey, settings.FullUri); + return result?.data?.pid != null; + } } } \ No newline at end of file