test
This commit is contained in:
41
samy.ps1
41
samy.ps1
@@ -108,12 +108,12 @@ $ConfirmPreference = 'None'
|
|||||||
|
|
||||||
# Background SAMY image used in CSS
|
# Background SAMY image used in CSS
|
||||||
$Script:SamyBgLogoUrl = "$Script:SamyRepoBase/$Script:SamyBranch/SAMY.png?raw=1"
|
$Script:SamyBgLogoUrl = "$Script:SamyRepoBase/$Script:SamyBranch/SAMY.png?raw=1"
|
||||||
|
|
||||||
$Script:SamyFaviconUrl = "$Script:SamyRepoBase/$Script:SamyBranch/SVS_Favicon.ico"
|
$Script:SamyFaviconUrl = "$Script:SamyRepoBase/$Script:SamyBranch/SVS_Favicon.ico"
|
||||||
$Script:SamyCssUrl = "$Script:SamyRepoBase/$Script:SamyBranch/samy.css?raw=1"
|
$Script:SamyCssUrl = "$Script:SamyRepoBase/$Script:SamyBranch/samy.css?raw=1"
|
||||||
$Script:SamyJsUrl = "$Script:SamyRepoBase/$Script:SamyBranch/samy.js?raw=1"
|
$Script:SamyJsUrl = "$Script:SamyRepoBase/$Script:SamyBranch/samy.js?raw=1"
|
||||||
$Script:SamyHtmlUrl = "$Script:SamyRepoBase/$Script:SamyBranch/samy.html?raw=1"
|
$Script:SamyHtmlUrl = "$Script:SamyRepoBase/$Script:SamyBranch/samy.html?raw=1"
|
||||||
$Script:SamyHintText = ""
|
$Script:SamyHintText = ""
|
||||||
|
$Script:SamyTasksUrl = "$Script:SamyRepoBase/$Script:SamyBranch/samy.tasks.json?raw=1"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -684,7 +684,8 @@ if (-not [System.Diagnostics.EventLog]::SourceExists('$EventSource')) {
|
|||||||
# HandlerFn → the PowerShell function to invoke
|
# HandlerFn → the PowerShell function to invoke
|
||||||
# Page → which tab/page it appears on
|
# Page → which tab/page it appears on
|
||||||
|
|
||||||
$Global:SamyTasks = @(
|
# Embedded fallback (keep your current list here)
|
||||||
|
$Script:EmbeddedSamyTasks = @(
|
||||||
# On-Boarding, left column
|
# On-Boarding, left column
|
||||||
@{ Id='setSVSPowerplan'; Name='setSVSPowerplan'; Label='Set SVS Powerplan'; HandlerFn='Invoke-setSVSPowerPlan'; Page='onboard'; Column='left' },
|
@{ Id='setSVSPowerplan'; Name='setSVSPowerplan'; Label='Set SVS Powerplan'; HandlerFn='Invoke-setSVSPowerPlan'; Page='onboard'; Column='left' },
|
||||||
@{ Id='installSVSMSPModule'; Name='installSVSMSPModule'; Label='Install SVSMSP Module'; HandlerFn='Invoke-InstallSVSMSP'; Page='onboard'; Column='left' },
|
@{ Id='installSVSMSPModule'; Name='installSVSMSPModule'; Label='Install SVSMSP Module'; HandlerFn='Invoke-InstallSVSMSP'; Page='onboard'; Column='left' },
|
||||||
@@ -709,7 +710,6 @@ if (-not [System.Diagnostics.EventLog]::SourceExists('$EventSource')) {
|
|||||||
@{ Id='wingetChrome'; Name='wingetChrome'; Label='Google Chrome'; HandlerFn='Invoke-InstallChrome'; Page='onboard';Column= 'right' },
|
@{ Id='wingetChrome'; Name='wingetChrome'; Label='Google Chrome'; HandlerFn='Invoke-InstallChrome'; Page='onboard';Column= 'right' },
|
||||||
@{ Id='wingetAcrobat'; Name='wingetAcrobat'; Label='Adobe Acrobat Reader (64-bit)'; HandlerFn='Invoke-InstallAcrobat'; Page='onboard';Column= 'right' },
|
@{ Id='wingetAcrobat'; Name='wingetAcrobat'; Label='Adobe Acrobat Reader (64-bit)'; HandlerFn='Invoke-InstallAcrobat'; Page='onboard';Column= 'right' },
|
||||||
|
|
||||||
|
|
||||||
# Off-Boarding
|
# Off-Boarding
|
||||||
@{ Id='offUninstallCyberQP'; Name='offUninstallCyberQP'; Label='Uninstall CyberQP'; HandlerFn='Invoke-UninstallCyberQP'; Page='offboard' },
|
@{ Id='offUninstallCyberQP'; Name='offUninstallCyberQP'; Label='Uninstall CyberQP'; HandlerFn='Invoke-UninstallCyberQP'; Page='offboard' },
|
||||||
@{ Id='offUninstallHelpDesk'; Name='offUninstallHelpDesk'; Label='Uninstall HelpDesk'; HandlerFn='Invoke-UninstallHelpDesk'; Page='offboard' },
|
@{ Id='offUninstallHelpDesk'; Name='offUninstallHelpDesk'; Label='Uninstall HelpDesk'; HandlerFn='Invoke-UninstallHelpDesk'; Page='offboard' },
|
||||||
@@ -717,10 +717,16 @@ if (-not [System.Diagnostics.EventLog]::SourceExists('$EventSource')) {
|
|||||||
@{ Id='offUninstallRocketCyber'; Name='offUninstallRocketCyber'; Label='Uninstall RocketCyber'; HandlerFn='Invoke-UninstallRocketCyber'; Page='offboard' },
|
@{ Id='offUninstallRocketCyber'; Name='offUninstallRocketCyber'; Label='Uninstall RocketCyber'; HandlerFn='Invoke-UninstallRocketCyber'; Page='offboard' },
|
||||||
@{ Id='offCleanupSVSMSPModule'; Name='offCleanupSVSMSPModule'; Label='Cleanup SVSMSP Toolkit'; HandlerFn='Invoke-CleanupSVSMSP'; Page='offboard' }
|
@{ Id='offCleanupSVSMSPModule'; Name='offCleanupSVSMSPModule'; Label='Cleanup SVSMSP Toolkit'; HandlerFn='Invoke-CleanupSVSMSP'; Page='offboard' }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Primary: load from repo JSON
|
||||||
|
$loaded = Get-SamyTasks
|
||||||
|
if ($loaded) {
|
||||||
|
$Global:SamyTasks = $loaded
|
||||||
|
} else {
|
||||||
|
$Global:SamyTasks = $Script:EmbeddedSamyTasks
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -970,6 +976,31 @@ function Get-UIHtml {
|
|||||||
return $html
|
return $html
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Get-SamyTasks {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param()
|
||||||
|
|
||||||
|
try {
|
||||||
|
$json = Get-RemoteText -Url $Script:SamyTasksUrl
|
||||||
|
if ([string]::IsNullOrWhiteSpace($json)) {
|
||||||
|
throw "Tasks JSON was empty."
|
||||||
|
}
|
||||||
|
|
||||||
|
$tasks = $json | ConvertFrom-Json -ErrorAction Stop
|
||||||
|
|
||||||
|
if (-not $tasks -or $tasks.Count -eq 0) {
|
||||||
|
throw "Tasks JSON parsed but contained no tasks."
|
||||||
|
}
|
||||||
|
|
||||||
|
return $tasks
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-LogHybrid "Failed to load samy.tasks.json: $($_.Exception.Message). Falling back to embedded tasks." Warning UI -LogToEvent
|
||||||
|
return $null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion UIHtml
|
#endregion UIHtml
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user