superbrain-server 1.0.58 → 1.0.59

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.58",
3
+ "version": "1.0.59",
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
@@ -726,12 +726,12 @@ async def check_cache(shortcode: str, token: str = Depends(verify_token)):
726
726
 
727
727
 
728
728
  @app.get("/recent")
729
- async def get_recent_analyses(limit: int = Query(default=50, ge=1, le=1000), token: str = Depends(verify_token)):
729
+ async def get_recent_analyses(limit: int = Query(default=10000, ge=1), token: str = Depends(verify_token)):
730
730
  """
731
731
  Get recent analyses from database
732
732
 
733
733
  - Returns most recently analyzed content
734
- - Default limit: 10, max: 100
734
+ - Default limit: 10000 (all lightweight posts)
735
735
  - Requires API authentication
736
736
  """
737
737
  try:
@@ -246,14 +246,15 @@ class Database:
246
246
  traceback.print_exc()
247
247
  return False
248
248
 
249
- def get_recent(self, limit=10):
250
- """Return the most recently analysed posts (excludes soft-deleted)."""
249
+ def get_recent(self, limit=10000):
250
+ """Return the most recently analysed posts (excludes soft-deleted). Optimized to exclude heavy text blobs."""
251
251
  if not self.is_connected():
252
252
  return []
253
253
  try:
254
254
  cur = self._conn.cursor()
255
+ cols = "shortcode, url, username, content_type, analyzed_at, updated_at, post_date, likes, thumbnail, title, summary, tags, music, category, is_hidden"
255
256
  cur.execute(
256
- "SELECT * FROM analyses WHERE (is_hidden IS NULL OR is_hidden = 0) ORDER BY analyzed_at DESC LIMIT ?", (limit,)
257
+ f"SELECT {cols} FROM analyses WHERE (is_hidden IS NULL OR is_hidden = 0) ORDER BY analyzed_at DESC LIMIT ?", (limit,)
257
258
  )
258
259
  return [self._row_to_dict(r) for r in cur.fetchall()]
259
260
  except Exception as e:
@@ -266,8 +267,9 @@ class Database:
266
267
  return []
267
268
  try:
268
269
  cur = self._conn.cursor()
270
+ cols = "shortcode, url, username, content_type, analyzed_at, updated_at, post_date, likes, thumbnail, title, summary, tags, music, category, is_hidden"
269
271
  cur.execute(
270
- "SELECT * FROM analyses WHERE category = ? AND (is_hidden IS NULL OR is_hidden = 0) ORDER BY analyzed_at DESC LIMIT ?",
272
+ f"SELECT {cols} FROM analyses WHERE category = ? AND (is_hidden IS NULL OR is_hidden = 0) ORDER BY analyzed_at DESC LIMIT ?",
271
273
  (category, limit)
272
274
  )
273
275
  return [self._row_to_dict(r) for r in cur.fetchall()]
@@ -292,8 +294,9 @@ class Database:
292
294
  cur = self._conn.cursor()
293
295
  conditions = " OR ".join(["LOWER(tags) LIKE ?" for _ in tags])
294
296
  params = [f"%{t.lower()}%" for t in tags] + [limit]
297
+ cols = "shortcode, url, username, content_type, analyzed_at, updated_at, post_date, likes, thumbnail, title, summary, tags, music, category, is_hidden"
295
298
  cur.execute(
296
- f"SELECT * FROM analyses WHERE ({conditions}) AND (is_hidden IS NULL OR is_hidden = 0) ORDER BY analyzed_at DESC LIMIT ?",
299
+ f"SELECT {cols} FROM analyses WHERE ({conditions}) AND (is_hidden IS NULL OR is_hidden = 0) ORDER BY analyzed_at DESC LIMIT ?",
297
300
  params
298
301
  )
299
302
  return [self._row_to_dict(r) for r in cur.fetchall()]