mirror of
https://github.com/TheNetsky/Microsoft-Rewards-Script.git
synced 2026-01-23 16:31:04 +00:00
fix: try fixing error fetching dashboard data on mobile func (#444)
This commit is contained in:
@@ -23,9 +23,24 @@ export default class BrowserFunc {
|
|||||||
*/
|
*/
|
||||||
async getDashboardData(): Promise<DashboardData> {
|
async getDashboardData(): Promise<DashboardData> {
|
||||||
try {
|
try {
|
||||||
const cookieHeader = this.bot.cookies.mobile
|
const allowedDomains = ['bing.com', 'live.com', 'microsoftonline.com'];
|
||||||
.map((c: { name: string; value: string }) => `${c.name}=${c.value}`)
|
|
||||||
.join('; ')
|
const cookieHeader = [
|
||||||
|
...new Map(
|
||||||
|
this.bot.cookies.mobile
|
||||||
|
.filter(
|
||||||
|
(c: { name: string; value: string; domain?: string }) =>
|
||||||
|
typeof c.domain === 'string' &&
|
||||||
|
allowedDomains.some(d =>
|
||||||
|
c.domain && c.domain.toLowerCase().endsWith(d)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.map(c => [c.name, c]) // dedupe by name, keep last
|
||||||
|
).values()
|
||||||
|
]
|
||||||
|
.map(c => `${c.name}=${c.value}`)
|
||||||
|
.join('; ');
|
||||||
|
|
||||||
|
|
||||||
const request: AxiosRequestConfig = {
|
const request: AxiosRequestConfig = {
|
||||||
url: 'https://rewards.bing.com/api/getuserinfo?type=1',
|
url: 'https://rewards.bing.com/api/getuserinfo?type=1',
|
||||||
|
|||||||
Reference in New Issue
Block a user