From 91e1db06f271e55586504f7a56c0b91e5685eaa9 Mon Sep 17 00:00:00 2001 From: Jamie Rees Date: Thu, 4 Apr 2019 22:21:44 +0100 Subject: [PATCH] try a different way of the reverse proxy --- src/Ombi/.vscode/launch.json | 58 +++++++++------------- src/Ombi/ClientApp/src/app/app.module.ts | 14 +++--- src/Ombi/ClientApp/src/index.html | 63 +++++++----------------- 3 files changed, 48 insertions(+), 87 deletions(-) diff --git a/src/Ombi/.vscode/launch.json b/src/Ombi/.vscode/launch.json index de90bc712..0a45aaea0 100644 --- a/src/Ombi/.vscode/launch.json +++ b/src/Ombi/.vscode/launch.json @@ -1,41 +1,27 @@ { "version": "0.2.0", "configurations": [ - { - "name": ".NET Core Launch", - "type": "coreclr", - "request": "launch", - "preLaunchTask": "build", - "program": "${workspaceRoot}/bin/Debug/netcoreapp2.0/Ombi.dll", - "args": [], - "cwd": "${workspaceRoot}", - "stopAtEntry": false, - "launchBrowser": { - "enabled": true, - "args": "${auto-detect-url}", - "windows": { - "command": "cmd.exe", - "args": "/C start ${auto-detect-url}" - }, - "osx": { - "command": "open" - }, - "linux": { - "command": "xdg-open" - } - }, - "env": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "sourceFileMap": { - "/Views": "${workspaceRoot}/Views" - } - }, - { - "name": ".NET Core Attach", - "type": "coreclr", - "request": "attach", - "processId": "${command:pickProcess}" + { + "name": "ng serve", + "type": "chrome", + "request": "launch", + "preLaunchTask": "npm: start", + "url": "http://localhost:3578/", + "webRoot": "${workspaceFolder}" + }, + { + "name": "ng test", + "type": "chrome", + "request": "launch", + "url": "http://localhost:9876/debug.html", + "webRoot": "${workspaceFolder}", + "sourceMaps": true, + "sourceMapPathOverrides": { + "/./*": "${webRoot}/*", + "/src/*": "${webRoot}/*", + "/*": "*", + "/./~/*": "${webRoot}/node_modules/*" } + }, ] -} \ No newline at end of file + } \ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/app.module.ts b/src/Ombi/ClientApp/src/app/app.module.ts index 819fb98e8..cabdf1646 100644 --- a/src/Ombi/ClientApp/src/app/app.module.ts +++ b/src/Ombi/ClientApp/src/app/app.module.ts @@ -79,8 +79,9 @@ const routes: Routes = [ ]; // AoT requires an exported function for factories -export function HttpLoaderFactory(http: HttpClient) { - const base = getBaseLocation(); +export function HttpLoaderFactory(http: HttpClient, platformLocation: PlatformLocation) { + // const base = getBaseLocation(); + const base = platformLocation.getBaseHrefFromDOM(); const version = Math.floor(Math.random() * 999999999); if (base.length > 1) { return new TranslateHttpLoader(http, `${base}/translations/`, `.json?v=${version}`); @@ -175,10 +176,11 @@ export function JwtTokenGetter() { SearchService, SearchV2Service, MessageService, - { - provide: APP_BASE_HREF, - useFactory: getBaseLocation - } + { provide: APP_BASE_HREF, useValue: window['_app_base'] || '/' } + // { + // provide: APP_BASE_HREF, + // useFactory: getBaseLocation + // } ], bootstrap: [AppComponent], }) diff --git a/src/Ombi/ClientApp/src/index.html b/src/Ombi/ClientApp/src/index.html index 6445278d6..da162d0d7 100644 --- a/src/Ombi/ClientApp/src/index.html +++ b/src/Ombi/ClientApp/src/index.html @@ -2,53 +2,26 @@ - - + window['_app_base'] = base; + document.write(""); +