mirror of
https://github.com/JogmansonReal/Radicade.git
synced 2026-10-25 15:09:26 -07:00
131 lines
2.9 KiB
C#
131 lines
2.9 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using RadicadeServer.DB;
|
|
using RadicadeServer.RecNet.Config;
|
|
|
|
namespace RadicadeServer.API.Config
|
|
{
|
|
[Route("api/config")]
|
|
public class ConfigAPI : Controller
|
|
{
|
|
RecDBContext db;
|
|
public ConfigAPI(RecDBContext context)
|
|
{
|
|
this.db = context;
|
|
}
|
|
|
|
[HttpGet("v1/amplitude")]
|
|
public IActionResult GetAmplitudeConfig()
|
|
{
|
|
AmplitudeConfig amplitudeConfig = new AmplitudeConfig
|
|
{
|
|
AmplitudeKey = "e1693a1003671058b6abc356c8ba8d59",
|
|
UseRudderStack = true,
|
|
RudderStackKey = "23NiJHIgu3koaGNCZIiuYvIQNCu",
|
|
UseStatSig = true,
|
|
StatSigKey = "client-SBZkOrjD3r1Cat3f3W8K6sBd11WKlXZXIlCWj6l4Aje",
|
|
StatSigEnvironment = 0,
|
|
};
|
|
return Ok(amplitudeConfig);
|
|
}
|
|
|
|
[HttpGet("v1/freegiftbutton")]
|
|
public IActionResult GetFreeGiftButtonConfig()
|
|
{
|
|
|
|
|
|
return Ok(true);
|
|
}
|
|
|
|
[HttpGet("v1/azurespeech")]
|
|
public IActionResult GetAzureSpeechConfig()
|
|
{
|
|
return Ok(new
|
|
{
|
|
Key = "dce8de5b297747d9b5bddcc7f19e8c5b",
|
|
Region = "eastus",
|
|
Enabled = false,
|
|
});
|
|
}
|
|
|
|
[HttpGet("v1/backtrace")]
|
|
public IActionResult GetBacktraceConfig()
|
|
{
|
|
return Ok(new
|
|
{
|
|
ReportBudget = 125,
|
|
FilterType = 0,
|
|
SampleRate = 1,
|
|
LogLineCount = 50,
|
|
CaptureNativeCrashes = 1,
|
|
AMRThresholdMS = 0,
|
|
MessageCount = 1000,
|
|
MessageRegex = "^.*$",
|
|
VersionRegex = ".*",
|
|
});
|
|
}
|
|
|
|
[HttpGet("v2")]
|
|
public async Task<ActionResult<MainConfig>> GetConfig()
|
|
{
|
|
MainConfig? config = await db.Config.FirstOrDefaultAsync();
|
|
if (config == null) return StatusCode(500);
|
|
|
|
bool didChanges = false;
|
|
|
|
if (string.IsNullOrWhiteSpace(config.CdnBaseUri) || config.CdnBaseUri.Contains("localhost", StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
config.CdnBaseUri = DBConfig.NameServer.CDN;
|
|
didChanges = true;
|
|
}
|
|
if (string.IsNullOrWhiteSpace(config.ShareBaseUrl) || config.ShareBaseUrl.Contains("localhost", StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
config.ShareBaseUrl = DBConfig.NameServer.WWW + "{0}";
|
|
didChanges = true;
|
|
}
|
|
|
|
if (config.ExpectingReload) {
|
|
didChanges = true;
|
|
config.SetAsActive();
|
|
config.ExpectingReload = false;
|
|
}
|
|
|
|
if (config.RefreshConfig())
|
|
didChanges = true;
|
|
|
|
if (didChanges)
|
|
await db.SaveChangesAsync();
|
|
|
|
return Ok(config?.ToActualConfig());
|
|
}
|
|
|
|
[HttpPost("~/statsigUserProperties")]
|
|
public IActionResult GetStatsigUserProperties()
|
|
{
|
|
return Ok(new { success = true });
|
|
}
|
|
|
|
[HttpGet("~/voice/config")]
|
|
[HttpGet("~/moderation/voice/config")]
|
|
public IActionResult GetVoiceConfig()
|
|
{
|
|
return Ok(new
|
|
{
|
|
KOLPDOKFMGH = "",
|
|
OKHMLNBOBNP = (object?)null,
|
|
BEGBMPFDPIE = (object?)null,
|
|
BNOIPAAFAMJ = new
|
|
{
|
|
_AOMMGOMJHPE = "",
|
|
_NPEJEBGENBC = "",
|
|
PEFLHAPIDIF = "",
|
|
ALOMNDOKBLH = ""
|
|
},
|
|
PAFBLJGNBLN = new string[0],
|
|
HAOCNOKPKDH = new string[0],
|
|
MBEGDKGEOMJ = false
|
|
});
|
|
}
|
|
}
|
|
}
|