()
| 673 | }; |
| 674 | |
| 675 | async function initCache() { |
| 676 | if (!CACHED.fbProfile) { |
| 677 | CACHED.fbProfile = new Map(); |
| 678 | try { |
| 679 | const c = localStorage.getItem("fbProfile"); |
| 680 | if (c) { |
| 681 | const arr = JSON.parse(c); |
| 682 | console.log(arr); |
| 683 | arr.forEach((info) => CACHED.fbProfile.set(info.uid, info)); |
| 684 | } |
| 685 | } catch (e) { |
| 686 | console.error(e); |
| 687 | } |
| 688 | } |
| 689 | |
| 690 | if (!CACHED.fb_dtsg) { |
| 691 | let res = await UfsGlobal.Extension.runInBackground("fetch", [ |
| 692 | "https://mbasic.facebook.com/photos/upload/", |
| 693 | ]); |
| 694 | CACHED.fb_dtsg = RegExp(/name="fb_dtsg" value="(.*?)"/).exec(res.body)?.[1]; |
| 695 | } |
| 696 | } |
| 697 | |
| 698 | async function getFbProfile(uid, force = false) { |
| 699 | if (CACHED.fbProfile.has(uid) && !force) return CACHED.fbProfile.get(uid); |
no test coverage detected