mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-13 18:16:55 -07:00
This commit is contained in:
parent
0e6a1707f4
commit
9a2b0f6102
6 changed files with 69 additions and 58 deletions
15
appveyor.yml
15
appveyor.yml
|
@ -1,6 +1,6 @@
|
|||
version: 3.0.{build}
|
||||
configuration: Release
|
||||
os: Visual Studio 2015
|
||||
os: Visual Studio 2017
|
||||
environment:
|
||||
nodejs_version: "7.8.0"
|
||||
|
||||
|
@ -13,19 +13,22 @@ build_script:
|
|||
after_build:
|
||||
- cmd: >-
|
||||
|
||||
appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\windows.zip"
|
||||
appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.0\windows.zip"
|
||||
|
||||
|
||||
appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\osx.tar.gz"
|
||||
appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.0\osx.tar.gz"
|
||||
|
||||
|
||||
appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\ubuntu.tar.gz"
|
||||
appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.0\ubuntu.tar.gz"
|
||||
|
||||
|
||||
appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\debian.tar.gz"
|
||||
appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.0\debian.tar.gz"
|
||||
|
||||
|
||||
appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\centos.tar.gz"
|
||||
appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.0\centos.tar.gz"
|
||||
|
||||
|
||||
appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.0\linux.tar.gz"
|
||||
|
||||
|
||||
|
||||
|
|
35
build.cake
35
build.cake
|
@ -42,10 +42,11 @@ var publishSettings = new DotNetCorePublishSettings
|
|||
|
||||
var artifactsFolder = buildDir + "/netcoreapp2.0/";
|
||||
var windowsArtifactsFolder = artifactsFolder + "win10-x64/published";
|
||||
var osxArtifactsFolder = artifactsFolder + "osx.10.12-x64/published";
|
||||
var ubuntuArtifactsFolder = artifactsFolder + "ubuntu.16.04-x64/published";
|
||||
var osxArtifactsFolder = artifactsFolder + "osx-x64/published";
|
||||
var ubuntuArtifactsFolder = artifactsFolder + "ubuntu-x64/published";
|
||||
var debianArtifactsFolder = artifactsFolder + "debian.8-x64/published";
|
||||
var centosArtifactsFolder = artifactsFolder + "centos.7-x64/published";
|
||||
var linuxArtifactsFolder = artifactsFolder + "linux-x64/published";
|
||||
|
||||
|
||||
|
||||
|
@ -89,8 +90,8 @@ Task("SetVersionInfo")
|
|||
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;
|
||||
// buildSettings.VersionSuffix = versionInfo.BranchName;
|
||||
// publishSettings.VersionSuffix = versionInfo.BranchName;
|
||||
});
|
||||
|
||||
Task("Restore")
|
||||
|
@ -139,12 +140,13 @@ Task("Package")
|
|||
GZipCompress(ubuntuArtifactsFolder, artifactsFolder + "ubuntu.tar.gz");
|
||||
GZipCompress(debianArtifactsFolder, artifactsFolder + "debian.tar.gz");
|
||||
GZipCompress(centosArtifactsFolder, artifactsFolder + "centos.tar.gz");
|
||||
GZipCompress(linuxArtifactsFolder, artifactsFolder + "linux.tar.gz");
|
||||
});
|
||||
|
||||
Task("Publish")
|
||||
.IsDependentOn("Build")
|
||||
.IsDependentOn("Publish-Windows")
|
||||
.IsDependentOn("Publish-OSX").IsDependentOn("Publish-Ubuntu").IsDependentOn("Publish-Debian").IsDependentOn("Publish-Centos")
|
||||
.IsDependentOn("Publish-OSX").IsDependentOn("Publish-Ubuntu").IsDependentOn("Publish-Debian").IsDependentOn("Publish-Centos").IsDependentOn("Publish-Linux")
|
||||
.IsDependentOn("Package");
|
||||
|
||||
Task("Publish-Windows")
|
||||
|
@ -161,22 +163,22 @@ Task("Publish-Windows")
|
|||
Task("Publish-OSX")
|
||||
.Does(() =>
|
||||
{
|
||||
publishSettings.Runtime = "osx.10.12-x64";
|
||||
publishSettings.OutputDirectory = Directory(buildDir) + Directory("netcoreapp2.0/osx.10.12-x64/published");
|
||||
publishSettings.Runtime = "osx-x64";
|
||||
publishSettings.OutputDirectory = Directory(buildDir) + Directory("netcoreapp2.0/osx-x64/published");
|
||||
|
||||
DotNetCorePublish("./src/Ombi/Ombi.csproj", publishSettings);
|
||||
CopyFile(buildDir + "/netcoreapp2.0/osx.10.12-x64/Swagger.xml", buildDir + "/netcoreapp2.0/osx.10.12-x64/published/Swagger.xml");
|
||||
CopyFile(buildDir + "/netcoreapp2.0/osx-x64/Swagger.xml", buildDir + "/netcoreapp2.0/osx-x64/published/Swagger.xml");
|
||||
DotNetCorePublish("./src/Ombi.Updater/Ombi.Updater.csproj", publishSettings);
|
||||
});
|
||||
|
||||
Task("Publish-Ubuntu")
|
||||
.Does(() =>
|
||||
{
|
||||
publishSettings.Runtime = "ubuntu.16.04-x64";
|
||||
publishSettings.OutputDirectory = Directory(buildDir) + Directory("netcoreapp2.0/ubuntu.16.04-x64/published");
|
||||
publishSettings.Runtime = "ubuntu-x64";
|
||||
publishSettings.OutputDirectory = Directory(buildDir) + Directory("netcoreapp2.0/ubuntu-x64/published");
|
||||
|
||||
DotNetCorePublish("./src/Ombi/Ombi.csproj", publishSettings);
|
||||
CopyFile(buildDir + "/netcoreapp2.0/ubuntu.16.04-x64/Swagger.xml", buildDir + "/netcoreapp2.0/ubuntu.16.04-x64/published/Swagger.xml");
|
||||
CopyFile(buildDir + "/netcoreapp2.0/ubuntu-x64/Swagger.xml", buildDir + "/netcoreapp2.0/ubuntu-x64/published/Swagger.xml");
|
||||
DotNetCorePublish("./src/Ombi.Updater/Ombi.Updater.csproj", publishSettings);
|
||||
});
|
||||
Task("Publish-Debian")
|
||||
|
@ -200,6 +202,17 @@ Task("Publish-Centos")
|
|||
DotNetCorePublish("./src/Ombi.Updater/Ombi.Updater.csproj", publishSettings);
|
||||
});
|
||||
|
||||
Task("Publish-Linux")
|
||||
.Does(() =>
|
||||
{
|
||||
publishSettings.Runtime = "linux-x64";
|
||||
publishSettings.OutputDirectory = Directory(buildDir) + Directory("netcoreapp2.0/linux-x64/published");
|
||||
|
||||
DotNetCorePublish("./src/Ombi/Ombi.csproj", publishSettings);
|
||||
CopyFile(buildDir + "/netcoreapp2.0/linux-x64/Swagger.xml", buildDir + "/netcoreapp2.0/linux-x64/published/Swagger.xml");
|
||||
DotNetCorePublish("./src/Ombi.Updater/Ombi.Updater.csproj", publishSettings);
|
||||
});
|
||||
|
||||
Task("Run-Unit-Tests")
|
||||
.IsDependentOn("Publish")
|
||||
.Does(() =>
|
||||
|
|
|
@ -54,7 +54,6 @@ namespace Ombi.DependencyInjection
|
|||
services.RegisterApi();
|
||||
services.RegisterServices();
|
||||
services.RegisterStore();
|
||||
services.RegisterIdentity();
|
||||
services.RegisterJobs();
|
||||
}
|
||||
|
||||
|
@ -135,15 +134,5 @@ namespace Ombi.DependencyInjection
|
|||
services.AddTransient<IRadarrCacher, RadarrCacher>();
|
||||
services.AddTransient<IOmbiAutomaticUpdater, OmbiAutomaticUpdater>();
|
||||
}
|
||||
|
||||
public static void RegisterIdentity(this IServiceCollection services)
|
||||
{
|
||||
services.AddAuthorization(auth =>
|
||||
{
|
||||
auth.AddPolicy("Bearer", new AuthorizationPolicyBuilder()
|
||||
.AddAuthenticationSchemes(JwtBearerDefaults.AuthenticationScheme)
|
||||
.RequireAuthenticatedUser().Build());
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.15
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi", "Ombi\Ombi.csproj", "{C987AA67-AFE1-468F-ACD3-EAD5A48E1F6A}"
|
||||
EndProject
|
||||
|
@ -10,7 +10,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
|||
..\appveyor.yml = ..\appveyor.yml
|
||||
..\build.cake = ..\build.cake
|
||||
..\CHANGELOG.md = ..\CHANGELOG.md
|
||||
..\global.json = ..\global.json
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.Core", "Ombi.Core\Ombi.Core.csproj", "{F56E79C7-791D-4668-A0EC-29E3BBC8D24B}"
|
||||
|
|
|
@ -77,6 +77,7 @@ namespace Ombi.Controllers
|
|||
var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_tokenAuthenticationOptions.SecretKey));
|
||||
var creds = new SigningCredentials(key, SecurityAlgorithms.HmacSha256);
|
||||
|
||||
|
||||
var token = new JwtSecurityToken(
|
||||
claims: claims,
|
||||
expires: DateTime.UtcNow.AddHours(5),
|
||||
|
|
|
@ -91,6 +91,31 @@ namespace Ombi
|
|||
|
||||
services.AddMemoryCache();
|
||||
|
||||
var tokenOptions = Configuration.GetSection("TokenAuthentication");
|
||||
|
||||
var tokenValidationParameters = new TokenValidationParameters
|
||||
{
|
||||
|
||||
ValidateIssuerSigningKey = true,
|
||||
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(tokenOptions.GetValue("SecretKey", string.Empty))),
|
||||
|
||||
RequireExpirationTime = true,
|
||||
ValidateLifetime = true,
|
||||
ValidAudience = "Ombi",
|
||||
ValidIssuer = "Ombi",
|
||||
ClockSkew = TimeSpan.Zero,
|
||||
};
|
||||
|
||||
services.AddAuthentication(options =>
|
||||
{
|
||||
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
}).AddJwtBearer(x =>
|
||||
{
|
||||
x.Audience = "Ombi";
|
||||
x.TokenValidationParameters = tokenValidationParameters;
|
||||
});
|
||||
|
||||
services.AddMvc()
|
||||
.AddJsonOptions(x => x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);
|
||||
|
||||
|
@ -156,29 +181,8 @@ namespace Ombi
|
|||
});
|
||||
|
||||
|
||||
var tokenOptions = Configuration.GetSection("TokenAuthentication");
|
||||
|
||||
|
||||
|
||||
var tokenValidationParameters = new TokenValidationParameters
|
||||
{
|
||||
|
||||
ValidateIssuerSigningKey = true,
|
||||
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(tokenOptions.GetValue("SecretKey", string.Empty))),
|
||||
|
||||
RequireExpirationTime = true,
|
||||
ValidateLifetime = true,
|
||||
ValidAudience = "Ombi",
|
||||
ValidIssuer = "Ombi",
|
||||
ClockSkew = TimeSpan.Zero
|
||||
};
|
||||
|
||||
services.AddAuthentication().AddJwtBearer(x =>
|
||||
{
|
||||
x.Audience = "Ombi";
|
||||
x.TokenValidationParameters = tokenValidationParameters;
|
||||
});
|
||||
|
||||
// Build the intermediate service provider
|
||||
var serviceProvider = services.BuildServiceProvider();
|
||||
|
||||
|
@ -195,17 +199,15 @@ namespace Ombi
|
|||
|
||||
|
||||
|
||||
app.UseAuthentication();
|
||||
|
||||
loggerFactory.AddSerilog();
|
||||
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
|
||||
{
|
||||
HotModuleReplacement = true
|
||||
});
|
||||
//app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
|
||||
//{
|
||||
// HotModuleReplacement = true
|
||||
//});
|
||||
}
|
||||
|
||||
app.UseHangfireServer();
|
||||
|
@ -235,6 +237,10 @@ namespace Ombi
|
|||
ContentTypeProvider = provider
|
||||
});
|
||||
|
||||
|
||||
|
||||
app.UseAuthentication();
|
||||
|
||||
app.UseMvc(routes =>
|
||||
{
|
||||
routes.MapRoute(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue