Resharper cleanup and fixes and remove useless asp overhead
This commit is contained in:
parent
e0d6a97dca
commit
acb2b25e09
44 changed files with 54 additions and 81 deletions
|
@ -10,7 +10,6 @@ using Geekbot.net.Database.Models;
|
|||
using Geekbot.net.Lib.ErrorHandling;
|
||||
using Geekbot.net.Lib.Extensions;
|
||||
using Geekbot.net.Lib.Localization;
|
||||
using StackExchange.Redis;
|
||||
|
||||
namespace Geekbot.net.Commands.Admin
|
||||
{
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.ErrorHandling;
|
||||
|
||||
namespace Geekbot.net.Commands.Admin
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace Geekbot.net.Commands.Audio
|
|||
}
|
||||
|
||||
// [Command("ytplay")]
|
||||
public async Task ytplay(string url)
|
||||
public async Task Ytplay(string url)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -3,7 +3,6 @@ using System.Linq;
|
|||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.ErrorHandling;
|
||||
using PokeAPI;
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.ErrorHandling;
|
||||
using Geekbot.net.Lib.Localization;
|
||||
using StackExchange.Redis;
|
||||
|
|
|
@ -4,7 +4,6 @@ using System.Linq;
|
|||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.Converters;
|
||||
using Geekbot.net.Lib.ErrorHandling;
|
||||
using MtgApiManager.Lib.Service;
|
||||
|
|
|
@ -3,7 +3,6 @@ using System.Threading.Tasks;
|
|||
using System.Web;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.Clients;
|
||||
using Geekbot.net.Lib.ErrorHandling;
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ using System.Net.Http;
|
|||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.ErrorHandling;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ using System.Net.Http;
|
|||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.ErrorHandling;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.ErrorHandling;
|
||||
using Geekbot.net.Lib.Media;
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ using System.Net.Http;
|
|||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.ErrorHandling;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ using System.Net.Http;
|
|||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.ErrorHandling;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ using System.Net.Http;
|
|||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.ErrorHandling;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.ErrorHandling;
|
||||
|
||||
namespace Geekbot.net.Commands.Randomness
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.Media;
|
||||
|
||||
namespace Geekbot.net.Commands.Randomness
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.ErrorHandling;
|
||||
|
||||
namespace Geekbot.net.Commands.Randomness
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.Media;
|
||||
|
||||
namespace Geekbot.net.Commands.Randomness
|
||||
|
|
|
@ -4,7 +4,6 @@ using System.Threading.Tasks;
|
|||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Database;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.ErrorHandling;
|
||||
using Geekbot.net.Lib.Extensions;
|
||||
using Geekbot.net.Lib.Levels;
|
||||
|
@ -42,7 +41,7 @@ namespace Geekbot.net.Commands.User
|
|||
var messages = _database.Messages
|
||||
.Where(e => e.GuildId == Context.Guild.Id.AsLong())
|
||||
.Sum(e => e.MessageCount);
|
||||
var level = _levelCalc.GetLevel((int) messages);
|
||||
var level = _levelCalc.GetLevel(messages);
|
||||
|
||||
eb.AddField("Server Age", $"{created.Day}/{created.Month}/{created.Year} ({age} days)");
|
||||
eb.AddInlineField("Level", level)
|
||||
|
|
|
@ -5,7 +5,6 @@ using Discord;
|
|||
using Discord.Commands;
|
||||
using Geekbot.net.Database;
|
||||
using Geekbot.net.Database.Models;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.ErrorHandling;
|
||||
using Geekbot.net.Lib.Extensions;
|
||||
using Geekbot.net.Lib.Localization;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.ErrorHandling;
|
||||
|
||||
namespace Geekbot.net.Commands.Utils
|
||||
|
|
|
@ -7,7 +7,6 @@ using System.Threading.Tasks;
|
|||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Discord.WebSocket;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.ErrorHandling;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.ErrorHandling;
|
||||
using Geekbot.net.Lib.Localization;
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Lib;
|
||||
|
||||
namespace Geekbot.net.Commands.Utils.Dice
|
||||
{
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.Converters;
|
||||
using Geekbot.net.Lib.ErrorHandling;
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.ErrorHandling;
|
||||
|
||||
namespace Geekbot.net.Commands.Utils
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Lib;
|
||||
|
||||
namespace Geekbot.net.Commands.Utils
|
||||
{
|
||||
|
|
|
@ -5,7 +5,6 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.Converters;
|
||||
using Geekbot.net.Lib.ErrorHandling;
|
||||
using Geekbot.net.Lib.UserRepository;
|
||||
|
@ -167,7 +166,10 @@ namespace Geekbot.net.Commands.Utils.Poll
|
|||
};
|
||||
results.Add(result);
|
||||
}
|
||||
catch {}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
results.Sort((x, y) => y.VoteCount.CompareTo(x.VoteCount));
|
||||
return results;
|
||||
|
|
|
@ -5,11 +5,9 @@ using Discord;
|
|||
using Discord.Commands;
|
||||
using Geekbot.net.Database;
|
||||
using Geekbot.net.Database.Models;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.ErrorHandling;
|
||||
using Geekbot.net.Lib.Extensions;
|
||||
using Geekbot.net.Lib.Polyfills;
|
||||
using StackExchange.Redis;
|
||||
|
||||
namespace Geekbot.net.Commands.Utils.Quote
|
||||
{
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Geekbot.net.Database
|
||||
{
|
||||
|
@ -13,6 +12,6 @@ namespace Geekbot.net.Database
|
|||
}
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
=> optionsBuilder.UseInMemoryDatabase(databaseName: _name);
|
||||
=> optionsBuilder.UseInMemoryDatabase(_name);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Geekbot.net.Database.Models
|
||||
|
|
|
@ -8,7 +8,6 @@ using Geekbot.net.Commands.Utils.Quote;
|
|||
using Geekbot.net.Database.Models;
|
||||
using Geekbot.net.Lib.Extensions;
|
||||
using Geekbot.net.Lib.Logger;
|
||||
using MtgApiManager.Lib.Model;
|
||||
using Newtonsoft.Json;
|
||||
using StackExchange.Redis;
|
||||
|
||||
|
|
|
@ -24,7 +24,11 @@
|
|||
</PackageReference>
|
||||
<PackageReference Include="Google.Apis.YouTube.v3" Version="1.33.1.1217" />
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.8.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.6" />
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.DataProtection.Redis" Version="0.3.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.0.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Cors" Version="2.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="2.0.2" />
|
||||
|
|
|
@ -25,7 +25,9 @@ namespace Geekbot.net
|
|||
private readonly IUserRepository _userRepository;
|
||||
private readonly IReactionListener _reactionListener;
|
||||
|
||||
public Handlers(DatabaseContext database, IDiscordClient client, IGeekbotLogger logger, IDatabase redis, IServiceProvider servicesProvider, CommandService commands, IUserRepository userRepository, IReactionListener reactionListener)
|
||||
public Handlers(DatabaseContext database, IDiscordClient client, IGeekbotLogger logger, IDatabase redis,
|
||||
IServiceProvider servicesProvider, CommandService commands, IUserRepository userRepository,
|
||||
IReactionListener reactionListener)
|
||||
{
|
||||
_database = database;
|
||||
_client = client;
|
||||
|
|
|
@ -1,45 +1,38 @@
|
|||
using System.Threading.Tasks;
|
||||
using Geekbot.net.Lib.GlobalSettings;
|
||||
using Geekbot.net.Lib.Logger;
|
||||
using MyAnimeListSharp.Auth;
|
||||
using MyAnimeListSharp.Core;
|
||||
using MyAnimeListSharp.Facade.Async;
|
||||
using StackExchange.Redis;
|
||||
|
||||
namespace Geekbot.net.Lib.Clients
|
||||
{
|
||||
public class MalClient : IMalClient
|
||||
{
|
||||
private readonly IDatabase _redis;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly IGeekbotLogger _logger;
|
||||
private ICredentialContext _credentials;
|
||||
private AnimeSearchMethodsAsync _animeSearch;
|
||||
private MangaSearchMethodsAsync _mangaSearch;
|
||||
|
||||
public MalClient(IDatabase redis, IGeekbotLogger logger)
|
||||
public MalClient(IGlobalSettings globalSettings, IGeekbotLogger logger)
|
||||
{
|
||||
_redis = redis;
|
||||
_globalSettings = globalSettings;
|
||||
_logger = logger;
|
||||
ReloadClient();
|
||||
}
|
||||
|
||||
public bool ReloadClient()
|
||||
{
|
||||
var malCredentials = _redis.HashGetAll("malCredentials");
|
||||
if (malCredentials.Length != 0)
|
||||
var malCredentials = _globalSettings.GetKey("MalCredentials");
|
||||
if (!string.IsNullOrEmpty(malCredentials))
|
||||
{
|
||||
_credentials = new CredentialContext();
|
||||
foreach (var c in malCredentials)
|
||||
var credSplit = malCredentials.Split('|');
|
||||
_credentials = new CredentialContext()
|
||||
{
|
||||
switch (c.Name)
|
||||
{
|
||||
case "Username":
|
||||
_credentials.UserName = c.Value;
|
||||
break;
|
||||
case "Password":
|
||||
_credentials.Password = c.Value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
UserName = credSplit[0],
|
||||
Password = credSplit[1]
|
||||
};
|
||||
_animeSearch = new AnimeSearchMethodsAsync(_credentials);
|
||||
_mangaSearch = new MangaSearchMethodsAsync(_credentials);
|
||||
_logger.Debug(LogSource.Geekbot, "Logged in to MAL");
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
using Geekbot.net.Commands.Randomness.Cat;
|
||||
|
||||
namespace Geekbot.net.Lib.Logger
|
||||
{
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.WebSocket;
|
||||
|
|
|
@ -53,6 +53,7 @@ namespace Geekbot.net
|
|||
logo.AppendLine(@"| |_| | |___| |___| . \| |_) | |_| || |");
|
||||
logo.AppendLine(@" \____|_____|_____|_|\_\____/ \___/ |_|");
|
||||
logo.AppendLine("=========================================");
|
||||
logo.AppendLine($"Version {Constants.BotVersion()}");
|
||||
Console.WriteLine(logo.ToString());
|
||||
var sumologicActive = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("GEEKBOT_SUMO"));
|
||||
var logger = new GeekbotLogger(runParameters, sumologicActive);
|
||||
|
@ -112,7 +113,7 @@ namespace Geekbot.net
|
|||
_userRepository = new UserRepository(_database, logger);
|
||||
var fortunes = new FortunesProvider(logger);
|
||||
var mediaProvider = new MediaProvider(logger);
|
||||
var malClient = new MalClient(_redis, logger);
|
||||
var malClient = new MalClient(_globalSettings, logger);
|
||||
var levelCalc = new LevelCalc();
|
||||
var emojiConverter = new EmojiConverter();
|
||||
var mtgManaConverter = new MtgManaConverter();
|
||||
|
@ -174,13 +175,12 @@ namespace Geekbot.net
|
|||
_client.UserLeft += handlers.UserLeft;
|
||||
_client.ReactionAdded += handlers.ReactionAdded;
|
||||
_client.ReactionRemoved += handlers.ReactionRemoved;
|
||||
|
||||
if (!_runParameters.DisableApi)
|
||||
{
|
||||
StartWebApi();
|
||||
}
|
||||
|
||||
var webserver = _runParameters.DisableApi ? Task.Delay(10) : StartWebApi();
|
||||
|
||||
_logger.Information(LogSource.Geekbot, "Done and ready for use");
|
||||
|
||||
await webserver;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -197,12 +197,11 @@ namespace Geekbot.net
|
|||
return true;
|
||||
}
|
||||
|
||||
private void StartWebApi()
|
||||
private Task StartWebApi()
|
||||
{
|
||||
_logger.Information(LogSource.Api, "Starting Webserver");
|
||||
var webApiUrl = new Uri($"http://{_runParameters.ApiHost}:{_runParameters.ApiPort}");
|
||||
WebApi.WebApiStartup.StartWebApi(_logger, _runParameters, _commands);
|
||||
_logger.Information(LogSource.Api, $"Webserver now running on {webApiUrl}");
|
||||
WebApi.WebApiStartup.StartWebApi(_logger, _runParameters, _commands, _database);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,11 +6,11 @@ using Microsoft.AspNetCore.Mvc;
|
|||
namespace Geekbot.net.WebApi.Controllers.Commands
|
||||
{
|
||||
[EnableCors("AllowSpecificOrigin")]
|
||||
public class HelpController : Controller
|
||||
public class CommandController : Controller
|
||||
{
|
||||
private readonly CommandService _commands;
|
||||
|
||||
public HelpController(CommandService commands)
|
||||
public CommandController(CommandService commands)
|
||||
{
|
||||
_commands = commands;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ namespace Geekbot.net.WebApi.Controllers.Commands
|
|||
let cmdParamsObj = cmd.Parameters.Select(cmdParam => new CommandParamDto
|
||||
{
|
||||
Summary = cmdParam.Summary,
|
||||
Default = cmdParam.DefaultValue?.ToString() ?? null,
|
||||
Default = cmdParam.DefaultValue?.ToString(),
|
||||
Type = cmdParam.Type?.ToString()
|
||||
})
|
||||
.ToList()
|
||||
|
@ -31,7 +31,7 @@ namespace Geekbot.net.WebApi.Controllers.Commands
|
|||
{
|
||||
Name = cmd.Name,
|
||||
Summary = cmd.Summary,
|
||||
IsAdminCommand = (param.Contains("admin")),
|
||||
IsAdminCommand = param.Contains("admin") || param.Contains("owner"),
|
||||
Aliases = cmd.Aliases.ToArray(),
|
||||
Params = cmdParamsObj
|
||||
}).ToList();
|
|
@ -1,4 +1,5 @@
|
|||
using Geekbot.net.Lib;
|
||||
using System.Globalization;
|
||||
using Geekbot.net.Lib;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
|
@ -13,7 +14,7 @@ namespace Geekbot.net.WebApi.Controllers.Status
|
|||
var responseBody = new ApiStatusDto
|
||||
{
|
||||
GeekbotVersion = Constants.BotVersion(),
|
||||
ApiVersion = Constants.ApiVersion.ToString(),
|
||||
ApiVersion = Constants.ApiVersion.ToString(CultureInfo.InvariantCulture),
|
||||
Status = "Online"
|
||||
};
|
||||
return Ok(responseBody);
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Concurrent;
|
||||
using Geekbot.net.Lib.Logger;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
|
|
|
@ -36,6 +36,8 @@ namespace Geekbot.net.WebApi.Logging
|
|||
case LogLevel.Critical:
|
||||
_geekbotLogger.Error(LogSource.Api, $"{eventId.Id} - {_categoryName} - {state}", exception);
|
||||
break;
|
||||
case LogLevel.None:
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(logLevel));
|
||||
}
|
||||
|
@ -67,6 +69,9 @@ namespace Geekbot.net.WebApi.Logging
|
|||
return NLog.LogLevel.Error;
|
||||
case LogLevel.Critical:
|
||||
return NLog.LogLevel.Fatal;
|
||||
case LogLevel.None:
|
||||
return NLog.LogLevel.Off;
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(level));
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Net;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Database;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.Logger;
|
||||
using Geekbot.net.WebApi.Logging;
|
||||
|
@ -13,9 +13,10 @@ using Microsoft.Extensions.Logging;
|
|||
|
||||
namespace Geekbot.net.WebApi
|
||||
{
|
||||
public class WebApiStartup
|
||||
public static class WebApiStartup
|
||||
{
|
||||
public static void StartWebApi(IGeekbotLogger logger, RunParameters runParameters, CommandService commandService)
|
||||
public static void StartWebApi(IGeekbotLogger logger, RunParameters runParameters, CommandService commandService,
|
||||
DatabaseContext databaseContext)
|
||||
{
|
||||
WebHost.CreateDefaultBuilder()
|
||||
.UseKestrel(options =>
|
||||
|
@ -26,6 +27,7 @@ namespace Geekbot.net.WebApi
|
|||
{
|
||||
services.AddMvc();
|
||||
services.AddSingleton<CommandService>(commandService);
|
||||
services.AddSingleton<DatabaseContext>(databaseContext);
|
||||
services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy("AllowSpecificOrigin",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.Converters;
|
||||
using Xunit;
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.Levels;
|
||||
using Xunit;
|
||||
|
||||
|
|
Loading…
Reference in a new issue