| 161 | } |
| 162 | |
| 163 | getHeaders(extra = {}) { |
| 164 | const timestamp = Date.now(); |
| 165 | const headers = { |
| 166 | "User-Agent": USER_AGENT, |
| 167 | "Referer": `https://servicewechat.com/${MINI_APP_ID}/454/page-frame.html`, |
| 168 | "Accept": "application/json, text/plain, */*", |
| 169 | "Content-type": "application/json", |
| 170 | "X-App-Env": APP_ENV, |
| 171 | "X-USER-TOKEN": this.token || "", |
| 172 | "app-id": ROKI_APP_ID, |
| 173 | timestamp, |
| 174 | nonce: AES_SECRET, |
| 175 | secret: AES_SECRET, |
| 176 | signature: signRequest(timestamp), |
| 177 | "app-version": APP_VERSION, |
| 178 | ...extra, |
| 179 | }; |
| 180 | return headers; |
| 181 | } |
| 182 | |
| 183 | async request({ method = "GET", apiPath, params = {}, data = {}, skipToken = false }) { |
| 184 | const upperMethod = method.toUpperCase(); |