Skip to content

Commit

Permalink
update puppeteersharp to v9
Browse files Browse the repository at this point in the history
  • Loading branch information
PhantomGamers committed May 8, 2024
1 parent 276364c commit 6cf9682
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 58 deletions.
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PackageVersion Include="Avalonia.ReactiveUI" Version="$(AvaloniaVersion)" />
<PackageVersion Include="BepInEx.AssemblyPublicizer.MSBuild" Version="0.4.1" />
<PackageVersion Include="Flurl.Http" Version="4.0.0-pre6" />
<PackageVersion Include="PuppeteerSharp" Version="6.2.0" />
<PackageVersion Include="PuppeteerSharp" Version="9.0.0" />
<PackageVersion Include="ReactiveUI.Fody" Version="19.5.1" />
<PackageVersion Include="Semver" Version="2.3.0" />
<PackageVersion Include="PortableJsonSettingsProvider" Version="0.2.2" />
Expand Down
20 changes: 10 additions & 10 deletions SFP/Models/Injection/Injector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace SFP.Models.Injection;

public static partial class Injector
{
private static Browser? s_browser;
private static IBrowser? s_browser;
private static bool s_isInjected;
private static bool s_manualDisconnect;
private static readonly SemaphoreSlim s_semaphore = new(1, 1);
Expand Down Expand Up @@ -195,7 +195,7 @@ private static async void Browser_TargetUpdate(object? sender, TargetChangedArgs
}
}

private static async Task ProcessPage(Page? page)
private static async Task ProcessPage(IPage? page)
{
if (page == null)
{
Expand All @@ -214,7 +214,7 @@ private static async Task ProcessPage(Page? page)
await ProcessFrame(page.MainFrame);
}

private static async Task ProcessFrame(Frame frame)
private static async Task ProcessFrame(IFrame frame)
{
var config = SfpConfig.GetConfig();
var patches = config.Patches as PatchEntry[] ?? config.Patches.ToArray();
Expand Down Expand Up @@ -307,7 +307,7 @@ private static async Task ProcessFrame(Frame frame)
}
}

private static async Task DumpFrame(Frame frame, string? fileName)
private static async Task DumpFrame(IFrame frame, string? fileName)
{
if (Settings.Default.DumpPages)
{
Expand Down Expand Up @@ -337,7 +337,7 @@ private static async Task DumpFrame(Frame frame, string? fileName)
}
}

private static async Task SetBypassCsp(Frame frame)
private static async Task SetBypassCsp(IFrame frame)
{
var pageTask = s_browser?.Targets().FirstOrDefault(t => t.TargetId == frame.Id)?.PageAsync();
if (pageTask == null)
Expand Down Expand Up @@ -365,7 +365,7 @@ private static async void Frame_Navigate(object? sender, FrameEventArgs e)
await ProcessFrame(e.Frame);
}

