mirror of
https://github.com/jaypyles/Scraperr.git
synced 2025-12-13 19:25:58 +00:00
feat: add agent mode (#81)
* chore: wip agent mode * wip: add agent mode frontend * wip: add agent mode frontend * chore: cleanup code * chore: cleanup code * chore: cleanup code
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import os
|
||||
from api.backend.database.common import connect, QUERIES, insert
|
||||
import logging
|
||||
import sqlite3
|
||||
|
||||
from api.backend.auth.auth_utils import get_password_hash
|
||||
|
||||
@@ -11,11 +12,22 @@ def init_database():
|
||||
cursor = connect()
|
||||
|
||||
for query in QUERIES["init"].strip().split(";"):
|
||||
if query.strip():
|
||||
query = query.strip()
|
||||
if not query:
|
||||
continue
|
||||
|
||||
try:
|
||||
LOG.info(f"Executing query: {query}")
|
||||
_ = cursor.execute(query)
|
||||
except sqlite3.OperationalError as e:
|
||||
if "duplicate column name" in str(e).lower():
|
||||
LOG.warning(f"Skipping duplicate column error: {e}")
|
||||
continue
|
||||
else:
|
||||
LOG.error(f"Error executing query: {query}")
|
||||
raise
|
||||
|
||||
if os.environ.get("REGISTRATION_ENABLED", "True") == "False":
|
||||
if os.environ.get("REGISTRATION_ENABLED", "true").lower() == "false":
|
||||
default_user_email = os.environ.get("DEFAULT_USER_EMAIL")
|
||||
default_user_password = os.environ.get("DEFAULT_USER_PASSWORD")
|
||||
default_user_full_name = os.environ.get("DEFAULT_USER_FULL_NAME")
|
||||
|
||||
Reference in New Issue
Block a user