两个页面接入完成
This commit is contained in:
@@ -13,6 +13,7 @@ namespace Stary.Evo
|
||||
public static class WebRequestSystem
|
||||
{
|
||||
private static string authorization;
|
||||
private static byte[] certificateData;
|
||||
|
||||
static WebRequestSystem()
|
||||
{
|
||||
@@ -21,6 +22,8 @@ namespace Stary.Evo
|
||||
#else
|
||||
authorization = CustomPlayerPrefs.GetString("Authorization");
|
||||
#endif
|
||||
var certPath = Path.Combine(Application.streamingAssetsPath, "server.crt");
|
||||
certificateData = File.ReadAllBytes(certPath);
|
||||
}
|
||||
|
||||
public static async Task<bool> Login(string url, string username, string password)
|
||||
@@ -220,6 +223,8 @@ namespace Stary.Evo
|
||||
{
|
||||
using var webRequest = UnityWebRequest.Get(url);
|
||||
webRequest.downloadHandler = new DownloadHandlerFile(tempPath);
|
||||
webRequest.certificateHandler = new SelfSignedCertHandler(certificateData);
|
||||
|
||||
if (authorization != null)
|
||||
webRequest.SetRequestHeader("Authorization", authorization); // 修正请求头名称规范
|
||||
|
||||
@@ -279,6 +284,7 @@ namespace Stary.Evo
|
||||
var fullUrl = url.TrimEnd('/') + "/" + path.TrimStart('/');
|
||||
using var webRequest = new UnityWebRequest(fullUrl, UnityWebRequest.kHttpVerbGET);
|
||||
webRequest.downloadHandler = new DownloadHandlerBuffer();
|
||||
webRequest.certificateHandler = new SelfSignedCertHandler(certificateData);
|
||||
if (authorization != null)
|
||||
webRequest.SetRequestHeader("Authorization", authorization); // 修正请求头名称规范
|
||||
|
||||
|
||||
Reference in New Issue
Block a user