feat(pwa): add web share target for text and images with offline queue

This commit is contained in:
sandrodach committed 2026-10-30 20:23:54 +01:00
1 parent c181ffea54
commit 86d2cd0138
9 files changed
+360 -2

No files matched your search

+18
View File
@@ -1533,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()