1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-08 22:58:11 -05:00

set base admin path for self host

This commit is contained in:
Kyle Spearrin 2018-03-23 23:27:33 -04:00
parent 73a4af3f17
commit 997839a2c7
2 changed files with 11 additions and 1 deletions

View File

@ -7,6 +7,7 @@ using Bit.Core;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System.Linq;
namespace Bit.Admin.Controllers namespace Bit.Admin.Controllers
{ {
@ -52,7 +53,7 @@ namespace Bit.Admin.Controllers
foreach(var result in results) foreach(var result in results)
{ {
var name = result["name"].ToString(); var name = result["name"].ToString();
if(name != "latest" && name != "beta") if(name.Count(c => c == '.') > 2)
{ {
return new JsonResult(name); return new JsonResult(name);
} }

View File

@ -69,6 +69,15 @@ namespace Bit.Admin
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();
} }
if(globalSettings.SelfHosted)
{
app.Use(async (context, next) =>
{
context.Request.PathBase = "/admin";
await next.Invoke();
});
}
app.UseAuthentication(); app.UseAuthentication();
app.UseStaticFiles(); app.UseStaticFiles();
app.UseMvcWithDefaultRoute(); app.UseMvcWithDefaultRoute();