()
| 473 | }; |
| 474 | |
| 475 | async function initCache() { |
| 476 | if (!CACHED.fbProfile) { |
| 477 | CACHED.fbProfile = new Map(); |
| 478 | try { |
| 479 | const c = localStorage.getItem("fbProfile"); |
| 480 | if (c) { |
| 481 | const arr = JSON.parse(c); |
| 482 | console.log(arr); |
| 483 | arr.forEach((info) => CACHED.fbProfile.set(info.uid, info)); |
| 484 | } |
| 485 | } catch (e) { |
| 486 | console.error(e); |
| 487 | } |
| 488 | } |
| 489 | |
| 490 | if (!CACHED.fb_dtsg) { |
| 491 | let res = await UfsGlobal.Extension.runInBackground("fetch", [ |
| 492 | "https://www.facebook.com/policies_center/", |
| 493 | ]); |
| 494 | CACHED.fb_dtsg = res?.body?.match?.( |
| 495 | /DTSGInitData",\[\],\{"token":"(.*?)"/ |
| 496 | )?.[1]; |
| 497 | } |
| 498 | } |
| 499 | |
| 500 | async function getFbProfile(uid, force = false) { |
| 501 | const cached = CACHED.fbProfile.get(uid); |
no test coverage detected