|
@@ -6,6 +6,16 @@
|
|
@using Masuit.Tools.Systems
|
|
@using Masuit.Tools.Systems
|
|
@using System.Text.RegularExpressions
|
|
@using System.Text.RegularExpressions
|
|
@model Masuit.MyBlogs.Core.Models.Entity.Post
|
|
@model Masuit.MyBlogs.Core.Models.Entity.Post
|
|
|
|
+@* 管理员模式直接看 *@
|
|
|
|
+@if (Context.Session.Get<UserInfoDto>(SessionKey.UserInfo)?.IsAdmin==true) {
|
|
|
|
+ <div class="encrypted-content">
|
|
|
|
+ <p class="size20 text-center text-red">↓↓↓以下是文章加密部分↓↓↓</p>
|
|
|
|
+ @Html.Raw(await Model.ProtectContent.ReplaceImgAttribute(Model.Title))
|
|
|
|
+ </div>
|
|
|
|
+ return;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+@* 授权可见 *@
|
|
@if (!string.IsNullOrEmpty(Model.ProtectContent) && Model.ProtectContentMode == ProtectContentMode.AuthorizeVisiable) {
|
|
@if (!string.IsNullOrEmpty(Model.ProtectContent) && Model.ProtectContentMode == ProtectContentMode.AuthorizeVisiable) {
|
|
<div class="encrypted-content" id="@SnowFlake.NewId">
|
|
<div class="encrypted-content" id="@SnowFlake.NewId">
|
|
@if (!string.IsNullOrEmpty(Context.Session.Get<string>("AccessViewToken")) || Context.Request.Cookies["Email"].MDString3(AppConfig.ConnString).Equals(Context.Request.Cookies["PostAccessToken"])) {
|
|
@if (!string.IsNullOrEmpty(Context.Session.Get<string>("AccessViewToken")) || Context.Request.Cookies["Email"].MDString3(AppConfig.ConnString).Equals(Context.Request.Cookies["PostAccessToken"])) {
|
|
@@ -16,8 +26,9 @@
|
|
<div class="comment-form">
|
|
<div class="comment-form">
|
|
<div class="comment-form-row" style="display:flex;gap:12px;flex-wrap:wrap;">
|
|
<div class="comment-form-row" style="display:flex;gap:12px;flex-wrap:wrap;">
|
|
<div style="position:relative;flex:1 1 240px;min-width:180px;display:flex;">
|
|
<div style="position:relative;flex:1 1 240px;min-width:180px;display:flex;">
|
|
|
|
+ @Html.AntiForgeryToken()
|
|
<input name="email" placeholder="请输入邮箱" required style="flex:1 1 auto;min-width:120px;padding-right:110px;" type="email" v-model="viewToken.email">
|
|
<input name="email" placeholder="请输入邮箱" required style="flex:1 1 auto;min-width:120px;padding-right:110px;" type="email" v-model="viewToken.email">
|
|
- <button :disabled="disableGetcode||!viewToken.email" @@click="getcode(viewToken.email)" class="comment-form-btn" style="position:absolute;right:2px;top:50%;transform:translateY(-50%);min-width:96px;height:36px;padding:0 8px;font-size:.97rem;z-index:2;" type="button"> {{codeMsg}} </button>
|
|
|
|
|
|
+ <button :disabled="disableGetcode||!viewToken.email" @@click="getToken(viewToken.email)" class="comment-form-btn" style="position:absolute;right:2px;top:50%;transform:translateY(-50%);min-width:96px;height:36px;padding:0 8px;font-size:.97rem;z-index:2;" type="button"> {{codeMsg}} </button>
|
|
</div>
|
|
</div>
|
|
<div style="position:relative;flex:1 1 240px;min-width:180px;display:flex;">
|
|
<div style="position:relative;flex:1 1 240px;min-width:180px;display:flex;">
|
|
<input name="email" placeholder="验证码" required style="flex:1 1 auto;min-width:120px;padding-right:110px;" v-model="viewToken.token">
|
|
<input name="email" placeholder="验证码" required style="flex:1 1 auto;min-width:120px;padding-right:110px;" v-model="viewToken.token">
|
|
@@ -33,19 +44,24 @@
|
|
</div>
|
|
</div>
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+@* 评论可见 *@
|
|
@if (!string.IsNullOrEmpty(Model.ProtectContent) && Model.ProtectContentMode == ProtectContentMode.CommentVisiable) {
|
|
@if (!string.IsNullOrEmpty(Model.ProtectContent) && Model.ProtectContentMode == ProtectContentMode.CommentVisiable) {
|
|
<div class="encrypted-content">
|
|
<div class="encrypted-content">
|
|
@if (string.IsNullOrEmpty(Context.Request.Cookies["Comment_" + Model.Id])) {
|
|
@if (string.IsNullOrEmpty(Context.Request.Cookies["Comment_" + Model.Id])) {
|
|
<p class="margin-bot10 size24 text-center text-red">此处内容已隐藏,评论回复后刷新页面可见</p>
|
|
<p class="margin-bot10 size24 text-center text-red">此处内容已隐藏,评论回复后刷新页面可见</p>
|
|
} else {
|
|
} else {
|
|
|
|
+ <p class="size20 text-center text-red">↓↓↓以下是文章加密部分↓↓↓</p>
|
|
@Html.Raw(await Model.ProtectContent.ReplaceImgAttribute(Model.Title))
|
|
@Html.Raw(await Model.ProtectContent.ReplaceImgAttribute(Model.Title))
|
|
}
|
|
}
|
|
</div>
|
|
</div>
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+@*密码科技*@
|
|
@if (!string.IsNullOrEmpty(Model.ProtectContent) && Model.ProtectContentMode == ProtectContentMode.Password) {
|
|
@if (!string.IsNullOrEmpty(Model.ProtectContent) && Model.ProtectContentMode == ProtectContentMode.Password) {
|
|
<div class="encrypted-content">
|
|
<div class="encrypted-content">
|
|
- @if (Context.Request.Query["password"] != Model.ProtectPassword) {
|
|
|
|
|
|
+ @if (Context.Request.Query["password"].ToString() != Model.ProtectPassword) {
|
|
<p class="margin-bot10 size24 text-center text-red">此处内容需要密码可见:</p>
|
|
<p class="margin-bot10 size24 text-center text-red">此处内容需要密码可见:</p>
|
|
<form class="comment-form" method="get">
|
|
<form class="comment-form" method="get">
|
|
<div style="position:relative;max-width:240px;">
|
|
<div style="position:relative;max-width:240px;">
|
|
@@ -55,11 +71,14 @@
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</form>
|
|
} else {
|
|
} else {
|
|
|
|
+ <p class="size20 text-center text-red">↓↓↓以下是文章加密部分↓↓↓</p>
|
|
@Html.Raw(await Model.ProtectContent.ReplaceImgAttribute(Model.Title))
|
|
@Html.Raw(await Model.ProtectContent.ReplaceImgAttribute(Model.Title))
|
|
}
|
|
}
|
|
</div>
|
|
</div>
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+@*地区可见*@
|
|
@if (Model.ProtectContentMode == ProtectContentMode.Regions) {
|
|
@if (Model.ProtectContentMode == ProtectContentMode.Regions) {
|
|
var loc = Context.Request.Location();
|
|
var loc = Context.Request.Location();
|
|
if (Model.ProtectContentLimitMode == RegionLimitMode.AllowRegion && Regex.IsMatch(loc + loc.Coodinate, Model.ProtectContentRegions, RegexOptions.IgnoreCase)) {
|
|
if (Model.ProtectContentLimitMode == RegionLimitMode.AllowRegion && Regex.IsMatch(loc + loc.Coodinate, Model.ProtectContentRegions, RegexOptions.IgnoreCase)) {
|
|
@@ -72,6 +91,8 @@
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+@*仅搜索引擎可见*@
|
|
@if (Context.Request.IsRobot() && Model.ProtectContentLimitMode == RegionLimitMode.OnlyForSearchEngine) {
|
|
@if (Context.Request.IsRobot() && Model.ProtectContentLimitMode == RegionLimitMode.OnlyForSearchEngine) {
|
|
@Html.Raw(await Model.ProtectContent.ReplaceImgAttribute(Model.Title))
|
|
@Html.Raw(await Model.ProtectContent.ReplaceImgAttribute(Model.Title))
|
|
return;
|
|
return;
|