Skip to content

Commit

Permalink
3.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Micke-K committed Aug 30, 2023
1 parent e6ec048 commit ea3af64
Show file tree
Hide file tree
Showing 47 changed files with 63,759 additions and 46,014 deletions.
42 changes: 42 additions & 0 deletions CS/HttpFactoryWithProxy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System;
using System.Net;
using System.Net.Http;
using Microsoft.Identity.Client;

public class HttpFactoryWithProxy : IMsalHttpClientFactory
{
private static HttpClient _httpClient;

public public HttpFactoryWithProxy(string proxyURI) : this(proxyURI, null, null)
{

}

public HttpFactoryWithProxy(string proxyURI, string proxyUserName = null, string proxyPassword = null)
{
if (_httpClient == null)
{
var proxy = new WebProxy
{
Address = new Uri(proxyURI),
BypassProxyOnLocal = false,
UseDefaultCredentials = false,
Credentials = new NetworkCredential(
userName: proxyUserName,
password: proxyPassword)
};

var httpClientHandler = new HttpClientHandler
{
Proxy = proxy,
};

_httpClient = new HttpClient(handler: httpClientHandler);
}
}

public HttpClient GetHttpClient()
{
return _httpClient;
}
}
4,471 changes: 0 additions & 4,471 deletions CloudAPIPowerShellManagement-DESKTOP-UCPS639.log

This file was deleted.

2 changes: 1 addition & 1 deletion CloudAPIPowerShellManagement.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'CloudAPIPowerShellManagement.psm1'

# Version number of this module.
ModuleVersion = '3.9.0'
ModuleVersion = '3.9.1'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
92 changes: 84 additions & 8 deletions Core.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This module handles the WPF UI

function Get-ModuleVersion
{
'3.8.1'
'3.9.1'
}

function Initialize-Window
Expand Down Expand Up @@ -58,6 +58,7 @@ function Start-CoreApp

$global:useDefaultFolderDialog = $false
$global:WindowsAPICodePackLoaded = $false
$script:proxyURI = $null

$global:loadedModules = @()
$global:viewObjects = @()
Expand Down Expand Up @@ -235,6 +236,8 @@ function Write-Log

if(-not $global:logFileMaxSize) { [Int64]$global:logFileMaxSize = Get-SettingValue "LogFileSize" 1024; $global:logFileMaxSize = $global:logFileMaxSize * 1kb }

if($null -eq $global:logOutputError) { $global:logOutputError = Get-SettingValue "LogOutputError" }

$fi = [IO.FileInfo]$global:logFile

if($fi.Length -gt $global:logFileMaxSize)
Expand Down Expand Up @@ -286,12 +289,19 @@ function Write-Log
if($type -eq 2)
{
Write-Warning $Text
$typeStr = "Error"
$typeStr = "Warning"
}
elseif($type -eq 3)
{
$host.ui.WriteErrorLine($Text)
$typeStr = "Warning"
if($global:logOutputError -ne $false)
{
$host.ui.WriteErrorLine($Text)
}
else
{
Write-Warning $Text
}
$typeStr = "Error"
}
else
{
Expand Down Expand Up @@ -667,8 +677,15 @@ function Show-UpdatesDialog
{
if($mystream) { $mystream.Dispose() }
}
$params = @{}
$proxyURI = Get-ProxyURI
if($proxyURI)
{
$params.Add("proxy", $proxyURI)
$params.Add("UseBasicParsing", $true)
}

$content = Invoke-RestMethod "https://api.github.com/repos/Micke-K/IntuneManagement/contents/ReleaseNotes.md"
$content = Invoke-RestMethod "https://api.github.com/repos/Micke-K/IntuneManagement/contents/ReleaseNotes.md" @params
if($content)
{
$txt = [System.Text.Encoding]::UTF8.GetString(([System.Convert]::FromBase64String($content.content)))
Expand Down Expand Up @@ -703,7 +720,15 @@ function Get-IsLatestVersion

$gitHubVer = $null

$content = Invoke-RestMethod "https://api.github.com/repos/Micke-K/IntuneManagement/releases/latest"
$params = @{}
$proxyURI = Get-ProxyURI
if($proxyURI)
{
$params.Add("proxy", $proxyURI)
$params.Add("UseBasicParsing", $true)
}

$content = Invoke-RestMethod "https://api.github.com/repos/Micke-K/IntuneManagement/releases/latest" @params
if($content.Name)
{
try
Expand All @@ -715,7 +740,15 @@ function Get-IsLatestVersion

if($null -eq $gitHubVer)
{
$content = Invoke-RestMethod "https://api.github.com/repos/Micke-K/IntuneManagement/contents/CloudAPIPowerShellManagement.psd1"
$params = @{}
$proxyURI = Get-ProxyURI
if($proxyURI)
{
$params.Add("proxy", $proxyURI)
$params.Add("UseBasicParsing", $true)
}

$content = Invoke-RestMethod "https://api.github.com/repos/Micke-K/IntuneManagement/contents/CloudAPIPowerShellManagement.psd1" @params
$gitHubText = [System.Text.Encoding]::UTF8.GetString(([System.Convert]::FromBase64String($content.content)))
$gitHubInfo = Get-ModuleDataTable $gitHubText
try
Expand Down Expand Up @@ -1150,6 +1183,10 @@ function Expand-FileName
[Environment]::SetEnvironmentVariable("DateTime",$null,[System.EnvironmentVariableTarget]::Process)
[Environment]::SetEnvironmentVariable("Organization",$null,[System.EnvironmentVariableTarget]::Process)

# Remove invalid path characters
$re = "[{0}]" -f [RegEx]::Escape(([IO.Path]::GetInvalidPathChars() -join ''))
$fileName = $fileName -replace $re

$fileName
}

Expand All @@ -1167,7 +1204,9 @@ function Initialize-Settings

$global:Debug = Get-SettingValue "Debug"
$global:logFile = $null
$global:logFileMaxSize = $null
$global:logFileMaxSize = $null
$global:logOutputError = $null
$script:proxyURI = $null

if($Updated -eq $true)
{
Expand Down Expand Up @@ -1943,6 +1982,14 @@ function Add-DefaultSettings
DefaultValue = 1024
}) "General"

Add-SettingsObject (New-Object PSObject -Property @{
Title = "Add errors to PowerShell output"
Key = "LogOutputError"
Type = "Boolean"
Description = "Write errors to the Error Output of the PS Host. If disabled, errors will be written as a Warning. Eg. disable this if automation should skip logging PowerShell errors."
DefaultValue = $true
}) "General"

Add-SettingsObject (New-Object PSObject -Property @{
Title = "Debug"
Key = "Debug"
Expand Down Expand Up @@ -1998,6 +2045,12 @@ function Add-DefaultSettings
Description = "Adds the organization name next to the login info on the menu bar"
}) "General"

Add-SettingsObject (New-Object PSObject -Property @{
Title = "Proxy URI"
Key = "ProxyURI"
Description = "Specify the URI for the proxy eg http://<server>:<port>"
}) "General"

}

function Add-SettingsObject
Expand Down Expand Up @@ -2434,6 +2487,15 @@ function Get-MainWindow
}

