Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
trudyhood committed Dec 6, 2023
2 parents 60b7b9a + 65e65b1 commit 85962f2
Show file tree
Hide file tree
Showing 449 changed files with 3,982 additions and 6,843 deletions.
77 changes: 77 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
[*.cs]

# Default severity for all analyzer diagnostics
dotnet_analyzer_diagnostic.severity = none
csharp_indent_labels = one_less_than_current
csharp_using_directive_placement = outside_namespace:silent
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_braces = true:silent
csharp_style_namespace_declarations = block_scoped:silent
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
csharp_style_prefer_primary_constructors = true:suggestion
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
csharp_space_around_binary_operators = before_and_after

[*.{cs,vb}]
#### Naming styles ####

# Naming rules

dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i

dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case

dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case

# Symbol specifications

dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =

dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =

dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =

# Naming styles

dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
indent_size = 4
end_of_line = crlf
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
22 changes: 21 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
# v3.2.439
### Client
Update: Improve Performance
Feature: Add the initializing state to the connection state
Feature: Android Set the navigation button background color

### Server
Update: Improve Performance
Update: Improve error reporting to access manager
Update: Improve reporting state to access manager
Fix: Server doesn't start when there is no local IpV6
Fix: Server freezes when default UDP port is not available
Fix: Send status even if server configuration is not successful
Security: Updating AccessManaget token

### Developer
Upgrade to .NET 8
Android: Migrate from Xamarin to .NET Android Application
Android: Upgrade to Android API 34

# v3.1.436
### Client
Update: Improve UI
Fix: Android: Keyboard cover input fields in the UI
Fix: Android: Frequently asking for adding the system tile
Fix: Android: Frequently asking to add the system tile

# v3.1.430
### Client
Expand Down
17 changes: 11 additions & 6 deletions Pub/Android.GooglePlay/_publish.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
. "$PSScriptRoot/../Common.ps1"
. "$PSScriptRoot/../Core/Common.ps1"

Write-Host "";
Write-Host "*** Publishing Android of GooglePlay ..." -BackgroundColor Blue -ForegroundColor White;
Expand All @@ -15,9 +15,10 @@ if ($apkFileData -eq $null)
}
$apkFile = $apkFileData.FullName;
$apkVersionCode = (Get-Item $apkFile).Basename;
$version = [version]::new($version.Major, $version.Minor, $apkVersionCode);
$versionParam = $version.ToString(3);
$versionTag="v$versionParam";
if ($apkVersionCode -ne $version.Build)
{
throw "The apk version code $apkVersionCode is not equal to the build version $($version.Build)";
}

# prepare module folders
$moduleDir = "$projectDir/apk/$versionTag";
Expand Down Expand Up @@ -53,7 +54,11 @@ Push-Location -Path "$solutionDir";
# Write-Host;
# Write-Host "*** Updating Android apk of GooglePlay to $versionTag ..." -BackgroundColor Blue -ForegroundColor White;
# $latestVersion = (gh release list -R "vpnhood/vpnhood" --limit 1 --exclude-drafts --exclude-pre-releases | ForEach-Object { $_.Split()[0] });
gh release upload $versionTag $module_infoFile $module_packageFile --clobber
gh release upload "$versionTag-prerelease" $module_packageFile --clobber

echo "Updating the Release ...";
gh release upload $versionTag $module_infoFile $module_packageFile --clobber;

echo "Updating the Pre-release ...";
gh release upload "$versionTag-prerelease" $module_infoFile $module_packageFile --clobber;

Pop-Location
46 changes: 24 additions & 22 deletions Pub/Common.ps1 → Pub/Core/Common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ param(
)
$ErrorActionPreference = "Stop";

$solutionDir = Split-Path -parent $PSScriptRoot;
$solutionDir = Split-Path -parent (Split-Path -parent $PSScriptRoot);
$pubDir = "$solutionDir/Pub";
$msbuild = Join-Path ${Env:Programfiles} "Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe";
$credentials = (Get-Content "$solutionDir/../.user/credentials.json" | Out-String | ConvertFrom-Json);
$nugetApiKey = $credentials.NugetApiKey;
$nuget = Join-Path $PSScriptRoot "nuget.exe";
$msverbosity = "minimal";

