Added base bundle service
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
using Logging.Net;
|
||||
using System.Text;
|
||||
using Logging.Net;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Moonlight.App.Helpers;
|
||||
using Moonlight.App.Models.Misc;
|
||||
using Moonlight.App.Services;
|
||||
using Moonlight.App.Services.Files;
|
||||
using Moonlight.App.Services.LogServices;
|
||||
using Moonlight.App.Services.Sessions;
|
||||
|
||||
namespace Moonlight.App.Http.Controllers.Api.Moonlight;
|
||||
|
||||
@@ -14,12 +16,14 @@ public class ResourcesController : Controller
|
||||
{
|
||||
private readonly SecurityLogService SecurityLogService;
|
||||
private readonly BucketService BucketService;
|
||||
private readonly BundleService BundleService;
|
||||
|
||||
public ResourcesController(SecurityLogService securityLogService,
|
||||
BucketService bucketService)
|
||||
BucketService bucketService, BundleService bundleService)
|
||||
{
|
||||
SecurityLogService = securityLogService;
|
||||
BucketService = bucketService;
|
||||
BundleService = bundleService;
|
||||
}
|
||||
|
||||
[HttpGet("images/{name}")]
|
||||
@@ -73,4 +77,34 @@ public class ResourcesController : Controller
|
||||
return Problem();
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("bundle/js")]
|
||||
public Task<ActionResult> GetJs()
|
||||
{
|
||||
if (BundleService.BundledFinished)
|
||||
{
|
||||
return Task.FromResult<ActionResult>(
|
||||
File(Encoding.ASCII.GetBytes(BundleService.BundledJs), "text/javascript")
|
||||
);
|
||||
}
|
||||
|
||||
return Task.FromResult<ActionResult>(
|
||||
NotFound()
|
||||
);
|
||||
}
|
||||
|
||||
[HttpGet("bundle/css")]
|
||||
public Task<ActionResult> GetCss()
|
||||
{
|
||||
if (BundleService.BundledFinished)
|
||||
{
|
||||
return Task.FromResult<ActionResult>(
|
||||
File(Encoding.ASCII.GetBytes(BundleService.BundledCss), "text/css")
|
||||
);
|
||||
}
|
||||
|
||||
return Task.FromResult<ActionResult>(
|
||||
NotFound()
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user