add environ error message

add to environ some data and some codereview pages
some fix oembed and OpenGraph
This commit is contained in:
Дмитрий Шиманский
2023-12-20 23:57:55 +03:00
parent 8a73f597cf
commit 921b8f3db3
14 changed files with 96 additions and 94 deletions

View File

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

View File

@@ -3,11 +3,13 @@
@using System.Text.Json.Nodes
@{
ViewData["Title"] = "Authorize";
string authorizationUrl = "https://discord.com/api/oauth2/authorize?client_id=@Startup.clientId&response_type=code&redirect_uri=@Startup.redirectUrl&scope=identify";
<p style="display:none;">Data: @Startup.clientId @Startup.redirectUrl @Startup.ownerId @Model.code</p>
if (Model.code == null)
{
if (Request.Cookies["melon"]?.ToString() == null)
{
<a href="https://discord.com/api/oauth2/authorize?client_id=1115013432710799440&response_type=code&redirect_uri=https%3A%2F%2Fyawaflua.ru%2Fauthorize&scope=identify">Login while Discord</a>
<a href="@authorizationUrl">Login while Discord</a>
}
else
{
@@ -28,7 +30,7 @@
else
{
<h4>
Токен авторизации неправильный! Попробуйте <a href="https://discord.com/api/oauth2/authorize?client_id=1115013432710799440&response_type=code&redirect_uri=https%3A%2F%2Fyawaflua.ru%2Fauthorize&scope=identify">заново</a>
Токен авторизации неправильный! Попробуйте <a href="@authorizationUrl">заново</a>
</h4>
}
@@ -52,6 +54,13 @@
if (body["access_token"]?.ToString() == null)
{
<h4>Ошибка! Попробуй авторизоваться заново</h4>
Console.Error.WriteLine("Don't worry, this message is not bad as you think \n START \\/");
Console.Error.WriteLine("Error: DiscordAuthorize is not worked");
Console.Error.WriteLine($"Body from discord: {body}");
Console.Error.WriteLine($"Check environment data: \n ClientId={Startup.clientId}\nClientSecret={Startup.clientSecret}\nRedirectUrl={Startup.redirectUrl}\nOwnerId=wwwwwwwwwwwwwwwwwwwwwww{Startup.ownerId} ");
Console.Error.WriteLine("If any data is null and you set data in environment or appsettings.json, please create issue with this debug messages ");
Console.Error.WriteLine("END /\\");
}
else
{

View File

@@ -33,7 +33,7 @@
<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>
<h6 align="left">Статья подготовлена <a href="https://yawaflua.ru/gh">Дмитрием</a></h6>
<h6 align="left">Статья подготовлена <a href="https://discord.com/users/@Post.author.Id">@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">
@@ -73,23 +73,23 @@
var allBlogs = Startup.dbContext.Blogs.ToArray();
if (allBlogs.Length == 0)
{
<p>
<h1 align="center">Ничего нет...</h1>
<h1 align="center">Вот вам банан -> 🍌</h1>
</p>
<p>
<h1 align="center">Ничего нет...</h1>
<h1 align="center">Вот вам банан -> 🍌</h1>
</p>
}
else
{
foreach (var blog in allBlogs)
foreach (Blogs blog in allBlogs)
{
<div class="card text-white bg-dark mb-3 text-center" style="width: 18rem;">
<img src="@blog.ImageUrl" class="card-img-top" alt="...">
<div class="card-body ">
<h5 class="card-title">@Html.Raw(blog.Title)</h5>
<p class="card-text">@Html.Raw(blog.Annotation)</p>
<a href="/Blog/@blog.Id" class="btn btn-primary center">Читать</a>
</div>
</div>
<div class="card text-white bg-dark mb-3 text-center" style="width: 18rem;">
<img src="@blog.ImageUrl" class="card-img-top" />
<div class="card-body ">
<h5 class="card-title">@Html.Raw(blog.Title)</h5>
<p class="card-text">@Html.Raw(blog.Annotation)</p>
<a href="/Blog/@blog.Id" class="btn btn-primary center">Читать</a>
</div>
</div>
}
}
}

View File

@@ -7,7 +7,7 @@
<h3 align="left" class="readme" >README.md</h3>
@{
string Github_readme = Startup.client.GetStringAsync("https://raw.githubusercontent.com/yawaflua/yawaflua/main/README.md").Result;
string Github_readme = Startup.client.GetStringAsync(Startup.readmeFile).Result;
<div class="text"> @Html.Raw(Github_readme) </div>
}

View File

@@ -9,7 +9,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page not found</title>
<link rel="stylesheet" href="https://yaflay.ru/css/500.css" />
<link rel="stylesheet" href="~/css/500.css" />
</head>
<body>
<div class="main-error-page">

View File

@@ -23,7 +23,7 @@
<div class="col-lg-7 text-center">
<img src="~/img/error-404.png" alt="image 404">
<h2><b>404</b> Страница не найдена</h2>
<p>посетите главную страницу <br> возможно вы найдёте её</p>
<p>посетите главную страницу <br> возможно вы найдёте свой путь</p>
<a href="@path" class="cmn-btn mt-4">На главную</a>
</div>
</div>

View File

@@ -3,10 +3,10 @@
Layout = null;
this.Response.ContentType = "text/plain";
}
# /Robots.txt file for httpы://yawaflua.ru/
User-agent: *
<environment include="Development,Staging">Disallow: /*</environment>
<environment include="Production">Disallow: /* </environment>
<environment include="Production">Allow: /Blog </environment>
<environment include="Production">Allow: /Blog/* </environment>
<environment include="Production">Allow: /Privacy </environment>
<environment include="Production">Allow: / </environment>

View File

@@ -8,7 +8,7 @@
<title>@ViewData["Title"] - @Context.Request.Host.Host</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
<link type="application/json+oembed" href="~/json/oembed.json" />
<!--<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css">
@@ -16,7 +16,7 @@
<!-- and it's easy to individually load additional languages -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/go.min.js"></script>
@if (Context.Request.Path == "")
@if (!Context.Request.Path.ToString().StartsWith("/Blog/"))
{
<meta property="og:title" content="yawaflua readme" />
<meta property="og:type" content="rich" />
@@ -26,8 +26,9 @@
content="Here you can check info about yawaflua: social networks, programming languages that he knows and his projects." />
<meta property="og:locale" content="en_US" />
<meta property="og:site_name" content="yawaflua.ru" />
<link type="application/json+oembed" href="~/json/oembed.json" />
}
else
else if (Context.Request.Path.ToString().StartsWith("/Blog/"))
{
<meta property="og:title" content="@ViewData["og:title"]" />
<meta property="og:type" content="rich" />
@@ -123,10 +124,11 @@
<footer class="border-top footer text-muted margin-2-vm">
<div class="container margin-2-vm">
&copy; 2023 - @Context.Request.Host.Host - <a asp-area="" asp-page="/Privacy">Privacy</a>
<b class="flex-row margin-2-vm container-md">
сrafted by <a href="https://yawaflua.ru/gh" class="underline dashed decoration-purple text-white hover:decoration-wavy">yawaflua</a>
</b>
</div>
<p class="flex-row margin-2-vm container-md">
сrafted by <a href="https://yawaflua.ru/gh" class="underline dashed decoration-purple text-white hover:decoration-wavy">yawaflua</a>
</p>
</footer>
<script src="~/lib/jquery/dist/jquery.min.js"></script>