refactor(windows scripts): remove BOM and improve UTF-8 handling
This commit is contained in:
+8
-5
@@ -1,4 +1,4 @@
|
||||
<#
|
||||
<#
|
||||
LXS - Windows multi-tool
|
||||
Description: Centralized workstation management and deployment toolkit
|
||||
Repo: https://git.hyko.cx/hykocx/lxs
|
||||
@@ -73,7 +73,10 @@ if ($libPath -and (Test-Path $libPath)) {
|
||||
Write-Error 'Failed to fetch lib/common.ps1'
|
||||
exit 1
|
||||
}
|
||||
. ([scriptblock]::Create($libSource))
|
||||
# Strip the UTF-8 BOM: it is required in the file (Windows PowerShell 5.1
|
||||
# reads a BOM-less .ps1 with the ANSI codepage) but arrives as a leading
|
||||
# U+FEFF character when fetched over HTTP, which the parser rejects.
|
||||
. ([scriptblock]::Create(($libSource -replace '^\uFEFF', '')))
|
||||
}
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════════════════
|
||||
@@ -113,7 +116,7 @@ function Test-LxsRemoteVersion {
|
||||
}
|
||||
|
||||
if ($age -ge $LxsVersionTtl) {
|
||||
# Refresh inline but on a short leash — a slow repo must not stall the menu.
|
||||
# Refresh inline but on a short leash - a slow repo must not stall the menu.
|
||||
try {
|
||||
$remote = Invoke-RestMethod -Uri "$LxsRawBase/VERSION" -TimeoutSec 3 `
|
||||
-Headers @{ 'Cache-Control' = 'no-cache' } -UseBasicParsing -ErrorAction Stop
|
||||
@@ -162,7 +165,7 @@ function Show-LxsHeader {
|
||||
$totalMem = [math]::Round($os.TotalVisibleMemorySize / 1MB, 1)
|
||||
$usedMem = [math]::Round(($os.TotalVisibleMemorySize - $os.FreePhysicalMemory) / 1MB, 1)
|
||||
} catch {
|
||||
# CIM unavailable — the header degrades but the menu still works.
|
||||
# CIM unavailable - the header degrades but the menu still works.
|
||||
}
|
||||
|
||||
$cores = $env:NUMBER_OF_PROCESSORS
|
||||
@@ -318,7 +321,7 @@ function Invoke-LxsCmdTool {
|
||||
}
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════════════════
|
||||
# setup / update — download the repo zip and mirror it into $LxsInstallDir.
|
||||
# setup / update - download the repo zip and mirror it into $LxsInstallDir.
|
||||
# Everything lands under %LOCALAPPDATA%, so no elevation is needed here;
|
||||
# individual tools elevate themselves when they touch the machine.
|
||||
# ═══════════════════════════════════════════════════════════════════════════
|
||||
|
||||
Reference in New Issue
Block a user