mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 12:59:39 -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
|
||||
export function HttpLoaderFactory(http: HttpClient, platformLocation: PlatformLocation) {
|
||||
// const base = getBaseLocation();
|
||||
const base = platformLocation.getBaseHrefFromDOM();
|
||||
const base = window["baseHref"];
|
||||
const version = Math.floor(Math.random() * 999999999);
|
||||
if (base !== null && base.length > 1) {
|
||||
return new TranslateHttpLoader(http, `${base}/translations/`, `.json?v=${version}`);
|
||||
|
|
|
@ -82,9 +82,9 @@
|
|||
[routerLink]="'/discover/collection/' + movie.belongsToCollection.id" mat-raised-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">
|
||||
<movie-admin-panel [movie]="movieRequest" (advancedOptionsChange)="setAdvancedOptions($event)">
|
||||
<movie-admin-panel [movie]="movieRequest" (radarrEnabledChange)="showAdvanced = $event" (advancedOptionsChange)="setAdvancedOptions($event)">
|
||||
</movie-admin-panel>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
|
|
|
@ -21,6 +21,7 @@ export class MovieDetailsComponent {
|
|||
public movieRequest: IMovieRequests;
|
||||
public isAdmin: boolean;
|
||||
public advancedOptions: IAdvancedData;
|
||||
public showAdvanced: boolean; // Set on the UI
|
||||
|
||||
private theMovidDbId: number;
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ export class MovieAdminPanelComponent implements OnInit {
|
|||
|
||||
@Input() public movie: IMovieRequests;
|
||||
@Output() public advancedOptionsChanged = new EventEmitter<IAdvancedData>();
|
||||
@Output() public radarrEnabledChange = new EventEmitter<boolean>();
|
||||
|
||||
public radarrEnabled: boolean;
|
||||
public radarrProfiles: IRadarrProfile[];
|
||||
|
@ -34,6 +35,8 @@ export class MovieAdminPanelComponent implements OnInit {
|
|||
this.setRootFolderOverrides();
|
||||
});
|
||||
}
|
||||
|
||||
this.radarrEnabledChange.emit(this.radarrEnabled);
|
||||
}
|
||||
|
||||
public async openAdvancedOptions() {
|
||||
|
|
|
@ -3,27 +3,20 @@ import { AuthService } from '../auth/auth.service';
|
|||
|
||||
import { HubConnection } from '@aspnet/signalr';
|
||||
import * as signalR from '@aspnet/signalr';
|
||||
import { PlatformLocation } from '@angular/common';
|
||||
import { platformBrowser } from '@angular/platform-browser';
|
||||
|
||||
@Injectable()
|
||||
export class SignalRNotificationService {
|
||||
|
||||
private hubConnection: HubConnection | undefined;
|
||||
public Notification: EventEmitter<any>;
|
||||
|
||||
constructor(private authService: AuthService, private platform: PlatformLocation) {
|
||||
constructor(private authService: AuthService) {
|
||||
this.Notification = new EventEmitter<any>();
|
||||
}
|
||||
|
||||
public initialize(): void {
|
||||
|
||||
this.stopConnection();
|
||||
let url = "/hubs/notification";
|
||||
const baseUrl = this.platform.getBaseHrefFromDOM();
|
||||
if(baseUrl !== null && baseUrl.length > 1) {
|
||||
url = baseUrl + url;
|
||||
}
|
||||
let url = "hubs/notification";
|
||||
this.hubConnection = new signalR.HubConnectionBuilder().withUrl(url, {
|
||||
accessTokenFactory: () => {
|
||||
return this.authService.getToken();
|
||||
|
|
|
@ -1,31 +1,16 @@
|
|||
import { Component, OnInit, Input } from "@angular/core";
|
||||
import { Router } from "@angular/router";
|
||||
|
||||
import { PlatformLocation } from "@angular/common";
|
||||
import { IdentityService } from "../../services";
|
||||
import { NotificationService } from "../../services";
|
||||
import { Component, Input } from "@angular/core";
|
||||
import { ICreateWizardUser } from "../../interfaces";
|
||||
|
||||
@Component({
|
||||
selector: "wizard-local-admin",
|
||||
templateUrl: "./createadmin.component.html",
|
||||
})
|
||||
export class CreateAdminComponent implements OnInit {
|
||||
export class CreateAdminComponent {
|
||||
|
||||
@Input() user: ICreateWizardUser;
|
||||
|
||||
public username: 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;
|
||||
}
|
||||
}
|
||||
public password: string;
|
||||
|
||||
constructor() { }
|
||||
}
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import { Component, OnInit } from "@angular/core";
|
||||
import { Router } from "@angular/router";
|
||||
|
||||
import { EmbyService } from "../../services";
|
||||
import { NotificationService } from "../../services";
|
||||
|
||||
import { PlatformLocation } from "@angular/common";
|
||||
import { IEmbySettings } from "../../interfaces";
|
||||
|
||||
@Component({
|
||||
|
@ -14,19 +12,12 @@ import { IEmbySettings } from "../../interfaces";
|
|||
export class EmbyComponent implements OnInit {
|
||||
|
||||
public embySettings: IEmbySettings;
|
||||
public baseUrl: string;
|
||||
|
||||
constructor(private embyService: EmbyService,
|
||||
private router: Router,
|
||||
private notificationService: NotificationService,
|
||||
private location: PlatformLocation) {
|
||||
private notificationService: NotificationService) {
|
||||
}
|
||||
|
||||
public ngOnInit() {
|
||||
const base = this.location.getBaseHrefFromDOM();
|
||||
if (base.length > 1) {
|
||||
this.baseUrl = base;
|
||||
}
|
||||
this.embySettings = {
|
||||
servers: [],
|
||||
isJellyfin: false,
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { Component, OnDestroy, OnInit } from "@angular/core";
|
||||
import { Router } from "@angular/router";
|
||||
|
||||
import { PlatformLocation } from "@angular/common";
|
||||
import { AuthService } from "../../auth/auth.service";
|
||||
import { PlexOAuthService, PlexService, PlexTvService, SettingsService } from "../../services";
|
||||
import { IdentityService, NotificationService } from "../../services";
|
||||
|
@ -15,7 +14,6 @@ export class PlexComponent implements OnInit, OnDestroy {
|
|||
|
||||
public login: string;
|
||||
public password: string;
|
||||
public baseUrl: string;
|
||||
public pinTimer: any;
|
||||
|
||||
private clientId: string;
|
||||
|
@ -24,14 +22,10 @@ export class PlexComponent implements OnInit, OnDestroy {
|
|||
private notificationService: NotificationService,
|
||||
private identityService: IdentityService, private plexTv: PlexTvService,
|
||||
private settingsService: SettingsService,
|
||||
private location: PlatformLocation, private authService: AuthService,
|
||||
private authService: AuthService,
|
||||
private plexOauth: PlexOAuthService, private store: StorageService) { }
|
||||
|
||||
public ngOnInit(): void {
|
||||
const base = this.location.getBaseHrefFromDOM();
|
||||
if (base.length > 1) {
|
||||
this.baseUrl = base;
|
||||
}
|
||||
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 { ICreateWizardUser } from "../../interfaces";
|
||||
import { IdentityService, NotificationService } from "../../services";
|
||||
|
@ -9,10 +8,9 @@ import { IdentityService, NotificationService } from "../../services";
|
|||
})
|
||||
export class WelcomeComponent implements OnInit {
|
||||
|
||||
public baseUrl: string;
|
||||
public localUser: ICreateWizardUser;
|
||||
|
||||
constructor(private router: Router, private location: PlatformLocation,
|
||||
constructor(private router: Router,
|
||||
private identityService: IdentityService, private notificationService: NotificationService) { }
|
||||
|
||||
public ngOnInit(): void {
|
||||
|
@ -21,10 +19,6 @@ export class WelcomeComponent implements OnInit {
|
|||
username:"",
|
||||
usePlexAdminAccount:false
|
||||
}
|
||||
const base = this.location.getBaseHrefFromDOM();
|
||||
if (base.length > 1) {
|
||||
this.baseUrl = base;
|
||||
}
|
||||
}
|
||||
|
||||
public createUser() {
|
||||
|
|
|
@ -2,23 +2,46 @@
|
|||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<script>
|
||||
<script type='text/javascript'>
|
||||
|
||||
var base = "/";
|
||||
var locations = window.location.pathname.split('/');
|
||||
if(locations[1] !== 'login' && locations[1] !== 'discover') {
|
||||
base = "/" + locations[1];
|
||||
}
|
||||
document.write("<base href='" + base + "' />");
|
||||
window["baseHref"] = base;
|
||||
console.log(base);
|
||||
function configExists(url) {
|
||||
var req = new XMLHttpRequest();
|
||||
req.open('GET', url, false);
|
||||
req.send();
|
||||
return req.status==200;
|
||||
}
|
||||
|
||||
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>
|
||||
<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="/styles/please-wait.css" rel="stylesheet">
|
||||
<link href="/styles/spinkit.css" rel="stylesheet">
|
||||
<link href="/styles/11-folding-cube.css" rel="stylesheet">
|
||||
<script src="/styles/please-wait.js"></script>
|
||||
<link href="styles/please-wait.css" rel="stylesheet">
|
||||
<link href="styles/spinkit.css" rel="stylesheet">
|
||||
<link href="styles/11-folding-cube.css" rel="stylesheet">
|
||||
<script src="styles/please-wait.js"></script>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ using Serilog;
|
|||
using SQLitePCL;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.AspNetCore.StaticFiles.Infrastructure;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Newtonsoft.Json;
|
||||
using ILogger = Serilog.ILogger;
|
||||
|
@ -120,12 +121,19 @@ namespace Ombi
|
|||
|
||||
var ctx = serviceProvider.GetService<OmbiContext>();
|
||||
loggerFactory.AddSerilog();
|
||||
|
||||
app.UseSpaStaticFiles();
|
||||
|
||||
var ombiService =
|
||||
serviceProvider.GetService<ISettingsService<OmbiSettings>>();
|
||||
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())
|
||||
{
|
||||
// Generate a API Key
|
||||
|
@ -159,20 +167,20 @@ namespace Ombi
|
|||
app.UsePathBase(settings.BaseUrl);
|
||||
}
|
||||
|
||||
// Setup the scheduler
|
||||
// Setup the scheduler
|
||||
//var jobSetup = app.ApplicationServices.GetService<IJobSetup>();
|
||||
//jobSetup.Setup();
|
||||
ctx.Seed();
|
||||
var settingsctx = serviceProvider.GetService<SettingsContext>();
|
||||
settingsctx.Seed();
|
||||
|
||||
var provider = new FileExtensionContentTypeProvider {Mappings = {[".map"] = "application/octet-stream"}};
|
||||
var provider = new FileExtensionContentTypeProvider { Mappings = { [".map"] = "application/octet-stream" } };
|
||||
|
||||
app.UseStaticFiles(new StaticFileOptions()
|
||||
{
|
||||
ContentTypeProvider = provider,
|
||||
});
|
||||
|
||||
|
||||
app.UseMiddleware<ErrorHandlingMiddleware>();
|
||||
app.UseMiddleware<ApiKeyMiddlewear>();
|
||||
app.UseRouting();
|
||||
|
@ -210,7 +218,7 @@ namespace Ombi
|
|||
spa.UseProxyToSpaDevelopmentServer("http://localhost:3578");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue