Commit Graph
901 Commits
Author SHA1 Message Date
binwiederhier 4e5f95ba0c Refactor webpush store to eliminate code duplication
Consolidate SQLite and Postgres store implementations into a single
commonStore with database-specific SQL queries passed via configuration.
This eliminates ~100 lines of duplicate code while maintaining full
functionality for both backends.

Key changes:
- Move all store methods to commonStore in store.go
- Remove sqliteStore and postgresStore wrapper structs
- Refactor SQLite to use QueryRow() pattern like Postgres
- Pass database-specific queries via storeQueries struct
- Make store types unexported, only expose Store interface

All tests pass for both SQLite and PostgreSQL backends.
2026-02-16 19:53:34 -05:00
binwiederhier a8dcecdb6d Refactor webpush store tests and add coverage
- Add SetSubscriptionUpdatedAt to Store interface, remove DB() accessor
- Rename store files to store_sqlite.go and store_postgres.go
- Use camelCase for test function names
- Add tests for upsert field updates and multi-user removal
- Use transaction in setupNewPostgresDB
- Use lowercase "excluded." in PostgreSQL upsert query
2026-02-16 18:53:12 -05:00
binwiederhier 5331437664 Unify webpush store tests across SQLite and PostgreSQL backends
Share test logic in store_test.go with thin per-backend wrappers.
Add SetSubscriptionUpdatedAt to both stores, removing the need for
raw SQL and the DB() accessor in tests.
2026-02-16 12:38:00 -05:00
binwiederhier e432bf2886 Rename PostgreSQL table prefix from wp_ to webpush_ 2026-02-16 12:13:10 -05:00
binwiederhier c6ab380ea4 Merge branch '1364-copy-action' 2026-02-08 20:46:54 -05:00
binwiederhier cfdc364e3f Version API endpoint 2026-02-08 14:28:27 -05:00
binwiederhier 3f0a7b65ee Server/Web: Support "copy" action button to copy a value to the clipboard 2026-02-08 14:20:03 -05:00
binwiederhier 65050ef4dc Fix server crash (nil pointer panic) when subscriber disconnects during publish 2026-02-08 11:23:31 -05:00
binwiederhier 3647d3975c Fix panic in handleSubscribeHTTP when client disconnects during publish
Replace wlock.TryLock() with a proper Lock() + closed flag to prevent
writing to a response writer that has been cleaned up after the handler
returns. The previous TryLock approach could not guarantee the response
writer was still valid when a concurrent Publish goroutine called Flush.
2026-02-08 10:49:31 -05:00
binwiederhier 570b188a88 Support for templating the priority header 2026-02-04 09:46:09 -08:00
binwiederhier 08eaafa77b Fix log spam from http: response.WriteHeader on hijacked connection for WebSocket errors 2026-02-04 06:05:54 -08:00
Alexander Ivanov b26546b709 chore: fix typos in server.yml config file
Signed-off-by: Alexander Ivanov <oshli.a.er@gmail.com>
2026-01-25 19:19:31 +03:00
binwiederhier d8232e539a PWA description 2026-01-19 20:38:42 -05:00
binwiederhier 602f201bae Derp 2026-01-18 19:15:10 -05:00
binwiederhier ac9cfbfaf4 Delete attachments 2026-01-18 16:04:42 -05:00
binwiederhier c23d201186 Updated/cancel scheduled messages 2026-01-18 15:50:40 -05:00
binwiederhier eddf654b96 Last fixes 2026-01-18 10:56:11 -05:00
binwiederhier 856f150958 Better 2026-01-18 10:46:15 -05:00
binwiederhier 5a1aa68ead Refine 2026-01-18 09:44:21 -05:00
binwiederhier cc9f9c0d24 Update checker 2026-01-17 20:36:15 -05:00
binwiederhier 353fedb93f Docs, lint 2026-01-17 14:59:43 -05:00
binwiederhier 6d5cc6aeac Windows server support 2026-01-17 14:43:43 -05:00
binwiederhier b23f6632b1 Use Go templates, update docs 2026-01-17 04:59:46 -05:00
binwiederhier 6bacf7dafc Works 2026-01-17 04:34:32 -05:00
binwiederhier 0e200b96e0 Merge branch 'main' of github.com:binwiederhier/ntfy into feature/twilio-call-format-file 2026-01-17 03:49:52 -05:00
binwiederhier c1ee163cab Remove cache thing 2026-01-16 10:07:09 -05:00
binwiederhier fcf57a04e1 Move event up 2026-01-16 09:36:27 -05:00
binwiederhier 2cc4bf7d28 Fix webpush stuff 2026-01-15 21:55:20 -05:00
binwiederhier 96638b516c Fix service worker handling for updating/deleting 2026-01-14 20:46:18 -05:00
binwiederhier 44f20f6b4c Add tests, fix firebase 2026-01-13 20:50:31 -05:00
binwiederhier a3c16d81f8 Rename to clear 2026-01-13 16:31:13 -05:00
binwiederhier 37d71051de Refine 2026-01-08 20:57:55 -05:00
binwiederhier 5ad3de2904 Switch to event type 2026-01-08 20:50:23 -05:00
binwiederhier 66ea25c18b Add JSON publishing support 2026-01-08 15:45:50 -05:00
binwiederhier 1ab7ca876c Rename to sequence_id 2026-01-08 14:27:18 -05:00
binwiederhier dffee9ea7d Remove forJSON 2026-01-08 11:39:32 -05:00
binwiederhier 2dd152df3f Manual fixes for AI slop 2026-01-06 18:02:08 -05:00
binwiederhier 2856793eff Deleted 2026-01-06 14:22:55 -05:00
binwiederhier aca9a77498 Remove mtime 2026-01-05 21:14:29 -05:00
binwiederhier 1c2550d749 Merge branch 'main' into 303-update-notifications 2026-01-05 15:34:42 -05:00
binwiederhier 17870cb471 Fix use of deprecated secrets file 2025-12-21 21:37:55 -05:00
Hunter Kehoe fb89b87efb do not escape JSON response 2025-12-07 14:15:36 -07:00
Hunter Kehoe 83b5470bc5 publish messages with a custom sequence ID 2025-10-17 19:01:41 -06:00
Hunter Kehoe 2aae3577cb add sid, mtime, and deleted to message_cache 2025-10-17 17:39:55 -06:00
binwiederhier 50f3563477 Docs 2025-08-24 21:18:28 -04:00
binwiederhier 3de04b27ab Redirect to login page if require-login is enabled 2025-08-24 13:48:19 -04:00
binwiederhier ec1f97b726 Merge remote-tracking branch 'theatischbein/feat_optional_require_login' into require-login 2025-08-24 13:34:22 -04:00
binwiederhier fe5c844a21 Add test 2025-08-08 16:10:49 -04:00
binwiederhier 97410db301 Merge remote-tracking branch 'timofej673/main' into message-cache-lock 2025-08-08 16:06:27 -04:00
binwiederhier 57a51ab2da Fix tests 2025-08-08 15:16:53 -04:00