# Version
$versionFile = Join-Path $PSScriptRoot "version.json"
$versionFile = "$pubDir/version.json";
$versionJson = (Get-Content $versionFile | Out-String | ConvertFrom-Json);
$bumpTime = [datetime]::Parse($versionJson.BumpTime);
$version = [version]::Parse($versionJson.Version);
Expand All @@ -25,44 +25,46 @@ if ( $bump -gt 0 )
$versionJson | ConvertTo-Json -depth 10 | Out-File $versionFile;
}

$prerelease=$versionJson.Prerelease;
$isLatest=$versionJson.Prerelease -eq $false;
$prerelease = $versionJson.Prerelease;
$isLatest = $versionJson.Prerelease -eq $false;
$versionParam = $version.ToString(3);
$versionTag="v$versionParam" + (&{if($prerelease) {"-prerelease"} else {""}});
$versionTag = "v$versionParam" + (&{if($prerelease) {"-prerelease"} else {""}});
$releaseDate = Get-Date -asUTC -Format "s";
$deprecatedVersion = $versionJson.DeprecatedVersion;

# Packages Directory
$packagesRootDir = "$PSScriptRoot/bin/" + $versionTag;
$packagesClientDir="$packagesRootDir/Client";
$packagesServerDir="$packagesRootDir/Server";
New-Item -ItemType Directory -Path $packagesClientDir -Force | Out-Null
New-Item -ItemType Directory -Path $packagesServerDir -Force | Out-Null
$packagesRootDir = "$pubDir/bin/" + $versionTag;
$packageServerDirName = "VpnHoodServer";
$packageClientDirName = "VpnHoodClient";
$packageConnectDirName = "VpnHoodConnect";

# Prepare the latest folder
$packagesRootDirLatest = "$PSScriptRoot/bin/latest" + (&{if($isLatest) {""} else {"/????"}});
$packagesClientDirLatest="$packagesRootDirLatest/Client";
$packagesServerDirLatest="$packagesRootDirLatest/Server";
$packagesRootDirLatest = "$pubDir/bin/latest" + (&{if($isLatest) {""} else {"/????"}});
$moduleGooglePlayLastestDir = "$solutionDir/pub/Android.GooglePlay/apk/latest";
if ($isLatest)
{
New-Item -ItemType Directory -Path $packagesClientDirLatest -Force | Out-Null
New-Item -ItemType Directory -Path $packagesServerDirLatest -Force | Out-Null
}

