This commit is contained in:
Дмитрий Шиманский
2023-12-23 23:18:52 +03:00
parent 8df7e26494
commit 153979cbbd
10 changed files with 295 additions and 83 deletions

View File

@@ -8,7 +8,7 @@
@if (Request.Cookies["melon"] != null)
{
if (Startup.ownerId.FirstOrDefault(Request.Cookies["cable"]) == null)
if (Startup.ownerId.FirstOrDefault(Request.Cookies["cable"]).isNull())
{
<h1 align="center">Вы не авторизованы! Сасни хуйца, олух</h1>
isAllowed = false;

View File

@@ -1,14 +1,8 @@
@page "{id?}"
@model BlogModel
@using yaflay.ru.Models.Tables
@{
if (Model.Id == 0)
ViewData["Title"] = "Blog";
}
@{
string path = $"{this.Request.Scheme}://{this.Request.Host}";
}
@{
if (Model.Id != 0)
{
@@ -29,48 +23,49 @@
<p align="left">
<h1 align="left">@Html.Raw(Post.Title)</h1>
<h5>@Post.dateTime</h5>
</p>
<div id="blogId" style="display:none;">@Model.Id</div>
<p align="center"><img src="@Post.ImageUrl" style="width:50vmax;"/></p>
<p align="center">@Html.Raw(Post.Text)</p>
string userId = "https://discord.com/users/"+Post.author.discordId;
<h6 align="left">Статья подготовлена <a href="@userId">@Post.author.discordNickName</a></h6>
<div class="container my-5 py-5 bg-dark text-muted">
<div class="row d-flex justify-content-center">
<div class="col-md-12 col-lg-10">
<div class="card text-muted bg-dark">
<div class="card-body position-static p-4" id="allComments">
<h4 class="mb-0" id="commentBar">Последние комментарии</h4>
</p>
<div id="blogId" style="display:none;">@Model.Id</div>
<p align="center"><img src="@Post.ImageUrl" style="width:50vmax;"/></p>
<p align="center">@Html.Raw(Post.Text)</p>
string userUrl = "https://discord.com/users/" + Post.authorId;
<h6 align="left">Статья подготовлена <a href="@userUrl">@Post.authorNickname</a></h6>
<div class="container my-5 py-5 bg-dark text-muted">
<div class="row d-flex justify-content-center">
<div class="col-md-12 col-lg-10">
<div class="card text-muted bg-dark">
<div class="card-body position-static p-4" id="allComments">
<h4 class="mb-0" id="commentBar">Последние комментарии</h4>
<h1 align="center">Дальше тьма...</h1>
<h1 align="center">Дальше тьма...</h1>
</div>
</div>
</div>
</div>
</div>
</div>
}
</div>
}
<div class="card-footer text-white bg-dark mb-3 py-3 border-0" >
<div class="d-flex flex-start w-100">
<div class="form-outline w-100">
<label for="userEmail" class="form-label">Адрес электронной почты</label>
<input type="email" class="form-control bg-dark text-white" id="userEmail" placeholder="name@example.com" name="userEmail">
<label for="commentText" class="form-label">Комментарий</label>
<input type="text" class="form-control bg-dark text-white" id="commentText" rows="4" name="commentText">
<div class="card-footer text-white bg-dark mb-3 py-3 border-0" >
<div class="d-flex flex-start w-100">
<div class="form-outline w-100">
<label for="userEmail" class="form-label">Адрес электронной почты</label>
<input type="email" class="form-control bg-dark text-white" id="userEmail" placeholder="name@example.com" name="userEmail">
<label for="commentText" class="form-label">Комментарий</label>
<input type="text" class="form-control bg-dark text-white" id="commentText" rows="4" name="commentText">
</div>
</div>
<div class="float-end mt-2 pt-1">
<button type="button" class="btn btn-primary btn-sm" id="postComment" >Запостить коммент</button>
</div>
</div>
<div class="float-end mt-2 pt-1">
<button type="button" class="btn btn-primary btn-sm" id="postComment" >Запостить коммент</button>
</div>
</div>
}
else
{
ViewData["Title"] = "Blog";
var allBlogs = Startup.dbContext.Blogs.ToArray();
if (allBlogs.Length == 0)
{

View File

@@ -77,7 +77,7 @@
}
string responseBody = await message.Content.ReadAsStringAsync();
JsonNode response = JsonNode.Parse(responseBody);
if (response["user"] != null)
if (!response["user"].isNull())
{
Context.Response.Cookies.Append("cable", response["user"]["id"].ToString());
string userName = response["user"]["global_name"].ToString();