mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 21:03:17 -07:00
think i actually finished the reverse proxy issue
This commit is contained in:
parent
39cef0d54b
commit
78af64446b
11 changed files with 68 additions and 76 deletions
|
@ -84,7 +84,7 @@ const routes: Routes = [
|
||||||
// AoT requires an exported function for factories
|
// AoT requires an exported function for factories
|
||||||
export function HttpLoaderFactory(http: HttpClient, platformLocation: PlatformLocation) {
|
export function HttpLoaderFactory(http: HttpClient, platformLocation: PlatformLocation) {
|
||||||
// const base = getBaseLocation();
|
// const base = getBaseLocation();
|
||||||
const base = platformLocation.getBaseHrefFromDOM();
|
const base = window["baseHref"];
|
||||||
const version = Math.floor(Math.random() * 999999999);
|
const version = Math.floor(Math.random() * 999999999);
|
||||||
if (base !== null && base.length > 1) {
|
if (base !== null && base.length > 1) {
|
||||||
return new TranslateHttpLoader(http, `${base}/translations/`, `.json?v=${version}`);
|
return new TranslateHttpLoader(http, `${base}/translations/`, `.json?v=${version}`);
|
||||||
|
|
|
@ -82,9 +82,9 @@
|
||||||
[routerLink]="'/discover/collection/' + movie.belongsToCollection.id" mat-raised-button
|
[routerLink]="'/discover/collection/' + movie.belongsToCollection.id" mat-raised-button
|
||||||
class="spacing-below full-width mat-elevation-z8">{{movie.belongsToCollection.name}}</button>
|
class="spacing-below full-width mat-elevation-z8">{{movie.belongsToCollection.name}}</button>
|
||||||
|
|
||||||
<mat-card class="mat-elevation-z8 spacing-below" *ngIf="isAdmin && movieRequest">
|
<mat-card class="mat-elevation-z8 spacing-below" *ngIf="isAdmin && movieRequest && showAdvanced">
|
||||||
<mat-card-content class="medium-font">
|
<mat-card-content class="medium-font">
|
||||||
<movie-admin-panel [movie]="movieRequest" (advancedOptionsChange)="setAdvancedOptions($event)">
|
<movie-admin-panel [movie]="movieRequest" (radarrEnabledChange)="showAdvanced = $event" (advancedOptionsChange)="setAdvancedOptions($event)">
|
||||||
</movie-admin-panel>
|
</movie-admin-panel>
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
|
|
|
@ -21,6 +21,7 @@ export class MovieDetailsComponent {
|
||||||
public movieRequest: IMovieRequests;
|
public movieRequest: IMovieRequests;
|
||||||
public isAdmin: boolean;
|
public isAdmin: boolean;
|
||||||
public advancedOptions: IAdvancedData;
|
public advancedOptions: IAdvancedData;
|
||||||
|
public showAdvanced: boolean; // Set on the UI
|
||||||
|
|
||||||
private theMovidDbId: number;
|
private theMovidDbId: number;
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ export class MovieAdminPanelComponent implements OnInit {
|
||||||
|
|
||||||
@Input() public movie: IMovieRequests;
|
@Input() public movie: IMovieRequests;
|
||||||
@Output() public advancedOptionsChanged = new EventEmitter<IAdvancedData>();
|
@Output() public advancedOptionsChanged = new EventEmitter<IAdvancedData>();
|
||||||
|
@Output() public radarrEnabledChange = new EventEmitter<boolean>();
|
||||||
|
|
||||||
public radarrEnabled: boolean;
|
public radarrEnabled: boolean;
|
||||||
public radarrProfiles: IRadarrProfile[];
|
public radarrProfiles: IRadarrProfile[];
|
||||||
|
@ -34,6 +35,8 @@ export class MovieAdminPanelComponent implements OnInit {
|
||||||
this.setRootFolderOverrides();
|
this.setRootFolderOverrides();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.radarrEnabledChange.emit(this.radarrEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async openAdvancedOptions() {
|
public async openAdvancedOptions() {
|
||||||
|
|
|
@ -3,27 +3,20 @@ import { AuthService } from '../auth/auth.service';
|
||||||
|
|
||||||
import { HubConnection } from '@aspnet/signalr';
|
import { HubConnection } from '@aspnet/signalr';
|
||||||
import * as signalR from '@aspnet/signalr';
|
import * as signalR from '@aspnet/signalr';
|
||||||
import { PlatformLocation } from '@angular/common';
|
|
||||||
import { platformBrowser } from '@angular/platform-browser';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SignalRNotificationService {
|
export class SignalRNotificationService {
|
||||||
|
|
||||||
private hubConnection: HubConnection | undefined;
|
private hubConnection: HubConnection | undefined;
|
||||||
public Notification: EventEmitter<any>;
|
public Notification: EventEmitter<any>;
|
||||||
|
|
||||||
constructor(private authService: AuthService, private platform: PlatformLocation) {
|
constructor(private authService: AuthService) {
|
||||||
this.Notification = new EventEmitter<any>();
|
this.Notification = new EventEmitter<any>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public initialize(): void {
|
public initialize(): void {
|
||||||
|
|
||||||
this.stopConnection();
|
this.stopConnection();
|
||||||
let url = "/hubs/notification";
|
let url = "hubs/notification";
|
||||||
const baseUrl = this.platform.getBaseHrefFromDOM();
|
|
||||||
if(baseUrl !== null && baseUrl.length > 1) {
|
|
||||||
url = baseUrl + url;
|
|
||||||
}
|
|
||||||
this.hubConnection = new signalR.HubConnectionBuilder().withUrl(url, {
|
this.hubConnection = new signalR.HubConnectionBuilder().withUrl(url, {
|
||||||
accessTokenFactory: () => {
|
accessTokenFactory: () => {
|
||||||
return this.authService.getToken();
|
return this.authService.getToken();
|
||||||
|
|
|
@ -1,31 +1,16 @@
|
||||||
import { Component, OnInit, Input } from "@angular/core";
|
import { Component, Input } from "@angular/core";
|
||||||
import { Router } from "@angular/router";
|
|
||||||
|
|
||||||
import { PlatformLocation } from "@angular/common";
|
|
||||||
import { IdentityService } from "../../services";
|
|
||||||
import { NotificationService } from "../../services";
|
|
||||||
import { ICreateWizardUser } from "../../interfaces";
|
import { ICreateWizardUser } from "../../interfaces";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "wizard-local-admin",
|
selector: "wizard-local-admin",
|
||||||
templateUrl: "./createadmin.component.html",
|
templateUrl: "./createadmin.component.html",
|
||||||
})
|
})
|
||||||
export class CreateAdminComponent implements OnInit {
|
export class CreateAdminComponent {
|
||||||
|
|
||||||
@Input() user: ICreateWizardUser;
|
@Input() user: ICreateWizardUser;
|
||||||
|
|
||||||
public username: string;
|
public username: string;
|
||||||
public password: string;
|
public password: string;
|
||||||
public baseUrl: string;
|
|
||||||
|
|
||||||
|
|
||||||
constructor(private location: PlatformLocation) { }
|
|
||||||
|
|
||||||
public ngOnInit(): void {
|
|
||||||
const base = this.location.getBaseHrefFromDOM();
|
|
||||||
if (base.length > 1) {
|
|
||||||
this.baseUrl = base;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
import { Component, OnInit } from "@angular/core";
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { Router } from "@angular/router";
|
|
||||||
|
|
||||||
import { EmbyService } from "../../services";
|
import { EmbyService } from "../../services";
|
||||||
import { NotificationService } from "../../services";
|
import { NotificationService } from "../../services";
|
||||||
|
|
||||||
import { PlatformLocation } from "@angular/common";
|
|
||||||
import { IEmbySettings } from "../../interfaces";
|
import { IEmbySettings } from "../../interfaces";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -14,19 +12,12 @@ import { IEmbySettings } from "../../interfaces";
|
||||||
export class EmbyComponent implements OnInit {
|
export class EmbyComponent implements OnInit {
|
||||||
|
|
||||||
public embySettings: IEmbySettings;
|
public embySettings: IEmbySettings;
|
||||||
public baseUrl: string;
|
|
||||||
|
|
||||||
constructor(private embyService: EmbyService,
|
constructor(private embyService: EmbyService,
|
||||||
private router: Router,
|
private notificationService: NotificationService) {
|
||||||
private notificationService: NotificationService,
|
|
||||||
private location: PlatformLocation) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ngOnInit() {
|
public ngOnInit() {
|
||||||
const base = this.location.getBaseHrefFromDOM();
|
|
||||||
if (base.length > 1) {
|
|
||||||
this.baseUrl = base;
|
|
||||||
}
|
|
||||||
this.embySettings = {
|
this.embySettings = {
|
||||||
servers: [],
|
servers: [],
|
||||||
isJellyfin: false,
|
isJellyfin: false,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { Component, OnDestroy, OnInit } from "@angular/core";
|
import { Component, OnDestroy, OnInit } from "@angular/core";
|
||||||
import { Router } from "@angular/router";
|
import { Router } from "@angular/router";
|
||||||
|
|
||||||
import { PlatformLocation } from "@angular/common";
|
|
||||||
import { AuthService } from "../../auth/auth.service";
|
import { AuthService } from "../../auth/auth.service";
|
||||||
import { PlexOAuthService, PlexService, PlexTvService, SettingsService } from "../../services";
|
import { PlexOAuthService, PlexService, PlexTvService, SettingsService } from "../../services";
|
||||||
import { IdentityService, NotificationService } from "../../services";
|
import { IdentityService, NotificationService } from "../../services";
|
||||||
|
@ -15,7 +14,6 @@ export class PlexComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
public login: string;
|
public login: string;
|
||||||
public password: string;
|
public password: string;
|
||||||
public baseUrl: string;
|
|
||||||
public pinTimer: any;
|
public pinTimer: any;
|
||||||
|
|
||||||
private clientId: string;
|
private clientId: string;
|
||||||
|
@ -24,14 +22,10 @@ export class PlexComponent implements OnInit, OnDestroy {
|
||||||
private notificationService: NotificationService,
|
private notificationService: NotificationService,
|
||||||
private identityService: IdentityService, private plexTv: PlexTvService,
|
private identityService: IdentityService, private plexTv: PlexTvService,
|
||||||
private settingsService: SettingsService,
|
private settingsService: SettingsService,
|
||||||
private location: PlatformLocation, private authService: AuthService,
|
private authService: AuthService,
|
||||||
private plexOauth: PlexOAuthService, private store: StorageService) { }
|
private plexOauth: PlexOAuthService, private store: StorageService) { }
|
||||||
|
|
||||||
public ngOnInit(): void {
|
public ngOnInit(): void {
|
||||||
const base = this.location.getBaseHrefFromDOM();
|
|
||||||
if (base.length > 1) {
|
|
||||||
this.baseUrl = base;
|
|
||||||
}
|
|
||||||
this.settingsService.getClientId().subscribe(x => this.clientId = x);
|
this.settingsService.getClientId().subscribe(x => this.clientId = x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { PlatformLocation } from "@angular/common";
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { Component, OnInit } from "@angular/core";
|
|
||||||
import { Router } from "@angular/router";
|
import { Router } from "@angular/router";
|
||||||
import { ICreateWizardUser } from "../../interfaces";
|
import { ICreateWizardUser } from "../../interfaces";
|
||||||
import { IdentityService, NotificationService } from "../../services";
|
import { IdentityService, NotificationService } from "../../services";
|
||||||
|
@ -9,10 +8,9 @@ import { IdentityService, NotificationService } from "../../services";
|
||||||
})
|
})
|
||||||
export class WelcomeComponent implements OnInit {
|
export class WelcomeComponent implements OnInit {
|
||||||
|
|
||||||
public baseUrl: string;
|
|
||||||
public localUser: ICreateWizardUser;
|
public localUser: ICreateWizardUser;
|
||||||
|
|
||||||
constructor(private router: Router, private location: PlatformLocation,
|
constructor(private router: Router,
|
||||||
private identityService: IdentityService, private notificationService: NotificationService) { }
|
private identityService: IdentityService, private notificationService: NotificationService) { }
|
||||||
|
|
||||||
public ngOnInit(): void {
|
public ngOnInit(): void {
|
||||||
|
@ -21,10 +19,6 @@ export class WelcomeComponent implements OnInit {
|
||||||
username:"",
|
username:"",
|
||||||
usePlexAdminAccount:false
|
usePlexAdminAccount:false
|
||||||
}
|
}
|
||||||
const base = this.location.getBaseHrefFromDOM();
|
|
||||||
if (base.length > 1) {
|
|
||||||
this.baseUrl = base;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public createUser() {
|
public createUser() {
|
||||||
|
|
|
@ -2,23 +2,46 @@
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<script>
|
<script type='text/javascript'>
|
||||||
|
|
||||||
var base = "/";
|
function configExists(url) {
|
||||||
var locations = window.location.pathname.split('/');
|
var req = new XMLHttpRequest();
|
||||||
if(locations[1] !== 'login' && locations[1] !== 'discover') {
|
req.open('GET', url, false);
|
||||||
base = "/" + locations[1];
|
req.send();
|
||||||
}
|
return req.status==200;
|
||||||
document.write("<base href='" + base + "' />");
|
}
|
||||||
window["baseHref"] = base;
|
|
||||||
console.log(base);
|
debugger;
|
||||||
|
var probePath = 'main.js';
|
||||||
|
var origin = document.location.origin;
|
||||||
|
var pathSegments = document.location.pathname.split('/');
|
||||||
|
|
||||||
|
var basePath = '/'
|
||||||
|
var configFound = false;
|
||||||
|
for (var i = 0; i < pathSegments.length; i++) {
|
||||||
|
var segment = pathSegments[i];
|
||||||
|
if (segment.length > 0) {
|
||||||
|
basePath = basePath + segment + '/';
|
||||||
|
}
|
||||||
|
var fullPath = origin + basePath + probePath;
|
||||||
|
configFound = configExists(fullPath);
|
||||||
|
if (configFound) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var basePathToUse = basePath.substring(0, basePath.length - 1); // trim off the trailing '/'
|
||||||
|
window["baseHref"] = configFound ? basePathToUse : '/';
|
||||||
|
|
||||||
|
document.write("<base href='" + (configFound ? basePath : '/') + "' />");
|
||||||
|
|
||||||
|
console.log(window["baseHref"]);
|
||||||
</script>
|
</script>
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
|
||||||
<link href="/styles/please-wait.css" rel="stylesheet">
|
<link href="styles/please-wait.css" rel="stylesheet">
|
||||||
<link href="/styles/spinkit.css" rel="stylesheet">
|
<link href="styles/spinkit.css" rel="stylesheet">
|
||||||
<link href="/styles/11-folding-cube.css" rel="stylesheet">
|
<link href="styles/11-folding-cube.css" rel="stylesheet">
|
||||||
<script src="/styles/please-wait.js"></script>
|
<script src="styles/please-wait.js"></script>
|
||||||
<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" />
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ using Serilog;
|
||||||
using SQLitePCL;
|
using SQLitePCL;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using Microsoft.AspNetCore.StaticFiles.Infrastructure;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using ILogger = Serilog.ILogger;
|
using ILogger = Serilog.ILogger;
|
||||||
|
@ -120,12 +121,19 @@ namespace Ombi
|
||||||
|
|
||||||
var ctx = serviceProvider.GetService<OmbiContext>();
|
var ctx = serviceProvider.GetService<OmbiContext>();
|
||||||
loggerFactory.AddSerilog();
|
loggerFactory.AddSerilog();
|
||||||
|
|
||||||
app.UseSpaStaticFiles();
|
|
||||||
|
|
||||||
var ombiService =
|
var ombiService =
|
||||||
serviceProvider.GetService<ISettingsService<OmbiSettings>>();
|
serviceProvider.GetService<ISettingsService<OmbiSettings>>();
|
||||||
var settings = ombiService.GetSettings();
|
var settings = ombiService.GetSettings();
|
||||||
|
|
||||||
|
var sharedOptions = new SharedOptions();
|
||||||
|
if (settings.BaseUrl.HasValue())
|
||||||
|
{
|
||||||
|
sharedOptions.RequestPath = settings.BaseUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
app.UseSpaStaticFiles(new StaticFileOptions(sharedOptions));
|
||||||
|
|
||||||
|
|
||||||
if (settings.ApiKey.IsNullOrEmpty())
|
if (settings.ApiKey.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
// Generate a API Key
|
// Generate a API Key
|
||||||
|
@ -159,20 +167,20 @@ namespace Ombi
|
||||||
app.UsePathBase(settings.BaseUrl);
|
app.UsePathBase(settings.BaseUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the scheduler
|
// Setup the scheduler
|
||||||
//var jobSetup = app.ApplicationServices.GetService<IJobSetup>();
|
//var jobSetup = app.ApplicationServices.GetService<IJobSetup>();
|
||||||
//jobSetup.Setup();
|
//jobSetup.Setup();
|
||||||
ctx.Seed();
|
ctx.Seed();
|
||||||
var settingsctx = serviceProvider.GetService<SettingsContext>();
|
var settingsctx = serviceProvider.GetService<SettingsContext>();
|
||||||
settingsctx.Seed();
|
settingsctx.Seed();
|
||||||
|
|
||||||
var provider = new FileExtensionContentTypeProvider {Mappings = {[".map"] = "application/octet-stream"}};
|
var provider = new FileExtensionContentTypeProvider { Mappings = { [".map"] = "application/octet-stream" } };
|
||||||
|
|
||||||
app.UseStaticFiles(new StaticFileOptions()
|
app.UseStaticFiles(new StaticFileOptions()
|
||||||
{
|
{
|
||||||
ContentTypeProvider = provider,
|
ContentTypeProvider = provider,
|
||||||
});
|
});
|
||||||
|
|
||||||
app.UseMiddleware<ErrorHandlingMiddleware>();
|
app.UseMiddleware<ErrorHandlingMiddleware>();
|
||||||
app.UseMiddleware<ApiKeyMiddlewear>();
|
app.UseMiddleware<ApiKeyMiddlewear>();
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
|
@ -210,7 +218,7 @@ namespace Ombi
|
||||||
spa.UseProxyToSpaDevelopmentServer("http://localhost:3578");
|
spa.UseProxyToSpaDevelopmentServer("http://localhost:3578");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue