From 0521f19ea4443937bc0569c3ff7f9d24c2abc111 Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Thu, 2 Jun 2022 20:59:07 -0400 Subject: [PATCH] Fix docs header color; tiny other fixes with logging --- docs/install.md | 58 +++++++++++++++++----------------- docs/releases.md | 10 ++---- docs/static/css/extra.css | 2 +- docs/static/js/extra.js | 8 ++--- server/server.go | 8 +++-- server/server_firebase.go | 5 +-- server/server_firebase_test.go | 2 +- 7 files changed, 47 insertions(+), 46 deletions(-) diff --git a/docs/install.md b/docs/install.md index 092c9a4b..5e9f8d44 100644 --- a/docs/install.md +++ b/docs/install.md @@ -26,37 +26,37 @@ deb/rpm packages. === "x86_64/amd64" ```bash - wget https://github.com/binwiederhier/ntfy/releases/download/v1.25.0/ntfy_1.25.0_linux_x86_64.tar.gz - tar zxvf ntfy_1.25.0_linux_x86_64.tar.gz - sudo cp -a ntfy_1.25.0_linux_x86_64/ntfy /usr/bin/ntfy - sudo mkdir /etc/ntfy && sudo cp ntfy_1.25.0_linux_x86_64/{client,server}/*.yml /etc/ntfy + wget https://github.com/binwiederhier/ntfy/releases/download/v1.25.1/ntfy_1.25.1_linux_x86_64.tar.gz + tar zxvf ntfy_1.25.1_linux_x86_64.tar.gz + sudo cp -a ntfy_1.25.1_linux_x86_64/ntfy /usr/bin/ntfy + sudo mkdir /etc/ntfy && sudo cp ntfy_1.25.1_linux_x86_64/{client,server}/*.yml /etc/ntfy sudo ntfy serve ``` === "armv6" ```bash - wget https://github.com/binwiederhier/ntfy/releases/download/v1.25.0/ntfy_1.25.0_linux_armv6.tar.gz - tar zxvf ntfy_1.25.0_linux_armv6.tar.gz - sudo cp -a ntfy_1.25.0_linux_armv6/ntfy /usr/bin/ntfy - sudo mkdir /etc/ntfy && sudo cp ntfy_1.25.0_linux_armv6/{client,server}/*.yml /etc/ntfy + wget https://github.com/binwiederhier/ntfy/releases/download/v1.25.1/ntfy_1.25.1_linux_armv6.tar.gz + tar zxvf ntfy_1.25.1_linux_armv6.tar.gz + sudo cp -a ntfy_1.25.1_linux_armv6/ntfy /usr/bin/ntfy + sudo mkdir /etc/ntfy && sudo cp ntfy_1.25.1_linux_armv6/{client,server}/*.yml /etc/ntfy sudo ntfy serve ``` === "armv7/armhf" ```bash - wget https://github.com/binwiederhier/ntfy/releases/download/v1.25.0/ntfy_1.25.0_linux_armv7.tar.gz - tar zxvf ntfy_1.25.0_linux_armv7.tar.gz - sudo cp -a ntfy_1.25.0_linux_armv7/ntfy /usr/bin/ntfy - sudo mkdir /etc/ntfy && sudo cp ntfy_1.25.0_linux_armv7/{client,server}/*.yml /etc/ntfy + wget https://github.com/binwiederhier/ntfy/releases/download/v1.25.1/ntfy_1.25.1_linux_armv7.tar.gz + tar zxvf ntfy_1.25.1_linux_armv7.tar.gz + sudo cp -a ntfy_1.25.1_linux_armv7/ntfy /usr/bin/ntfy + sudo mkdir /etc/ntfy && sudo cp ntfy_1.25.1_linux_armv7/{client,server}/*.yml /etc/ntfy sudo ntfy serve ``` === "arm64" ```bash - wget https://github.com/binwiederhier/ntfy/releases/download/v1.25.0/ntfy_1.25.0_linux_arm64.tar.gz - tar zxvf ntfy_1.25.0_linux_arm64.tar.gz - sudo cp -a ntfy_1.25.0_linux_arm64/ntfy /usr/bin/ntfy - sudo mkdir /etc/ntfy && sudo cp ntfy_1.25.0_linux_arm64/{client,server}/*.yml /etc/ntfy + wget https://github.com/binwiederhier/ntfy/releases/download/v1.25.1/ntfy_1.25.1_linux_arm64.tar.gz + tar zxvf ntfy_1.25.1_linux_arm64.tar.gz + sudo cp -a ntfy_1.25.1_linux_arm64/ntfy /usr/bin/ntfy + sudo mkdir /etc/ntfy && sudo cp ntfy_1.25.1_linux_arm64/{client,server}/*.yml /etc/ntfy sudo ntfy serve ``` @@ -103,7 +103,7 @@ Manually installing the .deb file: === "x86_64/amd64" ```bash - wget https://github.com/binwiederhier/ntfy/releases/download/v1.25.0/ntfy_1.25.0_linux_amd64.deb + wget https://github.com/binwiederhier/ntfy/releases/download/v1.25.1/ntfy_1.25.1_linux_amd64.deb sudo dpkg -i ntfy_*.deb sudo systemctl enable ntfy sudo systemctl start ntfy @@ -111,7 +111,7 @@ Manually installing the .deb file: === "armv6" ```bash - wget https://github.com/binwiederhier/ntfy/releases/download/v1.25.0/ntfy_1.25.0_linux_armv6.deb + wget https://github.com/binwiederhier/ntfy/releases/download/v1.25.1/ntfy_1.25.1_linux_armv6.deb sudo dpkg -i ntfy_*.deb sudo systemctl enable ntfy sudo systemctl start ntfy @@ -119,7 +119,7 @@ Manually installing the .deb file: === "armv7/armhf" ```bash - wget https://github.com/binwiederhier/ntfy/releases/download/v1.25.0/ntfy_1.25.0_linux_armv7.deb + wget https://github.com/binwiederhier/ntfy/releases/download/v1.25.1/ntfy_1.25.1_linux_armv7.deb sudo dpkg -i ntfy_*.deb sudo systemctl enable ntfy sudo systemctl start ntfy @@ -127,7 +127,7 @@ Manually installing the .deb file: === "arm64" ```bash - wget https://github.com/binwiederhier/ntfy/releases/download/v1.25.0/ntfy_1.25.0_linux_arm64.deb + wget https://github.com/binwiederhier/ntfy/releases/download/v1.25.1/ntfy_1.25.1_linux_arm64.deb sudo dpkg -i ntfy_*.deb sudo systemctl enable ntfy sudo systemctl start ntfy @@ -137,28 +137,28 @@ Manually installing the .deb file: === "x86_64/amd64" ```bash - sudo rpm -ivh https://github.com/binwiederhier/ntfy/releases/download/v1.25.0/ntfy_1.25.0_linux_amd64.rpm + sudo rpm -ivh https://github.com/binwiederhier/ntfy/releases/download/v1.25.1/ntfy_1.25.1_linux_amd64.rpm sudo systemctl enable ntfy sudo systemctl start ntfy ``` === "armv6" ```bash - sudo rpm -ivh https://github.com/binwiederhier/ntfy/releases/download/v1.25.0/ntfy_1.25.0_linux_armv6.rpm + sudo rpm -ivh https://github.com/binwiederhier/ntfy/releases/download/v1.25.1/ntfy_1.25.1_linux_armv6.rpm sudo systemctl enable ntfy sudo systemctl start ntfy ``` === "armv7/armhf" ```bash - sudo rpm -ivh https://github.com/binwiederhier/ntfy/releases/download/v1.25.0/ntfy_1.25.0_linux_armv7.rpm + sudo rpm -ivh https://github.com/binwiederhier/ntfy/releases/download/v1.25.1/ntfy_1.25.1_linux_armv7.rpm sudo systemctl enable ntfy sudo systemctl start ntfy ``` === "arm64" ```bash - sudo rpm -ivh https://github.com/binwiederhier/ntfy/releases/download/v1.25.0/ntfy_1.25.0_linux_arm64.rpm + sudo rpm -ivh https://github.com/binwiederhier/ntfy/releases/download/v1.25.1/ntfy_1.25.1_linux_arm64.rpm sudo systemctl enable ntfy sudo systemctl start ntfy ``` @@ -190,11 +190,11 @@ If run as `root`, ntfy will look for its config at `/etc/ntfy/client.yml`. For a `~/Library/Application Support/ntfy/client.yml` (sample included in the tarball). ```bash -curl https://github.com/binwiederhier/ntfy/releases/download/v1.25.0/ntfy_v1.25.0_macOS_all.tar.gz > ntfy_v1.25.0_macOS_all.tar.gz -tar zxvf ntfy_v1.25.0_macOS_all.tar.gz -sudo cp -a ntfy_v1.25.0_macOS_all/ntfy /usr/local/bin/ntfy +curl https://github.com/binwiederhier/ntfy/releases/download/v1.25.1/ntfy_v1.25.1_macOS_all.tar.gz > ntfy_v1.25.1_macOS_all.tar.gz +tar zxvf ntfy_v1.25.1_macOS_all.tar.gz +sudo cp -a ntfy_v1.25.1_macOS_all/ntfy /usr/local/bin/ntfy mkdir ~/Library/Application\ Support/ntfy -cp ntfy_v1.25.0_macOS_all/client/client.yml ~/Library/Application\ Support/ntfy/client.yml +cp ntfy_v1.25.1_macOS_all/client/client.yml ~/Library/Application\ Support/ntfy/client.yml ntfy --help ``` @@ -206,7 +206,7 @@ ntfy --help ## Windows The [ntfy CLI](subscribe/cli.md) (`ntfy publish` and `ntfy subscribe` only) is supported on Windows as well. -To install, please [download the latest ZIP](https://github.com/binwiederhier/ntfy/releases/download/v1.25.0/ntfy_v1.25.0_windows_x86_64.zip), +To install, please [download the latest ZIP](https://github.com/binwiederhier/ntfy/releases/download/v1.25.1/ntfy_v1.25.1_windows_x86_64.zip), extract it and place the `ntfy.exe` binary somewhere in your `%Path%`. The default path for the client config file is at `%AppData%\ntfy\client.yml` (not created automatically, sample in the ZIP file). diff --git a/docs/releases.md b/docs/releases.md index 704a60ee..3563f387 100644 --- a/docs/releases.md +++ b/docs/releases.md @@ -10,15 +10,9 @@ and the [ntfy Android app](https://github.com/binwiederhier/ntfy-android/release * Italian (thanks to [@Genio2003](https://hosted.weblate.org/user/Genio2003/)) -## ntfy Android app v1.26.0 (UNRELEASED) - -**Features:** - -* Add `tzdata` to Docker image to allow overriding the timezone with `TZ` ([#307](https://github.com/binwiederhier/ntfy/pull/307), thanks to [@ksurl](https://github.com/ksurl)) - --> -## ntfy server v1.25.0 +## ntfy server v1.25.1 Released June 2, 2022 This release adds the ability to set a log level to facilitate easier debugging of live systems. It also solves a @@ -31,10 +25,12 @@ more translations: Chinese/Simplified and Dutch. **Features:** * Advanced logging, with different log levels and hot reloading of the log level ([#284](https://github.com/binwiederhier/ntfy/pull/284)) +* Add `tzdata` to Docker image to allow overriding the timezone with `TZ` ([#307](https://github.com/binwiederhier/ntfy/pull/307), thanks to [@ksurl](https://github.com/ksurl)) **Bugs**: * Respect Firebase "quota exceeded" response for topics, block Firebase publishing for user for 10min ([#289](https://github.com/binwiederhier/ntfy/issues/289)) +* Fix documentation header blue header due to mkdocs-material theme update (no ticket) **Maintenance:** diff --git a/docs/static/css/extra.css b/docs/static/css/extra.css index cb71a018..a7370399 100644 --- a/docs/static/css/extra.css +++ b/docs/static/css/extra.css @@ -1,4 +1,4 @@ -:root { +:root > * { --md-primary-fg-color: #338574; --md-primary-fg-color--light: #338574; --md-primary-fg-color--dark: #338574; diff --git a/docs/static/js/extra.js b/docs/static/js/extra.js index 0aa380a7..6ddf07a9 100644 --- a/docs/static/js/extra.js +++ b/docs/static/js/extra.js @@ -1,8 +1,8 @@ // Link tabs, as per https://facelessuser.github.io/pymdown-extensions/extensions/tabbed/#linked-tabs -const savedTab = localStorage.getItem('savedTab') -const tabs = document.querySelectorAll(".tabbed-set > input") -for (const tab of tabs) { +const savedCodeTab = localStorage.getItem('savedTab') +const codeTabs = document.querySelectorAll(".tabbed-set > input") +for (const tab of codeTabs) { tab.addEventListener("click", () => { const current = document.querySelector(`label[for=${tab.id}]`) const pos = current.getBoundingClientRect().top @@ -25,7 +25,7 @@ for (const tab of tabs) { // Select saved tab const current = document.querySelector(`label[for=${tab.id}]`) const labelContent = current.innerHTML - if (savedTab === labelContent) { + if (savedCodeTab === labelContent) { tab.checked = true } } diff --git a/server/server.go b/server/server.go index a26fcc38..0b909b80 100644 --- a/server/server.go +++ b/server/server.go @@ -261,7 +261,7 @@ func (s *Server) handle(w http.ResponseWriter, r *http.Request) { if !ok { httpErr = errHTTPInternalError } - isNormalError := httpErr.HTTPCode == http.StatusNotFound + isNormalError := httpErr.HTTPCode == http.StatusNotFound || httpErr.HTTPCode == http.StatusBadRequest if isNormalError { log.Debug("%s Connection closed with HTTP %d (ntfy error %d): %s", logHTTPPrefix(v, r), httpErr.HTTPCode, httpErr.Code, err.Error()) } else { @@ -483,7 +483,11 @@ func (s *Server) handlePublish(w http.ResponseWriter, r *http.Request, v *visito func (s *Server) sendToFirebase(v *visitor, m *message) { log.Debug("%s Publishing to Firebase", logMessagePrefix(v, m)) if err := s.firebaseClient.Send(v, m); err != nil { - log.Warn("%s Unable to publish to Firebase: %v", logMessagePrefix(v, m), err.Error()) + if err == errFirebaseTemporarilyBanned { + log.Debug("%s Unable to publish to Firebase: %v", logMessagePrefix(v, m), err.Error()) + } else { + log.Warn("%s Unable to publish to Firebase: %v", logMessagePrefix(v, m), err.Error()) + } } } diff --git a/server/server_firebase.go b/server/server_firebase.go index e622a555..99f0ba13 100644 --- a/server/server_firebase.go +++ b/server/server_firebase.go @@ -20,7 +20,8 @@ const ( ) var ( - errFirebaseQuotaExceeded = errors.New("quota exceeded for Firebase messages to topic") + errFirebaseQuotaExceeded = errors.New("quota exceeded for Firebase messages to topic") + errFirebaseTemporarilyBanned = errors.New("visitor temporarily banned from using Firebase") ) // firebaseClient is a generic client that formats and sends messages to Firebase. @@ -39,7 +40,7 @@ func newFirebaseClient(sender firebaseSender, auther auth.Auther) *firebaseClien func (c *firebaseClient) Send(v *visitor, m *message) error { if err := v.FirebaseAllowed(); err != nil { - return errFirebaseQuotaExceeded + return errFirebaseTemporarilyBanned } fbm, err := toFirebaseMessage(m, c.auther) if err != nil { diff --git a/server/server_firebase_test.go b/server/server_firebase_test.go index b29cf3af..b004b0fa 100644 --- a/server/server_firebase_test.go +++ b/server/server_firebase_test.go @@ -331,6 +331,6 @@ func TestToFirebaseSender_Abuse(t *testing.T) { require.Equal(t, 2, len(sender.Messages())) sender.messages = make([]*messaging.Message, 0) // Reset to test that time limit is working - require.Equal(t, errFirebaseQuotaExceeded, client.Send(visitor, &message{Topic: "mytopic"})) + require.Equal(t, errFirebaseTemporarilyBanned, client.Send(visitor, &message{Topic: "mytopic"})) require.Equal(t, 0, len(sender.Messages())) }