feat: add cookiePath parameter to loadFacebookCookies
This commit is contained in:
@@ -213,7 +213,7 @@ async function delay(ms: number): Promise<void> {
|
|||||||
/**
|
/**
|
||||||
* Load Facebook cookies from file or string
|
* Load Facebook cookies from file or string
|
||||||
*/
|
*/
|
||||||
async function loadFacebookCookies(cookiesSource?: string): Promise<Cookie[]> {
|
async function loadFacebookCookies(cookiesSource?: string, cookiePath = './cookies/facebook.json'): Promise<Cookie[]> {
|
||||||
// First try to load from provided string parameter
|
// First try to load from provided string parameter
|
||||||
if (cookiesSource) {
|
if (cookiesSource) {
|
||||||
try {
|
try {
|
||||||
@@ -231,9 +231,9 @@ async function loadFacebookCookies(cookiesSource?: string): Promise<Cookie[]> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to load from ./cookies/facebook.json
|
// Try to load from specified path
|
||||||
try {
|
try {
|
||||||
const cookiesPath = "./cookies/facebook.json";
|
const cookiesPath = cookiePath;
|
||||||
const file = Bun.file(cookiesPath);
|
const file = Bun.file(cookiesPath);
|
||||||
if (await file.exists()) {
|
if (await file.exists()) {
|
||||||
const content = await file.text();
|
const content = await file.text();
|
||||||
|
|||||||
Reference in New Issue
Block a user