W21 sharing switched on without a password asks for it and says why it waits; W25 failed off-site run shows the household a sentence built from the classifier, raw text only to log and operator; W28 share restore skips the controller's drop-zone share; unreleased
gates / gates (push) Successful in 1m40s

This commit is contained in:
2026-10-21 23:19:07 +02:00
parent 28b05d6d68
commit 5776d54901
16 changed files with 330 additions and 7 deletions
@@ -296,6 +296,16 @@ func (s *Server) sharingEnableHandler(w http.ResponseWriter, r *http.Request) {
s.logger.Printf("[WARN] [sharing] could not ensure the import share: %v", err)
}
// W21 (rehearsal 2026-10-20): with no household password the service is never deployed (reconcile
// skips it: „deploy skipped — household SMB password not set yet"), yet the flash said the service was
// being prepared and the page stayed „áll" for ever. The answer now says it waits for the password, and
// the page asks for it (sharing.html, the needs-password alert). Nothing to prepare, so no job.
// Pinned by TestW21_SwitchOnWithoutPasswordAsksForItAtOnce.
if !s.settings.GetSMBSettings().UserSet {
s.logger.Printf("[INFO] [sharing] sharing switched on; the service waits for the household password")
sharingRedirect(w, r, "flash.sharing.saved_needs_password")
return
}
// v0.147.0 (4b): the bring-up runs DETACHED and the page polls it. Synchronously it was a form
// post that hung for minutes on a first-enable image pull and then flashed „Beállítás mentve."
// regardless of whether anything actually came up.
@@ -53,6 +53,12 @@
<span class="badge badge-warn">{{T "sharing.eloszor_adj_meg_jelszot"}}</span>
{{end}}
</div>
{{- /* W21 (rehearsal 2026-10-20): the service waits for the password; the page says so at once. */}}
{{- if and .SMBEnabled (not .SMBUserSet)}}
<div class="alert alert-warning" id="smb-needs-password">
{{T "sharing.needs_password_why"}} <a href="#smb_password">{{T "sharing.needs_password_link"}}</a>
</div>
{{- end}}
<div class="form-hint">
{{T "sharing.egyes_halozatokon_a_gep_kesve"}}
<span class="mono">\\{{.SMBServerName}}</span> {{T "sharing.cim_beirasa_a_cimsorba_ilyenkor"}}
@@ -97,7 +103,7 @@
<div class="form-group">
<label for="smb_password">{{T "sharing.uj_jelszo"}}</label>
<input type="password" id="smb_password" name="smb_password" class="form-control"
autocomplete="new-password" minlength="8" required>
autocomplete="new-password" minlength="8" required{{if and .SMBEnabled (not .SMBUserSet)}} autofocus{{end}}>
</div>
<div class="form-group">
<label for="smb_password_confirm">{{T "sharing.jelszo_megerositese"}}</label>
@@ -221,6 +221,9 @@
<span class="badge badge-warn">először adj meg jelszót</span>
</div>
<div class="alert alert-warning" id="smb-needs-password">
Állíts be egy megosztási jelszót — enélkül a megosztás nem indul el. <a href="#smb_password">Jelszó beállítása</a>
</div>
<div class="form-hint">
Egyes hálózatokon a gép késve jelenik meg az eszközlistában. A
<span class="mono">\\FELHOM</span> cím beírása a címsorba ilyenkor is működik.
@@ -253,7 +256,7 @@
<div class="form-group">
<label for="smb_password">Új jelszó</label>
<input type="password" id="smb_password" name="smb_password" class="form-control"
autocomplete="new-password" minlength="8" required>
autocomplete="new-password" minlength="8" required autofocus>
</div>
<div class="form-group">
<label for="smb_password_confirm">Jelszó megerősítése</label>
@@ -223,6 +223,9 @@
<span class="badge badge-warn">először adj meg jelszót</span>
</div>
<div class="alert alert-warning" id="smb-needs-password">
Állíts be egy megosztási jelszót — enélkül a megosztás nem indul el. <a href="#smb_password">Jelszó beállítása</a>
</div>
<div class="form-hint">
Egyes hálózatokon a gép késve jelenik meg az eszközlistában. A
<span class="mono">\\FELHOM</span> cím beírása a címsorba ilyenkor is működik.
@@ -263,7 +266,7 @@
<div class="form-group">
<label for="smb_password">Új jelszó</label>
<input type="password" id="smb_password" name="smb_password" class="form-control"
autocomplete="new-password" minlength="8" required>
autocomplete="new-password" minlength="8" required autofocus>
</div>
<div class="form-group">
<label for="smb_password_confirm">Jelszó megerősítése</label>
@@ -221,6 +221,9 @@
<span class="badge badge-warn">először adj meg jelszót</span>
</div>
<div class="alert alert-warning" id="smb-needs-password">
Állíts be egy megosztási jelszót — enélkül a megosztás nem indul el. <a href="#smb_password">Jelszó beállítása</a>
</div>
<div class="form-hint">
Egyes hálózatokon a gép késve jelenik meg az eszközlistában. A
<span class="mono">\\FELHOM</span> cím beírása a címsorba ilyenkor is működik.
@@ -253,7 +256,7 @@
<div class="form-group">
<label for="smb_password">Új jelszó</label>
<input type="password" id="smb_password" name="smb_password" class="form-control"
autocomplete="new-password" minlength="8" required>
autocomplete="new-password" minlength="8" required autofocus>
</div>
<div class="form-group">
<label for="smb_password_confirm">Jelszó megerősítése</label>
@@ -221,6 +221,9 @@
<span class="badge badge-warn">először adj meg jelszót</span>
</div>
<div class="alert alert-warning" id="smb-needs-password">
Állíts be egy megosztási jelszót — enélkül a megosztás nem indul el. <a href="#smb_password">Jelszó beállítása</a>
</div>
<div class="form-hint">
Egyes hálózatokon a gép késve jelenik meg az eszközlistában. A
<span class="mono">\\FELHOM</span> cím beírása a címsorba ilyenkor is működik.
@@ -253,7 +256,7 @@
<div class="form-group">
<label for="smb_password">Új jelszó</label>
<input type="password" id="smb_password" name="smb_password" class="form-control"
autocomplete="new-password" minlength="8" required>
autocomplete="new-password" minlength="8" required autofocus>
</div>
<div class="form-group">
<label for="smb_password_confirm">Jelszó megerősítése</label>
@@ -0,0 +1,57 @@
package web
import (
"html"
"net/http"
"net/http/httptest"
"net/url"
"strings"
"testing"
)
// W21 (rehearsal 2026-10-20): „switch on" with no household SMB password answered „Beállítás mentve. A megosztási
// szolgáltatás előkészítése folyamatban…" — but reconcile never deploys without the password („deploy skipped —
// household SMB password not set yet") and the page stayed „Állapot: áll" for ever. The answer and the page now ask
// for the password at once and say why the service waits; with a password set, the bring-up is unchanged.
func TestW21_SwitchOnWithoutPasswordAsksForItAtOnce(t *testing.T) {
s := i18nTestServer(t)
enable := func() string {
r := httptest.NewRequest(http.MethodPost, "/sharing/enable", strings.NewReader(url.Values{"enabled": {"on"}}.Encode()))
r.Header.Set("Content-Type", "application/x-www-form-urlencoded")
w := httptest.NewRecorder()
s.sharingEnableHandler(w, r)
if w.Code != http.StatusSeeOther {
t.Fatalf("enable: %d", w.Code)
}
return w.Header().Get("Location")
}
loc := enable()
if !strings.Contains(loc, "flash.sharing.saved_needs_password") {
t.Fatalf("switch-on without a password must say the service waits for it: %q", loc)
}
for lang, want := range map[string][2]string{
"hu": {"A megosztás akkor indul el, amikor beállítod a megosztási jelszót.", "Állíts be egy megosztási jelszót — enélkül a megosztás nem indul el."},
"en": {"Sharing starts when you set the sharing password.", "Set a sharing password. Without it, sharing does not start."},
} {
r := httptest.NewRequest(http.MethodGet, loc, nil)
r.AddCookie(&http.Cookie{Name: langCookieName, Value: lang})
w := httptest.NewRecorder()
s.sharingPageHandler(w, r)
page := html.UnescapeString(w.Body.String())
if !strings.Contains(page, want[0]) || !strings.Contains(page, want[1]) || !strings.Contains(page, `id="smb-needs-password"`) {
t.Errorf("%s: the page does not ask for the password at once", lang)
}
if strings.Contains(page, "szolgáltatás előkészítése folyamatban") || strings.Contains(page, "is being prepared") {
t.Errorf("%s: the page still says the service is being prepared", lang)
}
}
// with the password set the page asks for nothing (the bring-up path is the existing one, pinned elsewhere)
if err := s.settings.SetSMBUserSet(true); err != nil {
t.Fatal(err)
}
w := httptest.NewRecorder()
s.sharingPageHandler(w, httptest.NewRequest(http.MethodGet, "/sharing", nil))
if strings.Contains(w.Body.String(), `id="smb-needs-password"`) {
t.Fatal("the needs-password alert shows although a password is set")
}
}