implement spotizerr-auth
This commit is contained in:
@@ -5,6 +5,7 @@ from routes.utils.credentials import (
|
||||
create_credential,
|
||||
delete_credential,
|
||||
edit_credential,
|
||||
init_credentials_db,
|
||||
# Import new utility functions for global Spotify API creds
|
||||
_get_global_spotify_api_creds,
|
||||
save_global_spotify_api_creds
|
||||
@@ -15,6 +16,9 @@ import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
credentials_bp = Blueprint('credentials', __name__)
|
||||
|
||||
# Initialize the database and tables when the blueprint is loaded
|
||||
init_credentials_db()
|
||||
|
||||
@credentials_bp.route('/spotify_api_config', methods=['GET', 'PUT'])
|
||||
def handle_spotify_api_config():
|
||||
"""Handles GET and PUT requests for the global Spotify API client_id and client_secret."""
|
||||
|
||||
@@ -80,7 +80,6 @@ def init_credentials_db():
|
||||
try:
|
||||
with _get_db_connection() as conn:
|
||||
cursor = conn.cursor()
|
||||
cursor.row_factory = sqlite3.Row # Apply row_factory here as well for consistency
|
||||
# Spotify Table
|
||||
cursor.execute("""
|
||||
CREATE TABLE IF NOT EXISTS spotify (
|
||||
@@ -90,8 +89,7 @@ def init_credentials_db():
|
||||
updated_at REAL
|
||||
)
|
||||
""")
|
||||
if _ensure_table_schema(cursor, "spotify", EXPECTED_SPOTIFY_TABLE_COLUMNS):
|
||||
conn.commit()
|
||||
_ensure_table_schema(cursor, "spotify", EXPECTED_SPOTIFY_TABLE_COLUMNS)
|
||||
|
||||
# Deezer Table
|
||||
cursor.execute("""
|
||||
@@ -103,8 +101,7 @@ def init_credentials_db():
|
||||
updated_at REAL
|
||||
)
|
||||
""")
|
||||
if _ensure_table_schema(cursor, "deezer", EXPECTED_DEEZER_TABLE_COLUMNS):
|
||||
conn.commit()
|
||||
_ensure_table_schema(cursor, "deezer", EXPECTED_DEEZER_TABLE_COLUMNS)
|
||||
|
||||
# Ensure global search.json exists, create if not
|
||||
if not GLOBAL_SEARCH_JSON_PATH.exists():
|
||||
|
||||
Reference in New Issue
Block a user