Show-ModalForm $window.Title $script:welcomeForm -HideButtons
}
else
{
###!!! Force login here
if($global:currentViewObject.ViewInfo.Authenticate)
{
# Skip for now...need additional code to skip previous login and force this based on setting.
#!!!& $global:currentViewObject.ViewInfo.Authenticate -Params (@{"Interactve"=$true})
}
}
})

Expand Down Expand Up @@ -2694,6 +2756,20 @@ function Get-Base64ScriptContent
}
}

function Get-ProxyURI
{
if($null -eq $script:proxyURI)
{
$script:proxyUri = Get-SettingValue "ProxyURI"
}

if($null -eq $script:proxyURI)
{
$script:proxyUri = ""
}
return $script:proxyURI
}

New-Alias -Name ?? -value Invoke-Coalesce
New-Alias -Name ?: -value Invoke-IfTrue
Export-ModuleMember -alias * -function *
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
[
{
"nameResourceKey": "TableHeaders.policyType",
"descriptionResourceKey": "",
"entityKey": "WindowsDriverUpdateProfile.Subtitle.automatic",
"dataType": 200,
"booleanActions": 0,
"category": 1000,
"Condition": {
"Expressions": [
{
"property": "approvalType",
"value": "automatic"
}
]
}
},
{
"nameResourceKey": "TableHeaders.policyType",
"descriptionResourceKey": "",
"entityKey": "WindowsDriverUpdateProfile.Subtitle.manual",
"dataType": 200,
"booleanActions": 0,
"category": 1000,
"Condition": {
"Expressions": [
{
"property": "approvalType",
"value": "manual"
}
]
}
},
{
"nameResourceKey": "WindowsDriverUpdateProfile.Details.ApprovalMethod.label",
"descriptionResourceKey": "",
"entityKey": "approvalType",
"dataType": 16,
"booleanActions": 0,
"category": "TableHeaders.settings",
"options": [
{
"nameResourceKey": "WindowsDriverUpdateProfile.ApprovalMethod.automatic",
"value": "automatic"
},
{
"nameResourceKey": "WindowsDriverUpdateProfile.ApprovalMethod.manual",
"value": "manual"
}
]
},
{
"nameResourceKey": "WindowsDriverUpdateProfile.Details.DeploymentDeferralInDays.label",
"descriptionResourceKey": "",
"entityKey": "deploymentDeferralInDays",
"formatStringKey": "WindowsDriverUpdateProfile.Details.DeploymentDeferralInDays.value",
"dataType": 108,
"booleanActions": 0,
"category": "TableHeaders.settings",
"Condition": {
"Expressions": [
{
"property": "approvalType",
"value": "automatic"
}
]
}
}
]
Loading

0 comments on commit ea3af64

Please sign in to comment.