mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-08-19 00:56:16 +00:00
Minor cleanup and formatting fixes in docs handler and setup manager
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user