Skip to content

Commit

Permalink
add bypass ssl
Browse files Browse the repository at this point in the history
  • Loading branch information
akbaryahya committed Aug 30, 2022
1 parent eb61d80 commit d014357
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 17 deletions.
25 changes: 19 additions & 6 deletions API.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Newtonsoft.Json;
using RestSharp;
using System.Diagnostics;
using System.Net;
using YuukiPS_Launcher.json;

Expand Down Expand Up @@ -34,19 +35,31 @@ public static ServerList ServerList()

public static VersionGS? GetServerStatus(string url)
{
var client = new RestClient(url);
var s = new RestClientOptions(url)
{
RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true
};
var client = new RestClient(s);
var request = new RestRequest();

var response = client.Execute(request);
var getme = response.StatusCode == HttpStatusCode.OK ? response.Content : response.StatusCode.ToString();
if (getme != null)

if (response.StatusCode == HttpStatusCode.OK)
{
var tes = JsonConvert.DeserializeObject<VersionGS>(getme);
if (tes != null)
var getme = response.Content;
if (getme != null)
{
return tes;
var tes = JsonConvert.DeserializeObject<VersionGS>(getme);
if (tes != null)
{
return tes;
}
}
}
else
{
Debug.Print("Error Host " + url + ": " + response.StatusCode);
}
return null;
}

Expand Down
14 changes: 5 additions & 9 deletions Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,18 @@ public void UpdateServerListTimer()
int s = i;
new Thread(() =>
{
var host = ListServer[s].host;
try
{
var host = ListServer[s].host;
Debug.Print("Start update.. " + host);

if (host == "official")
{
return;
}

Debug.Print("Start update.. " + host);

string url_server_api = "https://" + host + "/status/server";
VersionGS ig = API.GetServerStatus(url_server_api);
VersionGS? ig = API.GetServerStatus(url_server_api);
ServerList.Invoke((Action)delegate
{
if (ig != null)
Expand All @@ -109,13 +109,9 @@ public void UpdateServerListTimer()
}
});
}
catch (NullReferenceException e)
{
Debug.Print("Error NullReferenceException:" + e.Message);
}
catch (Exception e)
{
Debug.Print("Error:" + e.Message);
Debug.Print("Error Host " + host + "" + e.Message);
}
finally
{
Expand Down
4 changes: 2 additions & 2 deletions YuukiPS Launcher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

<ApplicationManifest>Properties\app.manifest</ApplicationManifest>

<AssemblyVersion>2022.8.29.1836</AssemblyVersion>
<FileVersion>2022.8.29.1836</FileVersion>
<AssemblyVersion>2022.8.30.0924</AssemblyVersion>
<FileVersion>2022.8.30.0924</FileVersion>

<EnableWindowsTargeting>true</EnableWindowsTargeting>
<AssemblyName>YuukiPS</AssemblyName>
Expand Down

0 comments on commit d014357

Please sign in to comment.