diff --git a/CHANGELOG.md b/CHANGELOG.md index 55781a908..2ea817880 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,16 @@ -# v4.5.531 -# Upcoming +# v4.5.535 +### Client +* Improve: App Filter page +* Improve: Android TV * Update: Use Interstitial Ad instead of rewarded +* Update: Show client country when Exclude My Country is enabled * Feature: Support multiple ad networks * Feature: Add Turkey, German, and Hindi languages * Fix: Some error message after disconnection * Fix: Disconnect button doesn't work while connecting # v4.5.522 -# v4.5.531 +### Client * Update: Disable "Exclude My Country" when unable to load the IP location database * Update: Automatically disconnect client after changing exclude my country settings * Improve: Performance & Speed on the connection when the user has selected exclude my country @@ -17,7 +20,7 @@ * Update: Improve performance # v4.5.520 -# v4.5.531 +### Client * Feature: Allow to select servers by country if the server supports it * Feature: Auto pause and resume when the server is not reachable * Update: User IncludeIpRanges and ExcludeIpRanges in settings instead of CustomIpRanges @@ -32,7 +35,7 @@ * Deprecate: ServerProtocol Version 2 (451) is deprecated and no longer supported # v4.4.506 -# v4.5.531 +### Client * Update: Android: Show Notification & QuickLaunch Request after connect * Update: Display AD without VPN * Fix: Android: Crash when starting as always-on, but there is no selected server @@ -44,7 +47,7 @@ * Update: Support Flexible Ad # v4.4.500 -# v4.5.531 +### Client * Update: Retry failed connection if the access token is updated from the server token URL * Update: Move VpnHood Public Servers to VpnHood Connect App * Fix: Ad service @@ -58,7 +61,7 @@ * Feature: Ad reward service # v4.3.485 -# v4.5.531 +### Client * Feature: Accept DNS Servers from the connected Server * Feature: Multi-language Support (Arabic, Chinese, English, Persian, Portuguese, Russian, Spanish) * Feature: Support Billing integration @@ -75,7 +78,7 @@ * Update: Faster shutdown # v3.3.475 -# v4.5.531 +### Client * Feature: Update UI when the server does not support UDP tunnel * Fix: Crash when pressing "Disconnect" while connecting * Fix: Remove the "No data has been received" message before the connection is established @@ -87,18 +90,18 @@ * Feature: Support HTTP-01 DNS challenge to auto-verify domains # v3.3.463 -# v4.5.531 +### Client * Fix: The "Connect" button for free public servers does not work under certain circumstances # v3.3.462 -# v4.5.531 +### Client * Fix: Pull the recent tokens from the server & URL ### Server * Fix: Push the recent tokens to clients # v3.3.454 -# v4.5.531 +### Client * Update: New Access Token format * Update: Use OS encryption for TLS * Feature: Enable updating server endpoints by Url @@ -118,7 +121,7 @@ * Deprecate: Server ProtocolVersion 3 is deprecated and no longer supported # v3.2.439 -# v4.5.531 +### Client * Update: Improve Performance * Feature: Add the initializing state to the connection state * Feature: Android Set the navigation button background color @@ -138,13 +141,13 @@ * Android: Upgrade to Android API 34 # v3.1.436 -# v4.5.531 +### Client * Update: Improve UI * Fix: Android: Keyboard cover input fields in the UI * Fix: Android: Frequently asking to add the system tile # v3.1.430 -# v4.5.531 +### Client * Update: Improve UI * Update: Windows: Remove from the taskbar on minimize * Update: Android: Ask for notification permission @@ -160,7 +163,7 @@ * Client: Create Api.ts generated for TypeScript by nswag # v3.0.429 -# v4.5.531 +### Client * Android: Fix not showing apps in AppFilter # v3.0.428 @@ -169,13 +172,13 @@ * Fix: AutoUpdater # v3.0.427 -# v4.5.531 +### Client * Feature: Android: Support opening (key) as VpnHood Key file * Update: Windows: Fix Windows Firewall Configuration * Update: Windows: Set fixed window size # v3.0.423 -# v4.5.531 +### Client * Feature: Android: Support opening Cinderella file (CDY) as VpnHood Key file * Feature: Android: Changing file signature for no-google-store APK * Update: Remove the legacy Protocol Version 3 @@ -187,11 +190,11 @@ * Fix: Collection was modified error, which caused connection freeze temporary # v3.0.416 -# v4.5.531 +### Client * Feature: Offer Premium if VpnHood Public server selected # v3.0.412 -# v4.5.531 +### Client * Fix: Invalid UDP packet signature * Fix: Android: setMetered error @@ -200,7 +203,7 @@ * Update: Reduce server default logging # v3.0.411 -# v4.5.531 +### Client * Feature: Client Protocol Version 4 * Feature: TCP connection reuse * Feature: Allow Drop UDP packets @@ -238,7 +241,7 @@ * Fix: Restart listener on servers by UdpEndPoints changes # v2.9.369 -# v4.5.531 & Server +### Client & Server * Feature: Use shared UDP port * Feature: Improve protocol anonymity and anti-fingerprinting for UDP * Feature: Add Server Secret in addition to session secret @@ -255,18 +258,18 @@ * Update: Improve server security # v2.8.360 -# v4.5.531 +### Client * Fix: Used traffic was not displayed correctly ### Server * Fix: Used traffic was not reported correctly # v2.7.357 -# v4.5.531 +### Client * Fix: Windows: Too long filter expression error # v2.7.356 -# v4.5.531 +### Client * Feature: Windows: Add "Open in Browser" item to system menu * Update: windows: ""Open in browser" if WebView is not initialized properly @@ -279,7 +282,7 @@ * Update: Use 24h in filename in track archives # v2.7.350 -# v4.5.531 +### Client * Feature: Follow server-supported networks by IP range * Update: Performance improvement * Windows: Fix Auto Updater @@ -293,7 +296,7 @@ * Update: log file archive format # v2.6.346 -# v4.5.531 +### Client * Update: Improve stability when using no UDP mode ### Server @@ -301,7 +304,7 @@ * Fix: IpV6 detection # v2.6.342 -# v4.5.531 +### Client * Fix: UDP port memory leak * Feature: Notify when a new version is available * Update: Add the build version on the top right of the screen @@ -323,7 +326,7 @@ * Feature: Add Linux-arm64 installation # v2.6.336 -# v4.5.531 +### Client * Update: Optimizing UDP Processing * Update: Improving Garbage Collector * Update: Async Disposal @@ -362,7 +365,7 @@ * Feature: Add TcpChannelCount control # v2.6.326 -# v4.5.531 +### Client * Feature: Windows: Compile as Win-x64. NET runtime is not required anymore. * Feature: Windows: WebView2 is optional. Run UI in the default web browser if WebView2 was not installed * Fix: Unable to connect to IpV6 supported site on chrome when server IpV6 is not configured @@ -385,7 +388,7 @@ * Update: Change config JSON property name for SessionOptions and TrackingOptions # v2.5.323 -# v4.5.531 +### Client * Update: Improve messages of disconnection reason * Feature: Replace Always ON with auto-reconnect * Fix: Anonymize VpnHood Server IP in diagnose @@ -402,7 +405,7 @@ * Update: Remove extra trace log from OS # v2.4.320 -# v4.5.531 +### Client * Update: Upgrade to .NET 7 ### Server @@ -418,7 +421,7 @@ * Fix: Preventing running multiple instances from once location # v2.4.318 -# v4.5.531 +### Client * Feature: Show a message a device disconnected by your device * Feature: Android TV support * Update: Updating IP Location Database @@ -428,16 +431,16 @@ * Fix: Randomly select previous profile in UI # v2.4.310 -# v4.5.531 +### Client * Update: Removing Google Ads # v2.4.307 -# v4.5.531 +### Client * Feature: Add basic advertising support. Ouch! * Update: Upgrade to android 12.1 # v2.4.304 -# v4.5.531 +### Client * Fix: Trimming AccessKey * Update: Improve detecting countries @@ -447,7 +450,7 @@ * Update: Add destination port in tracking # v2.4.303 -# v4.5.531 +### Client * Update: Simplify Client's Country exclusion ### Server @@ -457,7 +460,7 @@ * Update: Move VpnHood.Client.WebUI to a standalone repo # v2.4.299 -# v4.5.531 +### Client * Fix: Windows: Installation Package # v2.4.297 @@ -465,7 +468,7 @@ * Fix: Reporting Negative usage # v2.4.296 -# v4.5.531 +### Client * Fix: Windows: WebView2 could not be installed on some devices ### Server @@ -475,7 +478,7 @@ * Fix: Synching sessions to access server on shut down # v2.4.295 -# v4.5.531 +### Client * Update: Tune TCP connections for games * Fix: Error when setting PacketCapture include filter @@ -486,7 +489,7 @@ * Fix: LogLevel.Trace in DiagnoseMode # v2.4.292 -# v4.5.531 +### Client * Update: Improve stability and memory usage ### Server @@ -500,7 +503,7 @@ * Fix: UDP Packet loss # v2.3.291 -# v4.5.531 +### Client * Fix: Android: Improve performance and stability in Android * Fix: Add time-stamp to logger @@ -509,7 +512,7 @@ * Fix: Catch a lost packet when removing TcpDatagramChannel # v2.3.290 -# v4.5.531 +### Client * Fix: Crash on Android 12 ### Server @@ -518,7 +521,7 @@ * Update: Use NLog.config in app binary folder if it does not exists in working folder # v2.3.289 -# v4.5.531 +### Client * Update: Add Logging Policy Warning * Update: Create Private Server Link @@ -527,7 +530,7 @@ * Fix: Maintenance mode detection # v2.3.287 -# v4.5.531 +### Client * Update: Upgrade to .NET 6 * Update: Diagnose just check some HTTPS sites to check internet connectivity * Update: Windows: Disable right click on App WebView @@ -540,7 +543,7 @@ * Fix: Redact IP addresses in the log # v2.2.283 -# v4.5.531 +### Client * Feature: Allow to have multi-endpoints in AccessToken * Feature: Create IPv6 tunnel when a client has access to a server by IPv6 * Feature: Add "Exclude Local Network" to UI settings @@ -568,7 +571,7 @@ * Update: Improve the speed of establishing the connection # v2.0.271 -# v4.5.531 +### Client * Feature: Server Redirection * Feature: Server Maintenance mode detection * Feature: Validate packets integrity in UdpChannel @@ -596,7 +599,7 @@ * Update: Decouple access manager from server to access server # v1.3.254 -# v4.5.531 +### Client * Feature: Android: Add Manage button to the system notification * Fix: Casual packet loss! * Fix: Empty error message after immediate disconnection @@ -608,7 +611,7 @@ * Fix: Casual packet loss! # v1.3.253 -# v4.5.531 +### Client * Feature: IpFilter by countries * Feature: Android: Exclude local networks from VPN * Feature: Android: Add disconnect to device notification bar @@ -620,7 +623,7 @@ * Update: Improve Performance and Memory usage # v1.2.250 -# v4.5.531 +### Client * Update: Display error for unsupported client * Fix: Random Crash! * Fix: No error message when Client lost the connection @@ -636,11 +639,11 @@ * Update: Significantly optimize performance & stability * Update: Improve power usage -# v4.5.531 +### Client * Fix: Attempting to connect after stopping the VPN # v1.2.248 -# v4.5.531 +### Client * Feature: Windows 7 Support * Feature: Add "What's New" link in the main menu * Fix: Windows: Display Main window location depending on TaskBar position @@ -665,27 +668,27 @@ * Upgrade to SharpPcap 6.0 # v1.1.242 -# v4.5.531 +### Client * Update: Windows: Installer check for new updates before installation # v1.1.241 -# v4.5.531 +### Client * Fix: Freeze in Disconnecting state * Fix: Reconnection # v1.1.240 -# v4.5.531 +### Client * Fix: Diagnostic report "No Internet", when there is internet * Update: Windows: Change Updater # v1.1.238 -# v4.5.531 +### Client * Feature: Set allowed or disallowed Apps that can use VPN * Update: Windows & Linux: Check TargetFramework before update * Update: Show warning for Public Server # v1.1.236 -# v4.5.531 +### Client * Fix: Android: Crash when sending feedback on Android 11 * Fix: Connection already in progress error when changing server * Update: Show traffic speed @@ -696,12 +699,12 @@ * Fix: Linux: Stop working after server update # v1.1.235 -# v4.5.531 +### Client * New: New public server * New: Windows: Bypass local network from tunneling # v1.1.232 -# v4.5.531 +### Client * New: Android: Prevent landscape orientation * Update: Significantly improve speed and stability * Update: Automatically remove profiles when token does not exist @@ -731,7 +734,7 @@ * Change: rename "run" command to "start" # v1.1.202 -# v4.5.531 +### Client * New: Change server list page * New: Android: Change system status bar color to match UI * New: Windows: Change icon on notification area by connection status @@ -742,7 +745,7 @@ * Update: Start new log file on every run # v1.1.197 -# v4.5.531 +### Client * Fix: rejecting AccessKey with vh:// ### Server @@ -751,7 +754,7 @@ * Fix: "Permission Denied" error in Linux while sending some UDP packets # v1.1.195 -# v4.5.531 +### Client * Feature: Modern UI * Feature: Show usage if there is any limitation * Feature: Windows: reconnect last connection after auto update @@ -762,7 +765,7 @@ * Fix: Use last command line argument after auto update # v1.1.187 -# v4.5.531 +### Client * Feature: Windows: Use new standalone UI * Feature: Windows: Add Context menu to system tray * Update: Add Microsoft WebView2 Edge to Windows Installer prerequisites @@ -774,7 +777,7 @@ * Update: Support multiple public IP and Amazon ElasticIP # v1.1.184 -# v4.5.531 +### Client * Feature: Auto Configure Windows Defender Firewall * Update: Improve diagnosing * Fix: Significantly Improve connection stability & speed @@ -796,7 +799,7 @@ # v1.1.176 * Feature: Client can detect its expired session -# v4.5.531 +### Client * Change: Always Open the main window at start if App is already running ### Developer @@ -814,7 +817,7 @@ # v1.1.91 * Fix: AppUpdater throw error if UpdateUrl in publish.json was empty string -# v4.5.531 +### Client * Update: Add client prefix to Bug Report File Name * Update: Close Bug Report bottom page after sending report * Update: Separate SPA from VpnHood.Client.App.UI. Make it easier for developers to use custom SPA diff --git a/Pub/PubVersion.json b/Pub/PubVersion.json index 44d9e9925..53584a337 100644 --- a/Pub/PubVersion.json +++ b/Pub/PubVersion.json @@ -1,6 +1,6 @@ { - "Version": "4.5.531", - "BumpTime": "2024-06-16T22:38:49.4194931Z", + "Version": "4.5.535", + "BumpTime": "2024-06-24T05:03:47.2884293Z", "Prerelease": false, "DeprecatedVersion": "4.0.00" } diff --git a/Pub/PublishToGitHub.ps1 b/Pub/PublishToGitHub.ps1 index 5f2c8de3f..f82039745 100644 --- a/Pub/PublishToGitHub.ps1 +++ b/Pub/PublishToGitHub.ps1 @@ -1,8 +1,5 @@ . "$PSScriptRoot/Core/Common.ps1" -# update maui nugets -Push-Location -Path "$solutionDir/VpnHood.Client.App.Maui.Common"; - # update CHANGELOG $text = Get-Content "$solutionDir/CHANGELOG.md" -Raw; @@ -19,7 +16,6 @@ $changeLog | Out-File -FilePath "$solutionDir/CHANGELOG.md" -Encoding utf8 -For $releaseNote = $changeLog; $releaseNote = $releaseNote.SubString($releaseNote.IndexOf("`n")); # remove version tag $releaseNote = $releaseNote.SubString(0, $releaseNote.IndexOf("`n# ")); # remove other version -# $releaseNote += "To see a list of all changes visit: [Changelog](https://github.com/vpnhood/VpnHood/blob/main/CHANGELOG.md)"; $releaseNote | Out-File -FilePath "$packagesRootDir/ReleaseNote.txt" -Encoding utf8 -Force -NoNewline; if ($isLatest) { diff --git a/Tests/VpnHood.Test/Tests/ClientAppTest.cs b/Tests/VpnHood.Test/Tests/ClientAppTest.cs index 58333f344..ced09089c 100644 --- a/Tests/VpnHood.Test/Tests/ClientAppTest.cs +++ b/Tests/VpnHood.Test/Tests/ClientAppTest.cs @@ -455,7 +455,7 @@ public async Task IpFilters(bool usePassthru, bool isDnsServerSupported) // ************ // *** TEST ***: Test Include ip filter app.UserSettings.IncludeIpRanges = customIps; - app.UserSettings.ExcludeIpRanges = null; + app.UserSettings.ExcludeIpRanges = []; await app.Connect(clientProfile.ClientProfileId); await TestHelper.WaitForAppState(app, AppConnectionState.Connected); await TestHelper.Test_Ping(ipAddress: TestConstants.PingV4Address1); @@ -465,7 +465,7 @@ public async Task IpFilters(bool usePassthru, bool isDnsServerSupported) // ************ // *** TEST ***: Test Exclude ip filters - app.UserSettings.IncludeIpRanges = null; + app.UserSettings.IncludeIpRanges = []; app.UserSettings.ExcludeIpRanges = customIps; await app.Connect(clientProfile.ClientProfileId); await TestHelper.WaitForAppState(app, AppConnectionState.Connected); diff --git a/VpnHood.Client.App.Abstractions/VpnHood.Client.App.Abstractions.csproj b/VpnHood.Client.App.Abstractions/VpnHood.Client.App.Abstractions.csproj index 8d463b6e3..ad4ba7987 100644 --- a/VpnHood.Client.App.Abstractions/VpnHood.Client.App.Abstractions.csproj +++ b/VpnHood.Client.App.Abstractions/VpnHood.Client.App.Abstractions.csproj @@ -19,7 +19,7 @@ VpnHood.png https://github.com/vpnhood/vpnhood https://github.com/vpnhood/vpnhood - 4.5.531 + 4.5.535 $([System.DateTime]::Now.ToString("yyyy.M.d.HHmm")) diff --git a/VpnHood.Client.App.Android.Ads.AdMob/AdMobAppOpenAdService.cs b/VpnHood.Client.App.Android.Ads.AdMob/AdMobAppOpenAdService.cs index b4c56d5ba..a0492d3a7 100644 --- a/VpnHood.Client.App.Android.Ads.AdMob/AdMobAppOpenAdService.cs +++ b/VpnHood.Client.App.Android.Ads.AdMob/AdMobAppOpenAdService.cs @@ -2,6 +2,7 @@ using Android.Gms.Ads.AppOpen; using VpnHood.Client.App.Abstractions; using VpnHood.Client.App.Droid.Ads.VhAdMob.AdNetworkCallBackFix; +using VpnHood.Client.App.Exceptions; using VpnHood.Client.Device; using VpnHood.Client.Device.Droid; using VpnHood.Common.Exceptions; @@ -123,7 +124,10 @@ protected override void OnAdLoaded(AppOpenAd appOpenAd) public override void OnAdFailedToLoad(LoadAdError addError) { - _loadedCompletionSource.TrySetException(new LoadAdException(addError.Message)); + _loadedCompletionSource.TrySetException( + addError.Message.Contains("No fill.", StringComparison.OrdinalIgnoreCase) + ? new NoFillAdException(addError.Message) + : new LoadAdException(addError.Message)); } } diff --git a/VpnHood.Client.App.Android.Ads.AdMob/AdMobInterstitialAdService.cs b/VpnHood.Client.App.Android.Ads.AdMob/AdMobInterstitialAdService.cs index d943f035d..cff1dbc8a 100644 --- a/VpnHood.Client.App.Android.Ads.AdMob/AdMobInterstitialAdService.cs +++ b/VpnHood.Client.App.Android.Ads.AdMob/AdMobInterstitialAdService.cs @@ -1,6 +1,7 @@ using Android.Gms.Ads; using Android.Gms.Ads.Interstitial; using VpnHood.Client.App.Abstractions; +using VpnHood.Client.App.Exceptions; using VpnHood.Client.Device; using VpnHood.Client.Device.Droid; using VpnHood.Common.Exceptions; @@ -111,7 +112,10 @@ protected override void OnAdLoaded(InterstitialAd interstitialAd) public override void OnAdFailedToLoad(LoadAdError addError) { - _loadedCompletionSource.TrySetException(new LoadAdException(addError.Message)); + _loadedCompletionSource.TrySetException( + addError.Message.Contains("No fill.", StringComparison.OrdinalIgnoreCase) + ? new NoFillAdException(addError.Message) + : new LoadAdException(addError.Message)); } } diff --git a/VpnHood.Client.App.Android.Ads.AdMob/AdMobRewardedAdService.cs b/VpnHood.Client.App.Android.Ads.AdMob/AdMobRewardedAdService.cs index 271a692b3..1d7dfa712 100644 --- a/VpnHood.Client.App.Android.Ads.AdMob/AdMobRewardedAdService.cs +++ b/VpnHood.Client.App.Android.Ads.AdMob/AdMobRewardedAdService.cs @@ -1,6 +1,7 @@ using Android.Gms.Ads; using Android.Gms.Ads.Rewarded; using VpnHood.Client.App.Abstractions; +using VpnHood.Client.App.Exceptions; using VpnHood.Client.Device; using VpnHood.Client.Device.Droid; using VpnHood.Common.Exceptions; @@ -110,9 +111,13 @@ protected override void OnAdLoaded(RewardedAd rewardedAd) public override void OnAdFailedToLoad(LoadAdError addError) { - _loadedCompletionSource.TrySetException(new LoadAdException(addError.Message)); + _loadedCompletionSource.TrySetException( + addError.Message.Contains("No fill.", StringComparison.OrdinalIgnoreCase) + ? new NoFillAdException(addError.Message) + : new LoadAdException(addError.Message)); } } + private class MyFullScreenContentCallback : FullScreenContentCallback { private readonly TaskCompletionSource _dismissedCompletionSource = new(); diff --git a/VpnHood.Client.App.Android.Ads.AdMob/VpnHood.Client.App.Android.Ads.AdMob.csproj b/VpnHood.Client.App.Android.Ads.AdMob/VpnHood.Client.App.Android.Ads.AdMob.csproj index c349d3df5..3bcc8e864 100644 --- a/VpnHood.Client.App.Android.Ads.AdMob/VpnHood.Client.App.Android.Ads.AdMob.csproj +++ b/VpnHood.Client.App.Android.Ads.AdMob/VpnHood.Client.App.Android.Ads.AdMob.csproj @@ -21,7 +21,7 @@ VpnHood.png https://github.com/vpnhood/vpnhood https://github.com/vpnhood/vpnhood - 4.5.531 + 4.5.535 $([System.DateTime]::Now.ToString("yyyy.M.d.HHmm")) diff --git a/VpnHood.Client.App.Android.Common/AndroidAppWebViewClient.cs b/VpnHood.Client.App.Android.Common/AndroidAppWebViewClient.cs index b003c0132..dcf79dbf6 100644 --- a/VpnHood.Client.App.Android.Common/AndroidAppWebViewClient.cs +++ b/VpnHood.Client.App.Android.Common/AndroidAppWebViewClient.cs @@ -1,5 +1,7 @@ using Android.Content; using Android.Webkit; +using Microsoft.Extensions.Logging; +using VpnHood.Common.Logging; namespace VpnHood.Client.App.Droid.Common; @@ -23,9 +25,16 @@ public override bool ShouldOverrideUrlLoading(WebView? webView, string? url) if (uri.AbsolutePath == "/" || string.IsNullOrEmpty(uri.AbsolutePath)) return false; - var intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse(url)); - intent.SetFlags(ActivityFlags.NewTask); - Application.Context.StartActivity(intent); + try + { + var intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse(url)); + intent.SetFlags(ActivityFlags.NewTask); + Application.Context.StartActivity(intent); + } + catch (Exception ex) + { + VhLogger.Instance.LogError(ex, $"Could not launch any activity for {url}"); + } return true; } diff --git a/VpnHood.Client.App.Android.Common/VpnHood.Client.App.Android.Common.csproj b/VpnHood.Client.App.Android.Common/VpnHood.Client.App.Android.Common.csproj index 32a729906..67ec7bc1c 100644 --- a/VpnHood.Client.App.Android.Common/VpnHood.Client.App.Android.Common.csproj +++ b/VpnHood.Client.App.Android.Common/VpnHood.Client.App.Android.Common.csproj @@ -21,7 +21,7 @@ VpnHood.png https://github.com/vpnhood/vpnhood https://github.com/vpnhood/vpnhood - 4.5.531 + 4.5.535 $([System.DateTime]::Now.ToString("yyyy.M.d.HHmm")) diff --git a/VpnHood.Client.App.Android.Connect/App.cs b/VpnHood.Client.App.Android.Connect/App.cs index edc73de9a..1abd02399 100644 --- a/VpnHood.Client.App.Android.Connect/App.cs +++ b/VpnHood.Client.App.Android.Connect/App.cs @@ -3,7 +3,6 @@ using Firebase.Crashlytics; using Firebase; using VpnHood.Client.App.Droid.Ads.VhAdMob; -using VpnHood.Client.App.Droid.Ads.VhUnityAds; using VpnHood.Client.App.Droid.Common; using VpnHood.Client.App.Droid.GooglePlay; using VpnHood.Client.App.Resources; @@ -37,7 +36,7 @@ protected override AppOptions CreateAppOptions() var resources = DefaultAppResource.Resource; resources.Colors.NavigationBarColor = Color.FromArgb(100, 32, 25, 81); resources.Colors.WindowBackgroundColor = Color.FromArgb(100, 32, 25, 81); - + return new AppOptions { StorageFolderPath = storageFolderPath, @@ -52,7 +51,6 @@ protected override AppOptions CreateAppOptions() AdServices = [ AdMobInterstitialAdService.Create(appSettings.AdMobInterstitialAdUnitId, true), AdMobInterstitialAdService.Create(appSettings.AdMobInterstitialNoVideoAdUnitId, false), - UnityAdService.Create(appSettings.UnityAdGameId, appSettings.UnityAdInterstitialPlacementId, AppSettings.IsDebugMode) ], UiService = new AndroidAppUiService() }; diff --git a/VpnHood.Client.App.Android.Connect/AppSettings.cs b/VpnHood.Client.App.Android.Connect/AppSettings.cs index 533072d45..3c36b1149 100644 --- a/VpnHood.Client.App.Android.Connect/AppSettings.cs +++ b/VpnHood.Client.App.Android.Connect/AppSettings.cs @@ -11,7 +11,7 @@ internal class AppSettings : Singleton // This is a test access key, you should replace it with your own access key. // It is limited and can not be used in production. - public string DefaultAccessKey { get; init; } = "vh://eyJ2Ijo0LCJuYW1lIjoiVnBuSG9vZCBTYW1wbGUiLCJzaWQiOiIxMzAwIiwidGlkIjoiYTM0Mjk4ZDktY2YwYi00MGEwLWI5NmMtZGJhYjYzMWQ2MGVjIiwiaWF0IjoiMjAyNC0wNi0xNFQyMjozMjo1NS44OTQ5ODAyWiIsInNlYyI6Im9wcTJ6M0M0ak9rdHNodXl3c0VKNXc9PSIsInNlciI6eyJjdCI6IjIwMjQtMDYtMDVUMDQ6MTU6MzZaIiwiaG5hbWUiOiJtby5naXdvd3l2eS5uZXQiLCJocG9ydCI6MCwiaXN2IjpmYWxzZSwic2VjIjoidmFCcVU5UkMzUUhhVzR4RjVpYllGdz09IiwiY2giOiIzZ1hPSGU1ZWN1aUM5cStzYk83aGxMb2tRYkE9IiwidXJsIjoiaHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL3Zwbmhvb2QvVnBuSG9vZC5GYXJtS2V5cy9tYWluL0ZyZWVfZW5jcnlwdGVkX3Rva2VuLnR4dCIsImVwIjpbIjUxLjgxLjIxMC4xNjQ6NDQzIiwiWzI2MDQ6MmRjMDoyMDI6MzAwOjo1Y2VdOjQ0MyJdLCJsb2MiOlsiVVMvT3JlZ29uIiwiVVMvVmlyZ2luaWEiXX19"; + public string DefaultAccessKey { get; init; } = ClientOptions.SampleAccessKey; // Google sign-in (It is created through Firebase) public string GoogleSignInClientId { get; init; } = "000000000000-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com"; //YOUR_FIREBASE_CLIENT_ID @@ -24,7 +24,7 @@ internal class AppSettings : Singleton // VpnHood Store server public Uri StoreBaseUri { get; init; } = new ("https://store-api.vpnhood.com"); public Guid StoreAppId { get; init; } = Guid.Parse("00000000-0000-0000-0000-000000000000"); //YOUR_VPNHOOD_STORE_APP_ID - public bool StoreIgnoreSslVerification { get; init; } + public bool StoreIgnoreSslVerification { get; init; } = IsDebugMode; // AdMob // Default value is AdMob test AdUnit id, References: https://developers.google.com/admob/android/test-ads diff --git a/VpnHood.Client.App.Android.Connect/VpnHood.Client.App.Android.Connect.csproj b/VpnHood.Client.App.Android.Connect/VpnHood.Client.App.Android.Connect.csproj index b98f29f75..56f3e5298 100644 --- a/VpnHood.Client.App.Android.Connect/VpnHood.Client.App.Android.Connect.csproj +++ b/VpnHood.Client.App.Android.Connect/VpnHood.Client.App.Android.Connect.csproj @@ -5,8 +5,8 @@ VpnHood.Client.App.Droid.Connect Exe com.vpnhood.connect.android - 530 - 4.5.530 + 534 + 4.5.534 23.0 @@ -30,7 +30,7 @@ VpnHood.png https://github.com/vpnhood/vpnhood https://github.com/vpnhood/vpnhood - 4.5.530 + 4.5.534 $([System.DateTime]::Now.ToString("yyyy.M.d.HHmm")) @@ -68,8 +68,7 @@ - - + \ No newline at end of file diff --git a/VpnHood.Client.App.Android.GooglePlay.Core/GooglePlayAppUpdaterService.cs b/VpnHood.Client.App.Android.GooglePlay.Core/GooglePlayAppUpdaterService.cs index 5d7b6927d..5873298ba 100644 --- a/VpnHood.Client.App.Android.GooglePlay.Core/GooglePlayAppUpdaterService.cs +++ b/VpnHood.Client.App.Android.GooglePlay.Core/GooglePlayAppUpdaterService.cs @@ -86,7 +86,7 @@ public void OnStateUpdate(InstallState state) break; case InstallStatus.Canceled: - _taskCompletionSource.SetCanceled(); + _taskCompletionSource.TrySetCanceled(); break; case InstallStatus.Failed: diff --git a/VpnHood.Client.App.Android.GooglePlay.Core/VpnHood.Client.App.Android.GooglePlay.Core.csproj b/VpnHood.Client.App.Android.GooglePlay.Core/VpnHood.Client.App.Android.GooglePlay.Core.csproj index 961d7c370..7fb031753 100644 --- a/VpnHood.Client.App.Android.GooglePlay.Core/VpnHood.Client.App.Android.GooglePlay.Core.csproj +++ b/VpnHood.Client.App.Android.GooglePlay.Core/VpnHood.Client.App.Android.GooglePlay.Core.csproj @@ -21,7 +21,7 @@ VpnHood.png https://github.com/vpnhood/vpnhood https://github.com/vpnhood/vpnhood - 4.5.531 + 4.5.535 $([System.DateTime]::Now.ToString("yyyy.M.d.HHmm")) diff --git a/VpnHood.Client.App.Android.GooglePlay/VpnHood.Client.App.Android.GooglePlay.csproj b/VpnHood.Client.App.Android.GooglePlay/VpnHood.Client.App.Android.GooglePlay.csproj index 68c3d815e..0e63b147b 100644 --- a/VpnHood.Client.App.Android.GooglePlay/VpnHood.Client.App.Android.GooglePlay.csproj +++ b/VpnHood.Client.App.Android.GooglePlay/VpnHood.Client.App.Android.GooglePlay.csproj @@ -21,7 +21,7 @@ VpnHood.png https://github.com/vpnhood/vpnhood https://github.com/vpnhood/vpnhood - 4.5.531 + 4.5.535 $([System.DateTime]::Now.ToString("yyyy.M.d.HHmm")) @@ -34,8 +34,8 @@ - - + + diff --git a/VpnHood.Client.App.Android/App.cs b/VpnHood.Client.App.Android/App.cs index d5258a180..cb264b1d9 100644 --- a/VpnHood.Client.App.Android/App.cs +++ b/VpnHood.Client.App.Android/App.cs @@ -17,6 +17,7 @@ public class App(IntPtr javaReference, JniHandleOwnership transfer) protected override AppOptions CreateAppOptions() => new() { Resource = DefaultAppResource.Resource, + AccessKeys = AssemblyInfo.IsDebugMode ? [ClientOptions.SampleAccessKey] : [], UpdateInfoUrl = AssemblyInfo.UpdateInfoUrl, IsAddAccessKeySupported = true, UpdaterService = AssemblyInfo.CreateUpdaterService(), diff --git a/VpnHood.Client.App.Android/VpnHood.Client.App.Android.csproj b/VpnHood.Client.App.Android/VpnHood.Client.App.Android.csproj index cec8b8953..36b0fe123 100644 --- a/VpnHood.Client.App.Android/VpnHood.Client.App.Android.csproj +++ b/VpnHood.Client.App.Android/VpnHood.Client.App.Android.csproj @@ -5,8 +5,8 @@ VpnHood.Client.App.Droid Exe com.vpnhood.client.android.web - 531 - 4.5.531 + 535 + 4.5.535 23.0 @@ -30,7 +30,7 @@ VpnHood.png https://github.com/vpnhood/vpnhood https://github.com/vpnhood/vpnhood - 4.5.531 + 4.5.535 $([System.DateTime]::Now.ToString("yyyy.M.d.HHmm")) diff --git a/VpnHood.Client.App.Maui.Common/VpnHood.Client.App.Maui.Common.csproj b/VpnHood.Client.App.Maui.Common/VpnHood.Client.App.Maui.Common.csproj index 18326008e..a2e3eb9b0 100644 --- a/VpnHood.Client.App.Maui.Common/VpnHood.Client.App.Maui.Common.csproj +++ b/VpnHood.Client.App.Maui.Common/VpnHood.Client.App.Maui.Common.csproj @@ -30,7 +30,7 @@ VpnHood.png https://github.com/vpnhood/vpnhood https://github.com/vpnhood/vpnhood - 4.5.531 + 4.5.535 $([System.DateTime]::Now.ToString("yyyy.M.d.HHmm")) diff --git a/VpnHood.Client.App.Resources/Resources/SPA.zip b/VpnHood.Client.App.Resources/Resources/SPA.zip index 1b98e919e..102240374 100644 Binary files a/VpnHood.Client.App.Resources/Resources/SPA.zip and b/VpnHood.Client.App.Resources/Resources/SPA.zip differ diff --git a/VpnHood.Client.App.Resources/VpnHood.Client.App.Resources.csproj b/VpnHood.Client.App.Resources/VpnHood.Client.App.Resources.csproj index 7497cea54..b3e6407b1 100644 --- a/VpnHood.Client.App.Resources/VpnHood.Client.App.Resources.csproj +++ b/VpnHood.Client.App.Resources/VpnHood.Client.App.Resources.csproj @@ -19,7 +19,7 @@ VpnHood.png https://github.com/vpnhood/vpnhood https://github.com/vpnhood/vpnhood - 4.5.531 + 4.5.535 $([System.DateTime]::Now.ToString("yyyy.M.d.HHmm")) diff --git a/VpnHood.Client.App.Store/VpnHood.Client.App.Store.csproj b/VpnHood.Client.App.Store/VpnHood.Client.App.Store.csproj index 106c7a64b..2a97fcb33 100644 --- a/VpnHood.Client.App.Store/VpnHood.Client.App.Store.csproj +++ b/VpnHood.Client.App.Store/VpnHood.Client.App.Store.csproj @@ -19,7 +19,7 @@ VpnHood.png https://github.com/vpnhood/vpnhood https://github.com/vpnhood/vpnhood - 4.5.531 + 4.5.535 $([System.DateTime]::Now.ToString("yyyy.M.d.HHmm")) @@ -35,7 +35,7 @@ - + diff --git a/VpnHood.Client.App.WebServer/VpnHood.Client.App.WebServer.csproj b/VpnHood.Client.App.WebServer/VpnHood.Client.App.WebServer.csproj index fe71fbc1b..a3c6863c9 100644 --- a/VpnHood.Client.App.WebServer/VpnHood.Client.App.WebServer.csproj +++ b/VpnHood.Client.App.WebServer/VpnHood.Client.App.WebServer.csproj @@ -19,7 +19,7 @@ VpnHood.png https://github.com/vpnhood/vpnhood https://github.com/vpnhood/vpnhood - 4.5.531 + 4.5.535 $([System.DateTime]::Now.ToString("yyyy.M.d.HHmm")) diff --git a/VpnHood.Client.App.Win.Common/VpnHood.Client.App.Win.Common.csproj b/VpnHood.Client.App.Win.Common/VpnHood.Client.App.Win.Common.csproj index 9ae43b25d..1003ff926 100644 --- a/VpnHood.Client.App.Win.Common/VpnHood.Client.App.Win.Common.csproj +++ b/VpnHood.Client.App.Win.Common/VpnHood.Client.App.Win.Common.csproj @@ -19,7 +19,7 @@ VpnHood.png https://github.com/vpnhood/vpnhood https://github.com/vpnhood/vpnhood - 4.5.531 + 4.5.535 $([System.DateTime]::Now.ToString("yyyy.M.d.HHmm")) diff --git a/VpnHood.Client.App.Win/VpnHood.Client.App.Win.csproj b/VpnHood.Client.App.Win/VpnHood.Client.App.Win.csproj index 7834ef97e..99592efdf 100644 --- a/VpnHood.Client.App.Win/VpnHood.Client.App.Win.csproj +++ b/VpnHood.Client.App.Win/VpnHood.Client.App.Win.csproj @@ -27,7 +27,7 @@ VpnHood.png https://github.com/vpnhood/vpnhood https://github.com/vpnhood/vpnhood - 4.5.531 + 4.5.535 $([System.DateTime]::Now.ToString("yyyy.M.d.HHmm")) @@ -48,7 +48,7 @@ - + diff --git a/VpnHood.Client.App/Exceptions/NoFillAdException.cs b/VpnHood.Client.App/Exceptions/NoFillAdException.cs new file mode 100644 index 000000000..e86f555ea --- /dev/null +++ b/VpnHood.Client.App/Exceptions/NoFillAdException.cs @@ -0,0 +1,14 @@ +using VpnHood.Common.Exceptions; + +namespace VpnHood.Client.App.Exceptions; + +public class NoFillAdException : LoadAdException +{ + public NoFillAdException(string message) : base(message) + { + } + + public NoFillAdException(string message, Exception innerException) : base(message, innerException) + { + } +} \ No newline at end of file diff --git a/VpnHood.Client.App/Settings/UserSettings.cs b/VpnHood.Client.App/Settings/UserSettings.cs index d2aa1b1f4..2d1bfba91 100644 --- a/VpnHood.Client.App/Settings/UserSettings.cs +++ b/VpnHood.Client.App/Settings/UserSettings.cs @@ -1,11 +1,13 @@ using System.Net; +using System.Text.Json.Serialization; +using VpnHood.Common.Converters; using VpnHood.Common.Net; namespace VpnHood.Client.App.Settings; public class UserSettings { - private static readonly ClientOptions DefaultClientOptions = new(); + private static readonly ClientOptions DefaultClientOptions = new(); public AppLogSettings Logging { get; set; } = new(); public string? CultureCode { get; set; } @@ -13,15 +15,24 @@ public class UserSettings public string? ServerLocation { get; set; } public int MaxDatagramChannelCount { get; set; } = DefaultClientOptions.MaxDatagramChannelCount; public bool TunnelClientCountry { get; set; } = true; - public string[]? AppFilters { get; set; } + [JsonConverter(typeof(NullToEmptyArrayConverter))] //todo: remove nullable after migration 4.5.533 + public string[] AppFilters { get; set; } = []; public FilterMode AppFiltersMode { get; set; } = FilterMode.All; public bool UseUdpChannel { get; set; } = DefaultClientOptions.UseUdpChannel; public bool DropUdpPackets { get; set; } = DefaultClientOptions.DropUdpPackets; public bool IncludeLocalNetwork { get; set; } = DefaultClientOptions.IncludeLocalNetwork; - public IpRange[]? IncludeIpRanges { get; set; } = IpNetwork.All.ToIpRanges().ToArray(); - public IpRange[]? ExcludeIpRanges { get; set; } = IpNetwork.None.ToIpRanges().ToArray(); - public IpRange[]? PacketCaptureIncludeIpRanges { get; set; } = IpNetwork.All.ToIpRanges().ToArray(); - public IpRange[]? PacketCaptureExcludeIpRanges { get; set; } = IpNetwork.None.ToIpRanges().ToArray(); + + [JsonConverter(typeof(NullToEmptyArrayConverter))] //todo: remove nullable after migration 4.5.533 + public IpRange[] IncludeIpRanges { get; set; } = IpNetwork.All.ToIpRanges().ToArray(); + + [JsonConverter(typeof(NullToEmptyArrayConverter))] //todo: remove nullable after migration 4.5.533 + public IpRange[] ExcludeIpRanges { get; set; } = IpNetwork.None.ToIpRanges().ToArray(); + + [JsonConverter(typeof(NullToEmptyArrayConverter))] //todo: remove nullable after migration 4.5.533 + public IpRange[] PacketCaptureIncludeIpRanges { get; set; } = IpNetwork.All.ToIpRanges().ToArray(); + + [JsonConverter(typeof(NullToEmptyArrayConverter))] //todo: remove nullable after migration 4.5.533 + public IpRange[] PacketCaptureExcludeIpRanges { get; set; } = IpNetwork.None.ToIpRanges().ToArray(); public bool AllowAnonymousTracker { get; set; } = DefaultClientOptions.AllowAnonymousTracker; public IPAddress[]? DnsServers { get; set; } public string? DebugData1 { get; set; } diff --git a/VpnHood.Client.App/VpnHood.Client.App.csproj b/VpnHood.Client.App/VpnHood.Client.App.csproj index b116a6a54..a5c70b640 100644 --- a/VpnHood.Client.App/VpnHood.Client.App.csproj +++ b/VpnHood.Client.App/VpnHood.Client.App.csproj @@ -19,7 +19,7 @@ VpnHood.png https://github.com/vpnhood/vpnhood https://github.com/vpnhood/vpnhood - 4.5.531 + 4.5.535 $([System.DateTime]::Now.ToString("yyyy.M.d.HHmm")) diff --git a/VpnHood.Client.App/VpnHoodApp.cs b/VpnHood.Client.App/VpnHoodApp.cs index b082b3244..673c3b54c 100644 --- a/VpnHood.Client.App/VpnHoodApp.cs +++ b/VpnHood.Client.App/VpnHoodApp.cs @@ -437,10 +437,10 @@ private async Task ConnectInternal(Token token, string? serverLocationInfo, stri // calculate packetCaptureIpRanges var packetCaptureIpRanges = new IpRangeOrderedList(IpNetwork.All.ToIpRanges()); - if (!VhUtil.IsNullOrEmpty(UserSettings.PacketCaptureIncludeIpRanges)) + if (UserSettings.PacketCaptureIncludeIpRanges.Any()) packetCaptureIpRanges = packetCaptureIpRanges.Intersect(UserSettings.PacketCaptureIncludeIpRanges); - if (!VhUtil.IsNullOrEmpty(UserSettings.PacketCaptureExcludeIpRanges)) + if (UserSettings.PacketCaptureExcludeIpRanges.Any()) packetCaptureIpRanges = packetCaptureIpRanges.Exclude(UserSettings.PacketCaptureExcludeIpRanges); // create clientOptions @@ -659,21 +659,33 @@ public async Task ShowAd(string sessionId, CancellationToken cancellatio var adServices = Services.AdServices.Where(x => x.AdType == AppAdType.InterstitialAd && x.IsCountrySupported(countryCode)); + var noFillAdNetworks = new List(); foreach (var adService in adServices) { + cancellationToken.ThrowIfCancellationRequested(); + // find first successful ad network try { + if (noFillAdNetworks.Contains(adService.NetworkName)) + continue; + using var timeoutCts = new CancellationTokenSource(_adLoadTimeout); - using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token); + using var linkedCts = + CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token); await adService.LoadAd(RequiredUiContext, linkedCts.Token).VhConfigureAwait(); } catch (UiContextNotAvailableException) { throw new ShowAdNoUiException(); } + catch (NoFillAdException) + { + noFillAdNetworks.Add(adService.NetworkName); + continue; + } // do not catch if parent cancel the operation - catch (Exception ex) when (!cancellationToken.IsCancellationRequested) + catch (Exception ex) { VhLogger.Instance.LogWarning(ex, "Could not load any ad. Network: {Network}.", adService.NetworkName); continue; @@ -877,8 +889,8 @@ public async Task VersionCheck(bool force = false) { // calculate packetCaptureIpRanges var ipRanges = IpNetwork.All.ToIpRanges(); - if (!VhUtil.IsNullOrEmpty(UserSettings.IncludeIpRanges)) ipRanges = ipRanges.Intersect(UserSettings.IncludeIpRanges); - if (!VhUtil.IsNullOrEmpty(UserSettings.ExcludeIpRanges)) ipRanges = ipRanges.Exclude(UserSettings.ExcludeIpRanges); + if (UserSettings.IncludeIpRanges.Any()) ipRanges = ipRanges.Intersect(UserSettings.IncludeIpRanges); + if (UserSettings.ExcludeIpRanges.Any()) ipRanges = ipRanges.Exclude(UserSettings.ExcludeIpRanges); // exclude client country IPs if (UserSettings.TunnelClientCountry) diff --git a/VpnHood.Client.Device.Android/AndroidDevice.cs b/VpnHood.Client.Device.Android/AndroidDevice.cs index e640a80dc..51a785be0 100644 --- a/VpnHood.Client.Device.Android/AndroidDevice.cs +++ b/VpnHood.Client.Device.Android/AndroidDevice.cs @@ -93,6 +93,8 @@ public DeviceAppInfo[] InstalledApps var intent = new Intent(Intent.ActionMain); intent.AddCategory(Intent.CategoryLauncher); var resolveInfoList = packageManager.QueryIntentActivities(intent, 0); + + var currentAppId = Application.Context.PackageName; foreach (var resolveInfo in resolveInfoList) { if (resolveInfo.ActivityInfo == null) @@ -101,7 +103,7 @@ public DeviceAppInfo[] InstalledApps var appName = resolveInfo.LoadLabel(packageManager); var appId = resolveInfo.ActivityInfo.PackageName; var icon = resolveInfo.LoadIcon(packageManager); - if (appName is "" or null || appId is "" or null || icon == null) + if (appName is "" or null || appId is "" or null || icon == null || appId == currentAppId) continue; var deviceAppInfo = new DeviceAppInfo diff --git a/VpnHood.Client.Device.Android/VpnHood.Client.Device.Android.csproj b/VpnHood.Client.Device.Android/VpnHood.Client.Device.Android.csproj index 0dee821d3..2acccce94 100644 --- a/VpnHood.Client.Device.Android/VpnHood.Client.Device.Android.csproj +++ b/VpnHood.Client.Device.Android/VpnHood.Client.Device.Android.csproj @@ -21,7 +21,7 @@ VpnHood.png https://github.com/vpnhood/vpnhood https://github.com/vpnhood/vpnhood - 4.5.531 + 4.5.535 $([System.DateTime]::Now.ToString("yyyy.M.d.HHmm")) diff --git a/VpnHood.Client.Device.WinDivert/VpnHood.Client.Device.WinDivert.csproj b/VpnHood.Client.Device.WinDivert/VpnHood.Client.Device.WinDivert.csproj index 247aa6e37..fcd7e7029 100644 --- a/VpnHood.Client.Device.WinDivert/VpnHood.Client.Device.WinDivert.csproj +++ b/VpnHood.Client.Device.WinDivert/VpnHood.Client.Device.WinDivert.csproj @@ -19,7 +19,7 @@ VpnHood.png https://github.com/vpnhood/vpnhood https://github.com/vpnhood/vpnhood - 4.5.531 + 4.5.535 $([System.DateTime]::Now.ToString("yyyy.M.d.HHmm")) diff --git a/VpnHood.Client.Device/VpnHood.Client.Device.csproj b/VpnHood.Client.Device/VpnHood.Client.Device.csproj index 28cb4ef25..a9fb543bf 100644 --- a/VpnHood.Client.Device/VpnHood.Client.Device.csproj +++ b/VpnHood.Client.Device/VpnHood.Client.Device.csproj @@ -19,7 +19,7 @@ VpnHood.png https://github.com/vpnhood/vpnhood https://github.com/vpnhood/vpnhood - 4.5.531 + 4.5.535 $([System.DateTime]::Now.ToString("yyyy.M.d.HHmm")) diff --git a/VpnHood.Client/ClientOptions.cs b/VpnHood.Client/ClientOptions.cs index 13afd2b78..09dad840a 100644 --- a/VpnHood.Client/ClientOptions.cs +++ b/VpnHood.Client/ClientOptions.cs @@ -43,4 +43,8 @@ public class ClientOptions public bool DropUdpPackets { get; set; } public string? AppGa4MeasurementId { get; set; } public string? ServerLocation { get; set; } + + // ReSharper disable StringLiteralTypo + public const string SampleAccessKey = "vh://eyJ2Ijo0LCJuYW1lIjoiVnBuSG9vZCBTYW1wbGUiLCJzaWQiOiIxMzAwIiwidGlkIjoiYTM0Mjk4ZDktY2YwYi00MGEwLWI5NmMtZGJhYjYzMWQ2MGVjIiwiaWF0IjoiMjAyNC0wNi0xNFQyMjozMjo1NS44OTQ5ODAyWiIsInNlYyI6Im9wcTJ6M0M0ak9rdHNodXl3c0VKNXc9PSIsInNlciI6eyJjdCI6IjIwMjQtMDYtMDVUMDQ6MTU6MzZaIiwiaG5hbWUiOiJtby5naXdvd3l2eS5uZXQiLCJocG9ydCI6MCwiaXN2IjpmYWxzZSwic2VjIjoidmFCcVU5UkMzUUhhVzR4RjVpYllGdz09IiwiY2giOiIzZ1hPSGU1ZWN1aUM5cStzYk83aGxMb2tRYkE9IiwidXJsIjoiaHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL3Zwbmhvb2QvVnBuSG9vZC5GYXJtS2V5cy9tYWluL0ZyZWVfZW5jcnlwdGVkX3Rva2VuLnR4dCIsImVwIjpbIjUxLjgxLjIxMC4xNjQ6NDQzIiwiWzI2MDQ6MmRjMDoyMDI6MzAwOjo1Y2VdOjQ0MyJdLCJsb2MiOlsiVVMvT3JlZ29uIiwiVVMvVmlyZ2luaWEiXX19"; + // ReSharper restore StringLiteralTypo } \ No newline at end of file diff --git a/VpnHood.Client/VpnHood.Client.csproj b/VpnHood.Client/VpnHood.Client.csproj index 11d948129..c2868bd5a 100644 --- a/VpnHood.Client/VpnHood.Client.csproj +++ b/VpnHood.Client/VpnHood.Client.csproj @@ -19,7 +19,7 @@ VpnHood.png https://github.com/vpnhood/vpnhood https://github.com/vpnhood/vpnhood - 4.5.531 + 4.5.535 $([System.DateTime]::Now.ToString("yyyy.M.d.HHmm")) diff --git a/VpnHood.Common/Converters/NullToEmptyArrayConverter.cs b/VpnHood.Common/Converters/NullToEmptyArrayConverter.cs new file mode 100644 index 000000000..4b741949c --- /dev/null +++ b/VpnHood.Common/Converters/NullToEmptyArrayConverter.cs @@ -0,0 +1,22 @@ +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace VpnHood.Common.Converters; + +public class NullToEmptyArrayConverter : JsonConverter +{ + public override bool HandleNull { get; } = true; + + public override T[] Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType == JsonTokenType.Null) + return []; + + return JsonSerializer.Deserialize(ref reader, options) ?? throw new JsonException($"Could not parse {typeof(T)}"); + } + + public override void Write(Utf8JsonWriter writer, T[] value, JsonSerializerOptions options) + { + JsonSerializer.Serialize(writer, value, options); + } +} \ No newline at end of file diff --git a/VpnHood.Common/VpnHood.Common.csproj b/VpnHood.Common/VpnHood.Common.csproj index 17f1c5c0d..55188c76d 100644 --- a/VpnHood.Common/VpnHood.Common.csproj +++ b/VpnHood.Common/VpnHood.Common.csproj @@ -19,7 +19,7 @@ VpnHood.png https://github.com/vpnhood/vpnhood https://github.com/vpnhood/vpnhood - 4.5.531 + 4.5.535 $([System.DateTime]::Now.ToString("yyyy.M.d.HHmm")) diff --git a/VpnHood.Server.Access/VpnHood.Server.Access.csproj b/VpnHood.Server.Access/VpnHood.Server.Access.csproj index 115c83738..0352393e6 100644 --- a/VpnHood.Server.Access/VpnHood.Server.Access.csproj +++ b/VpnHood.Server.Access/VpnHood.Server.Access.csproj @@ -20,7 +20,7 @@ VpnHood.png https://github.com/vpnhood/vpnhood https://github.com/vpnhood/vpnhood - 4.5.531 + 4.5.535 $([System.DateTime]::Now.ToString("yyyy.M.d.HHmm")) diff --git a/VpnHood.Server/VpnHood.Server.csproj b/VpnHood.Server/VpnHood.Server.csproj index aa56e301c..40826701d 100644 --- a/VpnHood.Server/VpnHood.Server.csproj +++ b/VpnHood.Server/VpnHood.Server.csproj @@ -19,7 +19,7 @@ VpnHood.png https://github.com/vpnhood/vpnhood https://github.com/vpnhood/vpnhood - 4.5.531 + 4.5.535 $([System.DateTime]::Now.ToString("yyyy.M.d.HHmm")) diff --git a/VpnHood.Tunneling/VpnHood.Tunneling.csproj b/VpnHood.Tunneling/VpnHood.Tunneling.csproj index 1c6e33f64..6668da302 100644 --- a/VpnHood.Tunneling/VpnHood.Tunneling.csproj +++ b/VpnHood.Tunneling/VpnHood.Tunneling.csproj @@ -19,7 +19,7 @@ VpnHood.png https://github.com/vpnhood/vpnhood https://github.com/vpnhood/vpnhood - 4.5.531 + 4.5.535 $([System.DateTime]::Now.ToString("yyyy.M.d.HHmm"))