Skip to content

Commit

Permalink
Merge branch 'release/3.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Mindaugas Veblauskas committed Sep 8, 2023
2 parents 9e73ea4 + d58c126 commit c99be0b
Show file tree
Hide file tree
Showing 83 changed files with 1,345 additions and 781 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci-templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
when: always
name: "result-ui"
paths:
- $SCREENSHOT_PATH
- $TEST_ARTIFACT_PATH
expire_in: 1 weeks

.build-script:
Expand Down
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include:

variables:
PUBLIC_REPO_URL: [email protected]:ProtonVPN/win-app.git
SCREENSHOT_PATH: src/bin/TestFailureData/
TEST_ARTIFACT_PATH: src/bin/TestArtifactData/
TEST_REPORT_PATH: results/
PROJECT_ID: "13"
MILESTONE: "Windows"
Expand Down Expand Up @@ -77,7 +77,7 @@ tests:
- cmd.exe /c BuildDependencies.bat bin gosrponly
- dotnet restore ProtonVpn.sln
- dotnet build ProtonVpn.sln
- coverlet src\bin --target "dotnet" --targetargs "test ProtonVpn.sln -l ""console;verbosity=normal"" --filter ""TestCategory!=UI&TestCategory!=Connection"" --no-restore --no-build" --format cobertura --output .\coverage-reports --exclude "[*.Tests*]*" --exclude "[ProtonVPN.MarkupValidator]*" --exclude "[TestTools*]*" --exclude "[*.Installers]*"
- coverlet src\bin --target "dotnet" --targetargs "test ProtonVpn.sln -l ""console;verbosity=normal"" --filter ""TestCategory!=UI&TestCategory!=Connection&TestCategory!=Performance"" --no-restore --no-build" --format cobertura --output .\coverage-reports --exclude "[*.Tests*]*" --exclude "[ProtonVPN.MarkupValidator]*" --exclude "[TestTools*]*" --exclude "[*.Installers]*"
- powershell -Command "(gc coverage-reports.cobertura.xml) -replace '\\', '/' | Out-File -encoding UTF8 cobertura.xml"
- ReportGenerator.exe "-reports:cobertura.xml" "-targetdir:.\code-coverage-report-html"
artifacts:
Expand Down
23 changes: 23 additions & 0 deletions ci/test-scripts/install-prod-app.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
$response = Invoke-RestMethod -Uri "https://protonvpn.com/download/windows-releases.json"
$documentsFolderPath = [Environment]::GetFolderPath("MyDocuments")
$installersFolderPath = Join-Path $documentsFolderPath "Installers"

if (-not (Test-Path -Path $installersFolderPath -PathType Container)) {
New-Item -Path $installersFolderPath -ItemType Directory
}

$mostRecentStableVersion = $response.Categories | Where-Object { $_.Name -eq "Stable" } |
Select-Object -ExpandProperty Releases |
Sort-Object { [version]::Parse($_.Version) } -Descending |
Select-Object -First 1

$mostRecentStableVersionUrl = $mostRecentStableVersion.File.Url
$executableName = [System.IO.Path]::GetFileName($mostRecentStableVersionUrl)

$executablePath = Join-Path $installersFolderPath $executableName

if (-not (Test-Path -Path $executablePath)) {
Invoke-WebRequest -Uri $mostRecentStableVersionUrl -OutFile $executablePath
}

