Compare commits
2 Commits
8f9396c791
...
9ab29a3a15
Author | SHA1 | Date | |
---|---|---|---|
9ab29a3a15 | |||
6c5fe1bc00 |
15
Program.cs
15
Program.cs
@@ -2,6 +2,7 @@
|
|||||||
using CatsOfMastodonBot.Models;
|
using CatsOfMastodonBot.Models;
|
||||||
using CatsOfMastodonBot.Services;
|
using CatsOfMastodonBot.Services;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using mstdnCats.Services;
|
using mstdnCats.Services;
|
||||||
@@ -41,12 +42,22 @@ public class MastodonBot
|
|||||||
{
|
{
|
||||||
options.ListenAnyIP(5005); // Listen on port 5005
|
options.ListenAnyIP(5005); // Listen on port 5005
|
||||||
});
|
});
|
||||||
|
webBuilder.ConfigureServices(services =>
|
||||||
|
{
|
||||||
|
services.AddCors(options =>
|
||||||
|
{
|
||||||
|
options.AddDefaultPolicy(options =>
|
||||||
|
{
|
||||||
|
options.AllowAnyHeader()
|
||||||
|
.AllowAnyMethod()
|
||||||
|
.AllowAnyOrigin();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} );
|
||||||
ServerStartup.Serverstartup(db);
|
ServerStartup.Serverstartup(db);
|
||||||
webBuilder.UseStartup<ServerStartup>();
|
webBuilder.UseStartup<ServerStartup>();
|
||||||
})
|
})
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Setup bot
|
// Setup bot
|
||||||
TelegramBotClient bot;
|
TelegramBotClient bot;
|
||||||
|
@@ -19,7 +19,7 @@ public class ServerStartup
|
|||||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||||
{
|
{
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
|
app.UseCors();
|
||||||
app.UseEndpoints(endpoints =>
|
app.UseEndpoints(endpoints =>
|
||||||
{
|
{
|
||||||
endpoints.MapGet("/", async context =>
|
endpoints.MapGet("/", async context =>
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DotNetEnv" Version="3.1.1" />
|
<PackageReference Include="DotNetEnv" Version="3.1.1" />
|
||||||
<PackageReference Include="MongoDB.Driver" Version="3.2.1" />
|
<PackageReference Include="MongoDB.Driver" Version="3.3.0" />
|
||||||
<PackageReference Include="Telegram.Bot" Version="22.4.4" />
|
<PackageReference Include="Telegram.Bot" Version="22.4.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user