dashboard fixes

This commit is contained in:
Peter Li 2026-02-07 22:13:23 -08:00
parent e0311f9d8f
commit 771b3f67c3
4 changed files with 7 additions and 7 deletions

View File

@ -218,10 +218,9 @@ func remotePathType(ctx context.Context, site store.Site, path string) (string,
func pullSQLiteTarget(ctx context.Context, jobID int64, site store.Site, target store.SiteTarget, stageDir string) error {
tmpBase := fmt.Sprintf("/tmp/satoru-backup-%d-%s.sqlite3", jobID, shortHash(target.Path))
quotedDB := shellQuote(target.Path)
quotedTmp := shellQuote(tmpBase)
remoteCmd := strings.Join([]string{
sqliteBackupCommand(quotedDB, quotedTmp),
sqliteBackupCommand(target.Path, quotedTmp),
fmt.Sprintf("gzip -f -- %s", quotedTmp),
}, " && ")
if err := sshCheck(ctx, site, remoteCmd); err != nil {

View File

@ -238,7 +238,7 @@ func sqlitePreflightCheck(ctx context.Context, site store.Site, dbPath string) e
"sqlite3 --version >/dev/null",
"[ -r " + quoted + " ]",
"tmp=$(mktemp /tmp/satoru-preflight.XXXXXX)",
sqliteBackupCommand(quoted, "$tmp"),
sqliteBackupCommand(dbPath, "$tmp"),
"rm -f -- \"$tmp\"",
}, " && ")
return sshCheck(ctx, site, cmd)

View File

@ -7,12 +7,13 @@ const (
sqliteBackupTimeoutMS = 5000
)
func sqliteBackupCommand(quotedDBPath, quotedBackupPath string) string {
func sqliteBackupCommand(dbPath, quotedBackupPath string) string {
readonlyURI := shellQuote("file:" + dbPath + "?mode=ro")
return fmt.Sprintf(
"ok=0; for i in $(seq 1 %d); do sqlite3 -cmd \".timeout %d\" %s \".backup %s\" && ok=1 && break; sleep 1; done; [ \"$ok\" -eq 1 ]",
"ok=0; for i in $(seq 1 %d); do sqlite3 -readonly -cmd \".timeout %d\" %s \".backup %s\" && ok=1 && break; sleep 1; done; [ \"$ok\" -eq 1 ]",
sqliteBackupRetryCount,
sqliteBackupTimeoutMS,
quotedDBPath,
readonlyURI,
quotedBackupPath,
)
}

View File

@ -262,7 +262,7 @@ func Dashboard(data DashboardData) templ.Component {
<div class="row split">
<div>
<p class="eyebrow">Satoru</p>
<h1>Managed Sites Overview</h1>
<h1>Manage Backups</h1>
<p class="muted">Signed in as <strong>%s</strong> (%s).</p>
</div>
<div class="row">