diff --git a/.gitpod.yml b/.gitpod.yml
new file mode 100644
index 00000000..6cccd8f2
--- /dev/null
+++ b/.gitpod.yml
@@ -0,0 +1,28 @@
+tasks:
+ - name: docs
+ before: make docs-deps
+ command: mkdocs serve
+ - name: binary
+ before: |
+ npm install --global nodemon
+ make cli-deps-static-sites
+ command: |
+ nodemon --watch './**/*.go' --ext go --signal SIGTERM --exec "CGO_ENABLED=1 go run main.go serve --listen-http :2586 --debug --base-url $(gp url 2586)"
+ openMode: split-right
+ - name: web
+ before: make web-deps
+ command: cd web && npm start
+ openMode: split-right
+
+vscode:
+ extensions:
+ - golang.go
+ - ms-azuretools.vscode-docker
+
+ports:
+ - name: docs
+ port: 8000
+ - name: binary
+ port: 2586
+ - name: web
+ port: 3000
\ No newline at end of file
diff --git a/README.md b/README.md
index 0c2926e3..de456be2 100644
--- a/README.md
+++ b/README.md
@@ -11,6 +11,8 @@
[![Matrix space](https://img.shields.io/matrix/ntfy-space:matrix.org?label=Matrix+space)](https://matrix.to/#/#ntfy-space:matrix.org)
[![Reddit](https://img.shields.io/reddit/subreddit-subscribers/ntfy?color=%23317f6f&label=-%20r%2Fntfy&style=social)](https://www.reddit.com/r/ntfy/)
[![Healthcheck](https://healthchecks.io/badge/68b65976-b3b0-4102-aec9-980921/kcoEgrLY.svg)](https://ntfy.statuspage.io/)
+[![Gitpod](https://img.shields.io/badge/Contribute%20with-Gitpod-908a85?logo=gitpod)](https://gitpod.io/#https://github.com/binwiederhier/ntfy)
+
**ntfy** (pronounce: *notify*) is a simple HTTP-based [pub-sub](https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern) notification service.
It allows you to **send notifications to your phone or desktop via scripts** from any computer, entirely **without signup or cost**.
@@ -94,8 +96,12 @@ appreciated. A big fat **Thank You** to the folks already sponsoring ntfy:
+
+
+
-I'd also like to thank [DigitalOcean](https://www.digitalocean.com/) for supporting the project with $60/yr:
+I'd also like to thank [IntelliJ IDEA](https://www.jetbrains.com/idea/) for providing their awesome IDE to me for free,
+and [DigitalOcean](https://www.digitalocean.com/) for supporting the project with $60/yr:
diff --git a/docs/develop.md b/docs/develop.md
index f3da274a..23a6c1bb 100644
--- a/docs/develop.md
+++ b/docs/develop.md
@@ -43,6 +43,13 @@ Build related:
The `web/` and `docs/` folder are the sources for web app and documentation. During the build process,
the generated output is copied to `server/site` (web app and landing page) and `server/docs` (documentation).
+### Build/test on Gitpod
+To get a quick working development environment you can use [Gitpod](https://gitpod.io), an in-browser IDE
+that makes it easy to develop ntfy without having to set up a desktop IDE. For any real development,
+I do suggest a proper IDE like [IntelliJ IDEA](https://www.jetbrains.com/idea/).
+
+[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/binwiederhier/ntfy)
+
### Build requirements
* [Go](https://go.dev/) (required for main server)
diff --git a/docs/releases.md b/docs/releases.md
index cfb50825..a2c69253 100644
--- a/docs/releases.md
+++ b/docs/releases.md
@@ -7,33 +7,27 @@ and the [ntfy Android app](https://github.com/binwiederhier/ntfy-android/release
**Features:**
* Web: Generate random topic name button ([#453](https://github.com/binwiederhier/ntfy/issues/453), thanks to [@yardenshoham](https://github.com/yardenshoham))
+* Add [Gitpod config](https://github.com/binwiederhier/ntfy/blob/main/.gitpod.yml) ([#540](https://github.com/binwiederhier/ntfy/pull/540), thanks to [@yardenshoham](https://github.com/yardenshoham))
**Bug fixes + maintenance:**
* Remove `--env-topic` option from `ntfy publish` as per [deprecation](deprecations.md) (no ticket)
+* Prepared statements for message cache writes ([#542](https://github.com/binwiederhier/ntfy/pull/542), thanks to [@nicois](https://github.com/nicois))
-## ntfy Android app v1.16.0 (UNRELEASED)
+## ntfy Android app v1.16.0
+Released December 11, 2022
+
+This is a feature and platform/dependency upgrade release. You can now have per-subscription notification settings
+(including sounds, DND, etc.), and you can make notifications continue ringing until they are dismissed. There's also
+support for thematic/adaptive launcher icon for Android 13.
+
+There are a few more Android 13 specific things, as well as many bug fixes: No more crashes from large images, no more
+opening the wrong subscription, and we also fixed the icon color issue.
**Features:**
* Custom per-subscription notification settings incl. sounds, DND, etc. ([#6](https://github.com/binwiederhier/ntfy/issues/6), thanks to [@doits](https://github.com/doits))
* Insistent notifications that ring until dismissed ([#417](https://github.com/binwiederhier/ntfy/issues/417), thanks to [@danmed](https://github.com/danmed) for reporting)
-
-**Bug fixes:**
-
-* Android 5 (SDK 21): Fix crash on unsubscribing ([#528](https://github.com/binwiederhier/ntfy/issues/528), thanks to Roger M.)
-
-## ntfy Android app v1.15.2 (UNRELEASED)
-
-This release is mainly a platform and dependency upgrade release, sprinkled with lots and lots of bugfixes. This version
-now targets SDK 33 (Android 13), and brings a few Android 13 specific improvements. Most prominently, ntfy now supports
-thematic/adaptive launcher icons.
-
-Other than that, the app now doesn't crash anymore when you send large attachment images, and we fixed the notification
-icon color.
-
-**Features:**
-
* Add thematic/adaptive launcher icon ([#513](https://github.com/binwiederhier/ntfy/issues/513), thanks to [@daedric7](https://github.com/daedric7) for reporting)
**Bug fixes + maintenance:**
@@ -42,6 +36,7 @@ icon color.
* Simplify F-Droid build: Disable tasks for Google Services ([#516](https://github.com/binwiederhier/ntfy/issues/516), thanks to [@markosopcic](https://github.com/markosopcic))
* Android 13: Ask for permission to post notifications ([#508](https://github.com/binwiederhier/ntfy/issues/508))
* Android 13: Do not allow swiping away the foreground notification ([#521](https://github.com/binwiederhier/ntfy/issues/521), thanks to [@alexhorner](https://github.com/alexhorner) for reporting)
+* Android 5 (SDK 21): Fix crash on unsubscribing ([#528](https://github.com/binwiederhier/ntfy/issues/528), thanks to Roger M.)
* Remove timestamp when copying message text ([#471](https://github.com/binwiederhier/ntfy/issues/471), thanks to [@wunter8](https://github.com/wunter8))
* Fix auto-delete if some icons do not exist anymore ([#506](https://github.com/binwiederhier/ntfy/issues/506))
* Fix notification icon color ([#480](https://github.com/binwiederhier/ntfy/issues/480), thanks to [@s-h-a-r-d](https://github.com/s-h-a-r-d) for reporting)
diff --git a/server/message_cache.go b/server/message_cache.go
index 3972470b..376c7611 100644
--- a/server/message_cache.go
+++ b/server/message_cache.go
@@ -258,12 +258,20 @@ func (c *messageCache) addMessages(ms []*message) error {
if c.nop {
return nil
}
+ if len(ms) == 0 {
+ return nil
+ }
start := time.Now()
tx, err := c.db.Begin()
if err != nil {
return err
}
defer tx.Rollback()
+ stmt, err := tx.Prepare(insertMessageQuery)
+ if err != nil {
+ return err
+ }
+ defer stmt.Close()
for _, m := range ms {
if m.Event != messageEvent {
return errUnexpectedMessageType
@@ -291,8 +299,7 @@ func (c *messageCache) addMessages(ms []*message) error {
if m.Sender.IsValid() {
sender = m.Sender.String()
}
- _, err := tx.Exec(
- insertMessageQuery,
+ _, err := stmt.Exec(
m.ID,
m.Time,
m.Topic,
diff --git a/web/src/app/utils.js b/web/src/app/utils.js
index e98ac77a..ea1a21aa 100644
--- a/web/src/app/utils.js
+++ b/web/src/app/utils.js
@@ -253,7 +253,7 @@ export async function* fetchLinesIterator(fileURL, headers) {
}
export const randomAlphanumericString = (len) => {
- const alphabet = "abcdefghijklmnopqrstuvwxyz0123456789";
+ const alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
let id = "";
for (let i = 0; i < len; i++) {
id += alphabet[(Math.random() * alphabet.length) | 0];