iwr the css and js
This commit is contained in:
42
samy.ps1
42
samy.ps1
@@ -1032,9 +1032,24 @@ Write-LogHybrid "Tasks by page: onboard=$(
|
|||||||
}
|
}
|
||||||
#endregion Strat-Server
|
#endregion Strat-Server
|
||||||
|
|
||||||
|
|
||||||
#region UIHtml
|
#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 {
|
function Get-UIHtml {
|
||||||
param([string]$Page = 'onboard')
|
param([string]$Page = 'onboard')
|
||||||
if (-not $Page) { $Page = 'onboard' }
|
if (-not $Page) { $Page = 'onboard' }
|
||||||
@@ -1058,8 +1073,13 @@ function Get-UIHtml {
|
|||||||
) -join ",`n"
|
) -join ",`n"
|
||||||
|
|
||||||
#
|
#
|
||||||
# 3) HTML template that references external CSS/JS hosted on Gitea
|
# 3) Pull CSS/JS from Gitea and inline them
|
||||||
# (adjust the URLs to match your repo + branch)
|
#
|
||||||
|
$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 = @"
|
$htmlTemplate = @"
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@@ -1070,8 +1090,9 @@ function Get-UIHtml {
|
|||||||
<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">
|
$cssContent
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="logo-container">
|
<div class="logo-container">
|
||||||
@@ -1166,7 +1187,7 @@ function Get-UIHtml {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Tiny inline bridge: pass dynamic data to external JS -->
|
<!-- Tiny inline bridge: pass dynamic data, then inline JS from Gitea -->
|
||||||
<script>
|
<script>
|
||||||
window.SAMY_TASKS = [
|
window.SAMY_TASKS = [
|
||||||
{{tasksJsAll}}
|
{{tasksJsAll}}
|
||||||
@@ -1175,8 +1196,9 @@ function Get-UIHtml {
|
|||||||
window.SAMY_DEFAULT_PAGE = "{{defaultPage}}";
|
window.SAMY_DEFAULT_PAGE = "{{defaultPage}}";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- External JS from Gitea -->
|
<script>
|
||||||
<script src="https://git.svstools.ca/SVS_Public_Repo/S.A.M.Y/raw/branch/main/samy.js?raw=1"></script>
|
$jsContent
|
||||||
|
</script>
|
||||||
|
|
||||||
<!-- Floating button group -->
|
<!-- Floating button group -->
|
||||||
<div class="fixed-buttons">
|
<div class="fixed-buttons">
|
||||||
@@ -1189,7 +1211,7 @@ function Get-UIHtml {
|
|||||||
"@
|
"@
|
||||||
|
|
||||||
#
|
#
|
||||||
# 4) Replace placeholders
|
# 5) Replace placeholders (unchanged vs your version)
|
||||||
#
|
#
|
||||||
$html = $htmlTemplate
|
$html = $htmlTemplate
|
||||||
$html = $html.Replace('{{moduleVersion}}', (Get-ModuleVersionHtml))
|
$html = $html.Replace('{{moduleVersion}}', (Get-ModuleVersionHtml))
|
||||||
@@ -1204,8 +1226,8 @@ function Get-UIHtml {
|
|||||||
return $html
|
return $html
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion UIHtml
|
||||||
|
|
||||||
#endregion UIHtml
|
|
||||||
|
|
||||||
#region Handler Stubs
|
#region Handler Stubs
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user