Skip to content

Commit

Permalink
Merge pull request #6156 from jeremy-farrance/personabar-systeminfo-w…
Browse files Browse the repository at this point in the history
…eb-enhancement

PersonaBar, Settings, Servers, System Info, Web subtab - Adds the .NET Framework Product Version
  • Loading branch information
valadas authored Oct 15, 2024
2 parents 87cbd77 + a9932aa commit 2edb5da
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,25 @@ class Web extends Component {
tooltip={Localization.get("ServerInfo_IISVersion.Help")}
text={props.webServerInfo.iisVersion || defaultPlaceHolder} />

<InfoBlock label={Localization.get("ServerInfo_Framework")}
tooltip={Localization.get("ServerInfo_Framework.Help")}
text={props.webServerInfo.framework || defaultPlaceHolder} />
<InfoBlock label={Localization.get("ServerInfo_Framework")}
tooltip={Localization.get("ServerInfo_Framework.Help")}
text={props.webServerInfo.framework || defaultPlaceHolder} />

<InfoBlock label={Localization.get("ServerInfo_Framework_Product")}
tooltip={Localization.get("ServerInfo_Framework_Product.Help")}
text={props.webServerInfo.netFrameworkVersion || defaultPlaceHolder} />

<div className="tooltipAdjustment">
<InfoBlock label={Localization.get("ServerInfo_Identity")}
tooltip={Localization.get("ServerInfo_Identity.Help")}
text={props.webServerInfo.identity || defaultPlaceHolder} />
</div>

</div>
<div>
<InfoBlock label={Localization.get("ServerInfo_HostName")}
tooltip={Localization.get("ServerInfo_HostName.Help")}
text={props.webServerInfo.hostName || defaultPlaceHolder} />
</div>
<div>

<InfoBlock label={Localization.get("ServerInfo_PhysicalPath")}
tooltip={Localization.get("ServerInfo_PhysicalPath.Help")}
text={props.webServerInfo.physicalPath || defaultPlaceHolder} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const sendTestEmail = function (parameters) {
return serviceFramework.post(getControllerName(), "SendTestEmail", parameters);
};

const getOAuthProviders = function(){
const getOAuthProviders = function () {
return serviceFramework.get(getControllerName(), "GetSmtpOAuthProviders");
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,35 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information

namespace Dnn.PersonaBar.Servers.Components.WebServer
{
using System;
using System.Net;
using System.Security.Principal;
using System.Web;

using DotNetNuke.Common;

public class ServerInfo
{
public string Framework => Environment.Version.ToString();

public string HostName => Dns.GetHostName();

public string Identity => WindowsIdentity.GetCurrent().Name;

public string IISVersion => HttpContext.Current.Request.ServerVariables["SERVER_SOFTWARE"];

public string OSVersion => Environment.OSVersion.ToString();

public string PhysicalPath => Globals.ApplicationMapPath;

public string Url => Globals.GetDomainName(HttpContext.Current.Request);

public string RelativePath => string.IsNullOrEmpty(Globals.ApplicationPath) ? "/" : Globals.ApplicationPath;

public string ServerTime => DateTime.Now.ToString();
}
}
namespace Dnn.PersonaBar.Servers.Components.WebServer
{
using System;
using System.Net;
using System.Security.Principal;
using System.Web;

using DotNetNuke.Common;

public class ServerInfo
{
public string Framework => Environment.Version.ToString();

public string NetFrameworkVersion => Globals.NETFrameworkVersion.ToString(3);

public string HostName => Dns.GetHostName();

public string Identity => WindowsIdentity.GetCurrent().Name;

public string IISVersion => HttpContext.Current.Request.ServerVariables["SERVER_SOFTWARE"];

public string OSVersion => Environment.OSVersion.ToString();

public string PhysicalPath => Globals.ApplicationMapPath;

public string Url => Globals.GetDomainName(HttpContext.Current.Request);

public string RelativePath => string.IsNullOrEmpty(Globals.ApplicationPath) ? "/" : Globals.ApplicationPath;

public string ServerTime => DateTime.Now.ToString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,9 @@
<Content Include="admin\personaBar\Dnn.Licensing\App_LocalResources\Licensing.resx" />
<Content Include="admin\personaBar\Dnn.Security\App_LocalResources\Security.resx" />
<Content Include="admin\personaBar\Dnn.Seo\App_LocalResources\Seo.resx" />
<Content Include="admin\personaBar\Dnn.Servers\App_LocalResources\Servers.resx" />
<Content Include="admin\personaBar\Dnn.Servers\App_LocalResources\Servers.resx">
<SubType>Designer</SubType>
</Content>
<Content Include="admin\personaBar\Dnn.SiteImportExport\App_LocalResources\SiteImportExport.resx" />
<Content Include="admin\personaBar\Dnn.SiteSettings\App_LocalResources\SiteSettings.resx" />
<Content Include="admin\personaBar\Dnn.SqlConsole\App_LocalResources\SqlConsole.resx" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,49 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information

namespace Dnn.PersonaBar.Servers.Services
{
using System;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace Dnn.PersonaBar.Servers.Services
{
using System;
using System.Net;
using System.Net.Http;
using System.Web.Http;

using Dnn.PersonaBar.Library;
using Dnn.PersonaBar.Library.Attributes;
using Dnn.PersonaBar.Servers.Components.WebServer;
using DotNetNuke.Instrumentation;
using Dnn.PersonaBar.Library;
using Dnn.PersonaBar.Library.Attributes;
using Dnn.PersonaBar.Servers.Components.WebServer;
using DotNetNuke.Instrumentation;

[MenuPermission(Scope = ServiceScope.Host)]
public class SystemInfoWebController : PersonaBarApiController
{
private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SystemInfoWebController));

[MenuPermission(Scope = ServiceScope.Host)]
public class SystemInfoWebController : PersonaBarApiController
{
private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SystemInfoWebController));

[HttpGet]

public HttpResponseMessage GetWebServerInfo()
{
try
{
var serverInfo = new ServerInfo();
return this.Request.CreateResponse(HttpStatusCode.OK, new
{
osVersion = serverInfo.OSVersion,
iisVersion = serverInfo.IISVersion,
framework = serverInfo.Framework,
identity = serverInfo.Identity,
hostName = serverInfo.HostName,
physicalPath = serverInfo.PhysicalPath,
url = serverInfo.Url,
relativePath = serverInfo.RelativePath,
serverTime = serverInfo.ServerTime,
});
}
catch (Exception exc)
{
Logger.Error(exc);
return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc);
}
}
}
}
public HttpResponseMessage GetWebServerInfo()
{
try
{
var serverInfo = new ServerInfo();
return this.Request.CreateResponse(HttpStatusCode.OK, new
{
osVersion = serverInfo.OSVersion,
iisVersion = serverInfo.IISVersion,
framework = serverInfo.Framework,
netFrameworkVersion = serverInfo.NetFrameworkVersion,
identity = serverInfo.Identity,
hostName = serverInfo.HostName,
physicalPath = serverInfo.PhysicalPath,
url = serverInfo.Url,
relativePath = serverInfo.RelativePath,
serverTime = serverInfo.ServerTime,
});
}
catch (Exception exc)
{
Logger.Error(exc);
return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,16 @@
<value>Web</value>
</data>
<data name="ServerInfo_Framework.Help" xml:space="preserve">
<value>The version of .NET.</value>
<value>This is the CLR version. The first two parts (e.g. 4.0) indicates the major version of the CLR, and remaining is the build number.</value>
</data>
<data name="ServerInfo_Framework.Text" xml:space="preserve">
<value>.NET Framework Version:</value>
<value>.NET Framework CLR Version:</value>
</data>
<data name="ServerInfo_Framework_Product.Help" xml:space="preserve">
<value>This is the version number that is typically used to refer to the .NET Framework as a product (e.g. 4.8.1).</value>
</data>
<data name="ServerInfo_Framework_Product.Text" xml:space="preserve">
<value>.NET Framework Product Version:</value>
</data>
<data name="ServerInfo_HostName.Help" xml:space="preserve">
<value>The name of the Host computer.</value>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/

0 comments on commit 2edb5da

Please sign in to comment.