Skip to content

Commit 376cd66

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 8ff14cd + 7146127 commit 376cd66

File tree

15 files changed

+178
-717
lines changed

15 files changed

+178
-717
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,6 @@ eFormAPI/Installation/CustomActions/bin/x64/Release/Microsoft.Deployment.Windows
8080
eFormAPI/Installation/CustomActions/bin/x64/Release/Microsoft.Deployment.WindowsInstaller.xml
8181
eFormAPI/Installation/CustomActions/bin/x64/Release/Microsoft.Web.Administration.dll
8282
eFormAPI/Installation/MainInstaller/BuildedCustomActions/System.Management.Automation.dll
83+
eFormAPI/Installation/MainInstaller/LetsEncryptFileList.wxs
84+
eFormAPI/Installation/MainInstaller/ClientFileList.wxs
85+
eFormAPI/Installation/MainInstaller/ApiFileList.wxs

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2007-2017 microting
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
![C# Build status](https://microtingas.visualstudio.com/_apis/public/build/definitions/a4743aa9-9116-44c0-8fbc-1145414eaf07/7/badge)
55
![Node Dependencies](https://david-dm.org/microting/eform-angular-frontend.svg)
66

7-
A Angular2 Frontend for integrating with the Microting eForm API v1.
7+
An Angular2 Frontend for integrating with the Microting eForm API v1.
88

99
## Support Platforms
1010

eFormAPI/Installation/AllowMultipleVersions/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.1.1.8")]
36-
[assembly: AssemblyFileVersion("1.1.1.8")]
35+
[assembly: AssemblyVersion("1.1.2.12")]
36+
[assembly: AssemblyFileVersion("1.1.2.12")]

eFormAPI/Installation/AllowMultipleVersionsBundle/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.1.1.8")]
36-
[assembly: AssemblyFileVersion("1.1.1.8")]
35+
[assembly: AssemblyVersion("1.1.2.12")]
36+
[assembly: AssemblyFileVersion("1.1.2.12")]

eFormAPI/Installation/CustomActions/CustomAction.cs

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,24 @@
1313
using System.Threading.Tasks;
1414
using System.Security.Principal;
1515
using System.Management.Automation;
16+
using System.Net.NetworkInformation;
1617

1718
namespace CustomActions
1819
{
1920
public class CustomActions
2021
{
2122
public static Session Session;
22-
23+
public static string FixACL = @"$out = icacls ""$dirrectory"" /verify /t /q;
24+
foreach($line in $out)
25+
{
26+
if ($line -match '(.:[^:]*): (.*)')
27+
{
28+
$path = $Matches[1];
29+
Set-Acl $path(Get-Acl $path);
30+
}
31+
}";
32+
33+
2334
[CustomAction]
2435
public static ActionResult GetAPIsListCA(Session session)
2536
{
@@ -89,7 +100,7 @@ public static ActionResult TryFindConfigs(Session session)
89100
return ActionResult.Success;
90101
}
91102

92-
var tmp = Path.Combine(Path.GetTempPath(), "MicrotingTemp");
103+
var tmp = Path.Combine("c:\\", "MicrotingTemp");
93104
Directory.CreateDirectory(tmp);
94105
Directory.CreateDirectory(Path.Combine(tmp, "files"));
95106
Directory.CreateDirectory(Path.Combine(tmp, "dirs"));
@@ -245,7 +256,7 @@ private static void HandlePreviousConfigs(Session session, string installFolder)
245256
{
246257
var keepFiles = session.CustomActionData["KEEPFILES"].Split(',');
247258
var keepFolders = session.CustomActionData["KEEPFOLDERS"].Split(',');
248-
var tmpConfigs = Path.Combine(Path.GetTempPath(), "MicrotingTemp");
259+
var tmpConfigs = Path.Combine("c:\\", "MicrotingTemp");
249260

250261
foreach (var keepFolder in keepFolders)
251262
{
@@ -306,6 +317,9 @@ public static ActionResult UpdateCA(Session session)
306317
RunProcess(@"C:\Program Files\nodejs\node.exe", "svc.js uninstall", uiIisDir);
307318
IncrementProgressBar(session);
308319

320+
DeleteDirectory(Path.Combine(uiIisDir, "node_modules"));
321+
DeleteDirectory(Path.Combine(uiIisDir, "dist"));
322+
309323
session.Log("Set proper names to folders");
310324

311325
DirectoryCopy(apiTemp, webApiLocation);
@@ -490,24 +504,28 @@ public static void CongigureSecurity(string folder)
490504
{
491505
using (var powershell = PowerShell.Create())
492506
{
493-
powershell.AddScript($"$path = \"{folder}\"; $acl = Get-Acl $path; Set-Acl $path $acl;");
507+
powershell.AddScript(FixACL.Replace("$dirrectory", folder));
508+
powershell.Invoke();
494509

495510
var dInfo = new DirectoryInfo(folder);
496511

497512
var dSecurity = dInfo.GetAccessControl();
498513

499514
dSecurity.AddAccessRule(new FileSystemAccessRule("IUSR", FileSystemRights.FullControl, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, PropagationFlags.None, AccessControlType.Allow));
515+
powershell.AddScript(FixACL.Replace("$dirrectory", folder));
516+
powershell.Invoke();
517+
500518
dSecurity.AddAccessRule(new FileSystemAccessRule("IIS_IUSRS", FileSystemRights.FullControl, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, PropagationFlags.None, AccessControlType.Allow));
519+
powershell.AddScript(FixACL.Replace("$dirrectory", folder));
520+
powershell.Invoke();
501521

502522
dInfo.SetAccessControl(dSecurity);
503523

504-
ReplaceAllDescendantPermissionsFromObject(dInfo, dSecurity, powershell);
505-
506-
powershell.Invoke();
524+
ReplaceAllDescendantPermissionsFromObject(dInfo, dSecurity);
507525
}
508526
}
509527

510-
private static void ReplaceAllDescendantPermissionsFromObject(DirectoryInfo dInfo, DirectorySecurity dSecurity, PowerShell powerShell)
528+
private static void ReplaceAllDescendantPermissionsFromObject(DirectoryInfo dInfo, DirectorySecurity dSecurity)
511529
{
512530
dInfo.SetAccessControl(dSecurity);
513531

@@ -520,9 +538,7 @@ private static void ReplaceAllDescendantPermissionsFromObject(DirectoryInfo dInf
520538
fi.SetAccessControl(ac);
521539
}
522540

523-
powerShell.AddScript($"$path = \"{dInfo.FullName}\"; $acl = Get-Acl $path; Set-Acl $path $acl;");
524-
525-
dInfo.GetDirectories().ToList().ForEach(d => ReplaceAllDescendantPermissionsFromObject(d, dSecurity, powerShell));
541+
dInfo.GetDirectories().ToList().ForEach(d => ReplaceAllDescendantPermissionsFromObject(d, dSecurity));
526542
}
527543

528544
private static void BuildAngularApp(string appLocation)
@@ -671,8 +687,32 @@ private static int GetWebApiPort()
671687
using (var serverManager = new ServerManager())
672688
{
673689
var usedPorts = serverManager.Sites.Where(t => t.Bindings.First().EndPoint.Port >= 5000).Select(t => t.Bindings.First().EndPoint.Port);
674-
return usedPorts.Any() ? usedPorts.Max() + 1 : 5000;
690+
var port = usedPorts.Any() ? usedPorts.Max() + 1 : 5000;
691+
692+
while (!IsPortAvailable(port))
693+
port += 1;
694+
695+
return port;
696+
}
697+
}
698+
699+
private static bool IsPortAvailable(int port)
700+
{
701+
bool isAvailable = true;
702+
703+
IPGlobalProperties ipGlobalProperties = IPGlobalProperties.GetIPGlobalProperties();
704+
var ports = new List<int>(ipGlobalProperties.GetActiveTcpConnections().Select(t => t.LocalEndPoint.Port));
705+
ports.AddRange(ipGlobalProperties.GetActiveTcpListeners().Select(t => t.Port));
706+
foreach (var usedPort in ports)
707+
{
708+
if (usedPort == port || usedPort == port - 2000)
709+
{
710+
isAvailable = false;
711+
break;
712+
}
675713
}
714+
715+
return isAvailable;
676716
}
677717

678718
private static void CreateAppPool(ServerManager serverManager, string name)

eFormAPI/Installation/CustomActions/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("1.1.1.8")]
35-
[assembly: AssemblyFileVersion("1.1.1.8")]
34+
[assembly: AssemblyVersion("1.1.2.12")]
35+
[assembly: AssemblyFileVersion("1.1.2.12")]

eFormAPI/Installation/MainInstaller/MainInstaller.wixproj

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,25 @@
2323
<SuppressValidation>true</SuppressValidation>
2424
</PropertyGroup>
2525
<ItemGroup>
26+
<Compile Include="ApiFileList.wxs" />
2627
<Compile Include="DomainNameDlg.wxs" />
2728
<Compile Include="EmptyFIieldDlg.wxs" />
29+
<Compile Include="ClientFileList.wxs" />
2830
<Compile Include="KeepSettingsDlg.wxs" />
31+
<Compile Include="LetsEncryptFileList.wxs" />
2932
<Compile Include="MaintenanceTypeModifiedDlg.wxs" />
3033
<Compile Include="DomainNameSelectDlg.wxs" />
3134
<Compile Include="ProgressModifiedDlg.wxs" />
3235
<Compile Include="VerifyReadyModifiedDlg.wxs" />
36+
<Compile Include="WelcomeDlgModified.wxs" />
3337
<Compile Include="WixUI_InstallDirModified.wxs" />
3438
<Compile Include="Product.wxs" />
3539
</ItemGroup>
3640
<ItemGroup>
3741
<Content Include="MainInstaller.wax" />
3842
<Content Include="MicrotingEULA.rtf" />
3943
<Content Include="TopBanner.bmp" />
44+
<Content Include="Transform.xslt" />
4045
<Content Include="WelcomeBanner.bmp" />
4146
</ItemGroup>
4247
<ItemGroup>
@@ -72,6 +77,14 @@
7277
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
7378
<Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
7479
</Target>
80+
<PropertyGroup>
81+
<DefineConstants>ClientPath=..\..\..\eform-client; ApiPath=..\..\eformapi; LetsEncryptPath=..\..\..\eFormAPI\Installation\letsencrypt</DefineConstants>
82+
</PropertyGroup>
83+
<Target Name="BeforeBuild">
84+
<HeatDirectory Directory="..\..\..\eform-client" PreprocessorVariable="var.ClientPath" OutputFile="ClientFileList.wxs" ComponentGroupName="ClientFiles" DirectoryRefId="eform_client" GenerateGuidsNow="true" ToolPath="$(WixToolPath)" SuppressFragments="true" SuppressRegistry="true" SuppressRootDirectory="true" />
85+
<HeatDirectory Directory="..\..\eformapi" PreprocessorVariable="var.ApiPath" Transforms="Transform.xslt" OutputFile="ApiFileList.wxs" ComponentGroupName="ApiFiles" DirectoryRefId="eform_api" GenerateGuidsNow="true" ToolPath="$(WixToolPath)" SuppressFragments="true" SuppressRegistry="true" SuppressRootDirectory="true" />
86+
<HeatDirectory Directory="..\..\..\eFormAPI\Installation\letsencrypt" PreprocessorVariable="var.LetsEncryptPath" OutputFile="LetsEncryptFileList.wxs" ComponentGroupName="LetsEncryptFiles" DirectoryRefId="letsencrypt" GenerateGuidsNow="true" ToolPath="$(WixToolPath)" SuppressFragments="true" SuppressRegistry="true" SuppressRootDirectory="true" />
87+
</Target>
7588
<PropertyGroup>
7689
<PostBuildEvent>"$(ProjectDir)BuildedCustomActions\AllowMultipleVersions.exe" "$(TargetPath)"</PostBuildEvent>
7790
</PropertyGroup>
@@ -88,12 +101,12 @@
88101
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
89102
<IntermediateOutputPath>obj\$(Platform)\$(Configuration)\</IntermediateOutputPath>
90103
</PropertyGroup>
91-
<!--
92-
To modify your build process, add your task inside one of the targets below and uncomment it.
93-
Other similar extension points exist, see Wix.targets.
94-
<Target Name="BeforeBuild">
95-
</Target>
96-
<Target Name="AfterBuild">
97-
</Target>
104+
<!--
105+
To modify your build process, add your task inside one of the targets below and uncomment it.
106+
Other similar extension points exist, see Wix.targets.
107+
<Target Name="BeforeBuild">
108+
</Target>
109+
<Target Name="AfterBuild">
110+
</Target>
98111
-->
99112
</Project>

0 commit comments

Comments
 (0)