mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
* Adds `codersdk.ExperimentWebPush` (`web-push`) * Adds a `coderd/webpush` package that allows sending native push notifications via `github.com/SherClockHolmes/webpush-go` * Adds database tables to store push notification subscriptions. * Adds an API endpoint that allows users to subscribe/unsubscribe, and send a test notification (404 without experiment, excluded from API docs) * Adds server CLI command to regenerate VAPID keys (note: regenerating the VAPID keypair requires deleting all existing subscriptions) --------- Co-authored-by: Kyle Carberry <kyle@carberry.com>
14 lines
701 B
SQL
14 lines
701 B
SQL
-- webpush_subscriptions is a table that stores push notification
|
|
-- subscriptions for users. These are acquired via the Push API in the browser.
|
|
CREATE TABLE IF NOT EXISTS webpush_subscriptions (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
user_id UUID NOT NULL REFERENCES users ON DELETE CASCADE,
|
|
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
-- endpoint is called by coderd to send a push notification to the user.
|
|
endpoint TEXT NOT NULL,
|
|
-- endpoint_p256dh_key is the public key for the endpoint.
|
|
endpoint_p256dh_key TEXT NOT NULL,
|
|
-- endpoint_auth_key is the authentication key for the endpoint.
|
|
endpoint_auth_key TEXT NOT NULL
|
|
);
|