Skip to content

Commit

Permalink
Update UserAgent
Browse files Browse the repository at this point in the history
  • Loading branch information
marcussacana committed Sep 14, 2024
1 parent b5e72d5 commit 711bacf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using DirectPackageInstaller.FileHosts;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 5 additions & 3 deletions DirectPackageInstaller/DirectPackageInstaller/SelfUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -158,14 +160,14 @@ public async Task<bool> 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
{
Expand Down

0 comments on commit 711bacf

Please sign in to comment.