mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat(coderd): add webpush package (#17091)
* 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>
This commit is contained in:
co-authored by
Kyle Carberry
parent
006600ea3e
commit
06e5d9ef21
Generated
+1
@@ -61,6 +61,7 @@ curl -X GET http://coder-server:8080/api/v2/buildinfo \
|
||||
"telemetry": true,
|
||||
"upgrade_message": "string",
|
||||
"version": "string",
|
||||
"webpush_public_key": "string",
|
||||
"workspace_proxy": true
|
||||
}
|
||||
```
|
||||
|
||||
Generated
+5
@@ -210,6 +210,7 @@ Status Code **200**
|
||||
| `resource_type` | `tailnet_coordinator` |
|
||||
| `resource_type` | `template` |
|
||||
| `resource_type` | `user` |
|
||||
| `resource_type` | `webpush_subscription` |
|
||||
| `resource_type` | `workspace` |
|
||||
| `resource_type` | `workspace_agent_devcontainers` |
|
||||
| `resource_type` | `workspace_agent_resource_monitor` |
|
||||
@@ -375,6 +376,7 @@ Status Code **200**
|
||||
| `resource_type` | `tailnet_coordinator` |
|
||||
| `resource_type` | `template` |
|
||||
| `resource_type` | `user` |
|
||||
| `resource_type` | `webpush_subscription` |
|
||||
| `resource_type` | `workspace` |
|
||||
| `resource_type` | `workspace_agent_devcontainers` |
|
||||
| `resource_type` | `workspace_agent_resource_monitor` |
|
||||
@@ -540,6 +542,7 @@ Status Code **200**
|
||||
| `resource_type` | `tailnet_coordinator` |
|
||||
| `resource_type` | `template` |
|
||||
| `resource_type` | `user` |
|
||||
| `resource_type` | `webpush_subscription` |
|
||||
| `resource_type` | `workspace` |
|
||||
| `resource_type` | `workspace_agent_devcontainers` |
|
||||
| `resource_type` | `workspace_agent_resource_monitor` |
|
||||
@@ -674,6 +677,7 @@ Status Code **200**
|
||||
| `resource_type` | `tailnet_coordinator` |
|
||||
| `resource_type` | `template` |
|
||||
| `resource_type` | `user` |
|
||||
| `resource_type` | `webpush_subscription` |
|
||||
| `resource_type` | `workspace` |
|
||||
| `resource_type` | `workspace_agent_devcontainers` |
|
||||
| `resource_type` | `workspace_agent_resource_monitor` |
|
||||
@@ -1030,6 +1034,7 @@ Status Code **200**
|
||||
| `resource_type` | `tailnet_coordinator` |
|
||||
| `resource_type` | `template` |
|
||||
| `resource_type` | `user` |
|
||||
| `resource_type` | `webpush_subscription` |
|
||||
| `resource_type` | `workspace` |
|
||||
| `resource_type` | `workspace_agent_devcontainers` |
|
||||
| `resource_type` | `workspace_agent_resource_monitor` |
|
||||
|
||||
Generated
+36
@@ -964,6 +964,7 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
"telemetry": true,
|
||||
"upgrade_message": "string",
|
||||
"version": "string",
|
||||
"webpush_public_key": "string",
|
||||
"workspace_proxy": true
|
||||
}
|
||||
```
|
||||
@@ -980,6 +981,7 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
| `telemetry` | boolean | false | | Telemetry is a boolean that indicates whether telemetry is enabled. |
|
||||
| `upgrade_message` | string | false | | Upgrade message is the message displayed to users when an outdated client is detected. |
|
||||
| `version` | string | false | | Version returns the semantic version of the build. |
|
||||
| `webpush_public_key` | string | false | | Webpush public key is the public key for push notifications via Web Push. |
|
||||
| `workspace_proxy` | boolean | false | | |
|
||||
|
||||
## codersdk.BuildReason
|
||||
@@ -1755,6 +1757,20 @@ CreateWorkspaceRequest provides options for creating a new workspace. Only one o
|
||||
| `allow_path_app_sharing` | boolean | false | | |
|
||||
| `allow_path_app_site_owner_access` | boolean | false | | |
|
||||
|
||||
## codersdk.DeleteWebpushSubscription
|
||||
|
||||
```json
|
||||
{
|
||||
"endpoint": "string"
|
||||
}
|
||||
```
|
||||
|
||||
### Properties
|
||||
|
||||
| Name | Type | Required | Restrictions | Description |
|
||||
|------------|--------|----------|--------------|-------------|
|
||||
| `endpoint` | string | false | | |
|
||||
|
||||
## codersdk.DeleteWorkspaceAgentPortShareRequest
|
||||
|
||||
```json
|
||||
@@ -2804,6 +2820,7 @@ CreateWorkspaceRequest provides options for creating a new workspace. Only one o
|
||||
| `auto-fill-parameters` |
|
||||
| `notifications` |
|
||||
| `workspace-usage` |
|
||||
| `web-push` |
|
||||
|
||||
## codersdk.ExternalAuth
|
||||
|
||||
@@ -5344,6 +5361,7 @@ Git clone makes use of this by parsing the URL from: 'Username for "https://gith
|
||||
| `tailnet_coordinator` |
|
||||
| `template` |
|
||||
| `user` |
|
||||
| `webpush_subscription` |
|
||||
| `workspace` |
|
||||
| `workspace_agent_devcontainers` |
|
||||
| `workspace_agent_resource_monitor` |
|
||||
@@ -7470,6 +7488,24 @@ If the schedule is empty, the user will be updated to use the default schedule.|
|
||||
| `name` | string | false | | |
|
||||
| `value` | string | false | | |
|
||||
|
||||
## codersdk.WebpushSubscription
|
||||
|
||||
```json
|
||||
{
|
||||
"auth_key": "string",
|
||||
"endpoint": "string",
|
||||
"p256dh_key": "string"
|
||||
}
|
||||
```
|
||||
|
||||
### Properties
|
||||
|
||||
| Name | Type | Required | Restrictions | Description |
|
||||
|--------------|--------|----------|--------------|-------------|
|
||||
| `auth_key` | string | false | | |
|
||||
| `endpoint` | string | false | | |
|
||||
| `p256dh_key` | string | false | | |
|
||||
|
||||
## codersdk.Workspace
|
||||
|
||||
```json
|
||||
|
||||
Reference in New Issue
Block a user