mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
More build versioning changes #865
This commit is contained in:
parent
302f7ca285
commit
2535645a90
6 changed files with 36 additions and 26 deletions
13
build.cake
13
build.cake
|
@ -58,7 +58,7 @@ Task("Clean")
|
|||
.Does(() =>
|
||||
{
|
||||
CleanDirectory(buildDir);
|
||||
CleanDirectory(nodeModulesDir);
|
||||
//CleanDirectory(nodeModulesDir);
|
||||
CleanDirectory(wwwRootDistDir);
|
||||
});
|
||||
|
||||
|
@ -80,8 +80,15 @@ Task("SetVersionInfo")
|
|||
|
||||
Information("GitResults -> {0}", versionInfo.Dump());
|
||||
|
||||
buildSettings.ArgumentCustomization = args => args.Append("/p:SemVer=" + versionInfo.BuildMetaData);
|
||||
publishSettings.ArgumentCustomization = args => args.Append("/p:SemVer=" + versionInfo.BuildMetaData);
|
||||
var fullVer = versionInfo.MajorMinorPatch + "-" + versionInfo.BranchName + "-" + versionInfo.BuildMetaData;
|
||||
|
||||
|
||||
buildSettings.ArgumentCustomization = args => args.Append("/p:SemVer=" + versionInfo.AssemblySemVer);
|
||||
buildSettings.ArgumentCustomization = args => args.Append("/p:FullVer=" + fullVer);
|
||||
publishSettings.ArgumentCustomization = args => args.Append("/p:SemVer=" + versionInfo.AssemblySemVer);
|
||||
publishSettings.ArgumentCustomization = args => args.Append("/p:FullVer=" + fullVer);
|
||||
buildSettings.VersionSuffix = versionInfo.BranchName;
|
||||
publishSettings.VersionSuffix = versionInfo.BranchName;
|
||||
});
|
||||
|
||||
Task("Restore")
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26730.10
|
||||
VisualStudioVersion = 15.0.26730.8
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi", "Ombi\Ombi.csproj", "{C987AA67-AFE1-468F-ACD3-EAD5A48E1F6A}"
|
||||
EndProject
|
||||
|
@ -9,7 +9,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
|||
ProjectSection(SolutionItems) = preProject
|
||||
..\appveyor.yml = ..\appveyor.yml
|
||||
..\build.cake = ..\build.cake
|
||||
..\BuildTask.ps1 = ..\BuildTask.ps1
|
||||
..\CHANGELOG.md = ..\CHANGELOG.md
|
||||
..\global.json = ..\global.json
|
||||
EndProjectSection
|
||||
|
@ -82,7 +81,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.Api.Pushover", "Ombi.A
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.Schedule.Tests", "Ombi.Schedule.Tests\Ombi.Schedule.Tests.csproj", "{BDD8B924-016E-4CDA-9FFA-50B0A34BCD3C}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ombi.Api.Telegram", "Ombi.Api.Telegram\Ombi.Api.Telegram.csproj", "{484A8CA4-C9DC-4033-971D-D9D8EABB957E}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.Api.Telegram", "Ombi.Api.Telegram\Ombi.Api.Telegram.csproj", "{484A8CA4-C9DC-4033-971D-D9D8EABB957E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<TypeScriptToolsVersion>2.3</TypeScriptToolsVersion>
|
||||
<AssemblyVersion>$(SemVer)</AssemblyVersion>
|
||||
<FileVersion>$(SemVer)</FileVersion>
|
||||
<Version>$(SemVer)</Version>
|
||||
<Version>$(FullVer)</Version>
|
||||
<PackageVersion></PackageVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -124,7 +124,14 @@ namespace Ombi
|
|||
{
|
||||
Console.WriteLine(e);
|
||||
}
|
||||
|
||||
c.AddSecurityDefinition("Bearer", new ApiKeyScheme()
|
||||
{
|
||||
Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"",
|
||||
Name = "Authorization",
|
||||
In = "header",
|
||||
Type = "apiKey"
|
||||
});
|
||||
|
||||
c.AddSecurityDefinition("Authentication", new ApiKeyScheme());
|
||||
c.OperationFilter<SwaggerOperationFilter>();
|
||||
c.DescribeAllParametersInCamelCase();
|
||||
|
@ -189,9 +196,10 @@ namespace Ombi
|
|||
|
||||
app.UseHangfireServer();
|
||||
app.UseHangfireDashboard();
|
||||
app.UseSwagger();
|
||||
|
||||
app.UseSwaggerUI(c =>
|
||||
{
|
||||
|
||||
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
|
||||
c.ShowJsonEditor();
|
||||
});
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Metadata;
|
||||
using Microsoft.AspNetCore.Mvc.ApiExplorer;
|
||||
using Microsoft.AspNetCore.Mvc.Authorization;
|
||||
using Swashbuckle.AspNetCore.Swagger;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
|
@ -8,25 +10,19 @@ namespace Ombi
|
|||
{
|
||||
public class SwaggerOperationFilter : IOperationFilter
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
|
||||
public SwaggerOperationFilter()
|
||||
{
|
||||
Name = "Authorization";
|
||||
}
|
||||
|
||||
public void Apply(Operation operation, OperationFilterContext context)
|
||||
{
|
||||
var filterPipeline = context.ApiDescription.ActionDescriptor.FilterDescriptors;
|
||||
var isAuthorized = filterPipeline.Select(filterInfo => filterInfo.Filter).Any(filter => filter is AuthorizeFilter);
|
||||
var allowAnonymous = filterPipeline.Select(filterInfo => filterInfo.Filter).Any(filter => filter is IAllowAnonymousFilter);
|
||||
if (isAuthorized && !allowAnonymous)
|
||||
{
|
||||
if (operation.Parameters == null)
|
||||
operation.Parameters = new List<IParameter>();
|
||||
operation.Parameters.Add(new NonBodyParameter
|
||||
{
|
||||
Name = "Authorization",
|
||||
In = "header",
|
||||
Description = "JWT token",
|
||||
Required = true,
|
||||
Type = "string",
|
||||
Default = "Bearer "
|
||||
});
|
||||
}
|
||||
if (operation.Parameters == null)
|
||||
operation.Parameters = new List<IParameter>();
|
||||
var tokenAuthDict = new Dictionary<string, IEnumerable<string>> {{Name, new List<string>()}};
|
||||
operation.Security = new IDictionary<string, IEnumerable<string>>[] { tokenAuthDict };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue