mirror of
https://gitlab.com/openlp/web-remote.git
synced 2024-12-22 03:22:48 +00:00
Merge branch 'get-port-from-url' into 'master'
Get the remote api port from the url See merge request openlp/web-remote!1
This commit is contained in:
commit
f08a80e3bd
@ -2,10 +2,10 @@ import { Injectable, EventEmitter } from '@angular/core';
|
|||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { URLSearchParams, Http } from '@angular/http';
|
import { URLSearchParams, Http } from '@angular/http';
|
||||||
|
|
||||||
|
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { map, take } from 'rxjs/operators';
|
import { map, take } from 'rxjs/operators';
|
||||||
import { PluginDescription, State, Slide, ServiceItem } from './responses';
|
import { PluginDescription, State, Slide, ServiceItem } from './responses';
|
||||||
|
import { environment } from '../environments/environment';
|
||||||
|
|
||||||
let deserialize = (json, cls) => {
|
let deserialize = (json, cls) => {
|
||||||
var inst = new cls();
|
var inst = new cls();
|
||||||
@ -20,11 +20,19 @@ let deserialize = (json, cls) => {
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class OpenLPService {
|
export class OpenLPService {
|
||||||
private apiURL: string = 'http://localhost:4316';
|
private apiURL: string;
|
||||||
|
|
||||||
public stateChanged$: EventEmitter<State>;
|
public stateChanged$: EventEmitter<State>;
|
||||||
|
|
||||||
constructor(private http: HttpClient) {
|
constructor(private http: HttpClient) {
|
||||||
|
let port: string;
|
||||||
|
if (environment.production) {
|
||||||
|
port = window.location.port;
|
||||||
|
} else {
|
||||||
|
port = '4316';
|
||||||
|
}
|
||||||
|
this.apiURL = `http://localhost:${port}`;
|
||||||
|
|
||||||
this.stateChanged$ = new EventEmitter<State>();
|
this.stateChanged$ = new EventEmitter<State>();
|
||||||
let state:State = null;
|
let state:State = null;
|
||||||
let ws:WebSocket = new WebSocket('ws://localhost:4317/state')
|
let ws:WebSocket = new WebSocket('ws://localhost:4317/state')
|
||||||
|
Loading…
Reference in New Issue
Block a user