浏览代码

修正bug

懒得勤快 4 年之前
父节点
当前提交
53ef4ae80d

+ 1 - 1
src/Masuit.MyBlogs.Core/Common/TrackData.cs

@@ -32,7 +32,7 @@ namespace Masuit.MyBlogs.Core.Common
             File.WriteAllText(logPath, RequestLogs.ToJsonString(new JsonSerializerSettings() { Formatting = Formatting.Indented }), Encoding.UTF8);
 
             logPath = Path.Combine(AppContext.BaseDirectory + "logs", DateTime.Now.ToString("yyyyMMdd"), "ip.txt").CreateFileIfNotExist();
-            File.WriteAllLines(logPath, RequestLogs.Keys.Select(s => new { s, loc = s.GetIPLocation() }).OrderBy(x => x.loc).Select(g => g.s + "\t" + g.loc), Encoding.UTF8);
+            File.WriteAllLines(logPath, RequestLogs.Keys.Select(s => new { s, loc = s.GetIPLocation().ToString() }).OrderBy(x => x.loc).Select(g => g.s + "\t" + g.loc), Encoding.UTF8);
             RequestLogs.Clear();
         }
 

+ 2 - 1
src/Masuit.MyBlogs.Core/Controllers/LinksController.cs

@@ -164,7 +164,8 @@ namespace Masuit.MyBlogs.Core.Controllers
             var b = await LinksService.GetQuery(m => m.Id == model.Id).UpdateFromQueryAsync(m => new Links()
             {
                 Name = model.Name,
-                Url = model.Url
+                Url = model.Url,
+                UrlBase = model.UrlBase
             }) > 0;
             return ResultData(null, b, b ? "保存成功" : "保存失败");
         }

+ 3 - 1
src/Masuit.MyBlogs.Core/Extensions/Firewall/FirewallAttribute.cs

@@ -4,6 +4,7 @@ using Masuit.MyBlogs.Core.Configs;
 using Masuit.MyBlogs.Core.Models.ViewModel;
 using Masuit.Tools;
 using Masuit.Tools.AspNetCore.Mime;
+using Masuit.Tools.Core.Net;
 using Masuit.Tools.Logging;
 using Masuit.Tools.Security;
 using Masuit.Tools.Strings;
@@ -110,12 +111,13 @@ namespace Masuit.MyBlogs.Core.Extensions.Firewall
                 {
                     if (request.Cookies.TryGetValue(SessionKey.ChallengeBypass, out var time) && time.AESDecrypt(AppConfig.BaiduAK).ToDateTime() > DateTime.Now)
                     {
+                        context.HttpContext.Session.Set("js-challenge", 1);
                         return;
                     }
                 }
                 catch
                 {
-                    // ignored
+                    context.HttpContext.Response.Cookies.Delete(SessionKey.ChallengeBypass);
                 }
 
                 var mode = CommonHelper.SystemSettings.GetOrAdd(SessionKey.ChallengeMode, "");

+ 1 - 1
src/Masuit.MyBlogs.Core/Masuit.MyBlogs.Core.csproj

@@ -54,7 +54,7 @@
         <PackageReference Include="System.Linq.Dynamic.Core" Version="1.2.13" />
         <PackageReference Include="TimeZoneConverter" Version="3.5.0" />
         <PackageReference Include="WilderMinds.RssSyndication" Version="1.7.0" />
-        <PackageReference Include="Z.EntityFramework.Plus.EFCore" Version="5.2.14" />
+        <PackageReference Include="Z.EntityFramework.Plus.EFCore" Version="5.2.15" />
     </ItemGroup>
     <ItemGroup>
         <Content Update="appsettings.json">

+ 3 - 3
src/Masuit.MyBlogs.Core/Views/Shared/JSChallenge.cshtml

@@ -43,9 +43,9 @@
 </html>
 <script src="/_framework/blazor.server.js"></script>
 <script>
-    window.checkBrowser =async function(dotNetHelper) {
+    window.checkBrowser = async function (dotNetHelper) {
         let token = await dotNetHelper.invokeMethodAsync('GetToken');
-        setTimeout(function () { 
+        setTimeout(function () {
             var formData = new FormData();
             formData.append("__RequestVerificationToken", document.querySelector("[name='__RequestVerificationToken']").value);
             formData.append("token", token);
@@ -55,7 +55,7 @@
                 mode: 'cors',
                 body: formData
             }).then(function (response) {
-                    location.reload();
+                location.reload();
             }).catch(function (e) {
                 alert("页面加载失败,请关闭掉额外的浏览器插件扩展后刷新重试!");
             });