From 28dc82c983e2c5ef3b9c6668889f58ba6ac35baf Mon Sep 17 00:00:00 2001 From: Stephan Yelle Date: Sat, 20 Dec 2025 15:18:47 -0500 Subject: [PATCH] Update samy.ps1 --- samy.ps1 | 230 +++++++------------------------------------------------ 1 file changed, 27 insertions(+), 203 deletions(-) diff --git a/samy.ps1 b/samy.ps1 index b4621f4..97dd625 100644 --- a/samy.ps1 +++ b/samy.ps1 @@ -9,6 +9,7 @@ Invoke-installprinters you can uncomment whatif in the function # SAMY asset config (change branch or base once and it updates everything) $Script:SamyBranch = 'beta' # or 'main' +line 268 - 281 .SYNOPSIS Script Automation Monkey (SAMY) is a unified MSP assistant that automates onboarding, headless offboarding, @@ -283,6 +284,9 @@ $ConfirmPreference = 'None' $Script:SamyFaviconUrl = "$Script:SamyRepoBase/$Script:SamyBranch/SVS_Favicon.ico" $Script:SamyCssUrl = "$Script:SamyRepoBase/$Script:SamyBranch/samy.css?raw=1" $Script:SamyJsUrl = "$Script:SamyRepoBase/$Script:SamyBranch/samy.js?raw=1" + $Script:SamyHtmlUrl = "$Script:SamyRepoBase/$Script:SamyBranch/samy.html?raw=1" + $Script:SamyHintText = "" + # Initialize a global in-memory log cache @@ -1094,11 +1098,24 @@ function Get-UIHtml { } # - # 3) Pull CSS/JS from Gitea and inline them + # 3) Pull CSS/JS/HTML from Gitea and inline them # $cssContent = Get-RemoteText -Url $Script:SamyCssUrl $jsContent = Get-RemoteText -Url $Script:SamyJsUrl + $htmlTemplate = Get-RemoteText -Url $Script:SamyHtmlUrl + + if (-not $htmlTemplate) { + # Hard fail or fallback, your call. + # This keeps the UI from becoming blank if the repo is unreachable. + Write-LogHybrid "UI template download failed. Returning minimal error page." Error UI -LogToEvent + return " +

SAMY UI template unavailable

+

Could not download samy.html from repo.

+ " + } + + # Optional: inject background override into CSS (same as you had) if ($cssContent) { $cssContent += @" @@ -1109,211 +1126,18 @@ function Get-UIHtml { "@ } - # - # 4) HTML template - **no external link/script src** anymore, all inlined - # - $htmlTemplate = @" - - - - - -Script Automation Monkey - - - - - -
- -
- SVS Logo - {{moduleVersion}} -
- - -
- Script Automation Monkey (Yeah!) -
- - -
- -
- -
- -
-
-

On-Boarding

-

This new deployment method ensures everything is successfully deployed with greater ease!

- -
-
-

SVSMSP Stack

- - {{onboardLeftColumn}} -
-
-

Optional

- - {{onboardRightColumn}} - - -
- -
- - -
-
- - - - - -
- -
-

Off-Boarding

-
-
-

Remove Stack

- - {{offboardCheckboxes}} -
-
-
- -
-

Tweaks

-
-
-

Tweaks

- {{tweaksCheckboxes}} -
-
-
- -
-

SVS APPs

-
-
-

Applications

- {{appsCheckboxes}} -
-
-
- - -
-

Devices

-

Manage printers and other client devices.

- - -
- -
- - -
-
- - - - - - -
-
-
- - - - - - - -
- - -
- - - -"@ - - # - # 5) Replace placeholders (unchanged vs your version) + # 4) Replace placeholders (unchanged vs your version) # $html = $htmlTemplate + + $html = $html.Replace('{{CssContent}}', $cssContent) + $html = $html.Replace('{{JsContent}}', $jsContent) + + $html = $html.Replace('{{SamyFaviconUrl}}', $Script:SamyFaviconUrl) + $html = $html.Replace('{{SamyTopLogoUrl}}', $Script:SamyTopLogoUrl) + $html = $html.Replace('{{SamyHintText}}', $Script:SamyHintText) + $html = $html.Replace('{{moduleVersion}}', (Get-ModuleVersionHtml)) $html = $html.Replace('{{onboardLeftColumn}}', $onboardLeft) $html = $html.Replace('{{onboardRightColumn}}', $onboardRight)