Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file removed .DS_Store
Binary file not shown.
39 changes: 7 additions & 32 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,18 @@ Logos/
**/publish/

# IDE files
.vs/
.vscode/
*.user
*.suo
*.userosscache
*.sln.docstates

# Test files
**/TestHarness/
**/UnitTests/
**/IntegrationTests/
**/TestResults/

# Logs
*.log
build.log
build_errors.txt

# Archives
*.zip
*.rar
*.7z

# Node modules (if any)
node_modules/
npm-debug.log*
**/.vs/
**/.vscode/

# Temporary files
*.tmp
*.temp
.DS_Store
Thumbs.db
# Node modules
**/node_modules/
**/npm-debug.log*

# Large directories that aren't needed for build
Archived/
External Libs/
# External Libs/ # Needed for build now
lumina-j5-bootstrap/
_CLEANUP_ARCHIVE/

# Package files
*.nupkg
Expand Down
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,10 @@ NextGenSoftware.OASIS.API.ONODE.WebUI.HTML/react-app/yarn.lock
/STAR ODK/OAPPTemplates/Source/final/OAPPTemplateDNA.json
/STAR ODK/OAPPTemplates/Source/super
/STAR ODK/OAPPTemplates
/STAR ODK
/STAR ODK/Runtimes
/STAR ODK/Runtimes/OASIS Runtime
/STAR ODK/Runtimes/STAR Runtime
#/STAR ODK
#/STAR ODK/Runtimes
#/STAR ODK/Runtimes/OASIS Runtime
#/STAR ODK/Runtimes/STAR Runtime
/STAR ODK/STAR OAPP DNA Templates
/STAR ODK/STAR OAPP DNA Templates/hello world!
/STAR ODK/STAR OAPP DNA Templates/NextGenSoftware.OASIS.STAR.DNATemplates.OAPP.Base
Expand Down
39 changes: 0 additions & 39 deletions Dockerfile

This file was deleted.

52 changes: 0 additions & 52 deletions Dockerfile.star-api

This file was deleted.

