mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 13:23:20 -07:00
Fixed the SignalR notification base url
This commit is contained in:
parent
11f91de16b
commit
e7422d8845
3 changed files with 13 additions and 43 deletions
|
@ -83,7 +83,7 @@ const routes: Routes = [
|
|||
// AoT requires an exported function for factories
|
||||
export function HttpLoaderFactory(http: HttpClient, platformLocation: PlatformLocation) {
|
||||
// const base = getBaseLocation();
|
||||
const base = '/' + (window.location.pathname.split('/')[1] || '')
|
||||
const base = platformLocation.getBaseHrefFromDOM();
|
||||
const version = Math.floor(Math.random() * 999999999);
|
||||
if (base !== null && base.length > 1) {
|
||||
return new TranslateHttpLoader(http, `${base}/translations/`, `.json?v=${version}`);
|
||||
|
|
|
@ -3,6 +3,8 @@ 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 {
|
||||
|
@ -10,15 +12,19 @@ export class SignalRNotificationService {
|
|||
private hubConnection: HubConnection | undefined;
|
||||
public Notification: EventEmitter<any>;
|
||||
|
||||
constructor(private authService: AuthService) {
|
||||
constructor(private authService: AuthService, private platform: PlatformLocation) {
|
||||
this.Notification = new EventEmitter<any>();
|
||||
}
|
||||
|
||||
public initialize(): void {
|
||||
|
||||
this.stopConnection();
|
||||
|
||||
this.hubConnection = new signalR.HubConnectionBuilder().withUrl("/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, {
|
||||
accessTokenFactory: () => {
|
||||
return this.authService.getToken();
|
||||
}
|
||||
|
|
|
@ -3,45 +3,9 @@
|
|||
|
||||
<head>
|
||||
<script>
|
||||
// manually sets the <base> tag's href attribute so the app can be located in places other than root
|
||||
|
||||
// var split = location.pathname.split('/');
|
||||
// var base = "";
|
||||
// var invalidProxies = ['DISCOVER',
|
||||
// 'REQUESTS-LIST',
|
||||
// 'DETAILS',
|
||||
// 'SETTINGS',
|
||||
// 'ISSUES',
|
||||
// 'USERMANAGEMENT',
|
||||
// 'RECENTLYADDED',
|
||||
// 'DETAILS',
|
||||
// 'VOTE',
|
||||
// 'LOGIN',
|
||||
// 'LANDINGPAGE',
|
||||
// 'TOKEN',
|
||||
// 'RESET',
|
||||
// 'CUSTOM',
|
||||
// 'AUTH',
|
||||
// 'WIZARD',
|
||||
// "CALENDAR"
|
||||
// ]
|
||||
// for (var i = 0; i < split.length - 1; i++) {
|
||||
// if( invalidProxies.indexOf(split[i].toUpperCase()) !== -1) {
|
||||
// break;
|
||||
// }
|
||||
// base += split[i];
|
||||
// if(base.length > 1) {
|
||||
// break;
|
||||
// }
|
||||
// if (i < split.length - 2) {
|
||||
// base += "/";
|
||||
// }
|
||||
// }
|
||||
// if(base === "") {
|
||||
// base = "/";
|
||||
// }
|
||||
// window['_app_base'] = base;
|
||||
// document.write("<base href='" + base + "' />");
|
||||
|
||||
var base = "/"+ (window.location.pathname.split('/')[1] || '');
|
||||
document.write("<base href='" + base + "' />");
|
||||
</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">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue