back in time

This commit is contained in:
2025-11-26 19:18:24 -05:00
parent b29bcdbca3
commit 70c0e147f5

View File

@@ -1039,25 +1039,28 @@ function Get-UIHtml {
param([string]$Page = 'onboard')
if (-not $Page) { $Page = 'onboard' }
#
# 1) Build checkbox HTML per page/column
#
$onboardLeft = Build-Checkboxes -Page 'onboard' -Column 'left'
$onboardRight = Build-Checkboxes -Page 'onboard' -Column 'right'
$offboard = Build-Checkboxes -Page 'offboard' -Column ''
$tweaks = Build-Checkboxes -Page 'tweaks' -Column ''
$apps = Build-Checkboxes -Page 'SVSApps' -Column ''
#
# 2) Build the JS tasks array once (this is the only dynamic JS piece)
#
$tasksJsAll = (
$Global:SamyTasks | ForEach-Object {
" { id: '$($_.Id)', handler: '/$($_.Name)', label: '$($_.Label)' }"
}
) -join ",`n"
# 3) Fetch CSS and JS from Gitea and inline them
$styleContent = Get-ExternalContentSafe -Url "https://git.svstools.ca/SVS_Public_Repo/S.A.M.Y./raw/branch/main/samy.css" -Description "SAMY CSS"
$scriptContent = Get-ExternalContentSafe -Url "https://git.svstools.ca/SVS_Public_Repo/S.A.M.Y./raw/branch/main/samy.js" -Description "SAMY JS"
# 4) HTML template (no external CSS/JS links; we inline them)
#
# 3) HTML template that references external CSS/JS hosted on Gitea
# (adjust the URLs to match your repo + branch)
#
$htmlTemplate = @"
<!DOCTYPE html>
<html lang="en">
@@ -1065,19 +1068,20 @@ function Get-UIHtml {
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Script Monkey</title>
<link rel="icon" href="https://git.svstools.ca/SVS_Public_Repo/S.A.M.Y./raw/branch/main/SVS_Favicon.ico">
<link rel="icon" href="https://git.svstools.ca/SVS_Public_Repo/S.A.M.Y/raw/branch/main/SVS_Favicon.ico">
<style>
{{INLINE_STYLE}}
</style>
<!-- External CSS from Gitea -->
<link rel="stylesheet" href="https://git.svstools.ca/SVS_Public_Repo/S.A.M.Y/raw/branch/main/samy.css">
</head>
<body>
<div class="logo-container">
<!-- SVS Logo (left) -->
<div class="logo-left">
<img src="https://git.svstools.ca/SVS_Public_Repo/S.A.M.Y./raw/branch/main/SVS_logo.svg" alt="SVS Logo">
<img src="https://git.svstools.ca/SVS_Public_Repo/S.A.M.Y/raw/branch/main/SVS_logo.svg" alt="SVS Logo">
{{moduleVersion}}
</div>
<!-- Centered rotating tagline -->
<div id="tagline" class="tagline">
Script Automation Monkey (Yeah!)
</div>
@@ -1124,7 +1128,7 @@ function Get-UIHtml {
<option disabled selected>Fetching sites...</option>
</select>
</div>
</div>
</div> <!-- end onboardTab -->
<div id="offboardTab" class="tab-content">
<h2>Off-Boarding</h2>
@@ -1162,16 +1166,19 @@ function Get-UIHtml {
</div>
</div>
<!-- Tiny inline bridge: pass dynamic data to external JS -->
<script>
window.SAMY_TASKS = [
{{tasksJsAll}}
];
window.SAMY_DEFAULT_PAGE = "{{defaultPage}}";
{{INLINE_SCRIPT}}
</script>
<!-- External JS from Gitea -->
<script src="https://git.svstools.ca/SVS_Public_Repo/S.A.M.Y/raw/branch/main/samy.js"></script>
<!-- Floating button group -->
<div class="fixed-buttons">
<button class="exit-button" onclick="endSession()">Exit</button>
<button class="run-button" onclick="triggerInstall()">Run Selected</button>
@@ -1181,18 +1188,18 @@ function Get-UIHtml {
</html>
"@
# 5) Replace placeholders
#
# 4) Replace placeholders
#
$html = $htmlTemplate
$html = $html.Replace("{{moduleVersion}}", (Get-ModuleVersionHtml))
$html = $html.Replace("{{onboardLeftColumn}}", $onboardLeft)
$html = $html.Replace("{{onboardRightColumn}}", $onboardRight)
$html = $html.Replace("{{offboardCheckboxes}}", $offboard)
$html = $html.Replace("{{tweaksCheckboxes}}", $tweaks)
$html = $html.Replace("{{appsCheckboxes}}", $apps)
$html = $html.Replace("{{tasksJsAll}}", $tasksJsAll)
$html = $html.Replace("{{defaultPage}}", $Page)
$html = $html.Replace("{{INLINE_STYLE}}", $styleContent)
$html = $html.Replace("{{INLINE_SCRIPT}}", $scriptContent)
$html = $html.Replace('{{moduleVersion}}', (Get-ModuleVersionHtml))
$html = $html.Replace('{{onboardLeftColumn}}', $onboardLeft)
$html = $html.Replace('{{onboardRightColumn}}', $onboardRight)
$html = $html.Replace('{{offboardCheckboxes}}', $offboard)
$html = $html.Replace('{{tweaksCheckboxes}}', $tweaks)
$html = $html.Replace('{{appsCheckboxes}}', $apps)
$html = $html.Replace('{{tasksJsAll}}', $tasksJsAll)
$html = $html.Replace('{{defaultPage}}', $Page)
return $html
}