Start-Process -FilePath $executablePath -ArgumentList "/verysilent" -PassThru -Wait
4 changes: 3 additions & 1 deletion ci/test-scripts/uninstall-app.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
$protonFolder = "C:\Program Files\Proton\VPN"
$protonUninstallExe = $protonFolder + "\unins000.exe"
if (Test-Path -Path $protonFolder) {
if(Test-Path -Path $protonUninstallExe) {
Start-Process -FilePath $protonUninstallExe -ArgumentList "/verysilent" -Wait -ErrorAction Ignore
}
if (Test-Path -Path $protonFolder) {
Remove-Item $protonFolder -Recurse -ErrorAction Ignore
}
34 changes: 0 additions & 34 deletions src/Api/ProtonVPN.Api.Contracts/Events/EventResponse.cs

This file was deleted.

2 changes: 0 additions & 2 deletions src/Api/ProtonVPN.Api.Contracts/IApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
using ProtonVPN.Api.Contracts.Auth;
using ProtonVPN.Api.Contracts.Certificates;
using ProtonVPN.Api.Contracts.Common;
using ProtonVPN.Api.Contracts.Events;
using ProtonVPN.Api.Contracts.Geographical;
using ProtonVPN.Api.Contracts.Partners;
using ProtonVPN.Api.Contracts.ReportAnIssue;
Expand All @@ -41,7 +40,6 @@ public interface IApiClient : IClientBase
Task<ApiResponseResult<PhysicalServerWrapperResponse>> GetServerAsync(string serverId);
Task<ApiResponseResult<VpnInfoWrapperResponse>> GetVpnInfoResponse();
Task<ApiResponseResult<BaseResponse>> GetLogoutResponse();
Task<ApiResponseResult<EventResponse>> GetEventResponse(string lastId = default);
Task<ApiResponseResult<ServersResponse>> GetServersAsync(string ip);
Task<ApiResponseResult<ReportAnIssueFormResponse>> GetReportAnIssueFormData();
Task<ApiResponseResult<ServersResponse>> GetServerLoadsAsync(string ip);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class LogicalServerResponse
public string ExitCountry { get; set; }
public string Domain { get; set; }
public sbyte Tier { get; set; }
public sbyte Features { get; set; }
public ulong Features { get; set; }
public LocationResponse LocationResponse { get; set; }
public sbyte Status { get; set; }
public sbyte Load { get; set; }
Expand Down
12 changes: 2 additions & 10 deletions src/Api/ProtonVPN.Api/ApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
using ProtonVPN.Api.Contracts.Auth;
using ProtonVPN.Api.Contracts.Certificates;
using ProtonVPN.Api.Contracts.Common;
using ProtonVPN.Api.Contracts.Events;
using ProtonVPN.Api.Contracts.Geographical;
using ProtonVPN.Api.Contracts.Partners;
using ProtonVPN.Api.Contracts.ReportAnIssue;
Expand All @@ -35,10 +34,10 @@
using ProtonVPN.Api.Contracts.VpnConfig;
using ProtonVPN.Api.Contracts.VpnSessions;
using ProtonVPN.Common.Configuration;
using ProtonVPN.Logging.Contracts;
using ProtonVPN.Logging.Contracts.Events.ApiLogs;
using ProtonVPN.Common.OS.Net.Http;
using ProtonVPN.Core.Settings;
using ProtonVPN.Logging.Contracts;
using ProtonVPN.Logging.Contracts.Events.ApiLogs;

namespace ProtonVPN.Api
{
Expand Down Expand Up @@ -95,13 +94,6 @@ public async Task<ApiResponseResult<BaseResponse>> GetLogoutResponse()
return await SendRequest<BaseResponse>(request, "Logout");
}

public async Task<ApiResponseResult<EventResponse>> GetEventResponse(string lastId)
{
string id = string.IsNullOrEmpty(lastId) ? "latest" : lastId;
HttpRequestMessage request = GetAuthorizedRequest(HttpMethod.Get, "events/" + id);
return await SendRequest<EventResponse>(request, "Get events");
}

public async Task<ApiResponseResult<ServersResponse>> GetServersAsync(string ip)
{
HttpRequestMessage request = GetAuthorizedRequest(HttpMethod.Get,
Expand Down
4 changes: 2 additions & 2 deletions src/GlobalAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: AssemblyVersion("3.1.0.0")]
[assembly: AssemblyFileVersion("3.1.0.0")]
[assembly: AssemblyVersion("3.1.1.0")]
[assembly: AssemblyFileVersion("3.1.1.0")]
[assembly: ComVisible(false)]
[assembly: AssemblyInformationalVersion("$AssemblyVersion")]
[assembly: SupportedOSPlatform("windows")]
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
xmlns:gui="clr-namespace:ProtonVPN.HumanVerification.Gui"
d:DataContext="{d:DesignInstance gui:WebViewViewModel}"
mc:Ignorable="d">
<wpf:WebView2 DefaultBackgroundColor="Black"
MinHeight="100"
<wpf:WebView2 MinHeight="100"
Width="370"
Name="WebView2"
Height="{Binding Height}">
Height="{Binding Height}"
DefaultBackgroundColor="#1C1B23">
<wpf:WebView2.CreationProperties>
<Binding RelativeSource="{RelativeSource Self}" Path="DataContext.WebView2CreationProperties" />
</wpf:WebView2.CreationProperties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ namespace ProtonVPN.HumanVerification.Gui
{
public class WebViewViewModel : ViewModelBase, IWebViewViewModel
{
private const int WEBVIEW_ADDED_HEIGHT = 124;

private readonly ILogger _logger;
private readonly ICaptchaUrlProvider _captchaUrlProvider;

Expand Down Expand Up @@ -75,7 +77,7 @@ private void OnWebMessageReceived(CoreWebView2WebMessageReceivedEventArgs e)
switch (message.Type)
{
case CaptchaMessageTypes.Height:
Height = message.Height;
Height = message.Height + WEBVIEW_ADDED_HEIGHT;
break;
case CaptchaMessageTypes.TokenResponse:
OnHumanVerificationTokenReceived?.Invoke(this, message.Token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public CaptchaUrlProvider(IApiHostProvider apiHostProvider)

public string GetCaptchaUrl(string token)
{
return $"https://{_apiHostProvider.GetHost()}/core/v4/captcha?Token={token}";
return $"https://{_apiHostProvider.GetHost()}/core/v4/captcha?Token={token}&Dark=1";
}
}
}
2 changes: 1 addition & 1 deletion src/ProtonVPN.App/Account/AccountModalViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public string ActionMessage

public PromoCodeViewModel PromoCodeViewModel { get; }

public bool IsToShowVpnPlans => !_userStorage.GetUser().IsBusiness();
public bool IsToShowVpnPlans => !_userStorage.GetUser().IsB2B();
public bool IsToShowUseCoupon => _appSettings.FeaturePromoCodeEnabled && _userStorage.GetUser().CanUsePromoCode();

public AccountModalViewModel(
Expand Down
3 changes: 0 additions & 3 deletions src/ProtonVPN.App/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,6 @@
<setting name="Ipv6LeakProtection" serializeAs="String">
<value>True</value>
</setting>
<setting name="UserLastEventId" serializeAs="String">
<value />
</setting>
<setting name="CustomDnsEnabled" serializeAs="String">
<value>False</value>
</setting>
Expand Down
6 changes: 0 additions & 6 deletions src/ProtonVPN.App/Core/AppSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,6 @@ public int OnboardingStep
set => SetPerUser(value);
}

public string LastEventId
{
get => GetPerUser<string>();
set => SetPerUser(value);
}

public int AppStartCounter
{
get => Get<int>();
Expand Down
11 changes: 0 additions & 11 deletions src/ProtonVPN.App/Core/Bootstraper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -482,15 +482,6 @@ private void RegisterEvents()
}
};

Resolve<EventClient>().ApiDataChanged += async (_, e) =>
{
IEnumerable<IApiDataChangeAware> instances = Resolve<IEnumerable<IApiDataChangeAware>>();
foreach (IApiDataChangeAware instance in instances)
{
await instance.OnApiDataChanged(e);
}
};

Resolve<ITokenClient>().RefreshTokenExpired += (_, _) =>
{
Resolve<ExpiredSessionHandler>().Execute();
Expand Down Expand Up @@ -574,8 +565,6 @@ private async Task SwitchToAppWindow(bool autoLogin)
await Resolve<SystemTimeValidator>().Validate();
await Resolve<AutoConnect>().LoadAsync(autoLogin);
Resolve<INetworkClient>().CheckForInsecureWiFi();
await Resolve<EventClient>().StoreLatestEvent();
Resolve<EventTimer>().Start();
}

private void LoadViewModels()
Expand Down
11 changes: 0 additions & 11 deletions src/ProtonVPN.App/Core/Ioc/CoreModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
using Autofac;
using ProtonVPN.Api;
using ProtonVPN.Common.Configuration;
using ProtonVPN.Common.Extensions;
using ProtonVPN.Common.OS.Net;
using ProtonVPN.Common.OS.Net.Http;
using ProtonVPN.Common.OS.Net.NetworkInterface;
Expand All @@ -32,7 +31,6 @@
using ProtonVPN.Config.Url;
using ProtonVPN.Core.Auth;
using ProtonVPN.Core.Config;
using ProtonVPN.Core.Events;
using ProtonVPN.Core.Network;
using ProtonVPN.Core.OS;
using ProtonVPN.Core.OS.Net.Dns;
Expand Down Expand Up @@ -91,16 +89,7 @@ protected override void Load(ContainerBuilder builder)
c.Resolve<INetworkInterfaces>())))
.As<IDnsClient>().SingleInstance();

