diff --git a/APIToolkit.csproj b/APIToolkit.csproj index 687a69e..12e413e 100644 --- a/APIToolkit.csproj +++ b/APIToolkit.csproj @@ -13,6 +13,7 @@ enable + diff --git a/Assets/Subject.png b/Assets/Subject.png new file mode 100644 index 0000000..d536581 Binary files /dev/null and b/Assets/Subject.png differ diff --git a/JSONClasses.cs b/JSONClasses.cs new file mode 100644 index 0000000..667c20f --- /dev/null +++ b/JSONClasses.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json.Serialization; +using System.Threading.Tasks; + +namespace APIToolkit +{ + public record class APIHeaders + { + [JsonPropertyName("user-agent")] + public required string UserAgent { get; set; } + + [JsonPropertyName("cf-connecting-ip")] + public required string CfConnectingIp { get; set; } + + [JsonPropertyName("cf-ipcountry")] + public required string CfIpCountry { get; set; } + + [JsonPropertyName("cf-ray")] + public required string CfRay { get; set; } + + } +} diff --git a/MainWindow.xaml b/MainWindow.xaml index 94137ca..f8db31b 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -26,7 +26,7 @@ - + diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index d4b3d68..0188495 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -1,7 +1,10 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Linq; +using System.Net.Http; +using System.Reflection; using System.Runtime.InteropServices.WindowsRuntime; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; @@ -28,6 +31,9 @@ namespace APIToolkit this.SetTitleBar(AppTitleBar); ContentArea.Navigate(typeof(URLShortener)); // Set default page + + GlobalMethods.WebRequest.BaseAddress = new Uri("https://enstrayed.com/api/"); // Set base address for web requests being made + GlobalMethods.WebRequest.DefaultRequestHeaders.UserAgent.ParseAdd($"DotNet/{Environment.Version} APIToolkit/{GlobalMethods.Version}"); // Set user agent of client } private void NavigationView_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args) @@ -51,4 +57,10 @@ namespace APIToolkit } } + public static class GlobalMethods + { + public static HttpClient WebRequest = new(); + public static string Version = "1.0"; + } + } diff --git a/Settings.xaml b/Settings.xaml index e2eff39..4a6475f 100644 --- a/Settings.xaml +++ b/Settings.xaml @@ -8,7 +8,90 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> - -