()
| 70 | .finally(() => $.done($.env.isQX ? rsp : { response: rsp })); |
| 71 | |
| 72 | async function runs() { |
| 73 | // Object.keys(list).map(a => delete list[a].only) |
| 74 | req.headers = formatHeaders(req.headers); //compatible with HTTP/2 |
| 75 | const appID = req.url.split(/\/apps\/(\d+)/)[1]; |
| 76 | const other = /\/(accept|withdraw|devices|session|notifications|status)/.test(req.url); |
| 77 | if (/accounts\/[a-z0-9-]{36}\/apps$/.test(req.url)) { |
| 78 | const acc = SaveAccount(req.url.split(/\/([a-z0-9-]{36})\//)[1]); |
| 79 | return await Promise.all(Object.keys(acc).map(QueryRequest)); |
| 80 | } else if (/\/install$/.test(req.url) && req.body) { |
| 81 | req.body = JSON.parse(req.body); |
| 82 | req.body.storefrontId = '143441-19,29'; //prevent regional restrictions |
| 83 | req.body = JSON.stringify(req.body); |
| 84 | } else if (/\/[A-Z]{200,}\/redeem$/.test(req.url)) { |
| 85 | return { body: ExternalAccount(req.url.split(/\/([A-Z]+)\/redeem$/)[1]) }; |
| 86 | } |
| 87 | return await QueryRequest(!other && appList[appID] || null); |
| 88 | } |
| 89 | |
| 90 | function SaveAccount(id, part, o) { |
| 91 | if (!list[id]) { |
no test coverage detected