(data)
| 257 | } |
| 258 | |
| 259 | function argsList(data) { |
| 260 | return Array.from( |
| 261 | data.split("&") |
| 262 | .map((i) => i.split("=")) |
| 263 | .map(([k, v]) => [k, decodeURIComponent(v)]) |
| 264 | ) |
| 265 | .reduce((a, [k, v]) => Object.assign(a, { [k]: v }), {}) |
| 266 | } |
| 267 | |
| 268 | //Bark APP notify |
| 269 | async function BarkNotify(c, k, t, b) { for (let i = 0; i < 3; i++) { c.log(`🔷Bark notify >> Start push (${i + 1})`); const s = await new Promise((n) => { c.post({ url: 'https://api.day.app/push', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ title: t, body: b, device_key: k, ext_params: { group: t } }) }, (e, r, d) => r && r.status == 200 ? n(1) : n(d || e)) }); if (s === 1) { c.log('✅Push success!'); break } else { c.log(`❌Push failed! >> ${s.message || s}`) } } }; |