Skip to content

Commit

Permalink
Merge branch 'release/3.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Mindaugas Veblauskas committed Aug 7, 2024
2 parents 1e57195 + 30a2a4c commit 3afe246
Show file tree
Hide file tree
Showing 95 changed files with 1,535 additions and 292 deletions.
77 changes: 75 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ include:

- local: '/.gitlab-ci-templates.yml'

- component: $CI_SERVER_HOST/proton/devops/cicd-components/tools/artifactlift/[email protected]
inputs:
product: vpn
platform: windows
artifact_list: "*"
artifact_local_directory: Setup/Installers
- component: $CI_SERVER_HOST/proton/devops/cicd-components/tools/artifactlift/[email protected]
inputs:
product: vpn
platform: windows
artifact_list: ""
artifact_metadata_path: /windows
artifact_metadata_list: ../windows-releases.json

variables:
PUBLIC_REPO_URL: [email protected]:ProtonVPN/win-app.git
TEST_ARTIFACT_PATH: src/bin/TestArtifactData/
Expand All @@ -34,6 +48,8 @@ stages:
- publish-to-slack
- test-setup
- ui-test
- generate
- deploy
- test-upload
- installation-test
- test-cleanup
Expand All @@ -48,7 +64,7 @@ build-release:
TYPE: Release
DEPENDENCIES: publish
BUILD_PATH: src/bin/win-x64/publish

build-bti:
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
Expand Down Expand Up @@ -257,4 +273,61 @@ send-slack-notification:
stage: publish-to-slack
script:
- python -m pip install -r ci\python-libs.txt
- python ci\build-scripts\main.py send-slack-notification
- python ci\build-scripts\main.py send-slack-notification

generate-release-artifacts:
stage: generate
image: harbor.protontech.ch/docker.io/library/alpine:3.20
tags:
- shared-small
script:
- set -ex
- export RELEASE_VERSION="${CI_COMMIT_BRANCH##release/}" && echo "RELEASE_VERSION=${RELEASE_VERSION}" | tee release.env
- echo "ARTIFACT_LIST=ProtonVPN_v${RELEASE_VERSION}.exe" | tee -a release.env
artifacts:
reports:
dotenv: release.env
only:
- /^release.*$/

artifactlift-release-candidate-artifacts:
rules:
- when: never

artifactlift-release-artifacts:
rules:
- when: never

artifactlift-release-metadata:
rules:
- when: never

release-binary-to-nexus:
extends: artifactlift-release-candidate-artifacts
rules:
- if: '$CI_COMMIT_BRANCH == "release/9.9.9"'
when: never
- if: '$CI_COMMIT_BRANCH =~ /^release\/\d+\.\d+\.\d+/'
when: manual
- when: never

release-binary-to-prod:
extends: artifactlift-release-artifacts
rules:
- if: '$CI_COMMIT_BRANCH == "release/9.9.9"'
when: never
- if: '$CI_COMMIT_BRANCH =~ /^release\/\d+\.\d+\.\d+/'
when: manual
- when: never

