iwr the css and js

This commit is contained in:
2025-11-26 19:57:30 -05:00
parent 2e3890b5ca
commit ec3a324124

View File

@@ -1032,9 +1032,24 @@ Write-LogHybrid "Tasks by page: onboard=$(
}
#endregion Strat-Server
#region UIHtml
function Get-RemoteText {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)][string]$Url
)
try {
$resp = Invoke-WebRequest -Uri $Url -UseBasicParsing -ErrorAction Stop
return $resp.Content
}
catch {
Write-LogHybrid "Get-RemoteText failed for $Url: $($_.Exception.Message)" Warning UI -LogToEvent
return ""
}
}
function Get-UIHtml {
param([string]$Page = 'onboard')
if (-not $Page) { $Page = 'onboard' }
@@ -1058,8 +1073,13 @@ function Get-UIHtml {
) -join ",`n"
#
# 3) HTML template that references external CSS/JS hosted on Gitea
# (adjust the URLs to match your repo + branch)
# 3) Pull CSS/JS from Gitea and inline them
#
$cssContent = Get-RemoteText -Url "https://git.svstools.ca/SVS_Public_Repo/S.A.M.Y/raw/branch/main/samy.css?raw=1"
$jsContent = Get-RemoteText -Url "https://git.svstools.ca/SVS_Public_Repo/S.A.M.Y/raw/branch/main/samy.js?raw=1"
#
# 4) HTML template **no external link/script src** anymore, all inlined
#
$htmlTemplate = @"
<!DOCTYPE html>
@@ -1070,8 +1090,9 @@ function Get-UIHtml {
<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">
<!-- External CSS from Gitea -->
<link rel="stylesheet" href="https://git.svstools.ca/SVS_Public_Repo/S.A.M.Y/raw/branch/main/samy.css">
<style>
$cssContent
</style>
</head>
<body>
<div class="logo-container">
@@ -1166,7 +1187,7 @@ function Get-UIHtml {
</div>
</div>
<!-- Tiny inline bridge: pass dynamic data to external JS -->
<!-- Tiny inline bridge: pass dynamic data, then inline JS from Gitea -->
<script>
window.SAMY_TASKS = [
{{tasksJsAll}}
@@ -1175,8 +1196,9 @@ function Get-UIHtml {
window.SAMY_DEFAULT_PAGE = "{{defaultPage}}";
</script>
<!-- External JS from Gitea -->
<script src="https://git.svstools.ca/SVS_Public_Repo/S.A.M.Y/raw/branch/main/samy.js?raw=1"></script>
<script>
$jsContent
</script>
<!-- Floating button group -->
<div class="fixed-buttons">
@@ -1189,7 +1211,7 @@ function Get-UIHtml {
"@
#
# 4) Replace placeholders
# 5) Replace placeholders (unchanged vs your version)
#
$html = $htmlTemplate
$html = $html.Replace('{{moduleVersion}}', (Get-ModuleVersionHtml))
@@ -1204,9 +1226,9 @@ function Get-UIHtml {
return $html
}
#endregion UIHtml
#region Handler Stubs
function Respond-Text {