forked from binwiederhier/ntfy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PWA, service worker and Web Push
- Use new notification request/opt-in flow for push - Implement unsubscribing - Implement muting - Implement emojis in title - Add iOS specific PWA warning - Don’t use websockets when web push is enabled - Fix duplicate notifications - Implement default web push setting - Implement changing subscription type - Implement web push subscription refresh - Implement web push notification click
- Loading branch information
1 parent
733ef46
commit ff5c854
Showing
53 changed files
with
4,502 additions
and
388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ secrets/ | |
node_modules/ | ||
.DS_Store | ||
__pycache__ | ||
web/dev-dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//go:build !noserver | ||
|
||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/SherClockHolmes/webpush-go" | ||
"github.com/urfave/cli/v2" | ||
) | ||
|
||
func init() { | ||
commands = append(commands, cmdWebPush) | ||
} | ||
|
||
var cmdWebPush = &cli.Command{ | ||
Name: "web-push-keys", | ||
Usage: "Generate web push VAPID keys", | ||
UsageText: "ntfy web-push-keys", | ||
Category: categoryServer, | ||
Action: generateWebPushKeys, | ||
} | ||
|
||
func generateWebPushKeys(c *cli.Context) error { | ||
privateKey, publicKey, err := webpush.GenerateVAPIDKeys() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
fmt.Fprintf(c.App.ErrWriter, `Add the following lines to your config file: | ||
web-push-enabled: true | ||
web-push-public-key: %s | ||
web-push-private-key: %s | ||
web-push-subscriptions-file: <filename> | ||
web-push-email-address: <email address> | ||
`, publicKey, privateKey) | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.