Skip to content

Commit 50dcc46

Browse files
committed
updated core modules
1 parent 556bd89 commit 50dcc46

File tree

58 files changed

+1023
-497
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1023
-497
lines changed

core/modules/monkeycloudutils/public/Get-MSGraphOrganization.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Function Get-MSGraphOrganization{
5454
}
5555
#Create authorization header
5656
$Authorization = $AuthObject.CreateAuthorizationHeader()
57-
$Tenants = Invoke-WebRequest $uri -Method Get -Headers @{Authorization=$Authorization};
57+
$Tenants = Invoke-WebRequest $uri -Method Get -Headers @{Authorization=$Authorization} -UseBasicParsing;
5858
$Tenants = (ConvertFrom-Json $Tenants.Content).value;
5959
if($Tenants){
6060
foreach($organization in @($Tenants)){

core/modules/monkeycloudutils/public/Get-SKUProduct.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Function Get-SKUProduct{
4343
try{
4444
$licenses = 'https://download.microsoft.com/download/e/3/e/e3e9faf2-f28b-490a-9ada-c6089a1fc5b0/Product%20names%20and%20service%20plan%20identifiers%20for%20licensing.csv'
4545
#Get CSV licenses
46-
$metadata = Invoke-WebRequest -Uri $licenses -Method Get
46+
$metadata = Invoke-WebRequest -Uri $licenses -Method Get -UseBasicParsing
4747
#Convert To CSV
4848
$csv = [System.Text.Encoding]::UTF8.GetString($metadata.Content) | ConvertFrom-Csv
4949
#Convert to RAW object

core/modules/monkeycloudutils/public/Get-TenantInfo.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Function Get-TenantInfo{
4949
}
5050
$Authorization = $AuthObject.CreateAuthorizationHeader()
5151
$uri = ("{0}/{1}/tenantDetails?api-version=1.6" -f $AuthObject.resource, $Tenant)
52-
$Tenants = Invoke-WebRequest $uri -Method Get -Headers @{Authorization=$Authorization};
52+
$Tenants = Invoke-WebRequest $uri -Method Get -Headers @{Authorization=$Authorization} -UseBasicParsing;
5353
return (ConvertFrom-Json $Tenants.Content).value;
5454
}
5555
else{

core/modules/monkeyhtml/private/Card/Get-HtmlContainerCard.ps1

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -129,71 +129,6 @@ Function Get-HtmlContainerCard{
129129
#Add to array
130130
[void]$allObjects.Add($row);
131131
}
132-
<#
133-
#Set h4 element
134-
$HElement = @{
135-
Name = 'h4';
136-
ClassName = 'resource-name';
137-
Text = $Resource.Name;
138-
InnerText = $true;
139-
Template = $row;
140-
}
141-
#Create element
142-
$H4Tag = New-HtmlTag @HElement
143-
#Get SVG icon
144-
$svg = $Resource.Name | Get-SvgIcon -LocalPath C:\monkey365_dev\newhtml
145-
$img_attributes = @{
146-
src = $svg;
147-
alt = $Resource.Name;
148-
}
149-
$img_element = @{
150-
Name = 'img';
151-
Attributes = $img_attributes;
152-
Empty = $true;
153-
Template = $row;
154-
}
155-
$img = New-HtmlTag @img_element
156-
#Get header
157-
$header = $row.SelectSingleNode('//div[@class="monkey-header"]')
158-
If($null -ne $header){
159-
#Add header and h4
160-
[void]$header.AppendChild($img);
161-
[void]$header.AppendChild($H4Tag);
162-
}
163-
#Get Card body
164-
$body = $row.SelectSingleNode('//div[@class="card-body"]')
165-
#Get search filter
166-
$searchFilter = New-HtmlCardFilter -Template $row
167-
#append child
168-
[void]$body.AppendChild($searchFilter);
169-
#Create div object
170-
#Div properties
171-
$divProperties = @{
172-
Name = 'div';
173-
ClassName = 'monkey-card-data';
174-
Id = ("{0}-findings" -f $Resource.Name.ToLower().Replace(' ',''))
175-
Template = $row;
176-
}
177-
#Create element
178-
$divContent = New-HtmlTag @divProperties
179-
#Get findings
180-
$allFindings = $Resource.Group | New-FindingCard -Template $row
181-
#Append all findings
182-
Foreach($finding in @($allFindings)){
183-
[void]$divContent.AppendChild($finding);
184-
}
185-
#append child
186-
[void]$body.AppendChild($divContent);
187-
#Import node
188-
$row = $TemplateObject.ImportNode($row.DocumentElement,$true);
189-
#Close div tags
190-
$divs = $row.SelectNodes("//div")
191-
$divs | ForEach-Object {
192-
If($_.IsEmpty){
193-
[void]$_.AppendChild($TemplateObject.CreateWhitespace(""))
194-
}
195-
}
196-
#>
197132
#Add to array
198133
[void]$allObjects.Add($row);
199134
}

core/modules/monkeyhtml/private/Card/New-FindingCard.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ Function New-FindingCard{
259259
ShowModalButton = $showModalButton;
260260
ShowGoToButton = $showGoToButton;
261261
}
262-
If($null -ne $TableOption -and $TableOption -ne "Normal"){
262+
If($null -ne $TableOption -and $TableOption -ne "default"){
263263
[void]$p.Add('AsList',$True);
264264
}
265265
If($null -ne $extraFormat -and @($extraFormat).Count -gt 0){

core/modules/monkeyhtml/private/Header/Get-HtmlHeader.ps1

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,10 @@ Function Get-HtmlHeader{
174174
);
175175
If($null -ne $properties){
176176
ForEach($prop in $properties.Psobject.Properties){
177-
If($prop.Name -eq 'crossorigin' -and $Script:mode -ne 'cdn'){
177+
If($prop.Name -eq 'crossorigin' -and ($Script:mode -ne 'cdn' -or $Script:mode -ne 'localcdn')){
178178
continue
179179
}
180-
If($prop.Name -eq 'integrity' -and $Script:mode -ne 'cdn'){
180+
If($prop.Name -eq 'integrity' -and ($Script:mode -ne 'cdn' -or $Script:mode -ne 'localcdn')){
181181
continue
182182
}
183183
If($Script:mode -eq 'cdn' -and $prop.Name -in @("src","href")){
@@ -191,6 +191,10 @@ Function Get-HtmlHeader{
191191
Write-Warning $Script:messages.BaseUrlErrorMessage
192192
}
193193
}
194+
ElseIf($Script:mode -eq 'localcdn' -and $prop.Name -in @("src","href")){
195+
$_url = ("{0}/{1}" -f $Script:Repository,$prop.Value);
196+
[void]$tag.SetAttribute($prop.Name,$_url)
197+
}
194198
Else{
195199
If($prop.Name -in @("src","href")){
196200
$_url = ("{0}/{1}" -f $Script:LocalPath,$prop.Value);

core/modules/monkeyhtml/private/Icons/Get-SvgIcon.ps1

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,17 @@ Function Get-SvgIcon{
100100
If($null -eq $icon){
101101
$icon = 'assets/inc-azicons/general/10001-icon-service-All-Resources.svg'
102102
}
103-
If($Script:mode -eq 'cdn'){
103+
If($Script:mode -eq 'cdn' -or $Script:mode -eq 'localcdn'){
104104
$baseUrl = ("{0}/{1}" -f $Script:Repository,$icon);
105-
$_iconPath = Convert-UrlToJsDelivr -Url $baseUrl -Latest
105+
If($Script:mode -eq 'cdn'){
106+
$_iconPath = Convert-UrlToJsDelivr -Url $baseUrl -Latest
107+
}
108+
Else{
109+
$_iconPath = $baseUrl;
110+
}
106111
If($PSBoundParameters.ContainsKey('Raw') -and $PSBoundParameters['Raw'].IsPresent){
107112
Try{
108-
$content = Invoke-WebRequest -Uri $_iconPath
113+
$content = Invoke-WebRequest -Uri $_iconPath -UseBasicParsing
109114
$streamReader = [System.IO.StreamReader]::new($content.RawContentStream,[System.Text.Encoding]::UTF8);
110115
[xml]$iconXml = $streamReader.ReadToEnd();
111116
$streamReader.Close();

core/modules/monkeyhtml/private/Modal/New-HtmlAboutTool.ps1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,14 @@ Function New-HtmlAboutTool{
6868
)
6969
#Tool image
7070
#Create Monkey365 IMG
71-
If($Script:mode -eq 'cdn'){
71+
If($Script:mode -eq 'cdn' -or $Script:mode -eq 'localcdn'){
7272
$baseUrl = ("{0}/{1}" -f $Script:Repository,'assets/inc-monkey/logo/MonkeyLogo.png');
73-
$img_src = Convert-UrlToJsDelivr -Url $baseUrl -Latest
73+
If($Script:mode -eq 'cdn'){
74+
$img_src = Convert-UrlToJsDelivr -Url $baseUrl -Latest
75+
}
76+
Else{
77+
$img_src = $baseUrl;
78+
}
7479
}
7580
Else{
7681
$img_src = ("{0}/{1}" -f $Script:LocalPath,'assets/inc-monkey/logo/MonkeyLogo.png');

core/modules/monkeyhtml/private/Objects/Get-HTMLNavBarGitHubInfo.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ Function Get-HTMLNavBarGitHubInfo{
5757
}
5858
$BaseUrl = $Url -replace "github.com","api.github.com/repos"
5959
Try{
60-
$repo = Invoke-WebRequest -Uri $BaseUrl -UserAgent "Monkey365" -ErrorAction Ignore
60+
$repo = Invoke-WebRequest -Uri $BaseUrl -UserAgent "Monkey365" -UseBasicParsing -ErrorAction Ignore
6161
$content = $repo.Content | ConvertFrom-Json
6262
#Get StarGazers
6363
$stargazers = $content | Select-Object -ExpandProperty stargazers_count -ErrorAction Ignore
6464
#Get latest release
6565
$repoUrl = ("{0}/releases/latest" -f $BaseUrl);
66-
$repo = Invoke-WebRequest -Uri $repoUrl -UserAgent "Monkey365" -ErrorAction Ignore
66+
$repo = Invoke-WebRequest -Uri $repoUrl -UserAgent "Monkey365" -UseBasicParsing -ErrorAction Ignore
6767
$content = $repo.Content | ConvertFrom-Json
6868
#Get tag name
6969
$version = $content | Select-Object -ExpandProperty tag_name -ErrorAction Ignore

core/modules/monkeyhtml/private/Sidebar/New-SideBar.ps1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,14 @@ function New-SideBar{
8686
#Create a element and combine with img and span tags
8787
$a_href = New-HtmlTag @a_element
8888
#Create Monkey365 IMG
89-
If($Script:mode -eq 'cdn'){
89+
If($Script:mode -eq 'cdn' -or $Script:mode -eq 'localcdn'){
9090
$baseUrl = ("{0}/{1}" -f $Script:Repository,'assets/inc-monkey/logo/MonkeyLogo.png');
91-
$_iconPath = Convert-UrlToJsDelivr -Url $baseUrl -Latest
91+
If($Script:mode -eq 'cdn'){
92+
$_iconPath = Convert-UrlToJsDelivr -Url $baseUrl -Latest
93+
}
94+
Else{
95+
$_iconPath = $baseUrl;
96+
}
9297
}
9398
Else{
9499
$_iconPath = ("{0}/{1}" -f $Script:LocalPath,'assets/inc-monkey/logo/MonkeyLogo.png');

0 commit comments

Comments
 (0)