diff --git a/Website/Data/BlogApi.cs b/Website/Data/BlogApi.cs index 1b32c81..81f9b43 100644 --- a/Website/Data/BlogApi.cs +++ b/Website/Data/BlogApi.cs @@ -9,14 +9,14 @@ namespace Website.Data public BlogApi(HttpClient client) : base(client) { } - public async Task GetPostByUrlAsync(string url) => await Get("/get/" + url); - public async Task> GetLatestPostsAsync(int count = 0, int offset = 0) => await Get>("/getlatestposts", new{count, offset}); - public async Task GetLatestPostAsync() => await Get("/getlatestpost"); - public async Task GetCountAsync() => await Get("/getcount"); - public async Task GetPostByIdAsync(int id) => await Get("/get/" + id); - public async Task SavePost(BlogPostSubmission post) => await Post("/savepost", post); - public async Task> GetAllPostsAsync() => await Get>("/getallposts"); - public async Task DeletePostAsync(int id) => await Post("/deletepost", id); - public async Task PublishPostAsync(int id) => await Post("/publishpost", id); + public async Task GetPostByUrlAsync(string url) => await Get("get/" + url); + public async Task> GetLatestPostsAsync(int count = 0, int offset = 0) => await Get>("getlatestposts", new{count, offset}); + public async Task GetLatestPostAsync() => await Get("getlatestpost"); + public async Task GetCountAsync() => await Get("getcount"); + public async Task GetPostByIdAsync(int id) => await Get("get/" + id); + public async Task SavePost(BlogPostSubmission post) => await Post("savepost", post); + public async Task> GetAllPostsAsync() => await Get>("getallposts"); + public async Task DeletePostAsync(int id) => await Post("deletepost", id); + public async Task PublishPostAsync(int id) => await Post("publishpost", id); } } diff --git a/Website/Startup.cs b/Website/Startup.cs index dcf6d4e..20ad655 100644 --- a/Website/Startup.cs +++ b/Website/Startup.cs @@ -1,4 +1,5 @@ using System; +using System.Net; using System.Net.Http; using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Builder; @@ -47,7 +48,10 @@ namespace Website .AddSingleton() .AddSingleton() .AddSingleton(new GitServerApi(new HttpClient(), Configuration["gitDomain"], Configuration["gitToken"])) - .AddHttpClient(client => client.BaseAddress = new Uri(Configuration["blogApiEndpoint"])); + .AddHttpClient(client => client.BaseAddress = new Uri(Configuration["blogApiEndpoint"])) + .ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler { + ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true + }); // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env)