using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Wabbajack.Common; using Wabbajack.Lib.Downloaders; namespace Wabbajack.BuildServer.Controllers { [ApiController] [Authorize(Roles = "User")] [Route("/site-integration")] public class SiteIntegration : ControllerBase { private ILogger _logger; public SiteIntegration(ILogger logger) { _logger = logger; } private HashSet Allowed = new HashSet { "loverslabcookies", "deadlystream", "tesall", "tesalliance", "vectorplexus"}; [Route("auth-info/{site}")] public async Task GetAuthInfo(string site) { if (!Allowed.Contains(site)) { return BadRequest("No key found"); } return Ok(Encoding.UTF8.GetString(await Utils.FromEncryptedData(site))); } } }