Skip to content

Commit

Permalink
Add Android WebSockets deprecation, remove 'ntfy serve' deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Heckel committed Mar 14, 2022
1 parent 207e990 commit d0bbda5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
9 changes: 0 additions & 9 deletions cmd/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ func New() *cli.App {
Reader: os.Stdin,
Writer: os.Stdout,
ErrWriter: os.Stderr,
Action: execMainApp,
Before: initConfigFileInputSource("config", flagsServe), // DEPRECATED, see deprecation notice
Flags: flagsServe, // DEPRECATED, see deprecation notice
Commands: []*cli.Command{
// Server commands
cmdServe,
Expand All @@ -46,12 +43,6 @@ func New() *cli.App {
}
}

func execMainApp(c *cli.Context) error {
fmt.Fprintln(c.App.ErrWriter, "\x1b[1;33mDeprecation notice: Please run the server using 'ntfy serve'; see 'ntfy -h' for help.\x1b[0m")
fmt.Fprintln(c.App.ErrWriter, "\x1b[1;33mThis way of running the server will be removed March 2022. See https://ntfy.sh/docs/deprecations/ for details.\x1b[0m")
return execServe(c)
}

// initConfigFileInputSource is like altsrc.InitInputSourceWithContext and altsrc.NewYamlSourceFromFlagFunc, but checks
// if the config flag is exists and only loads it if it does. If the flag is set and the file exists, it fails.
func initConfigFileInputSource(configFlag string, flags []cli.Flag) cli.BeforeFunc {
Expand Down
6 changes: 4 additions & 2 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,10 @@ HTTP challenge. I've found [this guide](https://nandovieira.com/using-lets-encry
be incredibly helpful.

### nginx/Apache2/caddy
For your convenience, here's a working config that'll help configure things behind a proxy. In this
example, ntfy runs on `:2586` and we proxy traffic to it. We also redirect HTTP to HTTPS for GET requests against a topic
For your convenience, here's a working config that'll help configure things behind a proxy. Be sure to **enable WebSockets**
by forwarding the `Connection` and `Upgrade` headers accordingly.

In this example, ntfy runs on `:2586` and we proxy traffic to it. We also redirect HTTP to HTTPS for GET requests against a topic
or the root domain:

=== "nginx (/etc/nginx/sites-*/ntfy)"
Expand Down
12 changes: 10 additions & 2 deletions docs/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,24 @@ This page is used to list deprecation notices for ntfy. Deprecated commands and

## Active deprecations

### Android app: Using `since=<timestamp>` instead of `since=<id>`
### Android app: WebSockets will become the default connection protocol
> since 2022-03-13
In future versions of the Android app, instant delivery connections and connections to self-hosted servers will
be using the WebSockets protocol. This potentially requires [configuration changes in your proxy](https://ntfy.sh/docs/config/#nginxapache2caddy).

### Android app: Using `since=<timestamp>` instead of `since=<id>`
> since 2022-02-27
In about 3 months, the Android app will start using `since=<id>` instead of `since=<timestamp>`, which means that it will
not work with servers older than v1.16.0 anymore. This is to simplify handling of deduplication in the Android app.

The `since=<timestamp>` endpoint will continue to work. This is merely a notice that the Android app behavior will change.

## Previous deprecations

### Running server via `ntfy` (instead of `ntfy serve`)
> since 2021-12-17
> deprecated 2021-12-17, behavior changed with v1.10.0
As more commands are added to the `ntfy` CLI tool, using just `ntfy` to run the server is not practical
anymore. Please use `ntfy serve` instead. This also applies to Docker images, as they can also execute more than
Expand Down

0 comments on commit d0bbda5

Please sign in to comment.