懒得勤快 1 gadu atpakaļ
vecāks
revīzija
054df2ca0c

+ 10 - 10
src/Masuit.MyBlogs.Core/Controllers/BaseController.cs

@@ -109,26 +109,26 @@ public class BaseController : Controller
         return template.Render();
     }
 
-    public override Task OnActionExecutionAsync(ActionExecutingContext filterContext, ActionExecutionDelegate next)
+    public override Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
     {
         ViewBag.Desc = CommonHelper.SystemSettings["Description"];
-        var user = filterContext.HttpContext.Session.Get<UserInfoDto>(SessionKey.UserInfo);
+        var user = context.HttpContext.Session.Get<UserInfoDto>(SessionKey.UserInfo);
 #if DEBUG
         if (HttpContext.Connection.RemoteIpAddress.IsPrivateIP())
         {
             user = Mapper.Map<UserInfoDto>(UserInfoService.GetByUsername("masuit"));
-            filterContext.HttpContext.Session.Set(SessionKey.UserInfo, user);
+            context.HttpContext.Session.Set(SessionKey.UserInfo, user);
         }
 #endif
         if (CommonHelper.SystemSettings.GetOrAdd("CloseSite", "false") == "true" && user?.IsAdmin != true)
         {
-            filterContext.Result = RedirectToAction("ComingSoon", "Error");
+            context.Result = RedirectToAction("ComingSoon", "Error");
             return Task.CompletedTask;
         }
 
-        if (Request.Method == HttpMethods.Post && !Request.Path.Value.Contains("get", StringComparison.InvariantCultureIgnoreCase) && CommonHelper.SystemSettings.GetOrAdd("DataReadonly", "false") == "true" && !filterContext.Filters.Any(m => m.ToString().Contains(nameof(MyAuthorizeAttribute))))
+        if (Request.Method == HttpMethods.Post && !Request.Path.Value.Contains("get", StringComparison.InvariantCultureIgnoreCase) && CommonHelper.SystemSettings.GetOrAdd("DataReadonly", "false") == "true" && !context.Filters.Any(m => m.ToString().Contains(nameof(MyAuthorizeAttribute))))
         {
-            filterContext.Result = ResultData("网站当前处于数据写保护状态,无法提交任何数据,如有疑问请联系网站管理员!", false, "网站当前处于数据写保护状态,无法提交任何数据,如有疑问请联系网站管理员!", user != null, HttpStatusCode.BadRequest);
+            context.Result = ResultData("网站当前处于数据写保护状态,无法提交任何数据,如有疑问请联系网站管理员!", false, "网站当前处于数据写保护状态,无法提交任何数据,如有疑问请联系网站管理员!", user != null, HttpStatusCode.BadRequest);
             return Task.CompletedTask;
         }
 
@@ -149,13 +149,13 @@ public class BaseController : Controller
                     Expires = DateTime.Now.AddYears(1),
                     SameSite = SameSiteMode.Lax
                 });
-                filterContext.HttpContext.Session.Set(SessionKey.UserInfo, userInfo);
+                context.HttpContext.Session.Set(SessionKey.UserInfo, userInfo);
             }
         }
 
         if (ModelState.IsValid) return next();
         var errmsgs = ModelState.SelectMany(kv => kv.Value.Errors.Select(e => e.ErrorMessage)).Select((s, i) => $"{i + 1}. {s}");
-        filterContext.Result = true switch
+        context.Result = true switch
         {
             _ when Request.HasJsonContentType() || Request.Method == HttpMethods.Post => ResultData(errmsgs, false, "数据校验失败,错误信息:" + errmsgs.Join(" | "), user != null, HttpStatusCode.BadRequest),
             _ => base.BadRequest("参数错误:" + errmsgs.Join(" | "))
@@ -174,7 +174,7 @@ public class BaseController : Controller
     {
         if (CurrentUser.IsAdmin)
         {
-            return string.Empty; ;
+            return string.Empty;
         }
 
         if (string.IsNullOrEmpty(Request.Cookies["ValidateKey"]))
@@ -345,4 +345,4 @@ public class BaseController : Controller
         });
         throw new NotFoundException("文章未找到");
     }
-}
+}

+ 4 - 4
src/Masuit.MyBlogs.Core/Controllers/Drive/AdminController.cs

