diff --git a/SfeduSchedule/Controllers/ProxyController.cs b/SfeduSchedule/Controllers/ProxyController.cs index bc9e931..7e6eb05 100644 --- a/SfeduSchedule/Controllers/ProxyController.cs +++ b/SfeduSchedule/Controllers/ProxyController.cs @@ -20,6 +20,7 @@ public class ProxyController(ModeusService modeusService, ILoggerВозвращает расписание /// Слишком много запросов [HttpPost] + [Route("events/search")] public async Task Post([FromBody] ModeusScheduleRequest request) { string? schedule; diff --git a/SfeduSchedule/Controllers/ScheduleController.cs b/SfeduSchedule/Controllers/ScheduleController.cs index 605ac4e..2e2958b 100644 --- a/SfeduSchedule/Controllers/ScheduleController.cs +++ b/SfeduSchedule/Controllers/ScheduleController.cs @@ -9,12 +9,12 @@ using SfeduSchedule.Services; namespace SfeduSchedule.Controllers; [ApiController] -[Route("api/[controller]")] +[Route("api/schedule")] [EnableRateLimiting("throttle")] public class ScheduleController(ModeusService modeusService, ILogger logger) : ControllerBase { /// - /// Получить расписание по пользовательскому запросу. + /// [УСТАРЕЛО] Получить расписание по пользовательскому запросу. /// /// Объект запроса, содержащий параметры фильтрации расписания. /// Список событий расписания. @@ -41,7 +41,7 @@ public class ScheduleController(ModeusService modeusService, ILogger - /// Поиск аудиторий по пользовательскому запросу. + /// [УСТАРЕЛО] Поиск аудиторий по пользовательскому запросу. /// /// Объект запроса, содержащий параметры фильтрации аудиторий. /// Список аудиторий. diff --git a/SfeduSchedule/PluginLoader.cs b/SfeduSchedule/PluginLoader.cs index 17c5822..1a28244 100644 --- a/SfeduSchedule/PluginLoader.cs +++ b/SfeduSchedule/PluginLoader.cs @@ -18,20 +18,26 @@ public static class PluginLoader foreach (var file in Directory.EnumerateFiles(pluginsDir, "*.plugin.dll", SearchOption.AllDirectories)) { - var path = Path.GetFullPath(file); - var alc = new PluginLoadContext(path); - var asm = alc.LoadFromAssemblyPath(path); + try + { + var path = Path.GetFullPath(file); + var alc = new PluginLoadContext(path); + var asm = alc.LoadFromAssemblyPath(path); - // Ищем реализацию IPlugin - var pluginType = asm - .GetTypes() - .FirstOrDefault(t => typeof(IPlugin).IsAssignableFrom(t) && !t.IsAbstract && !t.IsInterface); + var pluginType = asm + .GetTypes() + .FirstOrDefault(t => typeof(IPlugin).IsAssignableFrom(t) && !t.IsAbstract && !t.IsInterface); - if (pluginType is null) - continue; + if (pluginType is null) + continue; - var instance = (IPlugin)Activator.CreateInstance(pluginType)!; - result.Add(new LoadedPlugin(instance, asm, alc)); + var instance = (IPlugin)Activator.CreateInstance(pluginType)!; + result.Add(new LoadedPlugin(instance, asm, alc)); + } + catch (Exception ex) + { + Console.WriteLine($"Ошибка загрузки плагина {file}: {ex.Message}"); + } } return result; @@ -39,15 +45,9 @@ public static class PluginLoader } // Отдельный контекст загрузки для изоляции зависимостей плагина -public sealed class PluginLoadContext : AssemblyLoadContext +public sealed class PluginLoadContext(string pluginMainAssemblyPath) : AssemblyLoadContext(isCollectible: true) { - private readonly AssemblyDependencyResolver _resolver; - - public PluginLoadContext(string pluginMainAssemblyPath) - : base(isCollectible: true) - { - _resolver = new AssemblyDependencyResolver(pluginMainAssemblyPath); - } + private readonly AssemblyDependencyResolver _resolver = new(pluginMainAssemblyPath); // Разрешаем управляемые зависимости плагина из его папки. // Возвращаем null, чтобы отдать решение в Default ALC для общих сборок (например, SfeduSchedule.Abstractions).