Update samy.ps1
This commit is contained in:
55
samy.ps1
55
samy.ps1
@@ -1039,28 +1039,25 @@ 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) HTML template that references external CSS/JS hosted on Gitea
|
||||
# (adjust the URLs to match your repo + branch)
|
||||
#
|
||||
# 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)
|
||||
$htmlTemplate = @"
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
@@ -1068,20 +1065,19 @@ 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">
|
||||
|
||||
<!-- External CSS from Gitea -->
|
||||
<link rel="stylesheet" href="https://git.svstools.ca/SVS_Public_Repo/S.A.M.Y/raw/branch/main/samy.css?raw=1">
|
||||
<style>
|
||||
{{INLINE_STYLE}}
|
||||
</style>
|
||||
</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>
|
||||
@@ -1128,7 +1124,7 @@ function Get-UIHtml {
|
||||
<option disabled selected>Fetching sites...</option>
|
||||
</select>
|
||||
</div>
|
||||
</div> <!-- end onboardTab -->
|
||||
</div>
|
||||
|
||||
<div id="offboardTab" class="tab-content">
|
||||
<h2>Off-Boarding</h2>
|
||||
@@ -1166,19 +1162,16 @@ 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>
|
||||
@@ -1188,18 +1181,18 @@ function Get-UIHtml {
|
||||
</html>
|
||||
"@
|
||||
|
||||
#
|
||||
# 4) Replace placeholders
|
||||
#
|
||||
# 5) 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("{{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)
|
||||
|
||||
return $html
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user