2021-06-22 23:03:38 +01:00
|
|
|
using System.ComponentModel.DataAnnotations;
|
2021-04-08 02:03:17 +01:00
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
2021-04-08 03:08:20 +01:00
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Microsoft.AspNetCore.DataProtection;
|
2021-04-08 02:03:17 +01:00
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2021-06-21 23:38:05 +01:00
|
|
|
using Microsoft.EntityFrameworkCore;
|
2021-04-08 02:03:17 +01:00
|
|
|
using Microsoft.Extensions.Logging;
|
2021-05-02 15:22:46 +01:00
|
|
|
using Microsoft.Extensions.Options;
|
2021-06-22 01:25:28 +01:00
|
|
|
using NuGet.Versioning;
|
2021-08-15 19:09:01 +01:00
|
|
|
using isnd.Data;
|
|
|
|
|
using isnd.Entities;
|
2021-07-05 12:55:52 +01:00
|
|
|
using Unleash;
|
|
|
|
|
using isnd.Services;
|
2021-08-15 19:09:01 +01:00
|
|
|
using isnd.ViewModels;
|
|
|
|
|
using System.Threading.Tasks;
|
2021-08-23 03:21:08 +01:00
|
|
|
using isnd.Interfaces;
|
2022-04-09 19:53:26 +01:00
|
|
|
using isn.Abstract;
|
2021-04-08 02:03:17 +01:00
|
|
|
|
2021-08-15 19:09:01 +01:00
|
|
|
namespace isnd.Controllers
|
2021-04-08 02:03:17 +01:00
|
|
|
{
|
2021-05-09 03:06:23 +01:00
|
|
|
[AllowAnonymous]
|
2021-06-21 23:38:05 +01:00
|
|
|
public partial class PackagesController : Controller
|
2021-04-08 02:03:17 +01:00
|
|
|
{
|
2021-07-05 12:55:52 +01:00
|
|
|
const int maxTake = 100;
|
2022-04-18 20:58:14 +01:00
|
|
|
private readonly Resource[] resources;
|
|
|
|
|
private readonly ILogger<PackagesController> logger;
|
|
|
|
|
private readonly IDataProtector protector;
|
2021-04-08 02:03:17 +01:00
|
|
|
|
2022-04-18 20:58:14 +01:00
|
|
|
private readonly IsndSettings isndSettings;
|
|
|
|
|
readonly ApplicationDbContext dbContext;
|
|
|
|
|
private readonly IPackageManager packageManager;
|
|
|
|
|
private readonly IUnleash unleashĈlient;
|
2021-05-02 15:22:46 +01:00
|
|
|
|
|
|
|
|
public PackagesController(
|
|
|
|
|
ILoggerFactory loggerFactory,
|
|
|
|
|
IDataProtectionProvider provider,
|
2021-08-15 01:50:07 +01:00
|
|
|
IOptions<IsndSettings> isndOptions,
|
2021-07-11 22:13:48 +01:00
|
|
|
IUnleash unleashĈlient,
|
2021-08-23 03:21:08 +01:00
|
|
|
ApplicationDbContext dbContext,
|
|
|
|
|
IPackageManager pm)
|
2021-04-08 02:03:17 +01:00
|
|
|
{
|
2022-04-18 20:58:14 +01:00
|
|
|
logger = loggerFactory.CreateLogger<PackagesController>();
|
|
|
|
|
isndSettings = isndOptions.Value;
|
|
|
|
|
protector = provider.CreateProtector(isndSettings.ProtectionTitle);
|
|
|
|
|
this.dbContext = dbContext;
|
|
|
|
|
packageManager = pm;
|
|
|
|
|
this.unleashĈlient = unleashĈlient;
|
|
|
|
|
resources = packageManager.GetResources(unleashĈlient).ToArray();
|
2021-04-08 02:03:17 +01:00
|
|
|
}
|
|
|
|
|
}
|
2022-04-17 16:22:40 +01:00
|
|
|
}
|