mirror of
https://github.com/yawaflua/yaflay.ru.git
synced 2025-12-09 20:19:32 +02:00
make oembed
This commit is contained in:
18
Startup.cs
18
Startup.cs
@@ -1,26 +1,36 @@
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
using HeyRed.OEmbed;
|
||||
namespace yaflay.ru
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
private readonly IConfiguration configuration;
|
||||
private readonly OEmbedOptions options;
|
||||
public Startup()
|
||||
{
|
||||
configuration = new ConfigurationBuilder()
|
||||
.AddEnvironmentVariables(prefix: "m.")
|
||||
.AddJsonFile("appsettings.json", optional: true)
|
||||
.Build();
|
||||
options = new OEmbedOptions()
|
||||
{
|
||||
EnableCache = true
|
||||
};
|
||||
}
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddControllers();
|
||||
services.AddRouting();
|
||||
services.AddRazorPages();
|
||||
services.AddOEmbed(options =>
|
||||
{
|
||||
options.EnableCache = true; // true by default
|
||||
options.EnsureNotNull();
|
||||
});
|
||||
//services.AddDirectoryBrowser();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.18.1" />
|
||||
<PackageReference Include="OEmbed" Version="3.0.0" />
|
||||
<PackageReference Include="OEmbed.Extensions.Microsoft.DependencyInjection" Version="3.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user