Commit 7c575eff authored by SherryChaos's avatar SherryChaos

ypk downloading ignore certification check

parent 1c9f195a
using System; using System;
using UnityEngine.Networking;
namespace MDPro3.Net namespace MDPro3.Net
{ {
public static class NetUtil public static class NetUtil
{ {
public static bool IsValidUrl(string inputUrl) public static bool IsValidUrl(string inputUrl)
{ {
if(string.IsNullOrEmpty(inputUrl)) if(string.IsNullOrEmpty(inputUrl))
...@@ -38,5 +40,13 @@ namespace MDPro3.Net ...@@ -38,5 +40,13 @@ namespace MDPro3.Net
return false; return false;
} }
public class AcceptAllCertificateHandler : CertificateHandler
{
protected override bool ValidateCertificate(byte[] certificateData)
{
return true;
}
}
} }
} }
...@@ -6,6 +6,7 @@ using System; ...@@ -6,6 +6,7 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Net;
using System.Reflection; using System.Reflection;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using UnityEngine; using UnityEngine;
...@@ -15,6 +16,7 @@ using UnityEngine.Networking; ...@@ -15,6 +16,7 @@ using UnityEngine.Networking;
using UnityEngine.Rendering.Universal; using UnityEngine.Rendering.Universal;
using UnityEngine.UI; using UnityEngine.UI;
using static MDPro3.CardRenderer; using static MDPro3.CardRenderer;
using static MDPro3.Net.NetUtil;
namespace MDPro3.Servant namespace MDPro3.Servant
{ {
...@@ -236,16 +238,17 @@ namespace MDPro3.Servant ...@@ -236,16 +238,17 @@ namespace MDPro3.Servant
StartCoroutine(DownloadYpkAsync(url)); StartCoroutine(DownloadYpkAsync(url));
} }
private IEnumerator DownloadYpkAsync(string url) private IEnumerator DownloadYpkAsync(string url)
{ {
downloadingYPK = true; downloadingYPK = true;
using var request = UnityWebRequest.Get(url); using var request = UnityWebRequest.Get(url);
request.certificateHandler = new AcceptAllCertificateHandler();
request.SendWebRequest(); request.SendWebRequest();
while (!request.isDone) while (!request.isDone)
{ {
GetUI<SettingServantUI>().ButtonDownloadYPK.SetModeText((request.downloadProgress * 100f).ToString("0.##") + "%"); GetUI<SettingServantUI>().ButtonDownloadYPK.SetModeText((request.downloadProgress * 100f).ToString("0.##") + "%");
yield return null; yield return new WaitForSeconds(0.3f);
} }
if (request.result == UnityWebRequest.Result.Success) if (request.result == UnityWebRequest.Result.Success)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment