forked from modlist-org/KeyViewer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainController.cs
More file actions
27 lines (26 loc) · 902 Bytes
/
MainController.cs
File metadata and controls
27 lines (26 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using JSON;
using KeyViewer.WebAPI.Core.Utils;
using Microsoft.AspNetCore.Mvc;
namespace KeyViewer.WebAPI.Controllers
{
[Route("")]
[ApiController]
public class MainController : ControllerBase
{
public static readonly JsonNode Info = JsonNode.Parse(System.IO.File.ReadAllText("Info.json"));
[HttpGet("version")]
public Version GetVersion() => Version.Parse(Info["version"].Value);
[HttpGet("discord")]
public string GetDiscordLink() => Info["discord"].Value;
[HttpGet("download")]
public string GetDownloadLink() => Info["download"].Value;
[HttpGet("handshake")]
public string Handshake()
{
var ip = HttpContext.GetIpAddress() ?? "Anonymous";
System.IO.File.AppendAllText("handshakes.txt", ip + "\n");
Console.WriteLine(ip);
return ip;
}
}
}