Redesign the UI shell and stabilize download/auth UX

Shift the frontend to a brutalist control-surface style, align tab/button states, and remove duplicated panels so the interface is clearer. Also add auth boot loading feedback and robust temp archive cleanup to prevent LZ4 download collisions from stale files.
This commit is contained in:
mixa
2026-03-05 09:43:17 +03:00
parent 1bdeddb2ff
commit 299ff65afd
13 changed files with 286 additions and 109 deletions

Binary file not shown.

View File

@@ -1145,6 +1145,7 @@ func (s *Server) createTarLz4Temp(uid int64, rel, base string) (string, string,
if _, err := exec.LookPath("lz4"); err != nil {
return "", "", "", fmt.Errorf("lz4 format requires 'lz4' binary on server; choose zip or tar.gz in settings")
}
cleanupStaleTempArchives(1 * time.Hour)
tarPath, err := s.createTarTemp(uid, rel, base)
if err != nil {
return "", "", "", err
@@ -1157,6 +1158,7 @@ func (s *Server) createTarLz4Temp(uid int64, rel, base string) (string, string,
}
outPath := outTmp.Name()
outTmp.Close()
_ = os.Remove(outPath)
cmd := exec.Command("lz4", "-z", "-q", tarPath, outPath)
if out, err := cmd.CombinedOutput(); err != nil {
@@ -1536,6 +1538,7 @@ func createTarLz4FromLocalDir(root, baseName string) (string, string, string, er
if _, err := exec.LookPath("lz4"); err != nil {
return "", "", "", fmt.Errorf("lz4 format requires 'lz4' binary on server; choose zip or tar.gz in settings")
}
cleanupStaleTempArchives(1 * time.Hour)
tarPath, err := createTarFromLocalDir(root)
if err != nil {
return "", "", "", err
@@ -1548,6 +1551,7 @@ func createTarLz4FromLocalDir(root, baseName string) (string, string, string, er
}
outPath := outTmp.Name()
outTmp.Close()
_ = os.Remove(outPath)
cmd := exec.Command("lz4", "-z", "-q", tarPath, outPath)
if out, err := cmd.CombinedOutput(); err != nil {
os.Remove(outPath)
@@ -1556,6 +1560,35 @@ func createTarLz4FromLocalDir(root, baseName string) (string, string, string, er
return outPath, baseName + ".tar.lz4", "application/x-lz4", nil
}
func cleanupStaleTempArchives(maxIdle time.Duration) {
tmpDir := os.TempDir()
entries, err := os.ReadDir(tmpDir)
if err != nil {
return
}
cutoff := time.Now().Add(-maxIdle)
for _, entry := range entries {
name := entry.Name()
if !strings.HasPrefix(name, "filez-") && !strings.HasPrefix(name, "filez-batch-") {
continue
}
if !(strings.HasSuffix(name, ".tar.lz4") || strings.HasSuffix(name, ".tar") || strings.HasSuffix(name, ".tar.gz") || strings.HasSuffix(name, ".zip") || strings.HasSuffix(name, ".rar")) {
continue
}
info, err := entry.Info()
if err != nil || info.IsDir() {
continue
}
if info.ModTime().After(cutoff) {
continue
}
_ = os.Remove(filepath.Join(tmpDir, name))
}
}
func createRarFromLocalDir(root, baseName string) (string, string, string, error) {
if _, err := exec.LookPath("rar"); err != nil {
return "", "", "", fmt.Errorf("rar format requires 'rar' binary on server; choose zip or tar.gz in settings")