fixes and improvements

This commit is contained in:
bluepilledgreat 2025-03-20 15:49:24 +00:00
parent a5b7c916d4
commit c90c90b574
2 changed files with 22 additions and 4 deletions

View File

@ -144,9 +144,19 @@ namespace Bloxstrap
{ {
// dont let user switch web environment if debug mode is not on // dont let user switch web environment if debug mode is not on
if (Settings.Prop.WebEnvironment == WebEnvironment.Production || !Settings.Prop.DeveloperMode) if (Settings.Prop.WebEnvironment == WebEnvironment.Production || !Settings.Prop.DeveloperMode)
return $"bloxstraplabs.com"; return "bloxstraplabs.com";
return $"web-{Settings.Prop.WebEnvironment.GetDescription()}.bloxstraplabs.com"; string? sub = Settings.Prop.WebEnvironment.GetDescription();
return $"web-{sub}.bloxstraplabs.com";
}
public static bool CanSendLogs()
{
// non developer mode always uses production
if (!Settings.Prop.DeveloperMode || Settings.Prop.WebEnvironment == WebEnvironment.Production)
return IsProductionBuild;
return true;
} }
public static async Task<GithubRelease?> GetLatestRelease() public static async Task<GithubRelease?> GetLatestRelease()
@ -190,7 +200,7 @@ namespace Bloxstrap
public static async void SendLog() public static async void SendLog()
{ {
if (!Settings.Prop.EnableAnalytics || !IsProductionBuild) if (!Settings.Prop.EnableAnalytics || !CanSendLogs())
return; return;
try try

View File

@ -7,7 +7,15 @@ namespace Bloxstrap.Extensions
{ {
public static string? GetDescription<TEnum>(this TEnum e) public static string? GetDescription<TEnum>(this TEnum e)
{ {
DescriptionAttribute? attribute = e?.GetType().GetCustomAttribute<DescriptionAttribute>(); string? enumName = e.ToString();
if (enumName == null)
return null;
FieldInfo? field = e.GetType().GetField(enumName);
if (field == null)
return null;
DescriptionAttribute? attribute = field.GetCustomAttribute<DescriptionAttribute>();
return attribute?.Description; return attribute?.Description;
} }
} }