release-json-to-prod:
extends: artifactlift-release-metadata
needs:
- job: release-binary-to-prod
artifacts: true
rules:
- if: '$CI_COMMIT_BRANCH == "release/9.9.9"'
when: never
- if: '$CI_COMMIT_BRANCH =~ /^release\/\d+\.\d+\.\d+/'
when: manual
- when: never
43 changes: 29 additions & 14 deletions ProtonVpn.sln
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProtonVPN.TlsVerify", "src\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProtonVPN.Translations", "src\ProtonVPN.Translations\ProtonVPN.Translations.csproj", "{2A00C747-8BC0-4EF1-A53E-37A7E156D910}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProtonVPN.RestoreInternet", "src\ProtonVPN.RestoreInternet\ProtonVPN.RestoreInternet.csproj", "{8D07769D-0AAE-4224-AECB-DF68567F6B00}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProtonVPN.Crypto", "src\ProtonVPN.Crypto\ProtonVPN.Crypto.csproj", "{BA2D505E-CED3-4FCB-A463-DAF6B77C18DE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProtonVPN.Crypto.Tests", "src\Tests\ProtonVPN.Crypto.Tests\ProtonVPN.Crypto.Tests.csproj", "{7D608265-3330-4747-B5B4-9673A119FE6C}"
Expand Down Expand Up @@ -195,6 +193,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProtonVPN.Builds.Variables"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProtonVPN.Builds.ConsoleJob", "src\Builds\ProtonVPN.Builds.ConsoleJob\ProtonVPN.Builds.ConsoleJob.csproj", "{37355661-376A-4F1D-B4A8-2B74D088571A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProtonVPN.Logging.Events", "src\Logging\ProtonVPN.Logging.Events\ProtonVPN.Logging.Events.csproj", "{E4DC870F-6844-4031-B74D-F2B29B02ADD6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProtonVPN.RestoreInternet", "src\ProtonVPN.RestoreInternet\ProtonVPN.RestoreInternet.csproj", "{9B405749-AD48-49CC-ADE5-5D3AAB5A9D66}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -433,18 +435,6 @@ Global
{2A00C747-8BC0-4EF1-A53E-37A7E156D910}.Release|x64.Build.0 = Release|Any CPU
{2A00C747-8BC0-4EF1-A53E-37A7E156D910}.Release|x86.ActiveCfg = Release|Any CPU
{2A00C747-8BC0-4EF1-A53E-37A7E156D910}.Release|x86.Build.0 = Release|Any CPU
{8D07769D-0AAE-4224-AECB-DF68567F6B00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8D07769D-0AAE-4224-AECB-DF68567F6B00}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8D07769D-0AAE-4224-AECB-DF68567F6B00}.Debug|x64.ActiveCfg = Debug|Any CPU
{8D07769D-0AAE-4224-AECB-DF68567F6B00}.Debug|x64.Build.0 = Debug|Any CPU
{8D07769D-0AAE-4224-AECB-DF68567F6B00}.Debug|x86.ActiveCfg = Debug|Any CPU
{8D07769D-0AAE-4224-AECB-DF68567F6B00}.Debug|x86.Build.0 = Debug|Any CPU
{8D07769D-0AAE-4224-AECB-DF68567F6B00}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8D07769D-0AAE-4224-AECB-DF68567F6B00}.Release|Any CPU.Build.0 = Release|Any CPU
{8D07769D-0AAE-4224-AECB-DF68567F6B00}.Release|x64.ActiveCfg = Release|Any CPU
{8D07769D-0AAE-4224-AECB-DF68567F6B00}.Release|x64.Build.0 = Release|Any CPU
{8D07769D-0AAE-4224-AECB-DF68567F6B00}.Release|x86.ActiveCfg = Release|Any CPU
{8D07769D-0AAE-4224-AECB-DF68567F6B00}.Release|x86.Build.0 = Release|Any CPU
{BA2D505E-CED3-4FCB-A463-DAF6B77C18DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BA2D505E-CED3-4FCB-A463-DAF6B77C18DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BA2D505E-CED3-4FCB-A463-DAF6B77C18DE}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -1093,6 +1083,30 @@ Global
{37355661-376A-4F1D-B4A8-2B74D088571A}.Release|x64.Build.0 = Release|Any CPU
{37355661-376A-4F1D-B4A8-2B74D088571A}.Release|x86.ActiveCfg = Release|Any CPU
{37355661-376A-4F1D-B4A8-2B74D088571A}.Release|x86.Build.0 = Release|Any CPU
{E4DC870F-6844-4031-B74D-F2B29B02ADD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E4DC870F-6844-4031-B74D-F2B29B02ADD6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E4DC870F-6844-4031-B74D-F2B29B02ADD6}.Debug|x64.ActiveCfg = Debug|Any CPU
{E4DC870F-6844-4031-B74D-F2B29B02ADD6}.Debug|x64.Build.0 = Debug|Any CPU
{E4DC870F-6844-4031-B74D-F2B29B02ADD6}.Debug|x86.ActiveCfg = Debug|Any CPU
{E4DC870F-6844-4031-B74D-F2B29B02ADD6}.Debug|x86.Build.0 = Debug|Any CPU
{E4DC870F-6844-4031-B74D-F2B29B02ADD6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E4DC870F-6844-4031-B74D-F2B29B02ADD6}.Release|Any CPU.Build.0 = Release|Any CPU
{E4DC870F-6844-4031-B74D-F2B29B02ADD6}.Release|x64.ActiveCfg = Release|Any CPU
{E4DC870F-6844-4031-B74D-F2B29B02ADD6}.Release|x64.Build.0 = Release|Any CPU
{E4DC870F-6844-4031-B74D-F2B29B02ADD6}.Release|x86.ActiveCfg = Release|Any CPU
{E4DC870F-6844-4031-B74D-F2B29B02ADD6}.Release|x86.Build.0 = Release|Any CPU
{9B405749-AD48-49CC-ADE5-5D3AAB5A9D66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9B405749-AD48-49CC-ADE5-5D3AAB5A9D66}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9B405749-AD48-49CC-ADE5-5D3AAB5A9D66}.Debug|x64.ActiveCfg = Debug|Any CPU
{9B405749-AD48-49CC-ADE5-5D3AAB5A9D66}.Debug|x64.Build.0 = Debug|Any CPU
{9B405749-AD48-49CC-ADE5-5D3AAB5A9D66}.Debug|x86.ActiveCfg = Debug|Any CPU
{9B405749-AD48-49CC-ADE5-5D3AAB5A9D66}.Debug|x86.Build.0 = Debug|Any CPU
{9B405749-AD48-49CC-ADE5-5D3AAB5A9D66}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9B405749-AD48-49CC-ADE5-5D3AAB5A9D66}.Release|Any CPU.Build.0 = Release|Any CPU
{9B405749-AD48-49CC-ADE5-5D3AAB5A9D66}.Release|x64.ActiveCfg = Release|Any CPU
{9B405749-AD48-49CC-ADE5-5D3AAB5A9D66}.Release|x64.Build.0 = Release|Any CPU
{9B405749-AD48-49CC-ADE5-5D3AAB5A9D66}.Release|x86.ActiveCfg = Release|Any CPU
{9B405749-AD48-49CC-ADE5-5D3AAB5A9D66}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1158,6 +1172,7 @@ Global
{CEE9045E-0299-4488-80FF-0162D099C544} = {4B1EF657-A679-43B5-83DD-612D602C6333}
{070A1A8B-241E-45B8-882C-B33D79086E34} = {209CAB96-3CE8-4F93-A535-2B93C9A6AA32}
{37355661-376A-4F1D-B4A8-2B74D088571A} = {209CAB96-3CE8-4F93-A535-2B93C9A6AA32}
{E4DC870F-6844-4031-B74D-F2B29B02ADD6} = {2A968101-45CA-421C-A546-00D681BF3C76}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5CFD3EA5-ADCA-48F0-9E3F-BBC76CCBF1C2}
Expand Down
File renamed without changes.
Binary file added Setup/WireGuard/wireguard-tunnel-tcp.dll
Binary file not shown.
31 changes: 16 additions & 15 deletions Setup/setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#define Hash ""
#define VersionFolder "v" + MyAppVersion
#define ClearAppDataClientArg "-DoUninstallActions"
#define AppFolder "Proton\VPN"
#define SourcePath GetEnv("BUILD_PATH")
#define IsBTISource SourcePath == "src/bin/win-x64/BTI/publish"
Expand Down Expand Up @@ -129,7 +130,8 @@ Source: "tap\tapprotonvpn.cat"; DestDir: "{app}\{#VersionFolder}\Resources\tap"
Source: "tap\tapprotonvpn.Sys"; DestDir: "{app}\{#VersionFolder}\Resources\tap";

