Exemplo n.º 1
0
 public AlbumController(
     LibraryService libraryService,
     IcAmpLogger logger)
 {
     _libraryService = libraryService;
     _logger         = logger;
 }
Exemplo n.º 2
0
 public UserService(
     UserRepo userRepo,
     IcAmpLogger logger)
 {
     _userRepo = userRepo;
     _logger   = logger;
 }
Exemplo n.º 3
0
 public FileService(
     Library library,
     IcAmpLogger logger)
 {
     _libary = library;
     _logger = logger;
 }
Exemplo n.º 4
0
 public MediaManager(
     string musicFolder,
     IcAmpLogger logger)
 {
     _musicFolder = musicFolder;
     _logger      = logger;
 }
Exemplo n.º 5
0
 public UserController(
     UserService userService,
     IcAmpLogger logger)
 {
     _userService = userService;
     _logger      = logger;
 }
Exemplo n.º 6
0
 public AuthService(
     UserService userService,
     IcAmpLogger logger)
 {
     _userService = userService;
     _logger      = logger;
 }
Exemplo n.º 7
0
 public SoundFileController(
     FileService fileService,
     LibraryService libraryService,
     IcAmpLogger logger)
 {
     _fileService    = fileService;
     _libraryService = libraryService;
     _logger         = logger;
 }
Exemplo n.º 8
0
 public QueueController(
     Library library,
     LibraryService libraryService,
     IcAmpLogger logger)
 {
     _library        = library;
     _libraryService = libraryService;
     _logger         = logger;
 }
Exemplo n.º 9
0
 public FavoritesController(
     LibraryService libraryService,
     PlayListService playListService,
     IcAmpLogger logger)
 {
     _libraryService  = libraryService;
     _playListService = playListService;
     _logger          = logger;
 }
Exemplo n.º 10
0
 public LibraryService(
     Library library,
     PlayHistoryRepo playHistoryRepo,
     PlayListService playListService,
     IcAmpLogger logger)
 {
     _library         = library;
     _playHistoryRepo = playHistoryRepo;
     _playListService = playListService;
     _logger          = logger;
 }
Exemplo n.º 11
0
 public PlayListService(
     PlayListRepo playListRepo,
     PlayListSoundFileRepo playListSoundFileRepo,
     Library library,
     IcAmpLogger logger)
 {
     _playListRepo          = playListRepo;
     _playListSoundFileRepo = playListSoundFileRepo;
     _library = library;
     _logger  = logger;
 }
Exemplo n.º 12
0
 public AuthController(
     AuthService authService,
     JwtService jwtService,
     UserService userService,
     IcAmpLogger logger)
 {
     _authService = authService;
     _jwtService  = jwtService;
     _userService = userService;
     _logger      = logger;
 }
Exemplo n.º 13
0
 public StatusController(
     IcAmpLogger logger)
 {
     _logger = logger;
 }
Exemplo n.º 14
0
        public void Configure(
            IApplicationBuilder app,
            IHostingEnvironment env,
            IcAmpLogger logger)
        {
            app.UseExceptionHandler(errorApp =>
            {
                errorApp.Run(async context =>
                {
                    context.Response.StatusCode  = 500;
                    context.Response.ContentType = "text/html";

                    StringBuilder sb = new StringBuilder();

                    sb.Append("<html lang=\"en\"><body>\r\n");
                    sb.Append("ERROR!<br><br>\r\n");

                    var exceptionHandlerPathFeature =
                        context.Features.Get <IExceptionHandlerPathFeature>();

                    var error = exceptionHandlerPathFeature?.Error;
                    if (error != null)
                    {
                        sb.Append($"Error Type:{error.GetType()}<br>");

                        try
                        {
                            logger.Error(error.Message);
                        }
                        catch
                        {
                            //eat all errors
                        }

                        sb.Append(error.Message);
                    }
                    else
                    {
                        logger.Error("Unknown Error");
                    }

                    sb.Append("</body></html>\r\n");
                    await context.Response.WriteAsync(sb.ToString()); // IE padding
                });
            });

            DefaultFilesOptions defaultFileOptions = new DefaultFilesOptions();

            defaultFileOptions.DefaultFileNames.Clear();
            defaultFileOptions.DefaultFileNames.Add("index.html");
            app.UseDefaultFiles(defaultFileOptions);

            StaticFileOptions staticFileOptions = new StaticFileOptions
            {
                FileProvider = new PhysicalFileProvider(
                    Path.Combine(Directory.GetCurrentDirectory(), "wwwroot")),
                RequestPath = ""
            };

            app.UseStaticFiles(staticFileOptions);
            app.UseRouting();

            app.UseCors(x =>
            {
                x.AllowAnyHeader();
                x.AllowAnyOrigin();
                x.AllowAnyMethod();
            });

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });

            //app.UseMvc();
        }