| 83 | } |
| 84 | |
| 85 | function headers(token = "") { |
| 86 | return { |
| 87 | "Content-Type": "application/json", |
| 88 | "User-Agent": "Mozilla/5.0 MicroMessenger MiniProgramEnv/Windows", |
| 89 | Referer: `https://servicewechat.com/${MINI_APP_ID}/215/page-frame.html`, |
| 90 | AppID: MINI_APP_ID, |
| 91 | "App-Version": APP_VERSION, |
| 92 | Authorization: `Basic ${Buffer.from("wechat:wechat_secret").toString("base64")}`, |
| 93 | ...(token ? { "X-Access-Token": token } : {}), |
| 94 | }; |
| 95 | } |
| 96 | |
| 97 | function shortJson(value, limit = 180) { |
| 98 | const text = typeof value === "string" ? value : JSON.stringify(value); |