Minor cleanup and formatting fixes in docs handler and setup manager

This commit is contained in:
Tobias Gesellchen
2026-02-14 18:26:52 +01:00
parent 701889076d
commit d7a15c4dbe
2 changed files with 6 additions and 1 deletions
+4 -1
View File
@@ -13,6 +13,7 @@ import (
// HandleDocs returns a handler for serving documentation files as HTML.
func (s *Server) HandleDocs(w http.ResponseWriter, r *http.Request) {
path := strings.TrimPrefix(r.URL.Path, "/docs")
path = strings.TrimPrefix(path, "/")
if path == "" {
path = "guides/SURVIVAL-GUIDE.md"
@@ -33,6 +34,7 @@ func (s *Server) HandleDocs(w http.ResponseWriter, r *http.Request) {
// Load sidebar (SUMMARY.md)
summaryContent, _ := os.ReadFile(filepath.Join("docs", "SUMMARY.md"))
sidebar := ""
if len(summaryContent) > 0 {
// Render summary to HTML
@@ -52,7 +54,7 @@ func (s *Server) HandleDocs(w http.ResponseWriter, r *http.Request) {
// Wrap in a documentation template with sidebar
w.Header().Set("Content-Type", "text/html")
fmt.Fprintf(w, `<!DOCTYPE html>
_, _ = fmt.Fprintf(w, `<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
@@ -120,5 +122,6 @@ func (s *Server) fixSidebarLinks(sidebar string) string {
}
}
}
return strings.Join(lines, "\n")
}
+2
View File
@@ -446,10 +446,12 @@ func (m *Manager) MigrateSpeaker(deviceIP, targetURL, proxyURL string, options m
// 0b. Pre-flight check for SSH /rw permissions
client := m.NewSSH(deviceIP)
rwCmd := "(rw || mount -o remount,rw /)"
if rwTest, rwErr := client.Run(rwCmd); rwErr != nil {
return logs, fmt.Errorf("pre-flight check failed: cannot gain write access (cmd: %s, output: %s): %w", rwCmd, rwTest, rwErr)
}
logs += "Pre-flight: Write access verified.\n"
if method == MigrationMethodHosts {