// // Copyright (c) alveus.dev. All rights reserved. Licensed under the MIT License. // using Astral.ApiServer.Models; using Astral.ApiServer.Models.Responses; using Astral.ApiServer.Options; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; namespace Astral.ApiServer.Controllers; /// /// Get information about this instance. /// [Route("api")] public class ServerInfoController : BaseApiController { private readonly MetaverseInfoResponseModel _metaverseInfo; /// /// Initializes a new instance of the class. /// /// Instance of . public ServerInfoController(IOptions metaverse) { var options = metaverse.Value; _metaverseInfo = new MetaverseInfoResponseModel() { MetaverseName = options.Name, MetaverseNickName = options.Nickname, MetaverseUrl = options.ServerUrl, IceServerUrl = options.IceServerUrl, Version = new MetaverseVersionModel() { Version = options.Version, Codename = options.Codename } }; } /// /// Get information about this metaverse instance. /// /// Instance of . [HttpGet("metaverse_info")] [HttpGet("v1/metaverse_info")] public IActionResult GetMetaverseInformation() { return new JsonResult(_metaverseInfo); } }