Update samy.ps1

This commit is contained in:
2025-12-20 19:55:56 -05:00
parent af51917cc0
commit f1efec09bd

View File

@@ -719,54 +719,6 @@ function Get-SamyTasks {
}
}
function Initialize-SamyTasks {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[string]$Url,
[Parameter(Mandatory = $true)]
[object[]]$FallbackTasks
)
$tasks = Get-SamyTasks -Url $Url
if (-not $tasks) {
$tasks = @($FallbackTasks)
Write-LogHybrid "Using embedded fallback tasks ($($tasks.Count))" Info UI -LogToEvent
}
else {
Write-LogHybrid "Loaded remote tasks ($($tasks.Count))" Success UI -LogToEvent
}
# Ensure every task has a tooltip (default to Label) + safe escaping for title=''
foreach ($t in $tasks) {
$tooltip = $null
if ($t.PSObject.Properties.Name -contains 'Tooltip') {
$tooltip = [string]$t.Tooltip
}
if ([string]::IsNullOrWhiteSpace($tooltip)) {
$tooltip = [string]$t.Label
}
# Minimal HTML escaping for attribute usage
$tooltip = $tooltip -replace '&', '&'
$tooltip = $tooltip -replace "'", '''
$tooltip = $tooltip -replace '"', '"'
$tooltip = $tooltip -replace '<', '&lt;'
$tooltip = $tooltip -replace '>', '&gt;'
if ($t.PSObject.Properties.Name -contains 'Tooltip') {
$t.Tooltip = $tooltip
}
else {
$t | Add-Member -NotePropertyName Tooltip -NotePropertyValue $tooltip -Force
}
}
return $tasks
}
#endregion Remote Assets + Task Loading
@@ -796,7 +748,6 @@ function Initialize-SamyTasks {
# HandlerFn → the PowerShell function to invoke
# Page → which tab/page it appears on
# Embedded fallback (keep your current list here)
$Global:SamyTasks = Get-SamyTasks -Url $Script:SamyTasksUrl
if (-not $Global:SamyTasks) {