mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 12:59:39 -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}
|
version: 3.0.{build}
|
||||||
configuration: Release
|
configuration: Release
|
||||||
os: Visual Studio 2015
|
os: Visual Studio 2017
|
||||||
environment:
|
environment:
|
||||||
nodejs_version: "7.8.0"
|
nodejs_version: "7.8.0"
|
||||||
|
|
||||||
|
@ -13,19 +13,22 @@ build_script:
|
||||||
after_build:
|
after_build:
|
||||||
- cmd: >-
|
- 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 artifactsFolder = buildDir + "/netcoreapp2.0/";
|
||||||
var windowsArtifactsFolder = artifactsFolder + "win10-x64/published";
|
var windowsArtifactsFolder = artifactsFolder + "win10-x64/published";
|
||||||
var osxArtifactsFolder = artifactsFolder + "osx.10.12-x64/published";
|
var osxArtifactsFolder = artifactsFolder + "osx-x64/published";
|
||||||
var ubuntuArtifactsFolder = artifactsFolder + "ubuntu.16.04-x64/published";
|
var ubuntuArtifactsFolder = artifactsFolder + "ubuntu-x64/published";
|
||||||
var debianArtifactsFolder = artifactsFolder + "debian.8-x64/published";
|
var debianArtifactsFolder = artifactsFolder + "debian.8-x64/published";
|
||||||
var centosArtifactsFolder = artifactsFolder + "centos.7-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);
|
buildSettings.ArgumentCustomization = args => args.Append("/p:FullVer=" + fullVer);
|
||||||
publishSettings.ArgumentCustomization = args => args.Append("/p:SemVer=" + versionInfo.AssemblySemVer);
|
publishSettings.ArgumentCustomization = args => args.Append("/p:SemVer=" + versionInfo.AssemblySemVer);
|
||||||
publishSettings.ArgumentCustomization = args => args.Append("/p:FullVer=" + fullVer);
|
publishSettings.ArgumentCustomization = args => args.Append("/p:FullVer=" + fullVer);
|
||||||
buildSettings.VersionSuffix = versionInfo.BranchName;
|
// buildSettings.VersionSuffix = versionInfo.BranchName;
|
||||||
publishSettings.VersionSuffix = versionInfo.BranchName;
|
// publishSettings.VersionSuffix = versionInfo.BranchName;
|
||||||
});
|
});
|
||||||
|
|
||||||
Task("Restore")
|
Task("Restore")
|
||||||
|
@ -139,12 +140,13 @@ Task("Package")
|
||||||
GZipCompress(ubuntuArtifactsFolder, artifactsFolder + "ubuntu.tar.gz");
|
GZipCompress(ubuntuArtifactsFolder, artifactsFolder + "ubuntu.tar.gz");
|
||||||
GZipCompress(debianArtifactsFolder, artifactsFolder + "debian.tar.gz");
|
GZipCompress(debianArtifactsFolder, artifactsFolder + "debian.tar.gz");
|
||||||
GZipCompress(centosArtifactsFolder, artifactsFolder + "centos.tar.gz");
|
GZipCompress(centosArtifactsFolder, artifactsFolder + "centos.tar.gz");
|
||||||
|
GZipCompress(linuxArtifactsFolder, artifactsFolder + "linux.tar.gz");
|
||||||
});
|
});
|
||||||
|
|
||||||
Task("Publish")
|
Task("Publish")
|
||||||
.IsDependentOn("Build")
|
.IsDependentOn("Build")
|
||||||
.IsDependentOn("Publish-Windows")
|
.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");
|
.IsDependentOn("Package");
|
||||||
|
|
||||||
Task("Publish-Windows")
|
Task("Publish-Windows")
|
||||||
|
@ -161,22 +163,22 @@ Task("Publish-Windows")
|
||||||
Task("Publish-OSX")
|
Task("Publish-OSX")
|
||||||
.Does(() =>
|
.Does(() =>
|
||||||
{
|
{
|
||||||
publishSettings.Runtime = "osx.10.12-x64";
|
publishSettings.Runtime = "osx-x64";
|
||||||
publishSettings.OutputDirectory = Directory(buildDir) + Directory("netcoreapp2.0/osx.10.12-x64/published");
|
publishSettings.OutputDirectory = Directory(buildDir) + Directory("netcoreapp2.0/osx-x64/published");
|
||||||
|
|
||||||
DotNetCorePublish("./src/Ombi/Ombi.csproj", publishSettings);
|
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);
|
DotNetCorePublish("./src/Ombi.Updater/Ombi.Updater.csproj", publishSettings);
|
||||||
});
|
});
|
||||||
|
|
||||||
Task("Publish-Ubuntu")
|
Task("Publish-Ubuntu")
|
||||||
.Does(() =>
|
.Does(() =>
|
||||||
{
|
{
|
||||||
publishSettings.Runtime = "ubuntu.16.04-x64";
|
publishSettings.Runtime = "ubuntu-x64";
|
||||||
publishSettings.OutputDirectory = Directory(buildDir) + Directory("netcoreapp2.0/ubuntu.16.04-x64/published");
|
publishSettings.OutputDirectory = Directory(buildDir) + Directory("netcoreapp2.0/ubuntu-x64/published");
|
||||||
|
|
||||||
DotNetCorePublish("./src/Ombi/Ombi.csproj", publishSettings);
|
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);
|
DotNetCorePublish("./src/Ombi.Updater/Ombi.Updater.csproj", publishSettings);
|
||||||
});
|
});
|
||||||
Task("Publish-Debian")
|
Task("Publish-Debian")
|
||||||
|
@ -200,6 +202,17 @@ Task("Publish-Centos")
|
||||||
DotNetCorePublish("./src/Ombi.Updater/Ombi.Updater.csproj", publishSettings);
|
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")
|
Task("Run-Unit-Tests")
|
||||||
.IsDependentOn("Publish")
|
.IsDependentOn("Publish")
|
||||||
.Does(() =>
|
.Does(() =>
|
||||||
|
|
|
@ -54,7 +54,6 @@ namespace Ombi.DependencyInjection
|
||||||
services.RegisterApi();
|
services.RegisterApi();
|
||||||
services.RegisterServices();
|
services.RegisterServices();
|
||||||
services.RegisterStore();
|
services.RegisterStore();
|
||||||
services.RegisterIdentity();
|
|
||||||
services.RegisterJobs();
|
services.RegisterJobs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,15 +134,5 @@ namespace Ombi.DependencyInjection
|
||||||
services.AddTransient<IRadarrCacher, RadarrCacher>();
|
services.AddTransient<IRadarrCacher, RadarrCacher>();
|
||||||
services.AddTransient<IOmbiAutomaticUpdater, OmbiAutomaticUpdater>();
|
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
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio 15
|
||||||
VisualStudioVersion = 15.0.26730.10
|
VisualStudioVersion = 15.0.26730.15
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi", "Ombi\Ombi.csproj", "{C987AA67-AFE1-468F-ACD3-EAD5A48E1F6A}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi", "Ombi\Ombi.csproj", "{C987AA67-AFE1-468F-ACD3-EAD5A48E1F6A}"
|
||||||
EndProject
|
EndProject
|
||||||
|
@ -10,7 +10,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
||||||
..\appveyor.yml = ..\appveyor.yml
|
..\appveyor.yml = ..\appveyor.yml
|
||||||
..\build.cake = ..\build.cake
|
..\build.cake = ..\build.cake
|
||||||
..\CHANGELOG.md = ..\CHANGELOG.md
|
..\CHANGELOG.md = ..\CHANGELOG.md
|
||||||
..\global.json = ..\global.json
|
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.Core", "Ombi.Core\Ombi.Core.csproj", "{F56E79C7-791D-4668-A0EC-29E3BBC8D24B}"
|
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 key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_tokenAuthenticationOptions.SecretKey));
|
||||||
var creds = new SigningCredentials(key, SecurityAlgorithms.HmacSha256);
|
var creds = new SigningCredentials(key, SecurityAlgorithms.HmacSha256);
|
||||||
|
|
||||||
|
|
||||||
var token = new JwtSecurityToken(
|
var token = new JwtSecurityToken(
|
||||||
claims: claims,
|
claims: claims,
|
||||||
expires: DateTime.UtcNow.AddHours(5),
|
expires: DateTime.UtcNow.AddHours(5),
|
||||||
|
|
|
@ -91,6 +91,31 @@ namespace Ombi
|
||||||
|
|
||||||
services.AddMemoryCache();
|
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()
|
services.AddMvc()
|
||||||
.AddJsonOptions(x => x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);
|
.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
|
// Build the intermediate service provider
|
||||||
var serviceProvider = services.BuildServiceProvider();
|
var serviceProvider = services.BuildServiceProvider();
|
||||||
|
|
||||||
|
@ -195,17 +199,15 @@ namespace Ombi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
app.UseAuthentication();
|
|
||||||
|
|
||||||
loggerFactory.AddSerilog();
|
loggerFactory.AddSerilog();
|
||||||
|
|
||||||
if (env.IsDevelopment())
|
if (env.IsDevelopment())
|
||||||
{
|
{
|
||||||
app.UseDeveloperExceptionPage();
|
app.UseDeveloperExceptionPage();
|
||||||
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
|
//app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
|
||||||
{
|
//{
|
||||||
HotModuleReplacement = true
|
// HotModuleReplacement = true
|
||||||
});
|
//});
|
||||||
}
|
}
|
||||||
|
|
||||||
app.UseHangfireServer();
|
app.UseHangfireServer();
|
||||||
|
@ -235,6 +237,10 @@ namespace Ombi
|
||||||
ContentTypeProvider = provider
|
ContentTypeProvider = provider
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
app.UseAuthentication();
|
||||||
|
|
||||||
app.UseMvc(routes =>
|
app.UseMvc(routes =>
|
||||||
{
|
{
|
||||||
routes.MapRoute(
|
routes.MapRoute(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue