From 730c62818ed93ac4bc90b04665196675be1361de Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 7 Sep 2013 11:58:47 -0400 Subject: [PATCH] add http server port number to system info --- MediaBrowser.Model/System/SystemInfo.cs | 8 ++++++- .../ApplicationHost.cs | 3 ++- MediaBrowser.WebDashboard/ApiClient.js | 21 +++++++------------ MediaBrowser.WebDashboard/packages.config | 2 +- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/MediaBrowser.Model/System/SystemInfo.cs b/MediaBrowser.Model/System/SystemInfo.cs index e605a5daa7..959ec44c8b 100644 --- a/MediaBrowser.Model/System/SystemInfo.cs +++ b/MediaBrowser.Model/System/SystemInfo.cs @@ -72,7 +72,13 @@ namespace MediaBrowser.Model.System /// /// The program data path. public string ProgramDataPath { get; set; } - + + /// + /// Gets or sets the HTTP server port number. + /// + /// The HTTP server port number. + public int HttpServerPortNumber { get; set; } + /// /// Initializes a new instance of the class. /// diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs index 61bf0a0d14..3224205451 100644 --- a/MediaBrowser.ServerApplication/ApplicationHost.cs +++ b/MediaBrowser.ServerApplication/ApplicationHost.cs @@ -607,7 +607,8 @@ namespace MediaBrowser.ServerApplication CompletedInstallations = InstallationManager.CompletedInstallations.ToArray(), Id = _systemId, ProgramDataPath = ApplicationPaths.ProgramDataPath, - MacAddress = GetMacAddress() + MacAddress = GetMacAddress(), + HttpServerPortNumber = ServerConfigurationManager.Configuration.HttpServerPortNumber }; } diff --git a/MediaBrowser.WebDashboard/ApiClient.js b/MediaBrowser.WebDashboard/ApiClient.js index af785eb3e8..4bdd3f7795 100644 --- a/MediaBrowser.WebDashboard/ApiClient.js +++ b/MediaBrowser.WebDashboard/ApiClient.js @@ -20,9 +20,6 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { if (!serverHostName) { throw new Error("Must supply serverHostName, e.g. 192.168.1.1 or myServerName"); } - if (!serverPortNumber) { - throw new Error("Must supply a serverPortNumber"); - } var self = this; var deviceName = "Web Browser"; @@ -38,14 +35,6 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { return serverHostName; }; - /** - * Gets the server port number. - */ - self.serverPortNumber = function () { - - return serverPortNumber; - }; - /** * Gets or sets the current user id. */ @@ -152,7 +141,13 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { throw new Error("Url name cannot be empty"); } - var url = serverProtocol + "//" + serverHostName + ":" + serverPortNumber + "/mediabrowser/" + name; + var url = serverProtocol + "//" + serverHostName; + + if (serverPortNumber) { + url += ":" + serverPortNumber; + } + + url += "/mediabrowser/" + name; if (params) { url += "?" + $.param(params); @@ -3384,7 +3379,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { var deferred = $.Deferred(); - var msgData = itemId + "|" + (positionTicks == null ? "" : positionTicks) + "|" + (isPaused == null ? "" : isPaused) + "|" + (isMuted == null ? "" : isMuted); + var msgData = itemId + "|" + (positionTicks == null ? "" : positionTicks) + "|" + (isPaused == null ? "" : isPaused) + "|" + (isMuted == null ? "" : isMuted); self.sendWebSocketMessage("PlaybackProgress", msgData); diff --git a/MediaBrowser.WebDashboard/packages.config b/MediaBrowser.WebDashboard/packages.config index 395c46b566..f111dfc5aa 100644 --- a/MediaBrowser.WebDashboard/packages.config +++ b/MediaBrowser.WebDashboard/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file