mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-12 16:22:55 -07:00
REVERSE PROXY BITCH! #1513
This commit is contained in:
parent
af2f8d1380
commit
fc4bb76685
20 changed files with 117 additions and 72 deletions
|
@ -7,5 +7,6 @@ namespace Ombi.Helpers
|
||||||
public static class CacheKeys
|
public static class CacheKeys
|
||||||
{
|
{
|
||||||
public const string Update = nameof(Update);
|
public const string Update = nameof(Update);
|
||||||
|
public const string OmbiSettings = nameof(OmbiSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
34
src/Ombi.Helpers/StringHelpers.cs
Normal file
34
src/Ombi.Helpers/StringHelpers.cs
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2017 Jamie Rees
|
||||||
|
// File: StringHelpers.cs
|
||||||
|
// Created By: Jamie Rees
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
// a copy of this software and associated documentation files (the
|
||||||
|
// "Software"), to deal in the Software without restriction, including
|
||||||
|
// without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
// permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
// the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be
|
||||||
|
// included in all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
// ************************************************************************/
|
||||||
|
#endregion
|
||||||
|
namespace Ombi.Helpers
|
||||||
|
{
|
||||||
|
public static class StringHelpers
|
||||||
|
{
|
||||||
|
public static bool IsNullOrEmpty(this string s) => string.IsNullOrEmpty(s);
|
||||||
|
public static bool HasValue(this string s) => !IsNullOrEmpty(s);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
|
import { PlatformLocation } from "@angular/common";
|
||||||
import { Headers, Http } from "@angular/http";
|
import { Headers, Http } from "@angular/http";
|
||||||
import { JwtHelper, tokenNotExpired } from "angular2-jwt";
|
import { JwtHelper, tokenNotExpired } from "angular2-jwt";
|
||||||
import { Observable } from "rxjs/Rx";
|
import { Observable } from "rxjs/Rx";
|
||||||
|
@ -10,8 +11,8 @@ import { ILocalUser, IUserLogin } from "./IUserLogin";
|
||||||
export class AuthService extends ServiceHelpers {
|
export class AuthService extends ServiceHelpers {
|
||||||
public jwtHelper: JwtHelper = new JwtHelper();
|
public jwtHelper: JwtHelper = new JwtHelper();
|
||||||
|
|
||||||
constructor(http: Http) {
|
constructor(http: Http, public platformLocation: PlatformLocation) {
|
||||||
super(http, "/api/v1/token");
|
super(http, "/api/v1/token", platformLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public login(login: IUserLogin): Observable<any> {
|
public login(login: IUserLogin): Observable<any> {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
|
import { PlatformLocation } from "@angular/common";
|
||||||
import { Http } from "@angular/http";
|
import { Http } from "@angular/http";
|
||||||
import { AuthHttp } from "angular2-jwt";
|
import { AuthHttp } from "angular2-jwt";
|
||||||
import { Observable } from "rxjs/Rx";
|
import { Observable } from "rxjs/Rx";
|
||||||
|
@ -9,8 +10,8 @@ import { IEmbySettings, IUsersModel } from "../../interfaces";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class EmbyService extends ServiceAuthHelpers {
|
export class EmbyService extends ServiceAuthHelpers {
|
||||||
constructor(http: AuthHttp, private regularHttp: Http) {
|
constructor(http: AuthHttp, private regularHttp: Http, public platformLocation: PlatformLocation) {
|
||||||
super(http, "/api/v1/Emby/");
|
super(http, "/api/v1/Emby/", platformLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public logIn(settings: IEmbySettings): Observable<IEmbySettings> {
|
public logIn(settings: IEmbySettings): Observable<IEmbySettings> {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
|
import { PlatformLocation } from "@angular/common";
|
||||||
import { Http } from "@angular/http";
|
import { Http } from "@angular/http";
|
||||||
|
|
||||||
import { AuthHttp } from "angular2-jwt";
|
import { AuthHttp } from "angular2-jwt";
|
||||||
|
@ -10,8 +11,8 @@ import { IPlexAuthentication, IPlexLibResponse, IPlexServer, IPlexServerViewMode
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class PlexService extends ServiceAuthHelpers {
|
export class PlexService extends ServiceAuthHelpers {
|
||||||
constructor(http: AuthHttp, private regularHttp: Http) {
|
constructor(http: AuthHttp, private regularHttp: Http, public platformLocation: PlatformLocation) {
|
||||||
super(http, "/api/v1/Plex/");
|
super(http, "/api/v1/Plex/", platformLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public logIn(login: string, password: string): Observable<IPlexAuthentication> {
|
public logIn(login: string, password: string): Observable<IPlexAuthentication> {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
|
import { PlatformLocation } from "@angular/common";
|
||||||
import { AuthHttp } from "angular2-jwt";
|
import { AuthHttp } from "angular2-jwt";
|
||||||
import { Observable } from "rxjs/Rx";
|
import { Observable } from "rxjs/Rx";
|
||||||
|
|
||||||
|
@ -8,8 +9,8 @@ import { ServiceAuthHelpers } from "../service.helpers";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class RadarrService extends ServiceAuthHelpers {
|
export class RadarrService extends ServiceAuthHelpers {
|
||||||
constructor(http: AuthHttp) {
|
constructor(http: AuthHttp, public platformLocation: PlatformLocation) {
|
||||||
super(http, "/api/v1/Radarr");
|
super(http, "/api/v1/Radarr", platformLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getRootFolders(settings: IRadarrSettings): Observable<IRadarrRootFolder[]> {
|
public getRootFolders(settings: IRadarrSettings): Observable<IRadarrRootFolder[]> {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
|
import { PlatformLocation } from "@angular/common";
|
||||||
import { AuthHttp } from "angular2-jwt";
|
import { AuthHttp } from "angular2-jwt";
|
||||||
import { Observable } from "rxjs/Rx";
|
import { Observable } from "rxjs/Rx";
|
||||||
|
|
||||||
|
@ -8,8 +9,8 @@ import { ServiceAuthHelpers } from "../service.helpers";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SonarrService extends ServiceAuthHelpers {
|
export class SonarrService extends ServiceAuthHelpers {
|
||||||
constructor(http: AuthHttp) {
|
constructor(http: AuthHttp, public platformLocation: PlatformLocation) {
|
||||||
super(http, "/api/v1/Sonarr");
|
super(http, "/api/v1/Sonarr", platformLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getRootFolders(settings: ISonarrSettings): Observable<ISonarrRootFolder[]> {
|
public getRootFolders(settings: ISonarrSettings): Observable<ISonarrRootFolder[]> {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
|
import { PlatformLocation } from "@angular/common";
|
||||||
import { AuthHttp } from "angular2-jwt";
|
import { AuthHttp } from "angular2-jwt";
|
||||||
import { Observable } from "rxjs/Rx";
|
import { Observable } from "rxjs/Rx";
|
||||||
|
|
||||||
|
@ -19,8 +20,8 @@ import {
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class TesterService extends ServiceAuthHelpers {
|
export class TesterService extends ServiceAuthHelpers {
|
||||||
constructor(http: AuthHttp) {
|
constructor(http: AuthHttp, public platformLocation: PlatformLocation) {
|
||||||
super(http, "/api/v1/tester/");
|
super(http, "/api/v1/tester/", platformLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public discordTest(settings: IDiscordNotifcationSettings): Observable<boolean> {
|
public discordTest(settings: IDiscordNotifcationSettings): Observable<boolean> {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
|
import { PlatformLocation } from "@angular/common";
|
||||||
import { Http } from "@angular/http";
|
import { Http } from "@angular/http";
|
||||||
import { AuthHttp } from "angular2-jwt";
|
import { AuthHttp } from "angular2-jwt";
|
||||||
import { Observable } from "rxjs/Rx";
|
import { Observable } from "rxjs/Rx";
|
||||||
|
@ -8,8 +9,8 @@ import { ServiceAuthHelpers } from "./service.helpers";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class IdentityService extends ServiceAuthHelpers {
|
export class IdentityService extends ServiceAuthHelpers {
|
||||||
constructor(http: AuthHttp, private regularHttp: Http) {
|
constructor(http: AuthHttp, private regularHttp: Http, public platformLocation: PlatformLocation) {
|
||||||
super(http, "/api/v1/Identity/");
|
super(http, "/api/v1/Identity/", platformLocation);
|
||||||
}
|
}
|
||||||
public createWizardUser(username: string, password: string): Observable<boolean> {
|
public createWizardUser(username: string, password: string): Observable<boolean> {
|
||||||
return this.regularHttp.post(`${this.url}Wizard/`, JSON.stringify({ username, password }), { headers: this.headers }).map(this.extractData);
|
return this.regularHttp.post(`${this.url}Wizard/`, JSON.stringify({ username, password }), { headers: this.headers }).map(this.extractData);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
|
import { PlatformLocation } from "@angular/common";
|
||||||
import { Http } from "@angular/http";
|
import { Http } from "@angular/http";
|
||||||
import { Observable } from "rxjs/Rx";
|
import { Observable } from "rxjs/Rx";
|
||||||
|
|
||||||
|
@ -7,8 +8,8 @@ import { ServiceHelpers } from "./service.helpers";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ImageService extends ServiceHelpers {
|
export class ImageService extends ServiceHelpers {
|
||||||
constructor(public http: Http) {
|
constructor(public http: Http, public platformLocation: PlatformLocation) {
|
||||||
super(http, "/api/v1/Images/");
|
super(http, "/api/v1/Images/", platformLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getRandomBackground(): Observable<IImages> {
|
public getRandomBackground(): Observable<IImages> {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
|
import { PlatformLocation } from "@angular/common";
|
||||||
import { AuthHttp } from "angular2-jwt";
|
import { AuthHttp } from "angular2-jwt";
|
||||||
import { Observable } from "rxjs/Rx";
|
import { Observable } from "rxjs/Rx";
|
||||||
|
|
||||||
|
@ -6,8 +7,8 @@ import { ServiceAuthHelpers } from "./service.helpers";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class JobService extends ServiceAuthHelpers {
|
export class JobService extends ServiceAuthHelpers {
|
||||||
constructor(http: AuthHttp) {
|
constructor(http: AuthHttp, public platformLocation: PlatformLocation) {
|
||||||
super(http, "/api/v1/Job/");
|
super(http, "/api/v1/Job/", platformLocation);
|
||||||
}
|
}
|
||||||
public forceUpdate(): Observable<boolean> {
|
public forceUpdate(): Observable<boolean> {
|
||||||
return this.http.post(`${this.url}update/`, { headers: this.headers }).map(this.extractData);
|
return this.http.post(`${this.url}update/`, { headers: this.headers }).map(this.extractData);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
|
import { PlatformLocation } from "@angular/common";
|
||||||
import { Http } from "@angular/http";
|
import { Http } from "@angular/http";
|
||||||
import { Observable } from "rxjs/Rx";
|
import { Observable } from "rxjs/Rx";
|
||||||
|
|
||||||
|
@ -7,8 +8,8 @@ import { ServiceHelpers } from "./service.helpers";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class LandingPageService extends ServiceHelpers {
|
export class LandingPageService extends ServiceHelpers {
|
||||||
constructor(public http: Http) {
|
constructor(public http: Http, public platformLocation: PlatformLocation) {
|
||||||
super(http, "/api/v1/LandingPage/");
|
super(http, "/api/v1/LandingPage/", platformLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getServerStatus(): Observable<IMediaServerStatus> {
|
public getServerStatus(): Observable<IMediaServerStatus> {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
|
import { PlatformLocation } from "@angular/common";
|
||||||
import { Http } from "@angular/http";
|
import { Http } from "@angular/http";
|
||||||
import { AuthHttp } from "angular2-jwt";
|
import { AuthHttp } from "angular2-jwt";
|
||||||
import { Observable } from "rxjs/Rx";
|
import { Observable } from "rxjs/Rx";
|
||||||
|
@ -12,8 +13,8 @@ import { ServiceAuthHelpers } from "./service.helpers";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class RequestService extends ServiceAuthHelpers {
|
export class RequestService extends ServiceAuthHelpers {
|
||||||
constructor(http: AuthHttp, private basicHttp: Http) {
|
constructor(http: AuthHttp, private basicHttp: Http, public platformLocation: PlatformLocation) {
|
||||||
super(http, "/api/v1/Request/");
|
super(http, "/api/v1/Request/", platformLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public requestMovie(movie: ISearchMovieResult): Observable<IRequestEngineResult> {
|
public requestMovie(movie: ISearchMovieResult): Observable<IRequestEngineResult> {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
|
import { PlatformLocation } from "@angular/common";
|
||||||
import { AuthHttp } from "angular2-jwt";
|
import { AuthHttp } from "angular2-jwt";
|
||||||
import { Observable } from "rxjs/Rx";
|
import { Observable } from "rxjs/Rx";
|
||||||
|
|
||||||
|
@ -9,8 +10,8 @@ import { ServiceAuthHelpers } from "./service.helpers";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SearchService extends ServiceAuthHelpers {
|
export class SearchService extends ServiceAuthHelpers {
|
||||||
constructor(http: AuthHttp) {
|
constructor(http: AuthHttp, public platformLocation: PlatformLocation) {
|
||||||
super(http, "/api/v1/search");
|
super(http, "/api/v1/search", platformLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Movies
|
// Movies
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Headers, Http, Response } from "@angular/http";
|
import { PlatformLocation } from "@angular/common";
|
||||||
|
import { Headers, Http, Response } from "@angular/http";
|
||||||
import "rxjs/add/observable/throw";
|
import "rxjs/add/observable/throw";
|
||||||
import { Observable } from "rxjs/Observable";
|
import { Observable } from "rxjs/Observable";
|
||||||
|
|
||||||
|
@ -8,7 +9,10 @@ export class ServiceHelpers {
|
||||||
|
|
||||||
protected headers: Headers;
|
protected headers: Headers;
|
||||||
|
|
||||||
constructor(protected http: Http, protected url: string) {
|
constructor(protected http: Http, protected url: string, protected platformLocation: PlatformLocation) {
|
||||||
|
if (this.url.length > 1) {
|
||||||
|
this.url = platformLocation.getBaseHrefFromDOM() + this.url;
|
||||||
|
}
|
||||||
this.headers = new Headers();
|
this.headers = new Headers();
|
||||||
this.headers.append("Content-Type", "application/json; charset=utf-8");
|
this.headers.append("Content-Type", "application/json; charset=utf-8");
|
||||||
}
|
}
|
||||||
|
@ -32,7 +36,10 @@ export class ServiceAuthHelpers {
|
||||||
|
|
||||||
protected headers: Headers;
|
protected headers: Headers;
|
||||||
|
|
||||||
constructor(protected http: AuthHttp, protected url: string) {
|
constructor(protected http: AuthHttp, protected url: string, protected platformLocation: PlatformLocation) {
|
||||||
|
if (this.url.length > 1) {
|
||||||
|
this.url = platformLocation.getBaseHrefFromDOM() + this.url;
|
||||||
|
}
|
||||||
this.headers = new Headers();
|
this.headers = new Headers();
|
||||||
this.headers.append("Content-Type", "application/json; charset=utf-8");
|
this.headers.append("Content-Type", "application/json; charset=utf-8");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Injectable } from "@angular/core";
|
import { PlatformLocation } from "@angular/common";
|
||||||
|
import { Injectable } from "@angular/core";
|
||||||
import { Http } from "@angular/http";
|
import { Http } from "@angular/http";
|
||||||
import { AuthHttp } from "angular2-jwt";
|
import { AuthHttp } from "angular2-jwt";
|
||||||
import { Observable } from "rxjs/Rx";
|
import { Observable } from "rxjs/Rx";
|
||||||
|
@ -27,8 +28,9 @@ import { ServiceAuthHelpers } from "./service.helpers";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SettingsService extends ServiceAuthHelpers {
|
export class SettingsService extends ServiceAuthHelpers {
|
||||||
constructor(public httpAuth: AuthHttp, private nonAuthHttp: Http) {
|
constructor(public httpAuth: AuthHttp, private nonAuthHttp: Http,
|
||||||
super(httpAuth, "/api/v1/Settings");
|
public platformLocation: PlatformLocation) {
|
||||||
|
super(httpAuth, "/api/v1/Settings", platformLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public about(): Observable<IAbout> {
|
public about(): Observable<IAbout> {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
|
import { PlatformLocation } from "@angular/common";
|
||||||
import { Http } from "@angular/http";
|
import { Http } from "@angular/http";
|
||||||
import { Observable } from "rxjs/Rx";
|
import { Observable } from "rxjs/Rx";
|
||||||
|
|
||||||
|
@ -6,8 +7,8 @@ import { ServiceHelpers } from "./service.helpers";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class StatusService extends ServiceHelpers {
|
export class StatusService extends ServiceHelpers {
|
||||||
constructor(http: Http) {
|
constructor(http: Http, public platformLocation: PlatformLocation) {
|
||||||
super(http, "/api/v1/status/");
|
super(http, "/api/v1/status/", platformLocation);
|
||||||
}
|
}
|
||||||
public getWizardStatus(): Observable<any> {
|
public getWizardStatus(): Observable<any> {
|
||||||
return this.http.get(`${this.url}Wizard/`, { headers: this.headers }).map(this.extractData);
|
return this.http.get(`${this.url}Wizard/`, { headers: this.headers }).map(this.extractData);
|
||||||
|
|
|
@ -3,46 +3,34 @@ using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Security.Principal;
|
using System.Security.Principal;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using AutoMapper.EquivalencyExpression;
|
using AutoMapper.EquivalencyExpression;
|
||||||
using Hangfire;
|
using Hangfire;
|
||||||
using Hangfire.Console;
|
using Hangfire.Console;
|
||||||
using Hangfire.Dashboard;
|
using Hangfire.Dashboard;
|
||||||
using Hangfire.MemoryStorage;
|
using Hangfire.MemoryStorage;
|
||||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.HttpOverrides;
|
using Microsoft.AspNetCore.HttpOverrides;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
|
||||||
using Microsoft.AspNetCore.SpaServices.Webpack;
|
using Microsoft.AspNetCore.SpaServices.Webpack;
|
||||||
using Microsoft.AspNetCore.StaticFiles;
|
using Microsoft.AspNetCore.StaticFiles;
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.Extensions.Caching.Memory;
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
|
||||||
using Microsoft.Extensions.PlatformAbstractions;
|
|
||||||
using Microsoft.IdentityModel.Tokens;
|
|
||||||
using Ombi.Config;
|
|
||||||
using Ombi.Core.Authentication;
|
using Ombi.Core.Authentication;
|
||||||
using Ombi.Core.Claims;
|
|
||||||
using Ombi.Core.Settings;
|
using Ombi.Core.Settings;
|
||||||
using Ombi.DependencyInjection;
|
using Ombi.DependencyInjection;
|
||||||
using Ombi.Helpers;
|
using Ombi.Helpers;
|
||||||
using Ombi.Mapping;
|
using Ombi.Mapping;
|
||||||
using Ombi.Models.Identity;
|
|
||||||
using Ombi.Schedule;
|
using Ombi.Schedule;
|
||||||
using Ombi.Settings.Settings.Models;
|
using Ombi.Settings.Settings.Models;
|
||||||
using Ombi.Store.Context;
|
using Ombi.Store.Context;
|
||||||
using Ombi.Store.Entities;
|
using Ombi.Store.Entities;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
using Swashbuckle.AspNetCore.Swagger;
|
|
||||||
|
|
||||||
namespace Ombi
|
namespace Ombi
|
||||||
{
|
{
|
||||||
|
@ -157,15 +145,23 @@ namespace Ombi
|
||||||
});
|
});
|
||||||
|
|
||||||
// Setup the scheduler
|
// Setup the scheduler
|
||||||
var jobSetup = (IJobSetup)app.ApplicationServices.GetService(typeof(IJobSetup));
|
var jobSetup = app.ApplicationServices.GetService<IJobSetup>();
|
||||||
jobSetup.Setup();
|
jobSetup.Setup();
|
||||||
ctx.Seed();
|
ctx.Seed();
|
||||||
|
|
||||||
var provider = new FileExtensionContentTypeProvider { Mappings = { [".map"] = "application/octet-stream" } };
|
var provider = new FileExtensionContentTypeProvider { Mappings = { [".map"] = "application/octet-stream" } };
|
||||||
|
|
||||||
|
var ombiService =
|
||||||
|
app.ApplicationServices.GetService<ISettingsService<OmbiSettings>>();
|
||||||
|
var settings = ombiService.GetSettings();
|
||||||
|
if (settings.BaseUrl.HasValue())
|
||||||
|
{
|
||||||
|
app.UsePathBase(settings.BaseUrl);
|
||||||
|
}
|
||||||
|
|
||||||
app.UseStaticFiles(new StaticFileOptions()
|
app.UseStaticFiles(new StaticFileOptions()
|
||||||
{
|
{
|
||||||
ContentTypeProvider = provider
|
ContentTypeProvider = provider,
|
||||||
});
|
});
|
||||||
|
|
||||||
app.UseAuthentication();
|
app.UseAuthentication();
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
|
||||||
using Ombi.Core.Settings;
|
|
||||||
using Ombi.Settings.Settings.Models;
|
|
||||||
|
|
||||||
namespace Ombi.TagHelpers
|
|
||||||
{
|
|
||||||
public class ReverseProxyTagHelper : TagHelper
|
|
||||||
{
|
|
||||||
public ReverseProxyTagHelper(ISettingsService<OmbiSettings> c)
|
|
||||||
{
|
|
||||||
_ctx = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly ISettingsService<OmbiSettings> _ctx;
|
|
||||||
|
|
||||||
public override void Process(TagHelperContext context, TagHelperOutput output)
|
|
||||||
{
|
|
||||||
output.TagName = "base";
|
|
||||||
var s = _ctx.GetSettings();
|
|
||||||
var baseUrl = string.IsNullOrEmpty(s.BaseUrl) ? "/" : s.BaseUrl;
|
|
||||||
output.Attributes.SetAttribute("href", baseUrl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,10 +1,26 @@
|
||||||
<!DOCTYPE html>
|
@using Ombi.Core.Settings
|
||||||
|
@using Ombi.Settings.Settings.Models
|
||||||
|
@inject ISettingsService<OmbiSettings> Settings
|
||||||
|
@{
|
||||||
|
var s = await Settings.GetSettingsAsync();
|
||||||
|
var baseUrl = s.BaseUrl;
|
||||||
|
|
||||||
|
if (!baseUrl.EndsWith("/"))
|
||||||
|
{
|
||||||
|
baseUrl = baseUrl.TrimEnd('/');
|
||||||
|
}
|
||||||
|
if (baseUrl.StartsWith("/"))
|
||||||
|
{
|
||||||
|
baseUrl = baseUrl.TrimStart('/');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Ombi</title>
|
<title>Ombi</title>
|
||||||
<Reverse-Proxy></Reverse-Proxy>
|
<base href="/@baseUrl"/>
|
||||||
<link rel="SHORTCUT ICON" href="~/images/favicon/favicon.ico" />
|
<link rel="SHORTCUT ICON" href="~/images/favicon/favicon.ico" />
|
||||||
<link rel="icon" href="~/images/favicon/favicon.ico" type="image/ico" />
|
<link rel="icon" href="~/images/favicon/favicon.ico" type="image/ico" />
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue