Skip to content

Commit

Permalink
Fix: Bugs in sound param processing
Browse files Browse the repository at this point in the history
  • Loading branch information
cwxia0s committed Nov 22, 2024
1 parent 93807af commit d88b0c8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
11 changes: 8 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,15 @@ class Handler {
}
const body = decodeURIComponent(parameters.body || "NoContent")

let sound = parameters.sound || '1107'
if (!sound.endsWith('.caf')) {
sound += '.caf'
let sound = parameters.sound || undefined
if (sound) {
if (!sound.endsWith('.caf')) {
sound += '.caf'
}
} else {
sound = '1107'
}

const category = parameters.category || 'myNotificationCategory'
const group = parameters.group || undefined

Expand Down
15 changes: 10 additions & 5 deletions main_kv.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ async function handleRequest(request, env, ctx) {
class Handler {
constructor(env) {
this.version = "v2.1.3"
this.build = "2024-11-22 23:52:47"
this.build = "2024-11-23 00:32:33"
this.arch = "js"
this.commit = "73210060060f2d073e29ecec7b895a8ab470a6e7"
this.commit = "93807afd5b13feafdc4ef90f3483d4a789696fb3"

const db = new Database(env)

Expand Down Expand Up @@ -249,10 +249,15 @@ class Handler {
}
const body = decodeURIComponent(parameters.body || "NoContent")

let sound = parameters.sound || '1107'
if (!sound.endsWith('.caf')) {
sound += '.caf'
let sound = parameters.sound || undefined
if (sound) {
if (!sound.endsWith('.caf')) {
sound += '.caf'
}
} else {
sound = '1107'
}

const category = parameters.category || 'myNotificationCategory'
const group = parameters.group || undefined

Expand Down
2 changes: 1 addition & 1 deletion wrangler.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "bark-worker"
main = "main.js"
compatibility_date = "2024-09-01"
compatibility_date = "2024-11-01"

[[d1_databases]]
binding = "database" # available in your Worker on env.database
Expand Down

0 comments on commit d88b0c8

Please sign in to comment.