builder.RegisterType<EventClient>().SingleInstance();
builder.RegisterType<UserInfoHandler>().AsImplementedInterfaces().SingleInstance();

builder.RegisterType<VpnCredentialProvider>().As<IVpnCredentialProvider>().SingleInstance();
builder.Register(c => new EventTimer(
c.Resolve<EventClient>(),
c.Resolve<IConfiguration>().EventCheckInterval.RandomizedWithDeviation(0.2))) // REMOVE THIS CUSTOM REGISTRATION
.AsSelf()
.AsImplementedInterfaces()
.SingleInstance();
builder.Register(c => new SafeSystemProxy(c.Resolve<ILogger>(), new SystemProxy()))
.AsImplementedInterfaces()
.SingleInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private Profile CreateProfile(Server originalServer, Profile originalProfile)
profile = _profileFactory.Create();
profile.VpnProtocol = VpnProtocol.Smart;
profile.ProfileType = ProfileType.Fastest;
profile.Features = (Features)(originalServer?.Features ?? (sbyte)Features.None);
profile.Features = (Features)(originalServer?.Features ?? (ulong)Features.None);
profile.EntryCountryCode = originalServer?.EntryCountry;
profile.CountryCode = originalServer?.ExitCountry;
profile.City = originalServer?.City;
Expand All @@ -109,13 +109,13 @@ private IList<Server> GetSimilarServers(bool isToIncludeOriginalServer, Server o
IList<Server> servers = new List<Server>();
servers.AddIfNotNull(GetOriginalServerIfRequired(isToIncludeOriginalServer, originalServer));

if (ServerFeatures.IsSecureCore((int)baseProfile.Features))
if (ServerFeatures.IsSecureCore((ulong)baseProfile.Features))
{
servers.AddIfNotNull(GetBestServerForSameExitCountryAndDifferentEntryCountry(originalServer, servers, baseProfile));
servers.AddIfNotNull(GetBestServerForSameEntryCountryAndDifferentExitCountry(originalServer, servers, baseProfile));
servers.AddIfNotNull(GetBestServerForDifferentEntryAndExitCountries(originalServer, servers, baseProfile));
}
else if (ServerFeatures.IsB2B((int)baseProfile.Features))
else if (ServerFeatures.IsB2B((ulong)baseProfile.Features))
{
baseProfile.City = null;
baseProfile.CountryCode = null;
Expand Down
2 changes: 1 addition & 1 deletion src/ProtonVPN.App/Core/Service/Vpn/VpnReconnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ private async Task ExecuteReconnectionAsync(VpnReconnectionSteps reconnectionSte
private async Task ConnectToSimilarServerOrQuickConnectAsync(bool isToTryLastServer, VpnProtocol vpnProtocol)
{
IList<Server> serverCandidates = _similarServerCandidatesGenerator.Generate(isToTryLastServer, _targetServer, _targetProfile);
if (!ServerFeatures.IsB2B((int)_targetProfile.Features))
if (!ServerFeatures.IsB2B((ulong)_targetProfile.Features))
{
IEnumerable<Server> quickConnectServers = (await _vpnConnector.GetSortedAndValidQuickConnectServersAsync(
_config.MaxQuickConnectServersOnReconnection)).Except(serverCandidates);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ along with ProtonVPN. If not, see <https://www.gnu.org/licenses/>.
Style="{StaticResource BaseWindowStyle}"
x:Name="UserControl"
mc:Ignorable="d">
<Grid Width="320">
<Grid Margin="52,47,52,0">
<ContentPresenter Content="{Binding WebView}" />
</Grid>
</resource:BaseModalWindow>
Loading

0 comments on commit c99be0b

Please sign in to comment.