Merge branch 'feat/footer-share-ci' into dev
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 2m39s

CI keeps the 'test once per code state' plan but records commit and
git tree as image labels instead of extra :sha-/:tree- tags, so the
registry only holds dev, latest, vX.Y.Z and stable; the plan test now
asserts the expected decisions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
sandrodachandClaude Opus 5.5 committed 2026-10-30 21:29:56 +01:00
commit 141f87f3a0
22 files changed
+735 -61

No files matched your search

+2
View File
@@ -52,6 +52,8 @@ func (s *Server) handleAuthStatus(w http.ResponseWriter, r *http.Request) {
"hasImprintContent": s.cfg.Legal.ImprintContent != "",
"privacyUrl": s.cfg.Legal.PrivacyURL,
"hasPrivacyContent": s.cfg.Legal.PrivacyContent != "",
"customLinkLabel": s.cfg.Legal.CustomLinkLabel,
"customLinkUrl": s.cfg.Legal.CustomLinkURL,
},
}
// Countdown to the next demo reset; seconds as well, so client clocks do not matter
+5
View File
@@ -316,6 +316,11 @@ func (s *Server) Router() http.Handler {
})
})
// Web Share Target fallback when service worker is not active yet: redirect to /
r.Post("/share-target", func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/", http.StatusSeeOther)
})
// Embedded Frontend SPA Handler
if s.staticFS != nil {
fileServer := http.FileServer(http.FS(s.staticFS))
+27 -2
View File
@@ -1388,7 +1388,12 @@ func TestLegalTextsArePublic(t *testing.T) {
}
defer store.Close()
cfg := &config.Config{Port: "8080", DatabasePath: dbPath, JWTSecret: "test-jwt-secret-key",
Legal: config.LegalTexts{ImprintContent: "# Impressum\nMax Muster", PrivacyURL: "https://example.org/datenschutz"}}
Legal: config.LegalTexts{
ImprintContent: "# Impressum\nMax Muster",
PrivacyURL: "https://example.org/datenschutz",
CustomLinkLabel: "Support",
CustomLinkURL: "https://support.example.org",
}}
router := NewServer(cfg, store, ws.NewHub(), nil).Router()
rec := httptest.NewRecorder()
@@ -1399,10 +1404,12 @@ func TestLegalTextsArePublic(t *testing.T) {
HasImprintContent bool `json:"hasImprintContent"`
PrivacyURL string `json:"privacyUrl"`
HasPrivacyContent bool `json:"hasPrivacyContent"`
CustomLinkLabel string `json:"customLinkLabel"`
CustomLinkURL string `json:"customLinkUrl"`
} `json:"legal"`
}
_ = json.Unmarshal(rec.Body.Bytes(), &st)
if !st.Legal.HasImprintContent || st.Legal.HasPrivacyContent || st.Legal.PrivacyURL != "https://example.org/datenschutz" {
if !st.Legal.HasImprintContent || st.Legal.HasPrivacyContent || st.Legal.PrivacyURL != "https://example.org/datenschutz" || st.Legal.CustomLinkLabel != "Support" || st.Legal.CustomLinkURL != "https://support.example.org" {
t.Fatalf("unexpected legal status: %+v", st.Legal)
}
@@ -1526,6 +1533,24 @@ func TestPasswordResetFlow(t *testing.T) {
}
}
func TestShareTargetFallbackRedirects(t *testing.T) {
store, err := storage.NewStore(":memory:")
if err != nil {
t.Fatalf("NewStore: %v", err)
}
defer store.Close()
router := NewServer(&config.Config{Port: "8080", DatabasePath: ":memory:", JWTSecret: "test-jwt-secret-key"}, store, ws.NewHub(), nil).Router()
rec := httptest.NewRecorder()
req := httptest.NewRequest(http.MethodPost, "/share-target", nil)
router.ServeHTTP(rec, req)
if rec.Code != http.StatusSeeOther {
t.Fatalf("expected 303 See Other, got %d", rec.Code)
}
if loc := rec.Header().Get("Location"); loc != "/" {
t.Fatalf("expected Location '/', got %q", loc)
}
}
// testSession starts a server-side session, as a login would, for tokens made directly in tests.
func testSession(t *testing.T, store *storage.Store, userID string) string {
t.Helper()