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