diff --git a/DirectPackageInstaller/DirectPackageInstaller/FileHosts/FileHostBase.cs b/DirectPackageInstaller/DirectPackageInstaller/FileHosts/FileHostBase.cs index bd0af80..b201a1e 100644 --- a/DirectPackageInstaller/DirectPackageInstaller/FileHosts/FileHostBase.cs +++ b/DirectPackageInstaller/DirectPackageInstaller/FileHosts/FileHostBase.cs @@ -16,7 +16,7 @@ public abstract class FileHostBase public abstract bool IsValidUrl(string URL); public abstract DownloadInfo GetDownloadInfo(string URL); - public const string UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36 Edg/96.0.1054.53"; + public const string UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 DPI/" + SelfUpdate.CurrentVersion; protected string DownloadString(string URL, Cookie[]? Cookies = null) { diff --git a/DirectPackageInstaller/DirectPackageInstaller/IO/PartialHttpStream.cs b/DirectPackageInstaller/DirectPackageInstaller/IO/PartialHttpStream.cs index 09c90f3..7feb108 100644 --- a/DirectPackageInstaller/DirectPackageInstaller/IO/PartialHttpStream.cs +++ b/DirectPackageInstaller/DirectPackageInstaller/IO/PartialHttpStream.cs @@ -1,4 +1,5 @@ -using System; +using DirectPackageInstaller.FileHosts; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -251,6 +252,8 @@ private int HttpRead(byte[] buffer, ref int offset, ref int count, int Tries = 0 req.ConnectionGroupName = Guid.NewGuid().ToString(); req.CookieContainer = Cookies; req.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore); + req.UserAgent = FileHostBase.UserAgent; + req.KeepAlive = KeepAlive; req.ServicePoint.SetTcpKeepAlive(KeepAlive, 1000 * 60 * 5, 1000); @@ -372,6 +375,7 @@ private bool SllBypass(object sender, X509Certificate? certificate, X509Chain? c try { HttpWebRequest request = WebRequest.CreateHttp(Url); + request.UserAgent = FileHostBase.UserAgent; request.ConnectionGroupName = Guid.NewGuid().ToString(); request.KeepAlive = false; request.CookieContainer = Cookies; diff --git a/DirectPackageInstaller/DirectPackageInstaller/SelfUpdate.cs b/DirectPackageInstaller/DirectPackageInstaller/SelfUpdate.cs index 2caf62d..74db63d 100644 --- a/DirectPackageInstaller/DirectPackageInstaller/SelfUpdate.cs +++ b/DirectPackageInstaller/DirectPackageInstaller/SelfUpdate.cs @@ -47,7 +47,9 @@ public static string? MainExecutable const string UpdateList = "Update.ini"; - public static Version CurrentVersion = new Version("6.2.12"); + public const string CurrentVersion = "6.2.13"; + + static Version CurrentVer = new Version(CurrentVersion); public static Version? LastVersion = null; @@ -158,14 +160,14 @@ public async Task HasUpdates() if (Values.ContainsKey("brokenupdater")) { var BrokenVer = new Version(Values["brokenupdater"]); - if (CurrentVersion <= BrokenVer) + if (CurrentVer <= BrokenVer) { await Console.Error.WriteAsync("Auto Updater Broken - Please, Download the last update manually"); Environment.Exit(134); } } - return LastVersion > CurrentVersion; + return LastVersion > CurrentVer; } catch {