Skip to content

Commit

Permalink
Change ttl based on provider
Browse files Browse the repository at this point in the history
  • Loading branch information
NickM-27 committed Jul 22, 2024
1 parent 9d81046 commit 3f96029
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions frigate/comms/webpush.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,15 @@ def send_alert(self, payload: dict[str, any]) -> None:
endpoint = pusher.subscription_info["endpoint"]

# set headers for notification behavior
headers = self.claim_headers[
endpoint[0 : endpoint.index("/", 10)]
].copy()
provider = endpoint[0 : endpoint.index("/", 10)]
headers = self.claim_headers[provider].copy()
headers["urgency"] = "high"
ttl = 0 if "fcm.googleapis.com" in provider else 3600

# send message
resp = pusher.send(
headers=headers,
ttl=3600,
ttl=ttl,
data=json.dumps(
{
"title": title,
Expand Down
1 change: 0 additions & 1 deletion web/public/notifications-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ self.addEventListener("push", function (event) {
icon: "/images/maskable-icon.png",
image: data.image,
badge: "/images/maskable-badge.png",
tag: data.id,
data: { id: data.id, link: data.direct_url },
});
} else {
Expand Down

0 comments on commit 3f96029

Please sign in to comment.