(h)
| 133 | } |
| 134 | |
| 135 | function formatHeaders(h) { |
| 136 | return Object.keys(h).reduce((t, i) => (t[i.toLowerCase()] = h[i], t), {}) |
| 137 | } |
| 138 | |
| 139 | //Bark APP notify |
| 140 | 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}`) } } }; |