-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update tests * Switch from tabs to spaces * Fix async handling and new lines * Speed up blocklist search & make tests async * Make non-required messages debug messages * Clean up * Clean up code * Apply suggestions from code review Co-authored-by: H. Kamran <[email protected]> Signed-off-by: Carl <[email protected]> --------- Signed-off-by: Carl <[email protected]> Co-authored-by: H. Kamran <[email protected]>
- Loading branch information
Showing
10 changed files
with
328 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
import logger from '../logger.js'; | ||
|
||
export default async function Facebook(handle) { | ||
let res = await fetch(`https://www.facebook.com/${handle}`, { | ||
cf: { | ||
cacheTtl: 7 * 24 * 60, // Cache 7 days | ||
cacheEverything: true, | ||
}, | ||
}); | ||
let res = await fetch(`https://www.facebook.com/${handle}`, { | ||
cf: { | ||
cacheTtl: 7 * 24 * 60, // Cache 7 days | ||
cacheEverything: true | ||
} | ||
}); | ||
|
||
if (res.ok) return true; | ||
|
||
if (!res.ok) throw new Error(`Failed to fetch Facebook page ${handle}`); | ||
logger.addMessage('Facebook', `${handle} found.`); | ||
return true; | ||
throw { | ||
title: 'Facebook handle not found', | ||
message: `Failed to find the Facebook page https://facebook.com/${handle}\\nThe page might be private or not exist.` | ||
}; | ||
} |
Oops, something went wrong.