CBV01 commited on
Commit
a9d0ae5
·
1 Parent(s): 2b4315e

fix: resolve background poller 7-argument crash and scraper JWT error by correcting token header key

Browse files
backend/main.py CHANGED
@@ -1220,7 +1220,7 @@ async def root():
1220
  async def task_poller():
1221
  active_tasks = set()
1222
 
1223
- async def run_single_task(task_id, message, groups_str, phone_num, u_id, interval):
1224
  try:
1225
  # Update status to 'processing'
1226
  conn = get_db_connection()
 
1220
  async def task_poller():
1221
  active_tasks = set()
1222
 
1223
+ async def run_single_task(task_id, message, groups_str, phone_num, u_id, interval, scheduled_time):
1224
  try:
1225
  # Update status to 'processing'
1226
  conn = get_db_connection()
frontend/src/app/scraper/page.tsx CHANGED
@@ -135,9 +135,10 @@ export default function ScraperPage() {
135
  abortControllerRef.current = controller;
136
 
137
  try {
138
- const token = localStorage.getItem('token') || '';
 
139
  const cStr = country.trim() ? `&country=${encodeURIComponent(' ' + country.trim())}` : '';
140
- const res = await fetch(`${process.env.NEXT_PUBLIC_BASE_URL || ''}/api/telegram/scrape_stream?query=${encodeURIComponent(keyword)}${cStr}&limit=500`, {
141
  headers: { 'Authorization': `Bearer ${token}` },
142
  signal: controller.signal
143
  });
 
135
  abortControllerRef.current = controller;
136
 
137
  try {
138
+ const token = localStorage.getItem('tg_auth_token') || '';
139
+ const apiBase = (process.env.NEXT_PUBLIC_API_URL || '').replace(/\/$/, '');
140
  const cStr = country.trim() ? `&country=${encodeURIComponent(' ' + country.trim())}` : '';
141
+ const res = await fetch(`${apiBase}/api/telegram/scrape_stream?query=${encodeURIComponent(keyword)}${cStr}&limit=500`, {
142
  headers: { 'Authorization': `Bearer ${token}` },
143
  signal: controller.signal
144
  });