1 change: 1 addition & 0 deletions External Libs/NextGenSoftware-Libraries
Submodule NextGenSoftware-Libraries added at 3c4726
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ public enum AvatarType
{
Wizard,
User,
System
System,
Admin
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -205,76 +205,6 @@ private OASISResult<IAvatarDetail> PrepareToRegisterAvatarDetail(Guid avatarId,
CreatedByAvatarId = avatarId
};

// TODO: Temp! Remove later!
if (email == "davidellams@hotmail.com")
{
avatarDetail.Karma = 777777;
avatarDetail.XP = 2222222;

avatarDetail.GeneKeys.Add(new GeneKey() { Name = "Expectation", Gift = "a gift", Shadow = "a shadow", Sidhi = "a sidhi" });
avatarDetail.GeneKeys.Add(new GeneKey() { Name = "Invisibility", Gift = "a gift", Shadow = "a shadow", Sidhi = "a sidhi" });
avatarDetail.GeneKeys.Add(new GeneKey() { Name = "Rapture", Gift = "a gift", Shadow = "a shadow", Sidhi = "a sidhi" });

avatarDetail.HumanDesign.Type = "Generator";
//avatarDetail.Inventory.Add(new InventoryItem() { Name = "Magical Armour" });
//avatarDetail.Inventory.Add(new InventoryItem() { Name = "Mighty Wizard Sword" });

avatarDetail.Spells.Add(new Spell() { Name = "Super Spell" });
avatarDetail.Spells.Add(new Spell() { Name = "Super Speed Spell" });
avatarDetail.Spells.Add(new Spell() { Name = "Super Srength Spell" });

avatarDetail.Achievements.Add(new Achievement() { Name = "Becoming Superman!" });
avatarDetail.Achievements.Add(new Achievement() { Name = "Completing STAR!" });

avatarDetail.Gifts.Add(new AvatarGift() { GiftType = KarmaTypePositive.BeASuperHero });

avatarDetail.Aura.Brightness = 99;
avatarDetail.Aura.Level = 77;
avatarDetail.Aura.Progress = 88;
avatarDetail.Aura.Size = 10;
avatarDetail.Aura.Value = 777;

avatarDetail.Chakras.Root.Level = 77;
avatarDetail.Chakras.Root.Progress = 99;
avatarDetail.Chakras.Root.XP = 8783;

avatarDetail.Attributes.Dexterity = 99;
avatarDetail.Attributes.Endurance = 99;
avatarDetail.Attributes.Intelligence = 99;
avatarDetail.Attributes.Magic = 99;
avatarDetail.Attributes.Speed = 99;
avatarDetail.Attributes.Strength = 99;
avatarDetail.Attributes.Toughness = 99;
avatarDetail.Attributes.Vitality = 99;
avatarDetail.Attributes.Wisdom = 99;

avatarDetail.Stats.Energy.Current = 99;
avatarDetail.Stats.Energy.Max = 99;
avatarDetail.Stats.HP.Current = 99;
avatarDetail.Stats.HP.Max = 99;
avatarDetail.Stats.Mana.Current = 99;
avatarDetail.Stats.Mana.Max = 99;
avatarDetail.Stats.Stamina.Current = 99;
avatarDetail.Stats.Stamina.Max = 99;

avatarDetail.SuperPowers.AstralProjection = 99;
avatarDetail.SuperPowers.BioLocatation = 88;
avatarDetail.SuperPowers.Flight = 99;
avatarDetail.SuperPowers.FreezeBreath = 88;
avatarDetail.SuperPowers.HeatVision = 99;
avatarDetail.SuperPowers.Invulnerability = 99;
avatarDetail.SuperPowers.SuperSpeed = 99;
avatarDetail.SuperPowers.SuperStrength = 99;
avatarDetail.SuperPowers.XRayVision = 99;
avatarDetail.SuperPowers.Teleportation = 99;
avatarDetail.SuperPowers.Telekinesis = 99;

avatarDetail.Skills.Computers = 99;
avatarDetail.Skills.Engineering = 99;
}

//avatarDetail.CreatedDate = DateTime.UtcNow;

result.Result = avatarDetail;
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,81 @@ public async Task<OASISResult<IAvatar>> RegisterAsync(string avatarTitle, string
return result;
}

public async Task<OASISResult<IAvatar>> RegisterAdminAsync(string adminFirstName, string adminLastName, string adminEmail, string adminUsername, string adminPassword, OASISType createdOASISType = OASISType.OASISBootLoader, ConsoleColor cliColour = ConsoleColor.Red, ConsoleColor favColour = ConsoleColor.Red, string avatarTitle = "Admin", AvatarType avatarType = AvatarType.Admin)
{
OASISResult<IAvatar> result = new OASISResult<IAvatar>();

try
{
// First try by username...
result = await LoadAvatarAsync(adminUsername, false, false);

if (result.Result == null)
{
// Now try by email...
result = await LoadAvatarByEmailAsync(adminEmail, false, false);
}

if (result.Result != null)
{
result.Message = "Avatar already exists.";
result.IsError = false;
return result;
}

result = await PrepareToRegisterAvatarAsync(avatarTitle, adminFirstName, adminLastName, adminEmail, adminPassword, adminUsername, avatarType, createdOASISType);

if (result != null && !result.IsError && result.Result != null)
{
// Manually verify and activate the admin account immediately
result.Result.Verified = DateTime.Now;
result.Result.IsActive = true;
result.Result.VerificationToken = null; // Clear token as it's already verified

// AvatarDetail needs to have the same unique ID as Avatar so the records match (they will have unique/different provider keys per each provider)
OASISResult<IAvatarDetail> avatarDetailResult = PrepareToRegisterAvatarDetail(result.Result.Id, result.Result.Username, result.Result.Email, createdOASISType, cliColour, favColour);

if (avatarDetailResult != null && !avatarDetailResult.IsError && avatarDetailResult.Result != null)
{
OASISResult<IAvatar> saveAvatarResult = await SaveAvatarAsync(result.Result);

if (!saveAvatarResult.IsError && saveAvatarResult.IsSaved)
{
result.Result = saveAvatarResult.Result;
OASISResult<IAvatarDetail> saveAvatarDetailResult = await SaveAvatarDetailAsync(avatarDetailResult.Result);

if (saveAvatarDetailResult != null && !saveAvatarDetailResult.IsError && saveAvatarDetailResult.Result != null)
{
// result = AvatarRegistered(result); // Don't call this as it sends verification email!
result.Result = HideAuthDetails(result.Result);
result.IsSaved = true;
result.Message = "Admin Account Created Successfully.";
}
else
{
result.Message = saveAvatarDetailResult.Message;
result.IsError = saveAvatarDetailResult.IsError;
result.IsSaved = saveAvatarDetailResult.IsSaved;
}
}
else
{
result.Message = saveAvatarResult.Message;
result.IsError = saveAvatarResult.IsError;
result.IsSaved = saveAvatarResult.IsSaved;
}
}
}
}
catch (Exception ex)
{
OASISErrorHandling.HandleError(ref result, string.Concat("Unknown error occured in RegisterAdminAsync method in AvatarManager. Error Message: ", ex.Message), ex);
result.Result = null;
}

return result;
}

public OASISResult<IAvatar> BeamOut(IAvatar avatar, AutoReplicationMode autoReplicationMode = AutoReplicationMode.UseGlobalDefaultInOASISDNA, AutoFailOverMode autoFailOverMode = AutoFailOverMode.UseGlobalDefaultInOASISDNA, AutoLoadBalanceMode autoLoadBalanceMode = AutoLoadBalanceMode.UseGlobalDefaultInOASISDNA, bool waitForAutoReplicationResult = false, ProviderType providerType = ProviderType.Default)
{
OASISResult<IAvatar> result = new OASISResult<IAvatar>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@
<ItemGroup>
<ProjectReference Include="..\NextGenSoftware.OASIS.API.DNA\NextGenSoftware.OASIS.API.DNA.csproj" />
<ProjectReference Include="..\NextGenSoftware.OASIS.Common\NextGenSoftware.OASIS.Common.csproj" />
<!-- Removed Utilities reference as it may not exist or cause circular dependency -->
<!-- <ProjectReference Include="..\..\..\NextGenSoftware-Libraries\NextGenSoftware Libraries\NextGenSoftware.Utilities\NextGenSoftware.Utilities.csproj" /> -->
<ProjectReference Include="..\..\External Libs\NextGenSoftware-Libraries\NextGenSoftware Libraries\NextGenSoftware.Utilities\NextGenSoftware.Utilities.csproj" />
</ItemGroup>


Expand Down
11 changes: 11 additions & 0 deletions OASIS Architecture/NextGenSoftware.OASIS.API.DNA/OASISDNA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ public class OASISDNA
public OASIS OASIS { get; set; }
}

public class AdminConfig
{
public string AdminEmail { get; set; }
public string AdminUsername { get; set; }
public string AdminPassword { get; set; }
public string AdminFirstName { get; set; }
public string AdminLastName { get; set; }
}

public class OASIS
{
//public string CurrentLiveVersion { get; set; }
Expand Down Expand Up @@ -41,6 +50,8 @@ public class OASIS
// Stats caching controls
public bool StatsCacheEnabled { get; set; } = false;
public int StatsCacheTtlSeconds { get; set; } = 45;

public List<AdminConfig> Admins { get; set; } = new List<AdminConfig>();
}

public class SecuritySettings
Expand Down
Loading
Loading