Update samy.ps1

This commit is contained in:
2025-12-01 03:44:37 -05:00
parent 79a1474f81
commit 88b6aeef24

View File

@@ -228,6 +228,16 @@ $ConfirmPreference = 'None'
# Configurable endpoints # Configurable endpoints
$Global:DattoWebhookUrl = 'https://automate.svstools.ca/webhook/svsmspkit' $Global:DattoWebhookUrl = 'https://automate.svstools.ca/webhook/svsmspkit'
# SAMY asset config (change branch or base once and it updates everything)
$Script:SamyBranch = 'beta' # or 'main'
$Script:SamyRepoBase = 'https://git.svstools.ca/SVS_Public_Repo/SAMY/raw/branch'
$Script:SamyLogoUrl = "$Script:SamyRepoBase/$Script:SamyBranch/SVS_logo.svg"
$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"
# Initialize a global in-memory log cache # Initialize a global in-memory log cache
if (-not $Global:LogCache -or -not ($Global:LogCache -is [System.Collections.ArrayList])) { if (-not $Global:LogCache -or -not ($Global:LogCache -is [System.Collections.ArrayList])) {
@@ -1016,11 +1026,18 @@ function Get-UIHtml {
} }
) -join ",`n" ) -join ",`n"
# Human friendly branch label for UI
$branchDisplay = switch ($Script:SamyBranch.ToLower()) {
'main' { 'Main / Stable' }
'beta' { 'Beta' }
default { $Script:SamyBranch }
}
# #
# 3) Pull CSS/JS from Gitea and inline them # 3) Pull CSS/JS from Gitea and inline them
# #
$cssContent = Get-RemoteText -Url "https://git.svstools.ca/SVS_Public_Repo/SAMY/raw/branch/beta/samy.css?raw=1" $cssContent = Get-RemoteText -Url $Script:SamyCssUrl
$jsContent = Get-RemoteText -Url "https://git.svstools.ca/SVS_Public_Repo/SAMY/raw/branch/beta/samy.js?raw=1" $jsContent = Get-RemoteText -Url $Script:SamyJsUrl
# #
# 4) HTML template - **no external link/script src** anymore, all inlined # 4) HTML template - **no external link/script src** anymore, all inlined
@@ -1032,7 +1049,7 @@ function Get-UIHtml {
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Script Automation Monkey</title> <title>Script Automation Monkey</title>
<link rel="icon" href="https://git.svstools.ca/SVS_Public_Repo/SAMY/raw/branch/main/SVS_Favicon.ico"> <link rel="icon" href="$Script:SamyFaviconUrl">
<style> <style>
$cssContent $cssContent
@@ -1042,10 +1059,14 @@ $cssContent
<div class="logo-container"> <div class="logo-container">
<!-- SVS Logo (left) --> <!-- SVS Logo (left) -->
<div class="logo-left"> <div class="logo-left">
<img src="https://git.svstools.ca/SVS_Public_Repo/SAMY/raw/branch/main/SVS_logo.svg" alt="SVS Logo"> <img src="$Script:SamyLogoUrl" alt="SVS Logo">
{{moduleVersion}} {{moduleVersion}}
</div> </div>
<div style="color:#bbb; font-size:0.8em; margin-top:2px;">
UI Branch: {{branchTag}}
</div>
<!-- Centered rotating tagline --> <!-- Centered rotating tagline -->
<div id="tagline" class="tagline"> <div id="tagline" class="tagline">
Script Automation Monkey (Yeah!) Script Automation Monkey (Yeah!)
@@ -1088,7 +1109,9 @@ $cssContent
<div id="renameComputerBlock" style="display:none; margin-left: 24px; margin-top: 6px;"> <div id="renameComputerBlock" style="display:none; margin-left: 24px; margin-top: 6px;">
<label for="txtNewComputerName">New computer name:</label> <label for="txtNewComputerName">New computer name:</label>
<input type="text" id="txtNewComputerName" placeholder="e.g. CORP-LAP-123" /> <input type="text" id="txtNewComputerName" placeholder="e.g. CORP-LAP-123" />
<small>(Max 15 chars; letters, numbers, and hyphens only.)</small> <small> style="display:block; margin-top:4px;">
(Max 15 chars; letters, numbers, and hyphens only.)
</small>
</div> </div>
</div> </div>
</div> </div>
@@ -1181,6 +1204,8 @@ $jsContent
$html = $html.Replace('{{appsCheckboxes}}', $apps) $html = $html.Replace('{{appsCheckboxes}}', $apps)
$html = $html.Replace('{{tasksJsAll}}', $tasksJsAll) $html = $html.Replace('{{tasksJsAll}}', $tasksJsAll)
$html = $html.Replace('{{defaultPage}}', $Page) $html = $html.Replace('{{defaultPage}}', $Page)
$html = $html.Replace('{{branchTag}}', $branchDisplay)
return $html return $html
} }