1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-11 15:52:25 -05:00

vpn check updates, fixed some issues,

"masked" status is now sensitive
discord link in webfront if configured
This commit is contained in:
RaidMax
2018-03-13 16:30:22 -05:00
parent df3bd05f87
commit ae4fa23884
27 changed files with 235 additions and 119 deletions

View File

@ -1,4 +1,6 @@
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
@ -9,13 +11,18 @@ namespace WebfrontCore.Application.Misc
{
public static async Task<bool> UsingVPN(string ip)
{
#if DEBUG
return false;
#endif
try
{
using (var RequestClient = new System.Net.Http.HttpClient())
{
string response = await RequestClient.GetStringAsync($"http://check.getipintel.net/check.php?ip={ip}&contact=raidmax@live.com");
double probability = Convert.ToDouble(response);
return probability > 0.9;
RequestClient.DefaultRequestHeaders.Add("X-Key", Startup.Configuration["VPN:APIKey"]);
string response = await RequestClient.GetStringAsync($"http://v2.api.iphub.info/ip/{ip}");
var responseJson = JsonConvert.DeserializeObject<JObject>(response);
int blockType = Convert.ToInt32(responseJson["block"]);
return blockType == 1;
}
}