DriveController.cs 826 B

123456789101112131415161718192021222324252627
  1. using Masuit.MyBlogs.Core.Common;
  2. using Masuit.MyBlogs.Core.Extensions.Firewall;
  3. using Microsoft.AspNetCore.Mvc;
  4. using Microsoft.AspNetCore.Mvc.Filters;
  5. namespace Masuit.MyBlogs.Core.Controllers.Drive
  6. {
  7. [ServiceFilter(typeof(FirewallAttribute))]
  8. public sealed class DriveController : Controller
  9. {
  10. [HttpGet("/drive")]
  11. public IActionResult Index()
  12. {
  13. return View();
  14. }
  15. public override Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
  16. {
  17. if (CommonHelper.SystemSettings.GetOrAdd("CloseSite", "false") == "true")
  18. {
  19. context.Result = RedirectToAction("ComingSoon", "Error");
  20. return Task.CompletedTask;
  21. }
  22. return next();
  23. }
  24. }
  25. }