@@ -136,7 +136,7 @@ public sealed class AdminController(IDriveAccountService driveAccount, SettingSe
             {
                 message = e.Message
             });
-        };
+        }
         return StatusCode(204);
     }
 
@@ -163,7 +163,7 @@ public sealed class AdminController(IDriveAccountService driveAccount, SettingSe
             {
                 message = e.Message
             });
-        };
+        }
         return StatusCode(204);
     }
 
@@ -185,7 +185,7 @@ public sealed class AdminController(IDriveAccountService driveAccount, SettingSe
             {
                 message = e.Message
             });
-        };
+        }
         return StatusCode(204);
     }
 
@@ -260,4 +260,4 @@ public sealed class AdminController(IDriveAccountService driveAccount, SettingSe
     }
 
     #endregion 接收表单模型
-}
+}

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

@@ -25,7 +25,6 @@ public sealed class FirewallController : Controller
     /// <summary>
     /// JS挑战,5秒盾
     /// </summary>
-    /// <param name="token"></param>
     /// <returns></returns>
     [HttpPost("/challenge"), AutoValidateAntiforgeryToken]
     public ActionResult JsChallenge()
@@ -182,4 +181,4 @@ public class TurnstileResult
     public string Action { get; set; }
 
     public string Cdata { get; set; }
-}
+}

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

@@ -46,19 +46,19 @@
         <PackageReference Include="CHTCHSConv" Version="1.0.0" />
         <PackageReference Include="CLRStats" Version="1.0.0" />
         <PackageReference Include="Dispose.Scope.AspNetCore" Version="0.0.3" />
-        <PackageReference Include="EFCoreSecondLevelCacheInterceptor" Version="4.2.2" />
-        <PackageReference Include="EntityFrameworkCore.Exceptions.PostgreSQL" Version="8.0.0" />
-        <PackageReference Include="FreeRedis" Version="1.2.13" />
+        <PackageReference Include="EFCoreSecondLevelCacheInterceptor" Version="4.2.3" />
+        <PackageReference Include="EntityFrameworkCore.Exceptions.PostgreSQL" Version="8.1.0" />
+        <PackageReference Include="FreeRedis" Version="1.2.14" />
         <PackageReference Include="Hangfire" Version="1.8.11" />
         <PackageReference Include="Hangfire.MemoryStorage" Version="1.8.0" />
         <PackageReference Include="htmldiff.net" Version="1.4.2" />
         <PackageReference Include="Karambolo.AspNetCore.Bundling.NUglify" Version="3.7.0" />
-        <PackageReference Include="Markdig" Version="0.35.0" />
+        <PackageReference Include="Markdig" Version="0.36.2" />
         <PackageReference Include="MaxMind.GeoIP2" Version="5.2.0" />
-        <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.2" />
-        <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.2" />
-        <PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.2" />
-        <PackageReference Include="Microsoft.Extensions.Http.Polly" Version="8.0.2" />
+        <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.3" />
+        <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.3" />
+        <PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.3" />
+        <PackageReference Include="Microsoft.Extensions.Http.Polly" Version="8.0.3" />
         <PackageReference Include="Microsoft.Graph" Version="4.54.0" />
         <PackageReference Include="Microsoft.Graph.Auth" Version="1.0.0-preview.7" />
         <PackageReference Include="Microsoft.NETCore.Platforms" Version="7.0.4" />
@@ -68,8 +68,8 @@
         <PackageReference Include="MiniProfiler.EntityFrameworkCore" Version="4.3.8" />
         <PackageReference Include="PanGu.HighLight" Version="1.0.0" />
         <PackageReference Include="Rin" Version="2.6.0" />
-        <PackageReference Include="SixLabors.ImageSharp.Web" Version="3.1.0" />
-        <PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.8" />
+        <PackageReference Include="SixLabors.ImageSharp.Web" Version="3.1.1" />
+        <PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.10" />
         <PackageReference Include="TimeZoneConverter" Version="6.1.0" />
         <PackageReference Include="WilderMinds.RssSyndication" Version="1.7.1" />
         <PackageReference Include="Yarp.ReverseProxy" Version="2.1.0" />

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 237 - 242
src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/post.js


Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels