mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-13 00:32:57 -07:00
!wip added base url field in Ombi Settings #1513
This commit is contained in:
parent
ccb1bd30d0
commit
16a579d7fa
8 changed files with 42 additions and 13 deletions
|
@ -2,7 +2,7 @@
|
|||
{
|
||||
public class OmbiSettings : Models.Settings
|
||||
{
|
||||
//public string BaseUrl { get; set; }
|
||||
public string BaseUrl { get; set; }
|
||||
public bool CollectAnalyticData { get; set; }
|
||||
public bool Wizard { get; set; }
|
||||
public string ApiKey { get; set; }
|
||||
|
|
|
@ -9,7 +9,7 @@ export interface IExternalSettings extends ISettings {
|
|||
|
||||
export interface IOmbiSettings extends ISettings {
|
||||
port: number;
|
||||
//baseUrl:string,
|
||||
baseUrl: string;
|
||||
collectAnalyticData: boolean;
|
||||
wizard: boolean;
|
||||
apiKey: string;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<input type="text" class="form-control form-control-custom " id="externalUrl" name="externalUrl" placeholder="http://ombi.io/" formControlName="externalUrl" tooltipPosition="top" pTooltip="This will be the link that will be in any emails/notifications sent to the users.">
|
||||
</div>
|
||||
</div>-->
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<input type="checkbox" id="allowExternalUsersToAuthenticate" allowExternalUsersToAuthenticate="allowExternalUsersToAuthenticate" formControlName="allowExternalUsersToAuthenticate"
|
||||
|
@ -29,6 +29,13 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="baseUrl" class="control-label">Base Url</label>
|
||||
<div>
|
||||
<input type="text" class="form-control form-control-custom" id="baseUrl" name="baseUrl" placeholder="/ombi" formControlName="baseUrl">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="ApiKey" class="control-label">Api Key</label>
|
||||
<div class="input-group">
|
||||
|
@ -56,5 +63,6 @@
|
|||
<button [disabled]="form.invalid" type="submit" id="save" class="btn btn-primary-outline">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</fieldset>
|
|
@ -23,6 +23,7 @@ export class OmbiComponent implements OnInit {
|
|||
apiKey: [x.apiKey],
|
||||
externalUrl: [x.externalUrl],
|
||||
allowExternalUsersToAuthenticate: [x.allowExternalUsersToAuthenticate],
|
||||
baseUrl: [x.baseUrl],
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ using Swashbuckle.AspNetCore.Swagger;
|
|||
|
||||
namespace Ombi
|
||||
{
|
||||
public partial class Startup
|
||||
public class Startup
|
||||
{
|
||||
public Startup(IHostingEnvironment env)
|
||||
{
|
||||
|
@ -167,7 +167,7 @@ namespace Ombi
|
|||
|
||||
app.UseAuthentication();
|
||||
|
||||
//ApiKeyMiddlewear(app, serviceProvider);
|
||||
ApiKeyMiddlewear(app, serviceProvider);
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI(c =>
|
||||
{
|
||||
|
@ -210,11 +210,7 @@ namespace Ombi
|
|||
else
|
||||
{
|
||||
var identity = new GenericIdentity("API");
|
||||
identity.AddClaim(new System.Security.Claims.Claim("Origin", "Api"));
|
||||
identity.AddClaim(new System.Security.Claims.Claim("role", "Admin"));
|
||||
|
||||
var principal = new GenericPrincipal(identity, new[] { "ApiUser" });
|
||||
// TODO need to think about if I require a JWT Token here.
|
||||
var principal = new GenericPrincipal(identity, new[] {"Admin", "ApiUser"});
|
||||
context.User = principal;
|
||||
await next();
|
||||
}
|
||||
|
|
24
src/Ombi/TagHelpers/ReverseProxyTagHelper.cs
Normal file
24
src/Ombi/TagHelpers/ReverseProxyTagHelper.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
using Ombi.Core.Settings;
|
||||
using Ombi.Settings.Settings.Models;
|
||||
|
||||
namespace Ombi.TagHelpers
|
||||
{
|
||||
public class ReverseProxyTagHelper : TagHelper
|
||||
{
|
||||
public ReverseProxyTagHelper(ISettingsService<OmbiSettings> c)
|
||||
{
|
||||
_ctx = c;
|
||||
}
|
||||
|
||||
private readonly ISettingsService<OmbiSettings> _ctx;
|
||||
|
||||
public override void Process(TagHelperContext context, TagHelperOutput output)
|
||||
{
|
||||
output.TagName = "base";
|
||||
var s = _ctx.GetSettings();
|
||||
var baseUrl = string.IsNullOrEmpty(s.BaseUrl) ? "/" : s.BaseUrl;
|
||||
output.Attributes.SetAttribute("href", baseUrl);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,13 +4,13 @@
|
|||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Ombi</title>
|
||||
<base href="/" />
|
||||
@*<base href="/ombi" />*@
|
||||
<Reverse-Proxy></Reverse-Proxy>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||
<link rel="stylesheet" href="~/loading.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/dist/vendor.css" asp-append-version="true" />
|
||||
<script src="~/dist/vendor.js" asp-append-version="true" defer></script>
|
||||
<script src="~/dist/main.js" asp-append-version="true" defer></script>
|
||||
<mini-profiler />
|
||||
</head>
|
||||
<body>
|
||||
@RenderBody()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@using Ombi
|
||||
@addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers"
|
||||
@addTagHelper "*, Microsoft.AspNetCore.SpaServices"
|
||||
@*@addTagHelper *, MiniProfiler.AspNetCore.Mvc*@
|
||||
@addTagHelper *, Ombi
|
Loading…
Add table
Add a link
Reference in a new issue