superbrain-server 1.0.22 → 1.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superbrain-server",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "description": "1-Line Auto-Installer and Server Execution wrapper for SuperBrain",
5
5
  "main": "index.js",
6
6
  "bin": {
package/payload/api.py CHANGED
@@ -570,13 +570,13 @@ async def analyze_instagram(request: AnalyzeRequest, token: str = Depends(verify
570
570
  logger.warning(f"⚠️ [{shortcode}] main.py stderr:\n{stderr[:1000]}")
571
571
 
572
572
  if returncode == 2:
573
- # main.py detected quota exhaustion and queued item for retry.
573
+ # main.py detected quota exhaustion (Instagram block or AI) and queued item for retry.
574
574
  # NOTE: Do NOT remove from queue here — main.py already called
575
575
  # queue_for_retry() which set status='retry'. Removing would lose it.
576
- logger.info(f"⏰ [{shortcode}] Quota exhausted queued for automatic retry")
576
+ logger.info(f"⏰ [{shortcode}] Rate limit or quota exhausted (often Instagram blocking the download). Your request has been queued for automatic retry in 24 hours.")
577
577
  raise HTTPException(
578
578
  status_code=202,
579
- detail="API quota exhausted. Your request has been queued for automatic retry in 24 hours."
579
+ detail="Rate limit or quota exhausted (often Instagram blocking the download). Your request has been queued for automatic retry in 24 hours."
580
580
  )
581
581
 
582
582
  if returncode != 0:
@@ -119,7 +119,29 @@ def setup_instaloader_session(username: str, password: str) -> bool:
119
119
  return False
120
120
  except Exception as e:
121
121
  print(f" ✗ Login error: {e}")
122
- return False
122
+
123
+ # ── FALLBACK: Manual Session Cookie Import ──
124
+ print("\n ⚠️ Instagram has blocked this direct login attempt from this machine.")
125
+ print(" This happens often on cloud servers or new IPs (Checkpoint Required).")
126
+ print("\n 👉 To instantly bypass this, you can paste an active 'sessionid' cookie")
127
+ print(" from an Instagram account that is already logged in on your web browser.")
128
+ print("\n How to get it:")
129
+ print(" 1. Log into instagram.com on your computer's web browser.")
130
+ print(" 2. Open Developer Tools (F12) → Application/Storage → Cookies → instagram.com")
131
+ print(" 3. Copy the value of the 'sessionid' row.")
132
+
133
+ fallback = input("\n Do you want to manually enter a sessionid now? [y/N]: ").strip().lower()
134
+ if fallback == 'y':
135
+ sessionid = input(" Enter 'sessionid' cookie value: ").strip()
136
+ if sessionid:
137
+ # Inject the session into instaloader
138
+ L.context._session.cookies.set("sessionid", sessionid, domain=".instagram.com")
139
+ L.context.username = username
140
+ print(" ✓ Session cookie accepted and injected.")
141
+ else:
142
+ return False
143
+ else:
144
+ return False
123
145
 
124
146
  if not L.context.is_logged_in:
125
147
  print(" ✗ Login did not succeed.")
package/payload/start.py CHANGED
@@ -1287,13 +1287,13 @@ def launch_backend():
1287
1287
  tunnel_hint = ""
1288
1288
 
1289
1289
  if public_url:
1290
- tunnel_line = f" Public URL → {GREEN}{BOLD}{public_url}{RESET} {DIM}({tunnel_type}){RESET}"
1290
+ tunnel_line = f" Public URL → {GREEN}{BOLD}{public_url}{RESET} {DIM}({tunnel_type}){RESET}"
1291
1291
  tunnel_hint = f" · public → {GREEN}{public_url}{RESET}"
1292
1292
  elif NGROK_ENABLED.exists():
1293
- tunnel_line = f" Public URL → {YELLOW}(failed to start ngrok and localtunnel){RESET}"
1293
+ tunnel_line = f" Public URL → {YELLOW}(failed to start ngrok and localtunnel){RESET}"
1294
1294
  tunnel_hint = f" · public → run manually: {DIM}ngrok http {PORT}{RESET}"
1295
1295
  else:
1296
- tunnel_line = f" Public URL → {YELLOW}(failed to start localtunnel){RESET}"
1296
+ tunnel_line = f" Public URL → {YELLOW}(failed to start localtunnel){RESET}"
1297
1297
  tunnel_hint = f" · public → configure ngrok via {DIM}python start.py --reset{RESET} or ensure node/npx is installed"
1298
1298
 
1299
1299
  # ── Generate and display QR code ──────────────────────────────────────────
@@ -1336,8 +1336,10 @@ def launch_backend():
1336
1336
  """)
1337
1337
 
1338
1338
  os.chdir(BASE_DIR)
1339
- os.execv(str(VENV_PYTHON), [str(VENV_PYTHON), "-m", "uvicorn", "api:app",
1340
- "--host", "0.0.0.0", "--port", str(PORT), "--reload"])
1339
+ try:
1340
+ subprocess.run([str(VENV_PYTHON), "-m", "uvicorn", "api:app", "--host", "0.0.0.0", "--port", str(PORT), "--reload"], check=True)
1341
+ except KeyboardInterrupt:
1342
+ pass
1341
1343
 
1342
1344
  # ══════════════════════════════════════════════════════════════════════════════
1343
1345
  # Main