Source: "SplitTunnel\ProtonVPN.CalloutDriver.sys"; DestDir: "{app}\{#VersionFolder}\Resources"; AfterInstall: InstallNetworkDriver;
Source: "tun\wintun.dll"; DestDir: "{app}\{#VersionFolder}\Resources";
Source: "WireGuard\wintun.dll"; DestDir: "{app}\{#VersionFolder}";
Source: "WireGuard\wireguard-tunnel-tcp.dll"; DestDir: "{app}\{#VersionFolder}";
Source: "GuestHoleServers.json"; DestDir: "{app}\{#VersionFolder}\Resources";
Source: "Dependencies\{#Webview2InstallerName}"; Flags: dontcopy;

Expand Down Expand Up @@ -221,11 +223,14 @@ external 'RemovePinnedIcons@{app}\{#VersionFolder}\Resources\ProtonVPN.InstallAc
function RemoveWfpObjects(): Integer;
external 'RemoveWfpObjects@{app}\{#VersionFolder}\Resources\ProtonVPN.InstallActions.x86.dll cdecl uninstallonly';
function LaunchUnelevatedProcessOnUninstall(processPath, args: String; isToWait: Boolean): Integer;
external 'LaunchUnelevatedProcess@{app}\{#VersionFolder}\Resources\ProtonVPN.InstallActions.x86.dll cdecl uninstallonly';
type
TInt64Array = array of Int64;
var
IsToReboot, IsVerySilent, IsToDisableAutoUpdate: Boolean;
IsToReboot, IsSilent, IsVerySilent, IsToDisableAutoUpdate: Boolean;
InstallationProgressLabel: TNewStaticText;
procedure InitializeWizard;
Expand Down Expand Up @@ -335,17 +340,17 @@ begin
((Version.Major = Major) and (Version.Minor = Minor) and (Version.Build >= Build));
end;
procedure SetIsVerySilent();
procedure SetSilentModes();
var
i: Integer;
begin
isVerySilent := False;
IsVerySilent := False;
IsSilent := False;
for i := 1 to ParamCount do
if CompareText(ParamStr(i), '/verysilent') = 0 then
begin
IsVerySilent := True;
break;
end;
IsVerySilent := True
else if CompareText(ParamStr(i), '/silent') = 0 then
IsSilent := True
end;
procedure SetIsToDisableAutoUpdate();
Expand All @@ -371,7 +376,7 @@ var
Version: String;
ErrCode: Integer;
begin
SetIsVerySilent();
SetSilentModes();
SetIsToDisableAutoUpdate();
if IsWindowsVersionEqualOrHigher(10, 0, 17763) = False then begin
if WizardSilent() = false then begin
Expand Down Expand Up @@ -467,7 +472,7 @@ begin
end;
end
else if CurStep = ssPostInstall then begin
if IsVerySilent = false then begin
if (IsVerySilent = false) and (IsSilent = false) then begin
if WizardIsTaskSelected('installWebview2') then begin
InstallationProgressLabel.Caption := CustomMessage('InstallingWebview2Runtime');
WizardForm.Refresh();
Expand Down Expand Up @@ -498,15 +503,11 @@ begin
Log('TAP uninstallation returned: ' + IntToStr(res));
res := RemoveWfpObjects();
Log('RemoveWfpObjects returned: ' + IntToStr(res));
LaunchUnelevatedProcessOnUninstall(ExpandConstant('{app}\{#VersionFolder}\{#MyAppExeName}'), '{#ClearAppDataClientArg}', True);
UnloadDLL(ExpandConstant('{app}\{#VersionFolder}\Resources\ProtonVPN.InstallActions.x86.dll'));
end;
end;
function GetDriveInstallPath(value: String): String;
begin
Result := '"' + ExpandConstant('{autopf}\Proton\Drive') + '"';
end;
function ShouldDisplayProtonDriveCheckbox: Boolean;
begin
Result := IsProductInstalled('{F3B95BD2-1311-4B82-8B4A-B9EB7C0500ED}') = 0;
Expand Down
2 changes: 1 addition & 1 deletion ci/build-scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def print_sha256(file_path):
if 'BTI' in build_path:
installer_filename = 'ProtonVPN_v{semVersion}_BTI.exe'.format(semVersion=semVersion)
installer_path = os.path.join('.\Setup\Installers', installer_filename)

