From ed1bcbf6e6d7583afa9936e5a220b14d4fc1395b Mon Sep 17 00:00:00 2001 From: SunriseFox Date: Fri, 1 Nov 2019 15:03:47 +0800 Subject: [PATCH] fix: mobile facebook unable to resolve my identity --- .../UI/resolveLastRecognizedIdentity.ts | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/social-network-provider/facebook.com/UI/resolveLastRecognizedIdentity.ts b/src/social-network-provider/facebook.com/UI/resolveLastRecognizedIdentity.ts index b72f83126f2b..afc7a6bd8cb2 100644 --- a/src/social-network-provider/facebook.com/UI/resolveLastRecognizedIdentity.ts +++ b/src/social-network-provider/facebook.com/UI/resolveLastRecognizedIdentity.ts @@ -38,18 +38,12 @@ const myUsernameLiveSelectorOnMobile = new LiveSelector() .querySelectorAll('article') .map(x => x.dataset.store) .map(x => JSON.parse(x).actor_id as number) - .replace(orig => - orig.length - ? [ - orig.reduce((previous, current) => { - if (location.hostname === 'm.facebook.com' && location.pathname === '/') { - if (previous === current) return current - } - return undefined! - }), - ] - : [], - ) .filter(x => x) + .replace(orig => { + if (location.hostname === 'm.facebook.com' && location.pathname.match(/^\/(?:home)?[^/]*$/)) { + if (orig.every(x => x === orig[0])) return [orig[0]] + } + return [] + }) .map(x => ({ identifier: new PersonIdentifier('facebook.com', x.toString()) } as part)) //#endregion