Payment not tested rest done-ish
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
Password.txt
|
||||
*/Password.txt
|
||||
|
||||
# ---> VisualStudioCode
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Playwright" Version="1.59.0" />
|
||||
<PackageReference Include="Soenneker.Playwrights.Extensions.Stealth" Version="4.0.62" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="Password.txt" CopyToOutputDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,24 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.2.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BadmintonBooker", "BadmintonBooker.csproj", "{64D6B026-79C7-8E9B-78B3-7E47FF75FA6D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{64D6B026-79C7-8E9B-78B3-7E47FF75FA6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{64D6B026-79C7-8E9B-78B3-7E47FF75FA6D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{64D6B026-79C7-8E9B-78B3-7E47FF75FA6D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{64D6B026-79C7-8E9B-78B3-7E47FF75FA6D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {30C191B7-3059-49DA-8326-9D39D1120073}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,59 @@
|
||||
using System.Diagnostics;
|
||||
using System.Net.Sockets;
|
||||
using Microsoft.Playwright;
|
||||
|
||||
namespace BadmintonBooker;
|
||||
|
||||
internal static class BrowserManager
|
||||
{
|
||||
private const int DebugPort = 9222;
|
||||
private const string ChromeExe = @"C:\Program Files\Google\Chrome\Application\chrome.exe";
|
||||
private const string UserDataDir = @"C:\Users\Shaamil\PlaywrightData";
|
||||
|
||||
public static async Task<IBrowserContext> GetContextAsync(IPlaywright playwright)
|
||||
{
|
||||
await EnsureChromeRunningAsync();
|
||||
var browser = await playwright.Chromium.ConnectOverCDPAsync($"http://127.0.0.1:{DebugPort}");
|
||||
return browser.Contexts[0];
|
||||
}
|
||||
|
||||
private static async Task EnsureChromeRunningAsync()
|
||||
{
|
||||
if (IsPortListening(DebugPort))
|
||||
return;
|
||||
|
||||
Process.Start(new ProcessStartInfo
|
||||
{
|
||||
FileName = ChromeExe,
|
||||
Arguments = $"--remote-debugging-port={DebugPort} --user-data-dir=\"{UserDataDir}\"",
|
||||
UseShellExecute = true
|
||||
});
|
||||
|
||||
// Wait for Chrome to bind the debug port
|
||||
const int maxWaitMs = 10000;
|
||||
const int intervalMs = 500;
|
||||
var elapsed = 0;
|
||||
|
||||
while (!IsPortListening(DebugPort) && elapsed < maxWaitMs)
|
||||
{
|
||||
await Task.Delay(intervalMs);
|
||||
elapsed += intervalMs;
|
||||
}
|
||||
|
||||
if (!IsPortListening(DebugPort))
|
||||
throw new TimeoutException("Chrome did not open the remote debugging port in time.");
|
||||
}
|
||||
|
||||
private static bool IsPortListening(int port)
|
||||
{
|
||||
try
|
||||
{
|
||||
using var tcp = new TcpClient();
|
||||
tcp.Connect("127.0.0.1", port);
|
||||
return true;
|
||||
}
|
||||
catch { return false; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
{
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"epochs": [ {
|
||||
"calculation_time": "13420387114925427",
|
||||
"config_version": 0,
|
||||
"model_version": "0",
|
||||
"padded_top_topics_start_index": 0,
|
||||
"taxonomy_version": 0,
|
||||
"top_topics_and_observing_domains": [ ]
|
||||
} ],
|
||||
"hex_encoded_hmac_key": "AB796D0EEA6AEFED2F272F402D5399AA352104E54F25D4B61355AE09B615E868",
|
||||
"next_scheduled_calculation_time": "13420991914925464"
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 826 KiB |
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 287 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
$F~
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user