Update SPLIT-samy.ps1

This commit is contained in:
2026-01-25 00:26:00 -05:00
parent da014ecfa1
commit c61fb5e18b

View File

@@ -38,6 +38,26 @@ if ($ExecutionContext.SessionState.LanguageMode -ne 'FullLanguage' -or
$ProgressPreference = 'SilentlyContinue' $ProgressPreference = 'SilentlyContinue'
$ConfirmPreference = 'None' $ConfirmPreference = 'None'
function Initialize-SamyConfig {
[CmdletBinding()]
param()
# Listening port for HTTP UI
$Script:Port = 8082
# Endpoints
$Global:DattoWebhookUrl = 'https://bananas.svstools.ca/dattormm'
# Hint text shown in UI
$Script:SamyHintText = ""
# IMPORTANT: ui.ps1 expects $Script:SamyBranch (not SamyGitBranch)
if ([string]::IsNullOrWhiteSpace($Script:SamyBranch)) {
$Script:SamyBranch = $Script:SamyGitBranch
}
}
#region Remote chunk loader #region Remote chunk loader
function Import-SamyChunk { function Import-SamyChunk {
@@ -63,9 +83,10 @@ function Import-SamyChunk {
# (Matches your current inline values) # (Matches your current inline values)
$Script:SamyGitURL = 'https://git.svstools.ca/SVS_Public_Repo/SAMY/raw/branch' $Script:SamyGitURL = 'https://git.svstools.ca/SVS_Public_Repo/SAMY/raw/branch'
$Script:SamyGitBranch = 'beta' # 'main' or 'beta' $Script:SamyGitBranch = 'beta' # 'main' or 'beta'
$Script:SamyGitRepo = "$Script:SamyGitURL/$Script:SamyGitBranch" $Script:SamyGitRepo = "$Script:SamyGitURL/$Script:SamyGitBranch"
Initialize-SamyConfig
$Script:SamyTopLogoUrl = "$Script:SamyGitRepo/SVS_logo.svg?raw=1" $Script:SamyTopLogoUrl = "$Script:SamyGitRepo/SVS_logo.svg?raw=1"
$Script:SamyBgLogoUrl = "$Script:SamyGitRepo/SAMY.png?raw=1" $Script:SamyBgLogoUrl = "$Script:SamyGitRepo/SAMY.png?raw=1"
$Script:SamyFaviconUrl = "$Script:SamyGitRepo/SVS_Favicon.ico?raw=1" $Script:SamyFaviconUrl = "$Script:SamyGitRepo/SVS_Favicon.ico?raw=1"
@@ -80,41 +101,38 @@ $Script:ChunkBase = "$Script:SamyGitRepo/src"
# Load chunks (dependencies first) # Load chunks (dependencies first)
$chunks = @( $chunks = @(
# 1) Config first: establishes all $Script:Samy*Url / ports / repo base # 1) Logging next: used everywhere
@{ Name = 'config.ps1'; Url = "$Script:ChunkBase/config.ps1?raw=1" },
# 2) Logging next: used everywhere
@{ Name = 'logging.fallback.ps1'; Url = "$Script:ChunkBase/logging.fallback.ps1?raw=1" }, @{ Name = 'logging.fallback.ps1'; Url = "$Script:ChunkBase/logging.fallback.ps1?raw=1" },
# 3) Core helpers/utilities that others depend on # 2) Core helpers/utilities that others depend on
@{ Name = 'helpers.ps1'; Url = "$Script:ChunkBase/helpers.ps1?raw=1" }, @{ Name = 'helpers.ps1'; Url = "$Script:ChunkBase/helpers.ps1?raw=1" },
@{ Name = 'http.ps1'; Url = "$Script:ChunkBase/http.ps1?raw=1" }, @{ Name = 'http.ps1'; Url = "$Script:ChunkBase/http.ps1?raw=1" },
@{ Name = 'remote.ps1'; Url = "$Script:ChunkBase/remote.ps1?raw=1" }, @{ Name = 'remote.ps1'; Url = "$Script:ChunkBase/remote.ps1?raw=1" },
# 4) Core data loaders / domain logic # 3) Core data loaders / domain logic
@{ Name = 'tasks.ps1'; Url = "$Script:ChunkBase/tasks.ps1?raw=1" }, @{ Name = 'tasks.ps1'; Url = "$Script:ChunkBase/tasks.ps1?raw=1" },
# 5) Integrations + installers # 4) Integrations + installers
@{ Name = 'svsmsp.install.ps1'; Url = "$Script:ChunkBase/svsmsp.install.ps1?raw=1" }, @{ Name = 'svsmsp.install.ps1'; Url = "$Script:ChunkBase/svsmsp.install.ps1?raw=1" },
@{ Name = 'integrations.datto.ps1';Url = "$Script:ChunkBase/integrations.datto.ps1?raw=1" }, @{ Name = 'integrations.datto.ps1';Url = "$Script:ChunkBase/integrations.datto.ps1?raw=1" },
# 6) UI renderer (Get-UIHtml depends on URLs + http helpers) # 5) UI renderer (Get-UIHtml depends on URLs + http helpers)
@{ Name = 'ui.ps1'; Url = "$Script:ChunkBase/ui.ps1?raw=1" }, @{ Name = 'ui.ps1'; Url = "$Script:ChunkBase/ui.ps1?raw=1" },
# 7) Handlers (depend on tasks/helpers/logging) # 6) Handlers (depend on tasks/helpers/logging)
@{ Name = 'handlers.datto.ps1'; Url = "$Script:ChunkBase/handlers.datto.ps1?raw=1" }, @{ Name = 'handlers.datto.ps1'; Url = "$Script:ChunkBase/handlers.datto.ps1?raw=1" },
@{ Name = 'handlers.onboard.ps1'; Url = "$Script:ChunkBase/handlers.onboard.ps1?raw=1" }, @{ Name = 'handlers.onboard.ps1'; Url = "$Script:ChunkBase/handlers.onboard.ps1?raw=1" },
@{ Name = 'handlers.offboard.ps1'; Url = "$Script:ChunkBase/handlers.offboard.ps1?raw=1" }, @{ Name = 'handlers.offboard.ps1'; Url = "$Script:ChunkBase/handlers.offboard.ps1?raw=1" },
@{ Name = 'handlers.printers.ps1'; Url = "$Script:ChunkBase/handlers.printers.ps1?raw=1" }, @{ Name = 'handlers.printers.ps1'; Url = "$Script:ChunkBase/handlers.printers.ps1?raw=1" },
# 8) Router and server last (depend on UI + handlers + http) # 7) Router and server last (depend on UI + handlers + http)
@{ Name = 'router.ps1'; Url = "$Script:ChunkBase/router.ps1?raw=1" }, @{ Name = 'router.ps1'; Url = "$Script:ChunkBase/router.ps1?raw=1" },
@{ Name = 'server.ps1'; Url = "$Script:ChunkBase/server.ps1?raw=1" }, @{ Name = 'server.ps1'; Url = "$Script:ChunkBase/server.ps1?raw=1" },
# 9) Functions file can be early OR late, but safest is after config/logging. # 8) Functions file can be early OR late, but safest is after config/logging.
@{ Name = 'samy.functions.ps1'; Url = "$Script:ChunkBase/samy.functions.ps1?raw=1" }, @{ Name = 'samy.functions.ps1'; Url = "$Script:ChunkBase/samy.functions.ps1?raw=1" },
# 10) Entry point last # 9) Entry point last
@{ Name = 'core.ps1'; Url = "$Script:ChunkBase/core.ps1?raw=1" } @{ Name = 'core.ps1'; Url = "$Script:ChunkBase/core.ps1?raw=1" }
) )