# UpdateProjectVersion
Function UpdateProjectVersion([string] $projectFile)
{
$xml = New-Object XML;
$xml.PreserveWhitespace = $true;
$xml.Load($projectFile);
$assemblyVersion = $xml.SelectSingleNode("Project/PropertyGroup/AssemblyVersion");
$fileVersion = $xml.SelectSingleNode("Project/PropertyGroup/FileVersion");
$packageVersion = $xml.SelectSingleNode("Project/PropertyGroup/Version");
if ($assemblyVersion -and $assemblyVersion.InnerText -ne $versionParam){
$assemblyVersion.InnerText = $versionParam;

if ($packageVersion -and $packageVersion.InnerText -ne $versionParam){
$fileVersion.InnerText = '$([System.DateTime]::Now.ToString("yyyy.M.d.HHmm"))';
$packageVersion.InnerText = $versionParam;

# Update Android Version
$applicationVersion = $xml.SelectSingleNode("Project/PropertyGroup/ApplicationVersion");
$applicationDisplayVersion = $xml.SelectSingleNode("Project/PropertyGroup/ApplicationDisplayVersion");
if ($applicationVersion)
{
$applicationVersion.InnerText = $version.Build;
$applicationDisplayVersion.InnerText = $versionParam;
}

# Update project file
$xml.Save($projectFile);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
. "$PSScriptRoot/../Pub/Common.ps1"
param(
[Parameter(Mandatory=$true)] [String]$projectDir,
[Parameter(Mandatory=$true)] [String]$packageFileTitle)

Write-Host "";
Write-Host "*** Publishing Android ..." -BackgroundColor Blue -ForegroundColor White;
. "$PSScriptRoot/Common.ps1"

$projectDir = $PSScriptRoot
$projectFile = (Get-ChildItem -path $projectDir -file -Filter "*.csproj").FullName;

Write-Host "";
Write-Host "*** Publishing $projectFile ..." -BackgroundColor Blue -ForegroundColor White;

#update project version
UpdateProjectVersion $projectFile;

# prepare module folders
$moduleDir = "$packagesClientDir/android";
$moduleDirLatest = "$packagesClientDirLatest/android";
$moduleDir = "$packagesRootDir/$packageFileTitle/android";
$moduleDirLatest = "$packagesRootDirLatest/$packageFileTitle/android";
PrepareModuleFolder $moduleDir $moduleDirLatest;

$module_infoFile = "$moduleDir/VpnHoodClient-android-web.json";
$module_packageFile = "$moduleDir/VpnHoodClient-android-web.apk";
$module_infoFile = "$moduleDir/$packageFileTitle-android-web.json";
$module_packageFile = "$moduleDir/$packageFileTitle-android-web.apk";

# Calcualted Path
$module_infoFileName = $(Split-Path "$module_infoFile" -leaf);
Expand All @@ -23,16 +29,10 @@ $keystore = Join-Path "$solutionDir/../.user/" $credentials.Android.KeyStoreFile
$keystorePass = $credentials.Android.KeyStorePass
$keystoreAlias = $credentials.Android.KeyStoreAlias
$manifestFile = Join-Path $projectDir "Properties/AndroidManifest.xml";
$manifestFileAab = Join-Path $projectDir "Properties/AndroidManifest.aab.xml";
$appIconXml = Join-Path $projectDir "Resources\mipmap-anydpi-v26\appicon.xml";
$appIconXmlDoc = [xml](Get-Content $appIconXml);
$appIconXmlNode = $appIconXmlDoc.selectSingleNode("adaptive-icon/background");

# set android version
$xmlDoc = [xml](Get-Content $manifestFile);
$xmlDoc.manifest.versionCode = $version.Build.ToString();
$xmlDoc.manifest.versionName = $version.ToString(3);
$xmlDoc.save($manifestFile);
$packageId = ([xml](Get-Content $projectFile)).SelectSingleNode("Project/PropertyGroup/ApplicationId").InnerText;

# set app icon
$appIconXmlNode.SetAttribute("android:drawable", "@mipmap/appicon_background_dev");
Expand All @@ -42,13 +42,14 @@ $appIconXmlDoc.save($appIconXml);
Write-Host;
Write-Host "*** Creating Android APK ..." -BackgroundColor Blue -ForegroundColor White;

$packageId = $xmlDoc.manifest.package;
$outputPath="bin/ReleaseApk";
$signedPacakgeFile = Join-Path $projectDir "$outputPath/$packageId-Signed.apk"
$outputPath = Join-Path $projectDir "bin/ReleaseApk/";
$signedPacakgeFile = Join-Path $outputPath "$packageId-Signed.apk"

# todo
if (-not $noclean) { & $msbuild $projectFile /p:Configuration=Release /t:Clean /p:OutputPath=$outputPath /verbosity:$msverbosity; }
& $msbuild $projectFile /p:Configuration=Release /t:SignAndroidPackage /p:Version=$versionParam /p:OutputPath=$outputPath /p:AndroidPackageFormat="apk" /verbosity:$msverbosity `
/p:AndroidSigningKeyStore=$keystore /p:AndroidSigningKeyAlias=$keystoreAlias /p:AndroidSigningStorePass=$keystorePass `
/p:ApplicationId=$packageId `
/p:JarsignerTimestampAuthorityUrl="https://freetsa.org/tsr";

# publish info
Expand All @@ -63,7 +64,6 @@ $json = @{
};
$json | ConvertTo-Json | Out-File "$module_infoFile" -Encoding ASCII;

# copy to solution ouput
Copy-Item -path $signedPacakgeFile -Destination "$moduleDir/$module_packageFileName" -Force
if ($isLatest)
{
Expand All @@ -78,20 +78,18 @@ Write-Host "*** Creating Android AAB ..." -BackgroundColor Blue -ForegroundColor
$appIconXmlNode.SetAttribute("android:drawable", "@mipmap/appicon_background");
$appIconXmlDoc.save($appIconXml);

$outputPath="bin/ReleaseAab";
$packageId = "com.vpnhood.client.android";
$signedPacakgeFile = Join-Path $projectDir "$outputPath/$packageId-Signed.aab"
$module_packageFile = "$moduleDir/VpnHoodClient-android.aab";

# Calcualted
# update variables
$packageId = $packageId.replace(".web", "");
$outputPath = Join-Path $projectDir "bin/ReleaseAab/";
$signedPacakgeFile = Join-Path "$outputPath" "$packageId-Signed.aab"
$module_packageFile = "$moduleDir/$packageFileTitle-android.aab";
$module_packageFileName = $(Split-Path "$module_packageFile" -leaf);
$xmlDoc.manifest.package = $packageId;
$xmlDoc.save($manifestFileAab);

if (-not $noclean) { & $msbuild $projectFile /p:Configuration=Release /t:Clean /p:OutputPath=$outputPath /verbosity:$msverbosity; }
& $msbuild $projectFile /p:Configuration=Release /p:Version=$versionParam /p:OutputPath=$outputPath /t:SignAndroidPackage /p:ArchiveOnBuild=true /verbosity:$msverbosity `
/p:AndroidSigningKeyStore=$keystore /p:AndroidSigningKeyAlias=$keystoreAlias /p:AndroidSigningStorePass=$keystorePass `
/p:AndroidManifest="Properties\AndroidManifest.aab.xml" /p:DefineConstants=ANDROID_AAB `
/p:ApplicationId=$packageId `
/p:DefineConstants=ANDROID_AAB `
/p:AndroidSigningKeyPass=$keystorePass /p:AndroidKeyStore=True;

# set app icon
Expand All @@ -108,4 +106,4 @@ if ($isLatest)
}

# report version
ReportVersion
ReportVersion
6 changes: 3 additions & 3 deletions Pub/PublishNuget.ps1 → Pub/Core/PublishNuget.ps1
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
param([Parameter(Mandatory=$true)] [String]$projectDir)
. "$PSScriptRoot\Common.ps1"
. "$PSScriptRoot/Common.ps1"

# paths
$projectFile = (Get-ChildItem -path $projectDir -file -Filter "*.csproj").FullName;
$assemblyName = ([Xml] (Get-Content $projectFile)).Project.PropertyGroup.AssemblyName;
if (!$assemblyName) {$assemblyName = (Get-Item $projectFile).BaseName};
if ($assemblyName -eq $null) {$assemblyName = (Get-Item $projectFile).BaseName};
$packageId = ([Xml] (Get-Content $projectFile)).Project.PropertyGroup.PackageId;
if (!$packageId) {$packageId = $assemblyName};
if ($packageId -eq $null) {$packageId = $assemblyName};
$packageId = "$packageId".Trim();
$publishDir = Join-Path $projectDir "bin\release\publish";

Expand Down
14 changes: 11 additions & 3 deletions Pub/PublishApps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ param(

$nugets = $nugets -eq "1";
$android = $android -eq "1";
$androidConnect = $androidConnect -eq "1";
$distribute = $distribute -eq "1";
$winClient = $winClient -eq "1";
$server = $server -eq "1";

. "$PSScriptRoot/Common.ps1" -bump $bump
. "$PSScriptRoot/Core/Common.ps1" -bump $bump

# clean all
& $msbuild "$solutionDir" /p:Configuration=Release /t:Clean /verbosity:$msverbosity;
Expand All @@ -27,7 +28,7 @@ Remove-Item "$packagesRootDir/ReleaseNote.txt" -ErrorAction Ignore;
& "$solutionDir/VpnHood.Tunneling/_publish.ps1";

& "$solutionDir/VpnHood.Client/_publish.ps1";
& "$solutionDir/VpnHood.Client.Device.Android.Xamarin/_publish.ps1";
& "$solutionDir/VpnHood.Client.Device.Android/_publish.ps1";
& "$solutionDir/VpnHood.Client.Device/_publish.ps1";
& "$solutionDir/VpnHood.Client.Device.WinDivert/_publish.ps1";
& "$solutionDir/VpnHood.Client.App/_publish.ps1";
Expand All @@ -54,9 +55,16 @@ if ($server)
# publish android
if ($android)
{
& "$solutionDir/VpnHood.Client.App.Android.Xamarin/_publish.ps1";
& "$solutionDir/VpnHood.Client.App.Android/_publish.ps1";
}

# publish android
if ($androidConnect)
{
& "$solutionDir/VpnHood.Client.App.Android.connect/_publish.ps1";
}


# distribute
if ($distribute)
{
Expand Down
Loading

0 comments on commit 85962f2

Please sign in to comment.