forked from grandnode/grandnode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLetsEncryptController.cs
36 lines (30 loc) · 989 Bytes
/
LetsEncryptController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using Grand.Core;
using Grand.Core.Domain.Common;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.IO;
namespace Grand.Web.Controllers
{
[AllowAnonymous]
public partial class LetsEncryptController : Controller
{
private readonly CommonSettings _commonSettings;
public LetsEncryptController(CommonSettings commonSettings)
{
_commonSettings = commonSettings;
}
public virtual IActionResult Index(string fileName)
{
if(!_commonSettings.AllowToReadLetsEncryptFile)
return Content("");
if (fileName == null)
return Content("");
var file = CommonHelper.MapPath("~/wwwroot/content/acme/") + Path.GetFileName(fileName);
if (System.IO.File.Exists(file))
{
return new PhysicalFileResult(file, "text/plain");
}
return Content("");
}
}
}