Files
UnrealEngineUWP/Engine/Source/Programs/Horde/Horde.Build/Controllers/ServerController.cs
ben marsh 40b932b1af Horde: Rename the HordeServer project to Horde.Build.
#ROBOMERGE-AUTHOR: ben.marsh
#ROBOMERGE-SOURCE: CL 17926237 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v885-17909292)

[CL 17926263 by ben marsh in ue5-release-engine-test branch]
2021-10-26 12:03:02 -04:00

73 lines
1.8 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using EpicGames.Core;
using HordeServer.Api;
using HordeServer.Collections;
using HordeCommon;
using HordeServer.Models;
using HordeServer.Services;
using HordeServer.Utilities;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Authorization.Infrastructure;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security.Claims;
using System.Threading.Tasks;
using System.Reflection;
using System.Diagnostics;
namespace HordeServer.Controllers
{
/// <summary>
/// Controller managing account status
/// </summary>
[ApiController]
[Authorize]
[Route("[controller]")]
public class ServerController : ControllerBase
{
/// <summary>
/// Settings for the server
/// </summary>
IOptionsMonitor<ServerSettings> Settings;
/// <summary>
/// Constructor
/// </summary>
public ServerController(IOptionsMonitor<ServerSettings> Settings)
{
this.Settings = Settings;
}
/// <summary>
/// Get server version
/// </summary>
[HttpGet]
[Route("/api/v1/server/version")]
public ActionResult GetVersionAsync()
{
FileVersionInfo FileVersionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
return Ok(FileVersionInfo.ProductVersion);
}
/// <summary>
/// Get server information
/// </summary>
[HttpGet]
[Route("/api/v1/server/info")]
[ProducesResponseType(typeof(GetServerInfoResponse), 200)]
public ActionResult<GetServerInfoResponse> GetServerInfo()
{
return new GetServerInfoResponse(this.Settings.CurrentValue.SingleInstance);
}
}
}