diff --git a/scripts/ai-post-generator.js b/scripts/ai-post-generator.js index 375536a..1df01a3 100644 --- a/scripts/ai-post-generator.js +++ b/scripts/ai-post-generator.js @@ -8,7 +8,7 @@ const fs = require('fs'); const path = require('path'); // Auto-load .env file if present -const envPath = path.resolve(__dirname, '../.env'); +const envPath = path.resolve(__dirname, '.env'); if (fs.existsSync(envPath)) { const envContent = fs.readFileSync(envPath, 'utf8'); envContent.split('\n').forEach(line => { @@ -85,7 +85,7 @@ async function generatePostWithGemini(topic = 'منشور تعريفي عن من */ async function publishToFacebook(message) { console.log('Publishing generated post to Facebook Page...'); - + const url = `https://graph.facebook.com/v19.0/me/feed`; let res = await fetch(url, { method: 'POST', diff --git a/scripts/meta-ads-manager.js b/scripts/meta-ads-manager.js index debf3db..c868eca 100644 --- a/scripts/meta-ads-manager.js +++ b/scripts/meta-ads-manager.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); // Auto-load .env file if present -const envPath = path.resolve(__dirname, '../.env'); +const envPath = path.resolve(__dirname, '.env'); if (fs.existsSync(envPath)) { const envContent = fs.readFileSync(envPath, 'utf8'); envContent.split('\n').forEach(line => { diff --git a/scripts/publish-facebook-post.js b/scripts/publish-facebook-post.js index deb1d4d..72eb3bb 100644 --- a/scripts/publish-facebook-post.js +++ b/scripts/publish-facebook-post.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); // Auto-load .env file if present -const envPath = path.resolve(__dirname, '../.env'); +const envPath = path.resolve(__dirname, '.env'); if (fs.existsSync(envPath)) { const envContent = fs.readFileSync(envPath, 'utf8'); envContent.split('\n').forEach(line => { diff --git a/scripts/publish-now.js b/scripts/publish-now.js index 4e8f6a2..f264bab 100644 --- a/scripts/publish-now.js +++ b/scripts/publish-now.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); // Auto-load .env file if present -const envPath = path.resolve(__dirname, '../.env'); +const envPath = path.resolve(__dirname, '.env'); if (fs.existsSync(envPath)) { const envContent = fs.readFileSync(envPath, 'utf8'); envContent.split('\n').forEach(line => { @@ -37,7 +37,7 @@ const message = `شركتك تحمل اسمك… وتطبيقك يحمل اسم async function main() { console.log('Publishing post to Facebook Page via Page Token...'); - + // Try direct /me/feed endpoint first (works for Page Access Token) let res = await fetch(`https://graph.facebook.com/v19.0/me/feed`, { method: 'POST',