懒得勤快 5 anos atrás
pai
commit
4524e2e6e4

+ 4 - 1
src/Masuit.MyBlogs.Core/Extensions/UEditor/CrawlerHandler.cs

@@ -49,7 +49,10 @@ namespace Masuit.MyBlogs.Core.Extensions.UEditor
         public string SourceUrl { get; set; }
         public string ServerUrl { get; set; }
         public string State { get; set; }
-        private readonly HttpClient _httpClient = new HttpClient();
+        private readonly HttpClient _httpClient = new HttpClient(new HttpClientHandler()
+        {
+            ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
+        });
 
         public Crawler(string sourceUrl)
         {

+ 1 - 0
src/Masuit.MyBlogs.Core/Program.cs

@@ -27,6 +27,7 @@ namespace Masuit.MyBlogs.Core
             {
                 opt.ListenAnyIP(sslport.ToInt32(), s => s.UseHttps(AppContext.BaseDirectory + config["Https:CertPath"], config["Https:CertPassword"]));
             }
+
             opt.Limits.MaxRequestBodySize = null;
             Console.WriteLine($"应用程序监听端口:http:{port},https:{sslport}");
         }).UseIISIntegration().UseStartup<Startup>());

+ 1 - 1
src/Masuit.MyBlogs.Core/Properties/launchSettings.json

@@ -18,7 +18,7 @@
     "Masuit.MyBlogs.Core": {
       "commandName": "Project",
       "environmentVariables": {
-        "ASPNETCORE_ENVIRONMENT": ""
+        "ASPNETCORE_ENVIRONMENT": "prod"
       },
       "applicationUrl": "http://localhost:5000"
     }

+ 5 - 1
src/Masuit.MyBlogs.Core/Startup.cs

@@ -37,6 +37,7 @@ using StackExchange.Profiling;
 using System;
 using System.IO;
 using System.Linq;
+using System.Net.Http;
 using System.Threading.Tasks;
 using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IWebHostEnvironment;
 using SameSiteMode = Microsoft.AspNetCore.Http.SameSiteMode;
@@ -115,7 +116,10 @@ namespace Masuit.MyBlogs.Core
                 Path = "lucene"
             }); // 配置7z和断点续传和Redis和Lucene搜索引擎
 
-            services.AddHttpClient("", c => c.Timeout = TimeSpan.FromSeconds(30)); //注入HttpClient
+            services.AddHttpClient("", c => c.Timeout = TimeSpan.FromSeconds(30)).ConfigurePrimaryHttpMessageHandler(provider => new HttpClientHandler
+            {
+                ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
+            }); //注入HttpClient
             services.AddTransient<ImagebedClient>();
             services.AddHttpContextAccessor(); //注入静态HttpContext
             services.AddMiniProfiler(options =>

+ 10 - 9
src/Masuit.MyBlogs.Core/Views/Post/HistoryVersion_Admin.cshtml

@@ -36,11 +36,11 @@
                                         原分类:<i class="icon-map-pin"></i>@Html.ActionLink(Model.Category.Name, "Category", "Home", new { id = Model.CategoryId }, new { @class = "label label-" + colors[new Random().Next() % colors.Length] })
                                         @if (Model.Seminar.Any())
                                         {
-                                            <span> | 原所属专题:</span>
+                                        <span> | 原所属专题:</span>
                                             var seminars = Model.Seminar;
                                             foreach (var s in seminars)
                                             {
-                                                @Html.ActionLink(s.Seminar.Title, "Index", "Seminar", new { id = s.SeminarId }, new { @class = "label label-" + colors[new Random().Next() % colors.Length] })<text> </text>
+                                        @Html.ActionLink(s.Seminar.Title, "Index", "Seminar", new { id = s.SeminarId }, new { @class = "label label-" + colors[new Random().Next() % colors.Length] })<text> </text>
                                             }
                                         }
                                         <div class="btn-group">
@@ -52,22 +52,23 @@
                                 @{
                                     if (!string.IsNullOrEmpty(Model.Label))
                                     {
-                                        <div class="pull-right margin-right20">
-                                            <div>
-                                                @foreach (string s in Model.Label.Split(',', ',', ' '))
+                                    <div class="pull-right margin-right20">
+                                        <div>
+                                            @foreach (string s in Model.Label.Split(',', ',', ' '))
                                                 {
                                                     if (!string.IsNullOrEmpty(s))
                                                     {
-                                                        <a asp-controller="Home" asp-action="Tag" asp-route-id="@s">
-                                                            <span class="label label-@colors[new Random().Next() % colors.Length]">@s</span>
-                                                        </a>
+                                            <a asp-controller="Home" asp-action="Tag" asp-route-id="@s">
+                                                <span class="label label-@colors[new Random().Next() % colors.Length]">@s</span>
+                                            </a>
                                                     }
                                                 }
-                                            </div>
                                         </div>
+                                    </div>
                                     }
                                 }
                             </div>
+                            <p class="text-focus text-center">您目前正在查看该文章的历史版本,文章的历史版本可能无法为您提供最准确及时的资讯,不具备任何参考价值,@Html.ActionLink("点击前往", "Details", "Post", new { id = Model.PostId }, null)该文章的最新版本。</p>
                         </header>
                         <article class="article" id="article">
                             @Html.Raw(Model.Content)

+ 11 - 0
src/Masuit.MyBlogs.Core/wwwroot/Content/common/style.css

@@ -324,6 +324,17 @@ Custom bottom spacer
 .text-white {
     color: white;
 }
+.text-focus {
+    background-color: yellow;
+    color: red;
+    font-size: 22px !important;
+    -ms-border-radius: 5px;
+    border-radius: 5px;
+    border: dotted 3px red;
+    padding: 5px;
+    box-shadow: grey 0px 3px 15px;
+}
+
 .inline {
     display: inline !important;
 }