private static async Task InjectAsync(Frame frame, PatchEntry patch, string tabFriendlyName)
private static async Task InjectAsync(IFrame frame, PatchEntry patch, string tabFriendlyName)
{
if (Settings.Default.InjectCSS && !string.IsNullOrWhiteSpace(patch.TargetCss))
{
Expand All @@ -392,7 +392,7 @@ private static async Task InjectAsync(Frame frame, PatchEntry patch, string tabF
}
}

private static async Task InjectResourceAsync(Frame frame, string fileRelativePath, string tabFriendlyName,
private static async Task InjectResourceAsync(IFrame frame, string fileRelativePath, string tabFriendlyName,
string patchName)
{
var relativeSkinDir = Steam.GetRelativeSkinDir().Replace('\\', '/');
Expand Down Expand Up @@ -438,12 +438,12 @@ private static async Task InjectResourceAsync(Frame frame, string fileRelativePa
}
}

private static bool IsFrameWebkit(Frame frame)
private static bool IsFrameWebkit(IFrame frame)
{
return !frame.Url.StartsWith("https://steamloopback.host") && !frame.Url.StartsWith("devtools://");
}

private static async Task UpdateColorInPage(Page page)
private static async Task UpdateColorInPage(IPage page)
{
try
{
Expand Down Expand Up @@ -525,7 +525,7 @@ public static async void UpdateSystemAccentColors(bool useAccentColors = true)
await Task.WhenAll(processTasks);
}

private static async Task UpdateSystemAccentColorsInPage(Page page)
private static async Task UpdateSystemAccentColorsInPage(IPage page)
{
var injectString =
$@"function injectAcc() {{
Expand Down
80 changes: 57 additions & 23 deletions SFP/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,16 @@
},
"PuppeteerSharp": {
"type": "Direct",
"requested": "[6.2.0, )",
"resolved": "6.2.0",
"contentHash": "+JrmisMBa/2w0P5DoHlQJ1idpx+LXo0IICyYn8rg26/uFm1yGd8agTgJGLW2GNxrx+GfNA4EK0njUwx/Y/sAwg==",
"requested": "[9.0.0, )",
"resolved": "9.0.0",
"contentHash": "CiFLi10ukz1bSHz6uYCRxsmKjFOTM7GTu8zN984TtETYzWJRHa7J8b2823vbLDlr4fyICMypWRlpBzvey8RvNQ==",
"dependencies": {
"Microsoft.AspNetCore.WebUtilities": "2.0.2",
"Microsoft.AspNetCore.WebUtilities": "2.2.0",
"Microsoft.Bcl.AsyncInterfaces": "1.1.0",
"Microsoft.Extensions.Logging": "2.0.2",
"Newtonsoft.Json": "10.0.3",
"SharpZipLib": "1.3.3"
"Newtonsoft.Json": "13.0.1",
"SharpZipLib": "1.3.3",
"System.Text.Encodings.Web": "6.0.0"
}
},
"WindowsShortcutFactory": {
Expand All @@ -100,11 +101,11 @@
},
"Microsoft.AspNetCore.WebUtilities": {
"type": "Transitive",
"resolved": "2.0.2",
"contentHash": "dvn80+p1AIQKOfJ+VrOhVMUktWRvJs7Zb+UapZGBNSyrCzTsYiXbb9C7Mzw+nGj5UevnLNFcWWc7BUlLMD2qpw==",
"resolved": "2.2.0",
"contentHash": "9ErxAAKaDzxXASB/b5uLEkLgUWv1QbeVxyJYEHQwMaxXOeFFVkQxiq8RyfVcifLU7NR0QY0p3acqx4ZpYfhHDg==",
"dependencies": {
"Microsoft.Net.Http.Headers": "2.0.2",
"System.Text.Encodings.Web": "4.4.0"
"Microsoft.Net.Http.Headers": "2.2.0",
"System.Text.Encodings.Web": "4.5.0"
}
},
"Microsoft.Bcl.AsyncInterfaces": {
Expand Down Expand Up @@ -148,19 +149,20 @@
},
"Microsoft.Extensions.Primitives": {
"type": "Transitive",
"resolved": "2.0.0",
"contentHash": "ukg53qNlqTrK38WA30b5qhw0GD7y3jdI9PHHASjdKyTcBHTevFM2o23tyk3pWCgAV27Bbkm+CPQ2zUe1ZOuYSA==",
"resolved": "2.2.0",
"contentHash": "azyQtqbm4fSaDzZHD/J+V6oWMFaf2tWP4WEGIYePLCMw3+b2RQdj9ybgbQyjCshcitQKQ4lEDOZjmSlTTrHxUg==",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "4.4.0"
"System.Memory": "4.5.1",
"System.Runtime.CompilerServices.Unsafe": "4.5.1"
}
},
"Microsoft.Net.Http.Headers": {
"type": "Transitive",
"resolved": "2.0.2",
"contentHash": "hNhJU+Sd7Ws/yrBnakUWKWMyGiDUJE5lTkJfWe5xPL8YGTiL6Es07H9CcTyaYYwVlgW06uDVN0YhhH+t4EjdCw==",
"resolved": "2.2.0",
"contentHash": "iZNkjYqlo8sIOI0bQfpsSoMTmB/kyvmV2h225ihyZT33aTp48ZpF6qYnXxzSXmHt8DpBAwBTX+1s1UFLbYfZKg==",
"dependencies": {
"Microsoft.Extensions.Primitives": "2.0.0",
"System.Buffers": "4.4.0"
"Microsoft.Extensions.Primitives": "2.2.0",
"System.Buffers": "4.5.0"
}
},
"Microsoft.NETCore.Platforms": {
Expand Down Expand Up @@ -366,8 +368,8 @@
},
"System.Buffers": {
"type": "Transitive",
"resolved": "4.4.0",
"contentHash": "AwarXzzoDwX6BgrhjoJsk6tUezZEozOT5Y9QKF94Gl4JK91I4PIIBkBco9068Y9/Dra8Dkbie99kXB8+1BaYKw=="
"resolved": "4.5.0",
"contentHash": "pL2ChpaRRWI/p4LXyy4RgeWlYF2sgfj/pnVMvBqwNFr5cXg7CXNnWZWxrOONLg8VGdFB8oB+EG2Qw4MLgTOe+A=="
},
"System.Collections": {
"type": "Transitive",
Expand Down Expand Up @@ -683,6 +685,11 @@
"System.Threading": "4.3.0"
}
},
"System.Memory": {
"type": "Transitive",
"resolved": "4.5.1",
"contentHash": "sDJYJpGtTgx+23Ayu5euxG5mAXWdkDb4+b0rD0Cab0M1oQS9H0HXGPriKcqpXuiJDTV7fTp/d+fMDJmnr6sNvA=="
},
"System.Net.Http": {
"type": "Transitive",
"resolved": "4.3.0",
Expand Down Expand Up @@ -850,8 +857,8 @@
},
"System.Runtime.CompilerServices.Unsafe": {
"type": "Transitive",
"resolved": "4.4.0",
"contentHash": "9dLLuBxr5GNmOfl2jSMcsHuteEg32BEfUotmmUkmZjpR3RpVHE8YQwt0ow3p6prwA1ME8WqDVZqrr8z6H8G+Kw=="
"resolved": "6.0.0",
"contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
},
"System.Runtime.Extensions": {
"type": "Transitive",
Expand Down Expand Up @@ -1091,8 +1098,11 @@
},
"System.Text.Encodings.Web": {
"type": "Transitive",
"resolved": "4.4.0",
"contentHash": "l/tYeikqMHX2MD2jzrHDfR9ejrpTTF7wvAEbR51AMvzip1wSJgiURbDik4iv/w7ZgytmTD/hlwpplEhF9bmFNw=="
"resolved": "6.0.0",
"contentHash": "Vg8eB5Tawm1IFqj4TVK1czJX89rhFxJo9ELqc/Eiq0eXy13RK00eubyU6TJE6y+GQXjyV5gSfiewDUZjQgSE0w==",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
}
},
"System.Text.RegularExpressions": {
"type": "Transitive",
Expand Down Expand Up @@ -2037,6 +2047,14 @@
"runtime.any.System.Text.Encoding.Extensions": "4.3.0"
}
},
"System.Text.Encodings.Web": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "Vg8eB5Tawm1IFqj4TVK1czJX89rhFxJo9ELqc/Eiq0eXy13RK00eubyU6TJE6y+GQXjyV5gSfiewDUZjQgSE0w==",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
}
},
"System.Threading.Tasks": {
"type": "Transitive",
"resolved": "4.3.0",
Expand Down Expand Up @@ -2923,6 +2941,14 @@
"runtime.any.System.Text.Encoding.Extensions": "4.3.0"
}
},
"System.Text.Encodings.Web": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "Vg8eB5Tawm1IFqj4TVK1czJX89rhFxJo9ELqc/Eiq0eXy13RK00eubyU6TJE6y+GQXjyV5gSfiewDUZjQgSE0w==",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
}
},
"System.Threading.Tasks": {
"type": "Transitive",
"resolved": "4.3.0",
Expand Down Expand Up @@ -3790,6 +3816,14 @@
"runtime.any.System.Text.Encoding.Extensions": "4.3.0"
}
},
"System.Text.Encodings.Web": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "Vg8eB5Tawm1IFqj4TVK1czJX89rhFxJo9ELqc/Eiq0eXy13RK00eubyU6TJE6y+GQXjyV5gSfiewDUZjQgSE0w==",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
}
},
"System.Threading.Overlapped": {
"type": "Transitive",
"resolved": "4.3.0",
Expand Down
Loading

0 comments on commit 6cf9682

Please sign in to comment.