print_sha256(installer_path)
sys.exit(err)

Expand Down
22 changes: 17 additions & 5 deletions src/Api/ProtonVPN.Api.Contracts/ApiResponseResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* along with ProtonVPN. If not, see <https://www.gnu.org/licenses/>.
*/

using System;
using System.Collections.Generic;
using System.Net.Http;
using ProtonVPN.Api.Contracts.Common;
Expand All @@ -29,33 +30,44 @@ public class ApiResponseResult<T> : Result<T>
{
public HttpResponseMessage ResponseMessage { get; }
public IList<BaseResponseDetailAction> Actions { get; }
public DateTimeOffset? LastModified { get; }
public bool IsNotModified { get; }

protected ApiResponseResult(HttpResponseMessage responseMessage, bool success, string error, T value)
protected ApiResponseResult(HttpResponseMessage responseMessage, bool success, string error, bool isNotModified, T value)
: base(value, success, error)
{
ResponseMessage = responseMessage;
Actions = value?.Details?.Actions;
LastModified = responseMessage.Content.Headers.LastModified;
IsNotModified = isNotModified;
}

protected ApiResponseResult(HttpResponseMessage responseMessage, bool success, string error)
protected ApiResponseResult(HttpResponseMessage responseMessage, bool success, string error, bool isNotModified)
: base(default(T), success, error)
{
ResponseMessage = responseMessage;
LastModified = responseMessage.Content.Headers.LastModified;
IsNotModified = isNotModified;
}

public static ApiResponseResult<T> Ok(HttpResponseMessage responseMessage, T value)
{
return new ApiResponseResult<T>(responseMessage, true, "", value);
return new ApiResponseResult<T>(responseMessage, success: true, "", isNotModified: false, value);
}

public static ApiResponseResult<T> Fail(HttpResponseMessage responseMessage, string error)
{
return new ApiResponseResult<T>(responseMessage, false, error);
return new ApiResponseResult<T>(responseMessage, success: false, error, isNotModified: false);
}

public static ApiResponseResult<T> Fail(T value, HttpResponseMessage responseMessage, string error)
{
return new ApiResponseResult<T>(responseMessage, false, error, value);
return new ApiResponseResult<T>(responseMessage, success: false, error, isNotModified: false, value);
}

public static ApiResponseResult<T> NotModified(HttpResponseMessage responseMessage)
{
return new ApiResponseResult<T>(responseMessage, success: true, "", isNotModified: true);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,5 @@ public class VpnConfigResponse : BaseResponse
public int? ChangeServerLongDelayInSeconds { get; set; }

public FeatureFlagsResponse FeatureFlags { get; set; }

public SmartProtocolResponse SmartProtocol { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,11 @@ public class WireGuardPortsResponse
{
[JsonProperty(PropertyName = "UDP")]
public int[] Udp { get; set; }

[JsonProperty(PropertyName = "TCP")]
public int[] Tcp { get; set; }

[JsonProperty(PropertyName = "TLS")]
public int[] Tls { get; set; }
}
}
1 change: 1 addition & 0 deletions src/Api/ProtonVPN.Api/ApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public async Task<ApiResponseResult<ServersResponse>> GetServersAsync(string ip)
"vpn/logicals?SignServer=Server.EntryIP,Server.Label", ip);
request.SetRetryCount(SERVERS_RETRY_COUNT);
request.SetCustomTimeout(TimeSpan.FromSeconds(SERVERS_TIMEOUT_IN_SECONDS));
request.Headers.IfModifiedSince = AppSettings.LogicalsLastModifiedDate;
return await SendRequest<ServersResponse>(request, "Get servers");
}

Expand Down
9 changes: 8 additions & 1 deletion src/Api/ProtonVPN.Api/BaseApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ protected async Task<ApiResponseResult<T>> GetApiResponseResultAsync<T>(HttpResp
string body = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
T json = JsonConvert.DeserializeObject<T>(body) ?? throw new HttpRequestException(string.Empty);
T json = response.StatusCode is HttpStatusCode.NotModified
? default(T)
: JsonConvert.DeserializeObject<T>(body) ?? throw new HttpRequestException(string.Empty);
ApiResponseResult<T> result = CreateApiResponseResult(json, response);
HandleResult(result, response);
return result;
Expand All @@ -92,6 +94,11 @@ public string GetStatusCodeDescription(HttpStatusCode code)
private ApiResponseResult<T> CreateApiResponseResult<T>(T response, HttpResponseMessage responseMessage)
where T : BaseResponse
{
if (responseMessage.StatusCode is HttpStatusCode.NotModified)
{
return ApiResponseResult<T>.NotModified(responseMessage);
}

switch (response.Code)
{
case ResponseCodes.OkResponse:
Expand Down
Loading

0 comments on commit 3afe246

Please sign in to comment.