mirror of
https://github.com/yawaflua/yaflay.ru.git
synced 2025-12-09 20:19:32 +02:00
add providers to oembed, add robots.txt
This commit is contained in:
@@ -44,7 +44,7 @@ namespace yaflay.ru.Новая_папка
|
||||
|
||||
string? url = await getUrlFromGit(uri);
|
||||
|
||||
return Redirect(url != null ? url : uri);
|
||||
return Redirect(url != null ? url : "https://yaflay.ru/");
|
||||
}
|
||||
|
||||
// GET: HomeController/Create
|
||||
|
||||
9
Pages/RobotsTxt.cshtml
Normal file
9
Pages/RobotsTxt.cshtml
Normal file
@@ -0,0 +1,9 @@
|
||||
@page
|
||||
@{
|
||||
Layout = null;
|
||||
this.Response.ContentType = "text/plain";
|
||||
}
|
||||
# /robots.txt file for http://www.hanselman.com/
|
||||
User-agent: *
|
||||
<environment include="Development,Staging">Disallow: /</environment>
|
||||
<environment include="Production">Disallow: /* </environment>
|
||||
27
Startup.cs
27
Startup.cs
@@ -1,5 +1,7 @@
|
||||
using Microsoft.Extensions.Options;
|
||||
using HeyRed.OEmbed;
|
||||
using HeyRed.OEmbed.Providers;
|
||||
|
||||
namespace yaflay.ru
|
||||
{
|
||||
public class Startup
|
||||
@@ -26,7 +28,30 @@ namespace yaflay.ru
|
||||
{
|
||||
options.EnableCache = true; // true by default
|
||||
options.EnsureNotNull();
|
||||
});
|
||||
})
|
||||
.ClearProviders()
|
||||
.AddProvider<YoutubeProvider>()
|
||||
.AddProvider<YandexMusicProvider>()
|
||||
.AddProvider<FlickrProvider>()
|
||||
.AddProvider<TwitterProvider>(options =>
|
||||
{
|
||||
options.Parameters = new Dictionary<string, string?>
|
||||
{
|
||||
["theme"] = "dark"
|
||||
};
|
||||
})
|
||||
.AddProvider<FacebookProvider>(options =>
|
||||
{
|
||||
options.Parameters = new Dictionary<string, string?>
|
||||
{
|
||||
["access_token"] = "app_id|token"
|
||||
};
|
||||
});
|
||||
services.AddMvc()
|
||||
.AddRazorPagesOptions(options =>
|
||||
{
|
||||
options.Conventions.AddPageRoute("/robotstxt", "/Robots.Txt");
|
||||
});
|
||||
//services.AddDirectoryBrowser();
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.6.33723.286
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "yaflay.ru", "yaflay.ru.csproj", "{3AA2FE9B-D1AF-4B12-B090-7E4529BA40E0}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "yaflay.ru", "yaflay.ru.csproj", "{3AA2FE9B-D1AF-4B12-B090-7E4529BA40E0}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
||||
Reference in New Issue
Block a user