Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
added users
Murtaza Nasir39d180a6c22c
diff --git a/app.py b/app.pyindex 65d593dd..408d7f3d 100644--- a/app.py+++ b/app.py@@ -451,6 +451,34 @@ def logout():def account():return render_template('account.html', title='Account')[email protected]('/change_password', methods=['POST'])+@login_required+def change_password():+ current_password = request.form.get('current_password')+ new_password = request.form.get('new_password')+ confirm_password = request.form.get('confirm_password')++ # Validate form data+ if not current_password or not new_password or not confirm_password:+ flash('All fields are required.', 'danger')+ return redirect(url_for('account'))++ if new_password != confirm_password:+ flash('New password and confirmation do not match.', 'danger')+ return redirect(url_for('account'))++ # Check if current password is correct+ if not bcrypt.check_password_hash(current_user.password, current_password):+ flash('Current password is incorrect.', 'danger')+ return redirect(url_for('account'))++ # Update password+ current_user.password = bcrypt.generate_password_hash(new_password).decode('utf-8')+ db.session.commit()++ flash('Your password has been updated successfully.', 'success')+ return redirect(url_for('account'))+# --- Admin Routes ---@app.route('/admin', methods=['GET'])@login_requireddiff --git a/notes.md b/notes.mdindex 66ce56a0..795ff947 100644--- a/notes.md+++ b/notes.md@@ -5,4 +5,7 @@ python create_docs.py## start/stopsource venv/bin/activate-gunicorn --workers 3 --bind 0.0.0.0:8899 --timeout 600 app:app\ No newline at end of file+gunicorn --workers 3 --bind 0.0.0.0:8899 --timeout 600 app:app++## logs+sudo journalctl -u transcription.service -n 100 --no-pager\ No newline at end of filediff --git a/project_files.md b/project_files.mdindex 177855e6..00f6e065 100644--- a/project_files.md+++ b/project_files.md@@ -3,6 +3,68 @@Generated documentation of all project files.+## migrate_is_admin.py++```python++#!/usr/bin/env python3++import os+import sys+from flask import Flask+from flask_sqlalchemy import SQLAlchemy+from sqlalchemy import Column, Boolean++# Try to import from app context+try:+ from flask import current_app+ app = current_app._get_current_object()+ with app.app_context():+ db = app.extensions['sqlalchemy'].db+ User = app.extensions['sqlalchemy'].db.metadata.tables['user']+except (RuntimeError, AttributeError, KeyError):+ # If not in app context, import directly+ try:+ from app import app, db, User+ except ImportError as e:+ print(f"Error: Could not import required modules: {e}")+ print("Make sure migrate_is_admin.py is runnable and PYTHONPATH is set.")+ sys.exit(1)++def migrate_is_admin_field():+ """+ Add is_admin field to User model if it doesn't exist+ """+ print("Migrating database to add is_admin field to User model")+ print("=====================================================")++ with app.app_context():+ # Check if is_admin column exists+ inspector = db.inspect(db.engine)+ columns = [column['name'] for column in inspector.get_columns('user')]++ if 'is_admin' in columns:+ print("is_admin column already exists in User table.")+ return++ # Add is_admin column+ print("Adding is_admin column to User table...")+ try:+ db.engine.execute('ALTER TABLE user ADD COLUMN is_admin BOOLEAN DEFAULT 0')+ print("Column added successfully.")+ except Exception as e:+ print(f"Error adding column: {e}")+ sys.exit(1)++ print("\nMigration completed successfully!")+ print("You can now use the create_admin.py script to create admin users.")++if __name__ == "__main__":+ migrate_is_admin_field()++```++## reset_db.py```python@@ -113,14 +175,112 @@ if __name__ == "__main__":```+## create_admin.py++```python++#!/usr/bin/env python3++import os+import sys+import getpass+from email_validator import validate_email, EmailNotValidError++# Try to import from app context+try:+ from flask import current_app+ app = current_app._get_current_object()+ with app.app_context():+ db = app.extensions['sqlalchemy'].db+ User = app.extensions['sqlalchemy'].db.metadata.tables['user']+ bcrypt = app.extensions.get('bcrypt')+except (RuntimeError, AttributeError, KeyError):+ # If not in app context, import directly+ try:+ from app import app, db, User, bcrypt+ except ImportError as e:+ print(f"Error: Could not import required modules: {e}")+ print("Make sure create_admin.py is runnable and PYTHONPATH is set.")+ sys.exit(1)++def create_admin_user():+ """+ Create an admin user interactively.+ """+ print("Creating admin user for Speakr application")+ print("=========================================")++ # Get username+ while True:+ username = input("Enter username (min 3 characters): ").strip()+ if len(username) < 3:+ print("Username must be at least 3 characters long.")+ continue++ # Check if username already exists+ with app.app_context():+ existing_user = db.session.query(User).filter_by(username=username).first()+ if existing_user:+ print(f"Username '{username}' already exists. Please choose another.")+ continue+ break++ # Get email+ while True:+ email = input("Enter email address: ").strip()+ try:+ # Validate email+ validate_email(email)++ # Check if email already exists+ with app.app_context():+ existing_email = db.session.query(User).filter_by(email=email).first()+ if existing_email:+ print(f"Email '{email}' already exists. Please use another.")+ continue+ break+ except EmailNotValidError as e:+ print(f"Invalid email: {str(e)}")++ # Get password+ while True:+ password = getpass.getpass("Enter password (min 8 characters): ")+ if len(password) < 8:+ print("Password must be at least 8 characters long.")+ continue++ confirm_password = getpass.getpass("Confirm password: ")+ if password != confirm_password:+ print("Passwords do not match. Please try again.")+ continue+ break++ # Create user+ with app.app_context():+ hashed_password = bcrypt.generate_password_hash(password).decode('utf-8')+ new_user = User(username=username, email=email, password=hashed_password, is_admin=True)+ db.session.add(new_user)+ db.session.commit()++ print("\nAdmin user created successfully!")+ print(f"Username: {username}")+ print(f"Email: {email}")+ print("You can now log in to the application with these credentials.")++if __name__ == "__main__":+ create_admin_user()++```++## app.py```python-# app.py+# Speakr - Audio Transcription and Summarization Appimport osimport sys-from flask import Flask, render_template, request, jsonify, send_file+from flask import Flask, render_template, request, jsonify, send_file, Markup, redirect, url_for, flashfrom flask_sqlalchemy import SQLAlchemyfrom datetime import datetimefrom openai import OpenAI # Keep using the OpenAI library@@ -132,26 +292,81 @@ import threadingfrom dotenv import load_dotenv # Import load_dotenvimport httpximport re+import markdown+from flask_login import LoginManager, UserMixin, login_user, logout_user, login_required, current_user+from flask_bcrypt import Bcrypt+from flask_wtf import FlaskForm+from wtforms import StringField, PasswordField, SubmitField, BooleanField+from wtforms.validators import DataRequired, Length, Email, EqualTo, ValidationError# Load environment variables from .env fileload_dotenv()+# Initialize Flask-Bcrypt+bcrypt = Bcrypt()++# Helper function to convert markdown to HTML+def md_to_html(text):+ if not text:+ return ""+ # Convert markdown to HTML with extensions for tables, code highlighting, etc.+ html = markdown.markdown(text, extensions=[+ 'tables', # Support for tables+ 'fenced_code', # Support for ```code blocks```+ 'codehilite', # Syntax highlighting for code blocks+ 'nl2br', # Convert newlines to <br> tags+ 'sane_lists', # Better list handling+ 'smarty' # Smart quotes, dashes, etc.+ ])+ return html+app = Flask(__name__)# Ensure the path uses the directory structure from your setup scriptapp.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////opt/transcription-app/instance/transcriptions.db'app.config['UPLOAD_FOLDER'] = '/opt/transcription-app/uploads' # Use absolute path based on setupapp.config['MAX_CONTENT_LENGTH'] = 250 * 1024 * 1024 # 250MB max file size+# Set a secret key for session management and CSRF protection+app.config['SECRET_KEY'] = os.environ.get('SECRET_KEY', 'default-dev-key-change-in-production')db = SQLAlchemy()db.init_app(app)+# Initialize Flask-Login+login_manager = LoginManager()+login_manager.init_app(app)+login_manager.login_view = 'login'+login_manager.login_message_category = 'info'+bcrypt.init_app(app)++# Add context processor to make 'now' available to all templates[email protected]_processor+def inject_now():+ return {'now': datetime.now()}+# Ensure upload and instance directories existos.makedirs(app.config['UPLOAD_FOLDER'], exist_ok=True)# Assuming the instance folder is handled correctly by Flask or created by setup.sh# os.makedirs(os.path.dirname(app.config['SQLALCHEMY_DATABASE_URI'].replace('sqlite:///', '/')), exist_ok=True)+# --- User loader for Flask-Login ---+@login_manager.user_loader+def load_user(user_id):+ return db.session.get(User, int(user_id))+# --- Database Models ---+class User(db.Model, UserMixin):+ id = db.Column(db.Integer, primary_key=True)+ username = db.Column(db.String(20), unique=True, nullable=False)+ email = db.Column(db.String(120), unique=True, nullable=False)+ password = db.Column(db.String(60), nullable=False)+ is_admin = db.Column(db.Boolean, default=False)+ recordings = db.relationship('Recording', backref='owner', lazy=True)++ def __repr__(self):+ return f"User('{self.username}', '{self.email}')"class Recording(db.Model):+ # Add user_id foreign key to associate recordings with users+ user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=True)id = db.Column(db.Integer, primary_key=True)# Title will now often be AI-generated, maybe start with filename?title = db.Column(db.String(200), nullable=True) # Allow Null initially@@ -162,6 +377,7 @@ class Recording(db.Model):status = db.Column(db.String(50), default='PENDING') # PENDING, PROCESSING, SUMMARIZING, COMPLETED, FAILEDaudio_path = db.Column(db.String(500))created_at = db.Column(db.DateTime, default=datetime.utcnow)+ meeting_date = db.Column(db.Date, nullable=True) # <-- ADDED: Meeting Date fieldfile_size = db.Column(db.Integer) # Store file size in bytesdef to_dict(self):@@ -170,13 +386,41 @@ class Recording(db.Model):'title': self.title,'participants': self.participants,'notes': self.notes,+ 'notes_html': md_to_html(self.notes) if self.notes else "",'transcription': self.transcription,- 'summary': self.summary, # <-- ADDED: Include summary+ 'summary': self.summary,+ 'summary_html': md_to_html(self.summary) if self.summary else "",'status': self.status,'created_at': self.created_at.isoformat() if self.created_at else None,- 'file_size': self.file_size+ 'meeting_date': self.meeting_date.isoformat() if self.meeting_date else None, # <-- ADDED: Include meeting_date+ 'file_size': self.file_size,+ 'user_id': self.user_id}+# --- Forms for Authentication ---+class RegistrationForm(FlaskForm):+ username = StringField('Username', validators=[DataRequired(), Length(min=2, max=20)])+ email = StringField('Email', validators=[DataRequired(), Email()])+ password = PasswordField('Password', validators=[DataRequired(), Length(min=8)])+ confirm_password = PasswordField('Confirm Password', validators=[DataRequired(), EqualTo('password')])+ submit = SubmitField('Sign Up')++ def validate_username(self, username):+ user = User.query.filter_by(username=username.data).first()+ if user:+ raise ValidationError('That username is already taken. Please choose a different one.')++ def validate_email(self, email):+ user = User.query.filter_by(email=email.data).first()+ if user:+ raise ValidationError('That email is already registered. Please use a different one.')++class LoginForm(FlaskForm):+ email = StringField('Email', validators=[DataRequired(), Email()])+ password = PasswordField('Password', validators=[DataRequired()])+ remember = BooleanField('Remember Me')+ submit = SubmitField('Login')+with app.app_context():db.create_all()@@ -357,6 +601,400 @@ JSON Response:""" # The prompt guides the model towards the desired outputdb.session.commit()+# --- Chat with Transcription ---[email protected]('/chat', methods=['POST'])+@login_required+def chat_with_transcription():+ try:+ data = request.json+ if not data:+ return jsonify({'error': 'No data provided'}), 400++ recording_id = data.get('recording_id')+ user_message = data.get('message')+ message_history = data.get('message_history', [])++ if not recording_id:+ return jsonify({'error': 'No recording ID provided'}), 400+ if not user_message:+ return jsonify({'error': 'No message provided'}), 400++ # Get the recording+ recording = db.session.get(Recording, recording_id)+ if not recording:+ return jsonify({'error': 'Recording not found'}), 404++ # Check if the recording belongs to the current user+ if recording.user_id and recording.user_id != current_user.id:+ return jsonify({'error': 'You do not have permission to chat with this recording'}), 403++ # Check if OpenRouter client is available+ if client is None:+ return jsonify({'error': 'Chat service is not available (OpenRouter client not configured)'}), 503++ # Prepare the system prompt with the transcription+ system_prompt = f"""You are a professional meeting analyst working with Murtaza Nasir, Assistant Professor at Wichita State University. Analyze the following meeting information and respond to the specific request.++Following are the meeting participants and their roles:+{recording.participants or "No specific participants information provided."}++Following is the meeting transcript:+<<start transcript>>+{recording.transcription or "No transcript available."}+<<end transcript>>++Additional context and notes about the meeting:+{recording.notes or "none"}+"""++ # Call the LLM+ try:+ # Prepare messages array with system prompt and conversation history+ messages = [{"role": "system", "content": system_prompt}]++ # Add message history if provided+ if message_history:+ messages.extend(message_history)++ # Add the current user message+ messages.append({"role": "user", "content": user_message})++ completion = client.chat.completions.create(+ model=openrouter_model_name,+ messages=messages,+ temperature=0.7,+ max_tokens=1000+ )++ response_content = completion.choices[0].message.content++ # Convert markdown in the response to HTML+ response_html = md_to_html(response_content)++ return jsonify({+ 'response': response_content,+ 'response_html': response_html,+ 'success': True+ })++ except Exception as chat_error:+ app.logger.error(f"Error calling OpenRouter API for chat: {str(chat_error)}")+ return jsonify({'error': f'Chat service error: {str(chat_error)}'}), 500++ except Exception as e:+ app.logger.error(f"Error in chat endpoint: {str(e)}")+ return jsonify({'error': str(e)}), 500+++# --- Authentication Routes ---[email protected]('/register', methods=['GET', 'POST'])+def register():+ if current_user.is_authenticated:+ return redirect(url_for('index'))++ form = RegistrationForm()+ if form.validate_on_submit():+ hashed_password = bcrypt.generate_password_hash(form.password.data).decode('utf-8')+ user = User(username=form.username.data, email=form.email.data, password=hashed_password)+ db.session.add(user)+ db.session.commit()+ flash('Your account has been created! You can now log in.', 'success')+ return redirect(url_for('login'))++ return render_template('register.html', title='Register', form=form)+[email protected]('/login', methods=['GET', 'POST'])+def login():+ if current_user.is_authenticated:+ return redirect(url_for('index'))++ form = LoginForm()+ if form.validate_on_submit():+ user = User.query.filter_by(email=form.email.data).first()+ if user and bcrypt.check_password_hash(user.password, form.password.data):+ login_user(user, remember=form.remember.data)+ next_page = request.args.get('next')+ return redirect(next_page) if next_page else redirect(url_for('index'))+ else:+ flash('Login unsuccessful. Please check email and password.', 'danger')++ return render_template('login.html', title='Login', form=form)+[email protected]('/logout')+def logout():+ logout_user()+ return redirect(url_for('index'))+[email protected]('/account', methods=['GET'])+@login_required+def account():+ return render_template('account.html', title='Account')+[email protected]('/change_password', methods=['POST'])+@login_required+def change_password():+ current_password = request.form.get('current_password')+ new_password = request.form.get('new_password')+ confirm_password = request.form.get('confirm_password')++ # Validate form data+ if not current_password or not new_password or not confirm_password:+ flash('All fields are required.', 'danger')+ return redirect(url_for('account'))++ if new_password != confirm_password:+ flash('New password and confirmation do not match.', 'danger')+ return redirect(url_for('account'))++ # Check if current password is correct+ if not bcrypt.check_password_hash(current_user.password, current_password):+ flash('Current password is incorrect.', 'danger')+ return redirect(url_for('account'))++ # Update password+ current_user.password = bcrypt.generate_password_hash(new_password).decode('utf-8')+ db.session.commit()++ flash('Your password has been updated successfully.', 'success')+ return redirect(url_for('account'))++# --- Admin Routes ---[email protected]('/admin', methods=['GET'])+@login_required+def admin():+ # Check if user is admin+ if not current_user.is_admin:+ flash('You do not have permission to access the admin page.', 'danger')+ return redirect(url_for('index'))+ return render_template('admin.html', title='Admin Dashboard')+[email protected]('/admin/users', methods=['GET'])+@login_required+def admin_get_users():+ # Check if user is admin+ if not current_user.is_admin:+ return jsonify({'error': 'Unauthorized'}), 403++ users = User.query.all()+ user_data = []++ for user in users:+ # Get recordings count and storage used+ recordings_count = len(user.recordings)+ storage_used = sum(r.file_size for r in user.recordings if r.file_size) or 0++ user_data.append({+ 'id': user.id,+ 'username': user.username,+ 'email': user.email,+ 'is_admin': user.is_admin,+ 'recordings_count': recordings_count,+ 'storage_used': storage_used+ })++ return jsonify(user_data)+[email protected]('/admin/users', methods=['POST'])+@login_required+def admin_add_user():+ # Check if user is admin+ if not current_user.is_admin:+ return jsonify({'error': 'Unauthorized'}), 403++ data = request.json+ if not data:+ return jsonify({'error': 'No data provided'}), 400++ # Validate required fields+ required_fields = ['username', 'email', 'password']+ for field in required_fields:+ if field not in data:+ return jsonify({'error': f'Missing required field: {field}'}), 400++ # Check if username or email already exists+ if User.query.filter_by(username=data['username']).first():+ return jsonify({'error': 'Username already exists'}), 400++ if User.query.filter_by(email=data['email']).first():+ return jsonify({'error': 'Email already exists'}), 400++ # Create new user+ hashed_password = bcrypt.generate_password_hash(data['password']).decode('utf-8')+ new_user = User(+ username=data['username'],+ email=data['email'],+ password=hashed_password,+ is_admin=data.get('is_admin', False)+ )++ db.session.add(new_user)+ db.session.commit()++ return jsonify({+ 'id': new_user.id,+ 'username': new_user.username,+ 'email': new_user.email,+ 'is_admin': new_user.is_admin,+ 'recordings_count': 0,+ 'storage_used': 0+ }), 201+[email protected]('/admin/users/<int:user_id>', methods=['PUT'])+@login_required+def admin_update_user(user_id):+ # Check if user is admin+ if not current_user.is_admin:+ return jsonify({'error': 'Unauthorized'}), 403++ user = db.session.get(User, user_id)+ if not user:+ return jsonify({'error': 'User not found'}), 404++ data = request.json+ if not data:+ return jsonify({'error': 'No data provided'}), 400++ # Update user fields+ if 'username' in data and data['username'] != user.username:+ # Check if username already exists+ if User.query.filter_by(username=data['username']).first():+ return jsonify({'error': 'Username already exists'}), 400+ user.username = data['username']++ if 'email' in data and data['email'] != user.email:+ # Check if email already exists+ if User.query.filter_by(email=data['email']).first():+ return jsonify({'error': 'Email already exists'}), 400+ user.email = data['email']++ if 'password' in data and data['password']:+ user.password = bcrypt.generate_password_hash(data['password']).decode('utf-8')++ if 'is_admin' in data:+ user.is_admin = data['is_admin']++ db.session.commit()++ # Get recordings count and storage used+ recordings_count = len(user.recordings)+ storage_used = sum(r.file_size for r in user.recordings if r.file_size) or 0++ return jsonify({+ 'id': user.id,+ 'username': user.username,+ 'email': user.email,+ 'is_admin': user.is_admin,+ 'recordings_count': recordings_count,+ 'storage_used': storage_used+ })+[email protected]('/admin/users/<int:user_id>', methods=['DELETE'])+@login_required+def admin_delete_user(user_id):+ # Check if user is admin+ if not current_user.is_admin:+ return jsonify({'error': 'Unauthorized'}), 403++ # Prevent deleting self+ if user_id == current_user.id:+ return jsonify({'error': 'Cannot delete your own account'}), 400++ user = db.session.get(User, user_id)+ if not user:+ return jsonify({'error': 'User not found'}), 404++ # Delete user's recordings and audio files+ for recording in user.recordings:+ try:+ if recording.audio_path and os.path.exists(recording.audio_path):+ os.remove(recording.audio_path)+ except Exception as e:+ app.logger.error(f"Error deleting audio file {recording.audio_path}: {e}")++ # Delete user+ db.session.delete(user)+ db.session.commit()++ return jsonify({'success': True})+[email protected]('/admin/users/<int:user_id>/toggle-admin', methods=['POST'])+@login_required+def admin_toggle_admin(user_id):+ # Check if user is admin+ if not current_user.is_admin:+ return jsonify({'error': 'Unauthorized'}), 403++ # Prevent changing own admin status+ if user_id == current_user.id:+ return jsonify({'error': 'Cannot change your own admin status'}), 400++ user = db.session.get(User, user_id)+ if not user:+ return jsonify({'error': 'User not found'}), 404++ # Toggle admin status+ user.is_admin = not user.is_admin+ db.session.commit()++ return jsonify({'success': True, 'is_admin': user.is_admin})+[email protected]('/admin/stats', methods=['GET'])+@login_required+def admin_get_stats():+ # Check if user is admin+ if not current_user.is_admin:+ return jsonify({'error': 'Unauthorized'}), 403++ # Get total users+ total_users = User.query.count()++ # Get total recordings+ total_recordings = Recording.query.count()++ # Get recordings by status+ completed_recordings = Recording.query.filter_by(status='COMPLETED').count()+ processing_recordings = Recording.query.filter(Recording.status.in_(['PROCESSING', 'SUMMARIZING'])).count()+ pending_recordings = Recording.query.filter_by(status='PENDING').count()+ failed_recordings = Recording.query.filter_by(status='FAILED').count()++ # Get total storage used+ total_storage = db.session.query(db.func.sum(Recording.file_size)).scalar() or 0++ # Get top users by storage+ top_users_query = db.session.query(+ User.id,+ User.username,+ db.func.count(Recording.id).label('recordings_count'),+ db.func.sum(Recording.file_size).label('storage_used')+ ).join(Recording, User.id == Recording.user_id, isouter=True) \+ .group_by(User.id) \+ .order_by(db.func.sum(Recording.file_size).desc()) \+ .limit(5)++ top_users = []+ for user_id, username, recordings_count, storage_used in top_users_query:+ top_users.append({+ 'id': user_id,+ 'username': username,+ 'recordings_count': recordings_count or 0,+ 'storage_used': storage_used or 0+ })++ # Get total queries (chat requests)+ # This is a placeholder - you would need to track this in your database+ total_queries = 0++ return jsonify({+ 'total_users': total_users,+ 'total_recordings': total_recordings,+ 'completed_recordings': completed_recordings,+ 'processing_recordings': processing_recordings,+ 'pending_recordings': pending_recordings,+ 'failed_recordings': failed_recordings,+ 'total_storage': total_storage,+ 'top_users': top_users,+ 'total_queries': total_queries+ })# --- Flask Routes ---@app.route('/')@@ -364,9 +1002,11 @@ def index():return render_template('index.html')@app.route('/recordings', methods=['GET'])+@login_requireddef get_recordings():try:- stmt = select(Recording).order_by(Recording.created_at.desc())+ # Filter recordings by the current user+ stmt = select(Recording).where(Recording.user_id == current_user.id).order_by(Recording.created_at.desc())recordings = db.session.execute(stmt).scalars().all()return jsonify([recording.to_dict() for recording in recordings])except Exception as e:@@ -374,6 +1014,7 @@ def get_recordings():return jsonify({'error': str(e)}), 500@app.route('/save', methods=['POST'])+@login_requireddef save_metadata():try:data = request.json@@ -383,12 +1024,28 @@ def save_metadata():recording = db.session.get(Recording, recording_id)if not recording: return jsonify({'error': 'Recording not found'}), 404++ # Check if the recording belongs to the current user+ if recording.user_id and recording.user_id != current_user.id:+ return jsonify({'error': 'You do not have permission to edit this recording'}), 403# Update fields if providedif 'title' in data: recording.title = data['title']if 'participants' in data: recording.participants = data['participants']if 'notes' in data: recording.notes = data['notes']if 'summary' in data: recording.summary = data['summary'] # <-- ADDED: Allow saving edited summary+ if 'meeting_date' in data:+ try:+ # Attempt to parse date string (e.g., "YYYY-MM-DD")+ date_str = data['meeting_date']+ if date_str:+ recording.meeting_date = datetime.strptime(date_str, '%Y-%m-%d').date()+ else:+ recording.meeting_date = None # Allow clearing the date+ except (ValueError, TypeError) as e:+ app.logger.warning(f"Could not parse meeting_date '{data.get('meeting_date')}': {e}")+ # Optionally return an error or just ignore the invalid date+ # return jsonify({'error': f"Invalid date format for meeting_date. Use YYYY-MM-DD."}), 400# Do not update transcription or status heredb.session.commit()@@ -401,6 +1058,7 @@ def save_metadata():@app.route('/upload', methods=['POST'])+@login_requireddef upload_file():try:if 'file' not in request.files:@@ -432,7 +1090,9 @@ def upload_file():# Use filename (without path part) as initial titletitle=f"Recording - {filename}",file_size=file_size,- status='PENDING' # Explicitly set status+ status='PENDING', # Explicitly set status+ meeting_date=datetime.utcnow().date(), # <-- ADDED: Default meeting_date to today+ user_id=current_user.id # Associate with the current user)db.session.add(recording)db.session.commit()@@ -463,26 +1123,37 @@ def upload_file():return jsonify({'error': str(e)}), 500-# Status Endpoint (no changes needed, it returns the full recording dict)+# Status Endpoint@app.route('/status/<int:recording_id>', methods=['GET'])+@login_requireddef get_status(recording_id):"""Endpoint to check the transcription/summarization status."""try:recording = db.session.get(Recording, recording_id)if not recording:return jsonify({'error': 'Recording not found'}), 404++ # Check if the recording belongs to the current user+ if recording.user_id and recording.user_id != current_user.id:+ return jsonify({'error': 'You do not have permission to view this recording'}), 403+return jsonify(recording.to_dict())except Exception as e:app.logger.error(f"Error fetching status for recording {recording_id}: {e}")return jsonify({'error': str(e)}), 500-# Get Audio Endpoint (no changes needed)+# Get Audio Endpoint@app.route('/audio/<int:recording_id>')+@login_requireddef get_audio(recording_id):try:recording = db.session.get(Recording, recording_id)if not recording or not recording.audio_path:return jsonify({'error': 'Recording or audio file not found'}), 404++ # Check if the recording belongs to the current user+ if recording.user_id and recording.user_id != current_user.id:+ return jsonify({'error': 'You do not have permission to access this audio file'}), 403if not os.path.exists(recording.audio_path):app.logger.error(f"Audio file missing from server: {recording.audio_path}")return jsonify({'error': 'Audio file missing from server'}), 404@@ -491,13 +1162,18 @@ def get_audio(recording_id):app.logger.error(f"Error serving audio for recording {recording_id}: {e}")return jsonify({'error': str(e)}), 500-# Delete Recording Endpoint (no changes needed functionally)+# Delete Recording Endpoint@app.route('/recording/<int:recording_id>', methods=['DELETE'])+@login_requireddef delete_recording(recording_id):try:recording = db.session.get(Recording, recording_id)if not recording:return jsonify({'error': 'Recording not found'}), 404++ # Check if the recording belongs to the current user+ if recording.user_id and recording.user_id != current_user.id:+ return jsonify({'error': 'You do not have permission to delete this recording'}), 403# Delete the audio file firsttry:@@ -524,6 +1200,135 @@ if __name__ == '__main__':# waitress-serve --host 0.0.0.0 --port 8899 app:app# For development:app.run(host='0.0.0.0', port=8899, debug=True) # Set debug=False if thread issues arise++```+++## migrate_db.py++```python++#!/usr/bin/env python3++import os+import sys+from sqlalchemy import inspect, Column, Integer, ForeignKey+from sqlalchemy.exc import OperationalError++# Try to import from app context+try:+ from flask import current_app+ app = current_app._get_current_object()+ with app.app_context():+ db = app.extensions['sqlalchemy'].db+except (RuntimeError, AttributeError, KeyError):+ # If not in app context, import directly+ try:+ from app import app, db, User, Recording+ except ImportError as e:+ print(f"Error: Could not import 'app' and 'db': {e}")+ print("Make sure migrate_db.py is runnable and PYTHONPATH is set.")+ sys.exit(1)++def migrate_database():+ """+ Migrate the database schema without losing data:+ 1. Check if User table exists, create it if not+ 2. Check if Recording.user_id column exists, add it if not+ """+ print("Starting database migration...")++ with app.app_context():+ inspector = inspect(db.engine)+ existing_tables = inspector.get_table_names()++ # Check if User table exists+ if 'user' not in existing_tables:+ print("Creating User table...")+ # Create User table+ class TempUser(db.Model):+ __tablename__ = 'user'+ id = db.Column(db.Integer, primary_key=True)+ username = db.Column(db.String(20), unique=True, nullable=False)+ email = db.Column(db.String(120), unique=True, nullable=False)+ password = db.Column(db.String(60), nullable=False)++ # Create only the User table+ db.create_all(tables=[TempUser.__table__])+ print("User table created successfully!")+ else:+ print("User table already exists.")++ # Check if Recording.user_id column exists+ recording_columns = [column['name'] for column in inspector.get_columns('recording')]+ if 'user_id' not in recording_columns:+ print("Adding user_id column to Recording table...")+ try:+ # Add user_id column to Recording table+ with db.engine.begin() as conn:+ conn.execute(db.text("ALTER TABLE recording ADD COLUMN user_id INTEGER REFERENCES user(id)"))+ print("user_id column added successfully!")+ except OperationalError as e:+ print(f"Error adding user_id column: {e}")+ print("Attempting alternative approach...")+ try:+ # SQLite doesn't support ALTER TABLE ADD COLUMN with foreign keys+ # So we need to create a new table, copy data, drop old table, rename new table++ # 1. Create temporary table with new schema+ with db.engine.begin() as conn:+ conn.execute(db.text("""+ CREATE TABLE recording_new (+ id INTEGER PRIMARY KEY,+ title VARCHAR(200),+ participants VARCHAR(500),+ notes TEXT,+ transcription TEXT,+ summary TEXT,+ status VARCHAR(50),+ audio_path VARCHAR(500),+ created_at DATETIME,+ meeting_date DATE,+ file_size INTEGER,+ user_id INTEGER REFERENCES user(id)+ )+ """))++ # 2. Copy data from old table to new table+ with db.engine.begin() as conn:+ conn.execute(db.text("""+ INSERT INTO recording_new (+ id, title, participants, notes, transcription, summary,+ status, audio_path, created_at, meeting_date, file_size+ )+ SELECT+ id, title, participants, notes, transcription, summary,+ status, audio_path, created_at, meeting_date, file_size+ FROM recording+ """))++ # 3. Drop old table+ with db.engine.begin() as conn:+ conn.execute(db.text("DROP TABLE recording"))++ # 4. Rename new table+ with db.engine.begin() as conn:+ conn.execute(db.text("ALTER TABLE recording_new RENAME TO recording"))++ print("user_id column added successfully using table recreation!")+ except Exception as e2:+ print(f"Error during table recreation: {e2}")+ sys.exit(1)+ else:+ print("user_id column already exists in Recording table.")++ print("Database migration completed successfully!")++if __name__ == "__main__":+ print("Attempting to migrate the database...")+ migrate_database()+ print("Database migration process finished.")+```@@ -607,14 +1412,20 @@ if __name__ == "__main__":flask==2.3.3flask-sqlalchemy==3.1.1+flask-login==0.6.3+flask-wtf==1.2.2+flask-bcrypt==1.0.1+email-validator==2.2.0openai==1.3.0werkzeug==2.3.7gunicorn==21.2.0python-dotenv==1.0.0+markdown==3.5.1+```-## templates/index.html+## templates/account.html```html@@ -623,145 +1434,1592 @@ python-dotenv==1.0.0<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">- <title>Audio Transcription App</title>+ <title>{{ title }} - Speakr</title><script src="https://cdn.tailwindcss.com"></script>- <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet"><style>- /* Existing styles... */- .drag-area { transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out; }- .custom-scrollbar::-webkit-scrollbar { width: 8px; }- .custom-scrollbar::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; }- .custom-scrollbar::-webkit-scrollbar-thumb { background: #c5c5c5; border-radius: 10px; }- .custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #a8a8a8; }+ /* Dark Mode CSS Variables */+ :root {+ /* Light mode variables */+ --bg-primary: #f3f4f6; /* gray-100 */+ --bg-secondary: #ffffff; /* white */+ --bg-tertiary: #f9fafb; /* gray-50 */+ --bg-accent: #dbeafe; /* blue-100 */+ --bg-accent-hover: #bfdbfe; /* blue-200 */+ --bg-button: #2563eb; /* blue-600 */+ --bg-button-hover: #1d4ed8; /* blue-700 */+ --bg-danger: #dc2626; /* red-600 */+ --bg-danger-hover: #b91c1c; /* red-700 */+ --bg-danger-light: #fee2e2; /* red-100 */+ --bg-info-light: #dbeafe; /* blue-100 */+ --bg-warn-light: #fef3c7; /* amber-100 */+ --bg-success-light: #d1fae5; /* green-100 */+ --bg-pending-light: #f5f5f4; /* stone-100 */+ --bg-input: #ffffff; /* white */++ --text-primary: #1f2937; /* gray-800 */+ --text-secondary: #374151; /* gray-700 */+ --text-muted: #6b7280; /* gray-500 */+ --text-light: #9ca3af; /* gray-400 */+ --text-accent: #1d4ed8; /* blue-700 */+ --text-button: #ffffff; /* white */+ --text-danger: #b91c1c; /* red-700 */+ --text-danger-strong: #991b1b; /* red-800 */+ --text-info-strong: #1e40af; /* blue-800 */+ --text-warn-strong: #92400e; /* amber-800 */+ --text-success-strong: #065f46; /* green-800 */+ --text-pending-strong: #44403c; /* stone-700 */++ --border-primary: #e5e7eb; /* gray-200 */+ --border-secondary: #d1d5db; /* gray-300 */+ --border-accent: #93c5fd; /* blue-300 */+ --border-danger: #f87171; /* red-400 */+ --border-focus: #3b82f6; /* blue-500 */+ --ring-focus: #bfdbfe; /* blue-200 */+ }++ .dark {+ /* Dark mode variables */+ --bg-primary: #111827; /* gray-900 */+ --bg-secondary: #1f2937; /* gray-800 */+ --bg-tertiary: #374151; /* gray-700 */+ --bg-accent: #1e3a8a; /* blue-900 */+ --bg-accent-hover: #1e40af; /* blue-800 */+ --bg-button: #2563eb; /* blue-600 */+ --bg-button-hover: #3b82f6; /* blue-500 */+ --bg-danger: #dc2626; /* red-600 */+ --bg-danger-hover: #ef4444; /* red-500 */+ --bg-danger-light: #7f1d1d; /* red-900 */+ --bg-info-light: #1e3a8a; /* blue-900 */+ --bg-warn-light: #78350f; /* amber-900 */+ --bg-success-light: #064e3b; /* green-900 */+ --bg-pending-light: #292524; /* stone-800 */+ --bg-input: #374151; /* gray-700 */++ --text-primary: #f3f4f6; /* gray-100 */+ --text-secondary: #d1d5db; /* gray-300 */+ --text-muted: #9ca3af; /* gray-400 */+ --text-light: #6b7280; /* gray-500 */+ --text-accent: #60a5fa; /* blue-400 */+ --text-button: #ffffff; /* white */+ --text-danger: #f87171; /* red-400 */+ --text-danger-strong: #fca5a5; /* red-300 */+ --text-info-strong: #93c5fd; /* blue-300 */+ --text-warn-strong: #fcd34d; /* amber-300 */+ --text-success-strong: #6ee7b7; /* green-300 */+ --text-pending-strong: #d6d3d1; /* stone-300 */++ --border-primary: #374151; /* gray-700 */+ --border-secondary: #4b5563; /* gray-600 */+ --border-accent: #1d4ed8; /* blue-700 */+ --border-danger: #ef4444; /* red-500 */+ --border-focus: #3b82f6; /* blue-500 */+ --ring-focus: #1e40af; /* blue-800 */+ }++ html {+ background-color: var(--bg-primary);+ color: var(--text-primary);+ transition: background-color 0.3s, color 0.3s;+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;+ }html, body { height: 100%; margin: 0; }- #app { min-height: 100%; display: flex; flex-direction: column; }- main { flex-grow: 1; position: relative; }- .progress-popup { position: fixed; bottom: 1rem; left: 1rem; z-index: 100; transition: all 0.3s ease-in-out; min-width: 300px; }- .progress-popup.minimized { transform: translateY(calc(100% - 45px)); }- .progress-list-item { display: grid; grid-template-columns: auto 1fr auto; gap: 0.5rem; align-items: center; }- /* Add style for summary pre */- .summary-box {- background-color: #f9fafb; /* bg-gray-50 */- padding: 0.75rem; /* p-3 */- border-radius: 0.375rem; /* rounded */- border: 1px solid #e5e7eb; /* border-gray-200 */- min-height: 60px; /* min-h-[60px] or adjust as needed */- max-height: 20rem; /* Limit height */- overflow-y: auto;- white-space: pre-wrap;- font-family: inherit; /* Use body font */- font-size: 0.875rem; /* text-sm */- line-height: 1.25rem;+ </style>+</head>+<body class="bg-[var(--bg-primary)] text-[var(--text-primary)]">+ <div class="container mx-auto px-4 sm:px-6 lg:px-8 py-6 flex flex-col min-h-screen">+ <header class="flex justify-between items-center mb-6 pb-4 border-b border-[var(--border-primary)]">+ <h1 class="text-3xl font-bold text-[var(--text-primary)]">+ <a href="{{ url_for('index') }}">Speakr</a>+ </h1>+ <div class="flex items-center space-x-2">+ <button id="darkModeToggle" class="p-2 rounded-full text-[var(--text-muted)] hover:bg-[var(--bg-tertiary)] dark:text-gray-400 dark:hover:bg-gray-700 transition-colors duration-200">+ <i id="darkModeIcon" class="fas fa-moon"></i>+ </button>+ <div class="relative" id="userDropdown">+ <button id="userDropdownButton" class="flex items-center px-3 py-2 border border-[var(--border-secondary)] rounded-lg text-[var(--text-secondary)] hover:text-[var(--text-accent)] focus:outline-none">+ <i class="fas fa-user mr-2"></i>+ <span>{{ current_user.username }}</span>+ <i class="fas fa-chevron-down ml-2"></i>+ </button>+ <div id="userDropdownMenu" class="hidden absolute right-0 mt-2 w-48 bg-[var(--bg-secondary)] border border-[var(--border-primary)] rounded-lg shadow-lg z-10">+ <a href="{{ url_for('index') }}" class="block px-4 py-2 text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] hover:text-[var(--text-accent)]">+ <i class="fas fa-home mr-2"></i> Home+ </a>+ <a href="{{ url_for('account') }}" class="block px-4 py-2 text-[var(--text-accent)] bg-[var(--bg-accent)]">+ <i class="fas fa-user-circle mr-2"></i> Account+ </a>+ {% if current_user.is_admin %}+ <a href="{{ url_for('admin') }}" class="block px-4 py-2 text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] hover:text-[var(--text-accent)]">+ <i class="fas fa-user-shield mr-2"></i> Admin+ </a>+ {% endif %}+ <a href="{{ url_for('logout') }}" class="block px-4 py-2 text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] hover:text-[var(--text-danger)]">+ <i class="fas fa-sign-out-alt mr-2"></i> Logout+ </a>+ </div>+ </div>+ </div>+ </header>++ <main class="flex-grow">+ <div class="bg-[var(--bg-secondary)] p-8 rounded-xl shadow-lg border border-[var(--border-primary)]">+ <h2 class="text-2xl font-semibold text-[var(--text-primary)] mb-6">Account Information</h2>++ {% with messages = get_flashed_messages(with_categories=true) %}+ {% if messages %}+ {% for category, message in messages %}+ <div class="mb-4 p-3 rounded-lg {% if category == 'success' %}bg-[var(--bg-success-light)] text-[var(--text-success-strong)]{% elif category == 'danger' %}bg-[var(--bg-danger-light)] text-[var(--text-danger-strong)]{% else %}bg-[var(--bg-info-light)] text-[var(--text-info-strong)]{% endif %}">+ {{ message }}+ </div>+ {% endfor %}+ {% endif %}+ {% endwith %}++ <div class="grid grid-cols-1 md:grid-cols-2 gap-8">+ <div>+ <div class="mb-6">+ <h3 class="text-lg font-medium text-[var(--text-secondary)] mb-2">User Details</h3>+ <div class="bg-[var(--bg-tertiary)] p-4 rounded-lg border border-[var(--border-primary)]">+ <div class="mb-3">+ <span class="block text-sm font-medium text-[var(--text-muted)]">Username</span>+ <span class="block text-[var(--text-primary)]">{{ current_user.username }}</span>+ </div>+ <div>+ <span class="block text-sm font-medium text-[var(--text-muted)]">Email</span>+ <span class="block text-[var(--text-primary)]">{{ current_user.email }}</span>+ </div>+ </div>+ </div>++ <div>+ <h3 class="text-lg font-medium text-[var(--text-secondary)] mb-2">Account Actions</h3>+ <div class="flex flex-col space-y-3">+ <a href="{{ url_for('index') }}" class="inline-flex items-center px-4 py-2 bg-[var(--bg-button)] text-[var(--text-button)] rounded-md hover:bg-[var(--bg-button-hover)] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[var(--border-focus)] transition-colors duration-200">+ <i class="fas fa-microphone mr-2"></i> Go to Recordings+ </a>+ <button id="changePasswordBtn" class="inline-flex items-center px-4 py-2 border border-[var(--border-secondary)] text-[var(--text-secondary)] rounded-md hover:bg-[var(--bg-tertiary)] hover:text-[var(--text-accent)] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[var(--border-focus)] transition-colors duration-200">+ <i class="fas fa-key mr-2"></i> Change Password+ </button>+ </div>+ </div>+ </div>++ <div>+ <h3 class="text-lg font-medium text-[var(--text-secondary)] mb-2">Account Statistics</h3>+ <div class="bg-[var(--bg-tertiary)] p-4 rounded-lg border border-[var(--border-primary)]">+ <div class="grid grid-cols-2 gap-4">+ <div class="text-center p-4 bg-[var(--bg-secondary)] rounded-lg border border-[var(--border-primary)] shadow-sm">+ <span class="block text-3xl font-bold text-[var(--text-accent)]">{{ current_user.recordings|length }}</span>+ <span class="block text-sm text-[var(--text-muted)]">Total Recordings</span>+ </div>++ <div class="text-center p-4 bg-[var(--bg-secondary)] rounded-lg border border-[var(--border-primary)] shadow-sm">+ <span class="block text-3xl font-bold text-[var(--text-accent)]">+ {% set completed_count = current_user.recordings|selectattr('status', 'equalto', 'COMPLETED')|list|length %}+ {{ completed_count }}+ </span>+ <span class="block text-sm text-[var(--text-muted)]">Completed</span>+ </div>++ <div class="text-center p-4 bg-[var(--bg-secondary)] rounded-lg border border-[var(--border-primary)] shadow-sm">+ <span class="block text-3xl font-bold text-[var(--text-warn-strong)]">+ {% set processing_count = current_user.recordings|selectattr('status', 'in', ['PENDING', 'PROCESSING', 'SUMMARIZING'])|list|length %}+ {{ processing_count }}+ </span>+ <span class="block text-sm text-[var(--text-muted)]">Processing</span>+ </div>++ <div class="text-center p-4 bg-[var(--bg-secondary)] rounded-lg border border-[var(--border-primary)] shadow-sm">+ <span class="block text-3xl font-bold text-[var(--text-danger)]">+ {% set failed_count = current_user.recordings|selectattr('status', 'equalto', 'FAILED')|list|length %}+ {{ failed_count }}+ </span>+ <span class="block text-sm text-[var(--text-muted)]">Failed</span>+ </div>+ </div>+ </div>+ </div>+ </div>+ </div>+ </main>++ <footer class="text-center py-4 mt-8 text-xs text-[var(--text-light)] border-t border-[var(--border-primary)]">+ Speakr © {{ now.year }}+ </footer>+ </div>++ <!-- Change Password Modal -->+ <div id="changePasswordModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">+ <div class="bg-[var(--bg-secondary)] p-6 rounded-lg shadow-xl w-full max-w-md">+ <div class="flex justify-between items-center mb-4">+ <h3 class="text-xl font-semibold text-[var(--text-primary)]">Change Password</h3>+ <button id="closeModalBtn" class="text-[var(--text-light)] hover:text-[var(--text-muted)] text-2xl leading-none">×</button>+ </div>+ <form id="changePasswordForm" method="POST" action="{{ url_for('change_password') }}">+ <div class="mb-4">+ <label for="current_password" class="block text-sm font-medium text-[var(--text-secondary)] mb-1">Current Password</label>+ <input type="password" id="current_password" name="current_password" required class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">+ </div>+ <div class="mb-4">+ <label for="new_password" class="block text-sm font-medium text-[var(--text-secondary)] mb-1">New Password</label>+ <input type="password" id="new_password" name="new_password" required minlength="8" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">+ <p class="text-xs text-[var(--text-muted)] mt-1">Password must be at least 8 characters long</p>+ </div>+ <div class="mb-6">+ <label for="confirm_password" class="block text-sm font-medium text-[var(--text-secondary)] mb-1">Confirm New Password</label>+ <input type="password" id="confirm_password" name="confirm_password" required class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">+ </div>+ <div class="flex justify-end space-x-3">+ <button type="button" id="cancelBtn" class="px-4 py-2 bg-[var(--bg-tertiary)] text-[var(--text-secondary)] rounded-md hover:bg-[var(--border-secondary)]">Cancel</button>+ <button type="submit" class="px-4 py-2 bg-[var(--bg-button)] text-[var(--text-button)] rounded-md hover:bg-[var(--bg-button-hover)]">Change Password</button>+ </div>+ </form>+ </div>+ </div>++ <script>+ // Dark mode toggle functionality+ const darkModeToggle = document.getElementById('darkModeToggle');+ const darkModeIcon = document.getElementById('darkModeIcon');++ // Initialize dark mode based on localStorage or system preference+ function initializeDarkMode() {+ const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;+ const savedMode = localStorage.getItem('darkMode');++ if (savedMode === 'true' || (savedMode === null && prefersDark)) {+ document.documentElement.classList.add('dark');+ darkModeIcon.classList.remove('fa-moon');+ darkModeIcon.classList.add('fa-sun');+ } else {+ document.documentElement.classList.remove('dark');+ darkModeIcon.classList.remove('fa-sun');+ darkModeIcon.classList.add('fa-moon');+ }}- .status-badge {- display: inline-block;- padding: 0.125rem 0.5rem; /* px-2 py-0.5 */- font-size: 0.75rem; /* text-xs */- font-weight: 600; /* font-semibold */- border-radius: 9999px; /* rounded-full */- margin-top: 0.5rem; /* mt-2 */++ // Toggle dark mode+ darkModeToggle.addEventListener('click', () => {+ const isDarkMode = document.documentElement.classList.toggle('dark');+ localStorage.setItem('darkMode', isDarkMode);++ if (isDarkMode) {+ darkModeIcon.classList.remove('fa-moon');+ darkModeIcon.classList.add('fa-sun');+ } else {+ darkModeIcon.classList.remove('fa-sun');+ darkModeIcon.classList.add('fa-moon');+ }+ });++ // User dropdown functionality+ const userDropdownButton = document.getElementById('userDropdownButton');+ const userDropdownMenu = document.getElementById('userDropdownMenu');++ userDropdownButton.addEventListener('click', () => {+ userDropdownMenu.classList.toggle('hidden');+ });++ // Close dropdown when clicking outside+ document.addEventListener('click', (event) => {+ if (!userDropdownButton.contains(event.target) && !userDropdownMenu.contains(event.target)) {+ userDropdownMenu.classList.add('hidden');+ }+ });++ // Initialize dark mode on page load+ initializeDarkMode();++ // Change Password Modal functionality+ const changePasswordBtn = document.getElementById('changePasswordBtn');+ const changePasswordModal = document.getElementById('changePasswordModal');+ const closeModalBtn = document.getElementById('closeModalBtn');+ const cancelBtn = document.getElementById('cancelBtn');+ const changePasswordForm = document.getElementById('changePasswordForm');+ const newPasswordInput = document.getElementById('new_password');+ const confirmPasswordInput = document.getElementById('confirm_password');++ // Open modal+ changePasswordBtn.addEventListener('click', () => {+ changePasswordModal.classList.remove('hidden');+ // Reset form+ changePasswordForm.reset();+ });++ // Close modal functions+ function closeModal() {+ changePasswordModal.classList.add('hidden');+ }++ closeModalBtn.addEventListener('click', closeModal);+ cancelBtn.addEventListener('click', closeModal);++ // Close modal when clicking outside+ changePasswordModal.addEventListener('click', (event) => {+ if (event.target === changePasswordModal) {+ closeModal();+ }+ });++ // Form validation+ changePasswordForm.addEventListener('submit', (event) => {+ if (newPasswordInput.value !== confirmPasswordInput.value) {+ event.preventDefault();+ alert('New password and confirmation do not match.');+ }+ });+ </script>+</body>+</html>++```+++## templates/admin.html++```html++<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="UTF-8">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title>Admin Dashboard - Speakr</title>+ <script src="https://cdn.tailwindcss.com"></script>+ <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>+ <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">+ <style>+ /* Dark Mode CSS Variables */+ :root {+ /* Light mode variables */+ --bg-primary: #f3f4f6; /* gray-100 */+ --bg-secondary: #ffffff; /* white */+ --bg-tertiary: #f9fafb; /* gray-50 */+ --bg-accent: #dbeafe; /* blue-100 */+ --bg-accent-hover: #bfdbfe; /* blue-200 */+ --bg-button: #2563eb; /* blue-600 */+ --bg-button-hover: #1d4ed8; /* blue-700 */+ --bg-danger: #dc2626; /* red-600 */+ --bg-danger-hover: #b91c1c; /* red-700 */+ --bg-danger-light: #fee2e2; /* red-100 */+ --bg-info-light: #dbeafe; /* blue-100 */+ --bg-warn-light: #fef3c7; /* amber-100 */+ --bg-success-light: #d1fae5; /* green-100 */+ --bg-pending-light: #f5f5f4; /* stone-100 */+ --bg-input: #ffffff; /* white */++ --text-primary: #1f2937; /* gray-800 */+ --text-secondary: #374151; /* gray-700 */+ --text-muted: #6b7280; /* gray-500 */+ --text-light: #9ca3af; /* gray-400 */+ --text-accent: #1d4ed8; /* blue-700 */+ --text-button: #ffffff; /* white */+ --text-danger: #b91c1c; /* red-700 */+ --text-danger-strong: #991b1b; /* red-800 */+ --text-info-strong: #1e40af; /* blue-800 */+ --text-warn-strong: #92400e; /* amber-800 */+ --text-success-strong: #065f46; /* green-800 */+ --text-pending-strong: #44403c; /* stone-700 */++ --border-primary: #e5e7eb; /* gray-200 */+ --border-secondary: #d1d5db; /* gray-300 */+ --border-accent: #93c5fd; /* blue-300 */+ --border-danger: #f87171; /* red-400 */+ --border-focus: #3b82f6; /* blue-500 */+ --ring-focus: #bfdbfe; /* blue-200 */+ }++ .dark {+ /* Dark mode variables */+ --bg-primary: #111827; /* gray-900 */+ --bg-secondary: #1f2937; /* gray-800 */+ --bg-tertiary: #374151; /* gray-700 */+ --bg-accent: #1e3a8a; /* blue-900 */+ --bg-accent-hover: #1e40af; /* blue-800 */+ --bg-button: #2563eb; /* blue-600 */+ --bg-button-hover: #3b82f6; /* blue-500 */+ --bg-danger: #dc2626; /* red-600 */+ --bg-danger-hover: #ef4444; /* red-500 */+ --bg-danger-light: #7f1d1d; /* red-900 */+ --bg-info-light: #1e3a8a; /* blue-900 */+ --bg-warn-light: #78350f; /* amber-900 */+ --bg-success-light: #064e3b; /* green-900 */+ --bg-pending-light: #292524; /* stone-800 */+ --bg-input: #374151; /* gray-700 */++ --text-primary: #f3f4f6; /* gray-100 */+ --text-secondary: #d1d5db; /* gray-300 */+ --text-muted: #9ca3af; /* gray-400 */+ --text-light: #6b7280; /* gray-500 */+ --text-accent: #60a5fa; /* blue-400 */+ --text-button: #ffffff; /* white */+ --text-danger: #f87171; /* red-400 */+ --text-danger-strong: #fca5a5; /* red-300 */+ --text-info-strong: #93c5fd; /* blue-300 */+ --text-warn-strong: #fcd34d; /* amber-300 */+ --text-success-strong: #6ee7b7; /* green-300 */+ --text-pending-strong: #d6d3d1; /* stone-300 */++ --border-primary: #374151; /* gray-700 */+ --border-secondary: #4b5563; /* gray-600 */+ --border-accent: #1d4ed8; /* blue-700 */+ --border-danger: #ef4444; /* red-500 */+ --border-focus: #3b82f6; /* blue-500 */+ --ring-focus: #1e40af; /* blue-800 */+ }++ html {+ background-color: var(--bg-primary);+ color: var(--text-primary);+ transition: background-color 0.3s, color 0.3s;+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;+ }+ html, body { height: 100%; margin: 0; }+ .custom-scrollbar::-webkit-scrollbar { width: 6px; }+ .custom-scrollbar::-webkit-scrollbar-track { background: var(--scrollbar-track); border-radius: 12px; }+ .custom-scrollbar::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 12px; }+ .custom-scrollbar::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }+ </style>+</head>+<body class="bg-[var(--bg-primary)] text-[var(--text-primary)]">+ <div id="app" class="container mx-auto px-4 sm:px-6 lg:px-8 py-6 flex flex-col min-h-screen">+ <header class="flex justify-between items-center mb-6 pb-4 border-b border-[var(--border-primary)]">+ <h1 class="text-3xl font-bold text-[var(--text-primary)]">+ <a href="{{ url_for('index') }}">Speakr</a>+ </h1>+ <div class="flex items-center space-x-2">+ <button @click="toggleDarkMode" class="p-2 rounded-full text-[var(--text-muted)] hover:bg-[var(--bg-tertiary)] dark:text-gray-400 dark:hover:bg-gray-700 transition-colors duration-200" :title="isDarkMode ? 'Switch to Light Mode' : 'Switch to Dark Mode'">+ <i :class="isDarkMode ? 'fas fa-sun' : 'fas fa-moon'"></i>+ </button>+ <div class="relative" @click.away="isDropdownOpen = false">+ <button @click="isDropdownOpen = !isDropdownOpen" class="flex items-center px-3 py-2 border border-[var(--border-secondary)] rounded-lg text-[var(--text-secondary)] hover:text-[var(--text-accent)] focus:outline-none">+ <i class="fas fa-user-shield mr-2"></i>+ <span>{{ current_user.username }}</span>+ <i class="fas fa-chevron-down ml-2"></i>+ </button>+ <div v-show="isDropdownOpen" class="absolute right-0 mt-2 w-48 bg-[var(--bg-secondary)] border border-[var(--border-primary)] rounded-lg shadow-lg z-10">+ <a href="{{ url_for('index') }}" class="block px-4 py-2 text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] hover:text-[var(--text-accent)]">+ <i class="fas fa-home mr-2"></i> Home+ </a>+ <a href="{{ url_for('account') }}" class="block px-4 py-2 text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] hover:text-[var(--text-accent)]">+ <i class="fas fa-user mr-2"></i> Account+ </a>+ <a href="{{ url_for('admin') }}" class="block px-4 py-2 text-[var(--text-accent)] bg-[var(--bg-accent)]">+ <i class="fas fa-user-shield mr-2"></i> Admin+ </a>+ <a href="{{ url_for('logout') }}" class="block px-4 py-2 text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] hover:text-[var(--text-danger)]">+ <i class="fas fa-sign-out-alt mr-2"></i> Logout+ </a>+ </div>+ </div>+ </div>+ </header>++ <main class="flex-grow">+ <div class="bg-[var(--bg-secondary)] p-6 rounded-xl shadow-lg border border-[var(--border-primary)]">+ <h2 class="text-2xl font-semibold text-[var(--text-primary)] mb-6">Admin Dashboard</h2>++ {% with messages = get_flashed_messages(with_categories=true) %}+ {% if messages %}+ {% for category, message in messages %}+ <div class="mb-4 p-3 rounded-lg {% if category == 'success' %}bg-[var(--bg-success-light)] text-[var(--text-success-strong)]{% elif category == 'danger' %}bg-[var(--bg-danger-light)] text-[var(--text-danger-strong)]{% else %}bg-[var(--bg-info-light)] text-[var(--text-info-strong)]{% endif %}">+ {{ message }}+ </div>+ {% endfor %}+ {% endif %}+ {% endwith %}++ <!-- Tabs -->+ <div class="border-b border-[var(--border-primary)] mb-6">+ <nav class="-mb-px flex space-x-8" aria-label="Tabs">+ <button @click="activeTab = 'users'"+ :class="activeTab === 'users' ? 'border-[var(--border-focus)] text-[var(--text-accent)]' : 'border-transparent text-[var(--text-muted)] hover:text-[var(--text-secondary)] hover:border-[var(--border-secondary)]'"+ class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm">+ <i class="fas fa-users mr-2"></i> User Management+ </button>+ <button @click="activeTab = 'stats'"+ :class="activeTab === 'stats' ? 'border-[var(--border-focus)] text-[var(--text-accent)]' : 'border-transparent text-[var(--text-muted)] hover:text-[var(--text-secondary)] hover:border-[var(--border-secondary)]'"+ class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm">+ <i class="fas fa-chart-bar mr-2"></i> System Statistics+ </button>+ </nav>+ </div>++ <!-- User Management Tab -->+ <div v-show="activeTab === 'users'">+ <div class="flex justify-between items-center mb-4">+ <h3 class="text-lg font-medium text-[var(--text-secondary)]">User Management</h3>+ <button @click="showAddUserModal = true" class="px-4 py-2 bg-[var(--bg-button)] text-[var(--text-button)] rounded-lg shadow hover:bg-[var(--bg-button-hover)] focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] focus:ring-offset-2 transition duration-150 ease-in-out">+ <i class="fas fa-user-plus mr-2"></i> Add User+ </button>+ </div>++ <!-- Search and Filter -->+ <div class="mb-4 flex">+ <div class="relative flex-grow">+ <input type="text" v-model="userSearchQuery" placeholder="Search users..." class="w-full px-4 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">+ <button v-if="userSearchQuery" @click="userSearchQuery = ''" class="absolute right-3 top-2.5 text-[var(--text-muted)] hover:text-[var(--text-secondary)]">+ <i class="fas fa-times"></i>+ </button>+ </div>+ </div>++ <!-- Users Table -->+ <div class="overflow-x-auto">+ <table class="min-w-full divide-y divide-[var(--border-primary)]">+ <thead class="bg-[var(--bg-tertiary)]">+ <tr>+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-[var(--text-muted)] uppercase tracking-wider">ID</th>+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-[var(--text-muted)] uppercase tracking-wider">Username</th>+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-[var(--text-muted)] uppercase tracking-wider">Email</th>+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-[var(--text-muted)] uppercase tracking-wider">Admin</th>+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-[var(--text-muted)] uppercase tracking-wider">Recordings</th>+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-[var(--text-muted)] uppercase tracking-wider">Storage Used</th>+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-[var(--text-muted)] uppercase tracking-wider">Actions</th>+ </tr>+ </thead>+ <tbody class="bg-[var(--bg-secondary)] divide-y divide-[var(--border-primary)]">+ <tr v-for="user in filteredUsers" :key="user.id" class="hover:bg-[var(--bg-tertiary)]">+ <td class="px-6 py-4 whitespace-nowrap text-sm text-[var(--text-secondary)]">${ user.id }</td>+ <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-[var(--text-primary)]">${ user.username }</td>+ <td class="px-6 py-4 whitespace-nowrap text-sm text-[var(--text-secondary)]">${ user.email }</td>+ <td class="px-6 py-4 whitespace-nowrap text-sm text-[var(--text-secondary)]">+ <span v-if="user.is_admin" class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-[var(--bg-success-light)] text-[var(--text-success-strong)]">Yes</span>+ <span v-else class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-[var(--bg-pending-light)] text-[var(--text-pending-strong)]">No</span>+ </td>+ <td class="px-6 py-4 whitespace-nowrap text-sm text-[var(--text-secondary)]">${ user.recordings_count }</td>+ <td class="px-6 py-4 whitespace-nowrap text-sm text-[var(--text-secondary)]">${ formatFileSize(user.storage_used) }</td>+ <td class="px-6 py-4 whitespace-nowrap text-sm text-[var(--text-secondary)]">+ <div class="flex space-x-2">+ <button @click="editUser(user)" class="text-[var(--text-accent)] hover:text-[var(--text-accent-hover)]" title="Edit User">+ <i class="fas fa-edit"></i>+ </button>+ <button @click="toggleAdminStatus(user)" :class="user.is_admin ? 'text-[var(--text-warn-strong)]' : 'text-[var(--text-info-strong)]'" :title="user.is_admin ? 'Remove Admin' : 'Make Admin'">+ <i class="fas" :class="user.is_admin ? 'fa-user-minus' : 'fa-user-shield'"></i>+ </button>+ <button @click="confirmDeleteUser(user)" class="text-[var(--text-danger)] hover:text-[var(--text-danger-hover)]" title="Delete User">+ <i class="fas fa-trash"></i>+ </button>+ </div>+ </td>+ </tr>+ <tr v-if="filteredUsers.length === 0">+ <td colspan="7" class="px-6 py-4 text-center text-sm text-[var(--text-muted)]">+ <div v-if="isLoadingUsers">+ <i class="fas fa-spinner fa-spin mr-2"></i> Loading users...+ </div>+ <div v-else>+ No users found.+ </div>+ </td>+ </tr>+ </tbody>+ </table>+ </div>+ </div>++ <!-- System Statistics Tab -->+ <div v-show="activeTab === 'stats'">+ <h3 class="text-lg font-medium text-[var(--text-secondary)] mb-4">System Statistics</h3>++ <!-- Summary Cards -->+ <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-6">+ <div class="bg-[var(--bg-tertiary)] p-4 rounded-lg border border-[var(--border-primary)] shadow-sm">+ <div class="flex items-center">+ <div class="p-3 rounded-full bg-[var(--bg-info-light)] text-[var(--text-info-strong)]">+ <i class="fas fa-users text-xl"></i>+ </div>+ <div class="ml-4">+ <p class="text-sm font-medium text-[var(--text-muted)]">Total Users</p>+ <p class="text-2xl font-semibold text-[var(--text-primary)]">${ stats.total_users }</p>+ </div>+ </div>+ </div>++ <div class="bg-[var(--bg-tertiary)] p-4 rounded-lg border border-[var(--border-primary)] shadow-sm">+ <div class="flex items-center">+ <div class="p-3 rounded-full bg-[var(--bg-success-light)] text-[var(--text-success-strong)]">+ <i class="fas fa-file-audio text-xl"></i>+ </div>+ <div class="ml-4">+ <p class="text-sm font-medium text-[var(--text-muted)]">Total Recordings</p>+ <p class="text-2xl font-semibold text-[var(--text-primary)]">${ stats.total_recordings }</p>+ </div>+ </div>+ </div>++ <div class="bg-[var(--bg-tertiary)] p-4 rounded-lg border border-[var(--border-primary)] shadow-sm">+ <div class="flex items-center">+ <div class="p-3 rounded-full bg-[var(--bg-warn-light)] text-[var(--text-warn-strong)]">+ <i class="fas fa-database text-xl"></i>+ </div>+ <div class="ml-4">+ <p class="text-sm font-medium text-[var(--text-muted)]">Total Storage Used</p>+ <p class="text-2xl font-semibold text-[var(--text-primary)]">${ formatFileSize(stats.total_storage) }</p>+ </div>+ </div>+ </div>++ <div class="bg-[var(--bg-tertiary)] p-4 rounded-lg border border-[var(--border-primary)] shadow-sm">+ <div class="flex items-center">+ <div class="p-3 rounded-full bg-[var(--bg-accent)] text-[var(--text-accent)]">+ <i class="fas fa-comments text-xl"></i>+ </div>+ <div class="ml-4">+ <p class="text-sm font-medium text-[var(--text-muted)]">Total Queries</p>+ <p class="text-2xl font-semibold text-[var(--text-primary)]">${ stats.total_queries }</p>+ </div>+ </div>+ </div>+ </div>++ <!-- Status Distribution -->+ <div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-6">+ <div class="bg-[var(--bg-tertiary)] p-4 rounded-lg border border-[var(--border-primary)] shadow-sm">+ <h4 class="text-md font-medium text-[var(--text-secondary)] mb-3">Recording Status Distribution</h4>+ <div class="grid grid-cols-2 gap-4">+ <div class="text-center p-3 bg-[var(--bg-secondary)] rounded-lg border border-[var(--border-primary)] shadow-sm">+ <span class="block text-2xl font-bold text-[var(--text-success-strong)]">${ stats.completed_recordings }</span>+ <span class="block text-sm text-[var(--text-muted)]">Completed</span>+ </div>+ <div class="text-center p-3 bg-[var(--bg-secondary)] rounded-lg border border-[var(--border-primary)] shadow-sm">+ <span class="block text-2xl font-bold text-[var(--text-warn-strong)]">${ stats.processing_recordings }</span>+ <span class="block text-sm text-[var(--text-muted)]">Processing</span>+ </div>+ <div class="text-center p-3 bg-[var(--bg-secondary)] rounded-lg border border-[var(--border-primary)] shadow-sm">+ <span class="block text-2xl font-bold text-[var(--text-pending-strong)]">${ stats.pending_recordings }</span>+ <span class="block text-sm text-[var(--text-muted)]">Pending</span>+ </div>+ <div class="text-center p-3 bg-[var(--bg-secondary)] rounded-lg border border-[var(--border-primary)] shadow-sm">+ <span class="block text-2xl font-bold text-[var(--text-danger-strong)]">${ stats.failed_recordings }</span>+ <span class="block text-sm text-[var(--text-muted)]">Failed</span>+ </div>+ </div>+ </div>++ <div class="bg-[var(--bg-tertiary)] p-4 rounded-lg border border-[var(--border-primary)] shadow-sm">+ <h4 class="text-md font-medium text-[var(--text-secondary)] mb-3">Top Users by Storage</h4>+ <div class="space-y-3">+ <div v-for="user in stats.top_users" :key="user.id" class="flex justify-between items-center p-2 bg-[var(--bg-secondary)] rounded-lg border border-[var(--border-primary)]">+ <div class="flex items-center">+ <i class="fas fa-user text-[var(--text-accent)] mr-2"></i>+ <span class="text-sm font-medium text-[var(--text-primary)]">${ user.username }</span>+ </div>+ <div class="text-sm text-[var(--text-secondary)]">+ <span class="font-medium">${ formatFileSize(user.storage_used) }</span>+ <span class="text-[var(--text-muted)] ml-2">(${ user.recordings_count} recordings)</span>+ </div>+ </div>+ <div v-if="stats.top_users.length === 0" class="text-center text-sm text-[var(--text-muted)] p-2">+ No data available+ </div>+ </div>+ </div>+ </div>+ </div>+ </div>+ </main>++ <footer class="text-center py-4 mt-8 text-xs text-[var(--text-light)] border-t border-[var(--border-primary)]">+ Speakr © {{ now.year }}+ </footer>++ <!-- Add User Modal -->+ <div v-if="showAddUserModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4">+ <div class="bg-[var(--bg-secondary)] p-6 rounded-lg shadow-xl w-full max-w-md">+ <div class="flex justify-between items-center mb-4">+ <h3 class="text-xl font-semibold text-[var(--text-primary)]">Add New User</h3>+ <button @click="showAddUserModal = false" class="text-[var(--text-muted)] hover:text-[var(--text-secondary)]">×</button>+ </div>+ <form @submit.prevent="addUser">+ <div class="mb-4">+ <label class="block text-sm font-medium text-[var(--text-secondary)] mb-1">Username</label>+ <input v-model="newUser.username" type="text" required class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">+ </div>+ <div class="mb-4">+ <label class="block text-sm font-medium text-[var(--text-secondary)] mb-1">Email</label>+ <input v-model="newUser.email" type="email" required class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">+ </div>+ <div class="mb-4">+ <label class="block text-sm font-medium text-[var(--text-secondary)] mb-1">Password</label>+ <input v-model="newUser.password" type="password" required class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">+ </div>+ <div class="mb-4">+ <label class="block text-sm font-medium text-[var(--text-secondary)] mb-1">Confirm Password</label>+ <input v-model="newUser.confirmPassword" type="password" required class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">+ </div>+ <div class="mb-4 flex items-center">+ <input v-model="newUser.isAdmin" type="checkbox" id="isAdmin" class="rounded border-[var(--border-secondary)] text-[var(--text-accent)] focus:ring-[var(--border-focus)]">+ <label for="isAdmin" class="ml-2 text-sm text-[var(--text-secondary)]">Admin User</label>+ </div>+ <div class="flex justify-end space-x-3">+ <button type="button" @click="showAddUserModal = false" class="px-4 py-2 border border-[var(--border-secondary)] text-[var(--text-secondary)] rounded-md hover:bg-[var(--bg-tertiary)]">Cancel</button>+ <button type="submit" class="px-4 py-2 bg-[var(--bg-button)] text-[var(--text-button)] rounded-md hover:bg-[var(--bg-button-hover)]">Add User</button>+ </div>+ </form>+ </div>+ </div>++ <!-- Edit User Modal -->+ <div v-if="showEditUserModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4">+ <div class="bg-[var(--bg-secondary)] p-6 rounded-lg shadow-xl w-full max-w-md">+ <div class="flex justify-between items-center mb-4">+ <h3 class="text-xl font-semibold text-[var(--text-primary)]">Edit User</h3>+ <button @click="showEditUserModal = false" class="text-[var(--text-muted)] hover:text-[var(--text-secondary)]">×</button>+ </div>+ <form @submit.prevent="updateUser">+ <div class="mb-4">+ <label class="block text-sm font-medium text-[var(--text-secondary)] mb-1">Username</label>+ <input v-model="editingUser.username" type="text" required class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">+ </div>+ <div class="mb-4">+ <label class="block text-sm font-medium text-[var(--text-secondary)] mb-1">Email</label>+ <input v-model="editingUser.email" type="email" required class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">+ </div>+ <div class="mb-4">+ <label class="block text-sm font-medium text-[var(--text-secondary)] mb-1">New Password (leave blank to keep current)</label>+ <input v-model="editingUser.password" type="password" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">+ </div>+ <div class="mb-4 flex items-center">+ <input v-model="editingUser.is_admin" type="checkbox" id="editIsAdmin" class="rounded border-[var(--border-secondary)] text-[var(--text-accent)] focus:ring-[var(--border-focus)]">+ <label for="editIsAdmin" class="ml-2 text-sm text-[var(--text-secondary)]">Admin User</label>+ </div>+ <div class="flex justify-end space-x-3">+ <button type="button" @click="showEditUserModal = false" class="px-4 py-2 border border-[var(--border-secondary)] text-[var(--text-secondary)] rounded-md hover:bg-[var(--bg-tertiary)]">Cancel</button>+ <button type="submit" class="px-4 py-2 bg-[var(--bg-button)] text-[var(--text-button)] rounded-md hover:bg-[var(--bg-button-hover)]">Update User</button>+ </div>+ </form>+ </div>+ </div>++ <!-- Delete User Confirmation Modal -->+ <div v-if="showDeleteUserModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4">+ <div class="bg-[var(--bg-secondary)] p-6 rounded-lg shadow-xl w-full max-w-md">+ <div class="flex justify-between items-center mb-4">+ <h3 class="text-xl font-semibold text-[var(--text-primary)]">Confirm Delete</h3>+ <button @click="showDeleteUserModal = false" class="text-[var(--text-muted)] hover:text-[var(--text-secondary)]">×</button>+ </div>+ <p class="mb-4 text-[var(--text-secondary)]">Are you sure you want to delete the user <span class="font-semibold">${ userToDelete?.username }</span>? This action cannot be undone.</p>+ <div class="flex justify-end space-x-3">+ <button @click="showDeleteUserModal = false" class="px-4 py-2 border border-[var(--border-secondary)] text-[var(--text-secondary)] rounded-md hover:bg-[var(--bg-tertiary)]">Cancel</button>+ <button @click="deleteUser" class="px-4 py-2 bg-[var(--bg-danger)] text-[var(--text-button)] rounded-md hover:bg-[var(--bg-danger-hover)]">Delete User</button>+ </div>+ </div>+ </div>+ </div>++ <script>+ const { createApp, ref, computed, onMounted, watch } = Vue++ createApp({+ setup() {+ // State+ const activeTab = ref('users');+ const users = ref([]);+ const stats = ref({+ total_users: 0,+ total_recordings: 0,+ total_storage: 0,+ total_queries: 0,+ completed_recordings: 0,+ processing_recordings: 0,+ pending_recordings: 0,+ failed_recordings: 0,+ top_users: []+ });+ const isLoadingUsers = ref(true);+ const userSearchQuery = ref('');+ const isDarkMode = ref(false);+ const isDropdownOpen = ref(false);++ // Modal state+ const showAddUserModal = ref(false);+ const showEditUserModal = ref(false);+ const showDeleteUserModal = ref(false);+ const newUser = ref({+ username: '',+ email: '',+ password: '',+ confirmPassword: '',+ isAdmin: false+ });+ const editingUser = ref(null);+ const userToDelete = ref(null);++ // Computed properties+ const filteredUsers = computed(() => {+ if (!userSearchQuery.value) return users.value;++ const query = userSearchQuery.value.toLowerCase();+ return users.value.filter(user =>+ user.username.toLowerCase().includes(query) ||+ user.email.toLowerCase().includes(query)+ );+ });++ // Methods+ const loadUsers = async () => {+ isLoadingUsers.value = true;+ try {+ const response = await fetch('/admin/users');+ if (!response.ok) throw new Error('Failed to load users');++ const data = await response.json();+ users.value = data;+ } catch (error) {+ console.error('Error loading users:', error);+ // Show error notification+ } finally {+ isLoadingUsers.value = false;+ }+ };++ const loadStats = async () => {+ try {+ const response = await fetch('/admin/stats');+ if (!response.ok) throw new Error('Failed to load statistics');++ const data = await response.json();+ stats.value = data;+ } catch (error) {+ console.error('Error loading statistics:', error);+ // Show error notification+ }+ };++ const addUser = async () => {+ if (newUser.value.password !== newUser.value.confirmPassword) {+ alert('Passwords do not match');+ return;+ }++ try {+ const response = await fetch('/admin/users', {+ method: 'POST',+ headers: {+ 'Content-Type': 'application/json'+ },+ body: JSON.stringify({+ username: newUser.value.username,+ email: newUser.value.email,+ password: newUser.value.password,+ is_admin: newUser.value.isAdmin+ })+ });++ if (!response.ok) {+ const errorData = await response.json();+ throw new Error(errorData.error || 'Failed to add user');+ }++ // Reset form and close modal+ newUser.value = {+ username: '',+ email: '',+ password: '',+ confirmPassword: '',+ isAdmin: false+ };+ showAddUserModal.value = false;++ // Reload users+ await loadUsers();+ await loadStats();++ } catch (error) {+ console.error('Error adding user:', error);+ alert(error.message);+ }+ };++ const editUser = (user) => {+ editingUser.value = { ...user, password: '' };+ showEditUserModal.value = true;+ };++ const updateUser = async () => {+ try {+ const payload = {+ username: editingUser.value.username,+ email: editingUser.value.email,+ is_admin: editingUser.value.is_admin+ };++ // Only include password if it was changed+ if (editingUser.value.password) {+ payload.password = editingUser.value.password;+ }++ const response = await fetch(`/admin/users/${editingUser.value.id}`, {+ method: 'PUT',+ headers: {+ 'Content-Type': 'application/json'+ },+ body: JSON.stringify(payload)+ });++ if (!response.ok) {+ const errorData = await response.json();+ throw new Error(errorData.error || 'Failed to update user');+ }++ // Close modal and reload users+ showEditUserModal.value = false;+ await loadUsers();++ } catch (error) {+ console.error('Error updating user:', error);+ alert(error.message);+ }+ };++ const confirmDeleteUser = (user) => {+ userToDelete.value = user;+ showDeleteUserModal.value = true;+ };++ const deleteUser = async () => {+ try {+ const response = await fetch(`/admin/users/${userToDelete.value.id}`, {+ method: 'DELETE'+ });++ if (!response.ok) {+ const errorData = await response.json();+ throw new Error(errorData.error || 'Failed to delete user');+ }++ // Close modal and reload users+ showDeleteUserModal.value = false;+ await loadUsers();+ await loadStats();++ } catch (error) {+ console.error('Error deleting user:', error);+ alert(error.message);+ }+ };++ const toggleAdminStatus = async (user) => {+ try {+ const response = await fetch(`/admin/users/${user.id}/toggle-admin`, {+ method: 'POST'+ });++ if (!response.ok) {+ const errorData = await response.json();+ throw new Error(errorData.error || 'Failed to toggle admin status');+ }++ // Reload users+ await loadUsers();++ } catch (error) {+ console.error('Error toggling admin status:', error);+ alert(error.message);+ }+ };++ const formatFileSize = (bytes) => {+ if (!bytes || bytes === 0) return '0 Bytes';++ const k = 1024;+ const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];+ const i = Math.floor(Math.log(bytes) / Math.log(k));++ return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];+ };++ const toggleDarkMode = () => {+ isDarkMode.value = !isDarkMode.value;+ if (isDarkMode.value) {+ document.documentElement.classList.add('dark');+ localStorage.setItem('darkMode', 'true');+ } else {+ document.documentElement.classList.remove('dark');+ localStorage.setItem('darkMode', 'false');+ }+ };++ // Initialize dark mode+ const initializeDarkMode = () => {+ const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;+ const savedMode = localStorage.getItem('darkMode');++ if (savedMode === 'true' || (savedMode === null && prefersDark)) {+ isDarkMode.value = true;+ document.documentElement.classList.add('dark');+ } else {+ isDarkMode.value = false;+ document.documentElement.classList.remove('dark');+ }+ };++ // Lifecycle hooks+ onMounted(() => {+ loadUsers();+ loadStats();+ initializeDarkMode();+ });++ // Watch for tab changes to reload data+ watch(activeTab, (newTab) => {+ if (newTab === 'users') {+ loadUsers();+ } else if (newTab === 'stats') {+ loadStats();+ }+ });++ return {+ // State+ activeTab,+ users,+ stats,+ isLoadingUsers,+ userSearchQuery,+ isDarkMode,+ isDropdownOpen,++ // Modal state+ showAddUserModal,+ showEditUserModal,+ showDeleteUserModal,+ newUser,+ editingUser,+ userToDelete,++ // Computed+ filteredUsers,++ // Methods+ loadUsers,+ loadStats,+ addUser,+ editUser,+ updateUser,+ confirmDeleteUser,+ deleteUser,+ toggleAdminStatus,+ formatFileSize,+ toggleDarkMode+ };+ },+ delimiters: ['${', '}'] // Use different delimiters to avoid conflict with Flask's Jinja2+ }).mount('#app');+ </script>+</body>+</html>++```+++## templates/index.html++```html++<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="UTF-8">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title>Speakr</title>+ <script src="https://cdn.tailwindcss.com"></script>+ <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>+ <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">+ <style>+ /* Dark Mode CSS Variables */+ :root {+ /* Light mode variables */+ --bg-primary: #f3f4f6; /* gray-100 */+ --bg-secondary: #ffffff; /* white */+ --bg-tertiary: #f9fafb; /* gray-50 */+ --bg-accent: #dbeafe; /* blue-100 */+ --bg-accent-hover: #bfdbfe; /* blue-200 */+ --bg-button: #2563eb; /* blue-600 */+ --bg-button-hover: #1d4ed8; /* blue-700 */+ --bg-danger: #dc2626; /* red-600 */+ --bg-danger-hover: #b91c1c; /* red-700 */+ --bg-danger-light: #fee2e2; /* red-100 */+ --bg-info-light: #dbeafe; /* blue-100 */+ --bg-warn-light: #fef3c7; /* amber-100 */+ --bg-success-light: #d1fae5; /* green-100 */+ --bg-pending-light: #f5f5f4; /* stone-100 */+ --bg-input: #ffffff; /* white */+ --bg-audio-player: linear-gradient(to right, #eff6ff, #eef2ff); /* blue-50, indigo-50 */++ --text-primary: #1f2937; /* gray-800 */+ --text-secondary: #374151; /* gray-700 */+ --text-muted: #6b7280; /* gray-500 */+ --text-light: #9ca3af; /* gray-400 */+ --text-accent: #1d4ed8; /* blue-700 */+ --text-button: #ffffff; /* white */+ --text-danger: #b91c1c; /* red-700 */+ --text-danger-strong: #991b1b; /* red-800 */+ --text-info-strong: #1e40af; /* blue-800 */+ --text-warn-strong: #92400e; /* amber-800 */+ --text-success-strong: #065f46; /* green-800 */+ --text-pending-strong: #44403c; /* stone-700 */++ --border-primary: #e5e7eb; /* gray-200 */+ --border-secondary: #d1d5db; /* gray-300 */+ --border-accent: #93c5fd; /* blue-300 */+ --border-danger: #f87171; /* red-400 */+ --border-focus: #3b82f6; /* blue-500 */+ --ring-focus: #bfdbfe; /* blue-200 */++ --scrollbar-track: #f1f1f1;+ --scrollbar-thumb: #c5c5c5;+ --scrollbar-thumb-hover: #a8a8a8;+ }++ .dark {+ /* Dark mode variables */+ --bg-primary: #111827; /* gray-900 */+ --bg-secondary: #1f2937; /* gray-800 */+ --bg-tertiary: #374151; /* gray-700 */+ --bg-accent: #1e3a8a; /* blue-900 */+ --bg-accent-hover: #1e40af; /* blue-800 */+ --bg-button: #2563eb; /* blue-600 */+ --bg-button-hover: #3b82f6; /* blue-500 */+ --bg-danger: #dc2626; /* red-600 */+ --bg-danger-hover: #ef4444; /* red-500 */+ --bg-danger-light: #7f1d1d; /* red-900 */+ --bg-info-light: #1e3a8a; /* blue-900 */+ --bg-warn-light: #78350f; /* amber-900 */+ --bg-success-light: #064e3b; /* green-900 */+ --bg-pending-light: #292524; /* stone-800 */+ --bg-input: #374151; /* gray-700 */+ --bg-audio-player: linear-gradient(to right, #374151, #4b5563); /* gray-700, gray-600 */++ --text-primary: #f3f4f6; /* gray-100 */+ --text-secondary: #d1d5db; /* gray-300 */+ --text-muted: #9ca3af; /* gray-400 */+ --text-light: #6b7280; /* gray-500 */+ --text-accent: #60a5fa; /* blue-400 */+ --text-button: #ffffff; /* white */+ --text-danger: #f87171; /* red-400 */+ --text-danger-strong: #fca5a5; /* red-300 */+ --text-info-strong: #93c5fd; /* blue-300 */+ --text-warn-strong: #fcd34d; /* amber-300 */+ --text-success-strong: #6ee7b7; /* green-300 */+ --text-pending-strong: #d6d3d1; /* stone-300 */++ --border-primary: #374151; /* gray-700 */+ --border-secondary: #4b5563; /* gray-600 */+ --border-accent: #1d4ed8; /* blue-700 */+ --border-danger: #ef4444; /* red-500 */+ --border-focus: #3b82f6; /* blue-500 */+ --ring-focus: #1e40af; /* blue-800 */++ --scrollbar-track: #2d3748; /* gray-800 */+ --scrollbar-thumb: #4a5568; /* gray-600 */+ --scrollbar-thumb-hover: #718096; /* gray-500 */+ }++ /* Modern UI styles */+ .drag-area { transition: background-color 0.3s ease, border-color 0.3s ease; }+ .custom-scrollbar::-webkit-scrollbar { width: 6px; }+ .custom-scrollbar::-webkit-scrollbar-track { background: var(--scrollbar-track); border-radius: 12px; }+ .custom-scrollbar::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 12px; }+ .custom-scrollbar::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }+ html { /* Apply base colors to html for smoother transitions */+ background-color: var(--bg-primary);+ color: var(--text-primary);+ transition: background-color 0.3s, color 0.3s;+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;+ }+ html, body { height: 100%; margin: 0; }+ #app { min-height: 100%; display: flex; flex-direction: column; }+ main { flex-grow: 1; position: relative; }+ .progress-popup { position: fixed; bottom: 1rem; left: 1rem; z-index: 100; transition: all 0.3s ease-in-out; min-width: 300px; border-radius: 12px; overflow: hidden; }+ .progress-popup.minimized { transform: translateY(calc(100% - 45px)); }+ .progress-list-item { display: grid; grid-template-columns: auto 1fr auto; gap: 0.5rem; align-items: center; }+ /* Modern style for summary box */+ .summary-box {+ background-color: #f9fafb; /* bg-gray-50 */+ padding: 1rem; /* p-4 */+ border-radius: 0.75rem; /* rounded-xl */+ border: 1px solid #e5e7eb; /* border-gray-200 */+ min-height: 60px; /* min-h-[60px] or adjust as needed */+ max-height: 20rem; /* Limit height */+ overflow-y: auto;+ white-space: pre-wrap;+ font-family: inherit; /* Use body font */+ font-size: 0.875rem; /* text-sm */+ line-height: 1.5; /* Improved line height */+ box-shadow: 0 1px 2px rgba(0,0,0,0.03); /* Subtle shadow */+ }++ /* Standardize border radius for all content boxes */+ .transcription-box,+ .summary-box,+ .chat-container,+ textarea,+ div[v-if="!editingParticipants"],+ div[v-if="!editingNotes"] {+ border-radius: 0.75rem !important; /* rounded-xl */+ }+ .status-badge {+ display: inline-block;+ padding: 0.25rem 0.75rem; /* px-3 py-1 */+ font-size: 0.75rem; /* text-xs */+ font-weight: 500; /* font-medium */+ border-radius: 9999px; /* rounded-full */+ margin-top: 0.5rem; /* mt-2 */+ box-shadow: 0 1px 2px rgba(0,0,0,0.05);+ letter-spacing: 0.025em;+ }+ .status-processing { color: #1d4ed8; background-color: #dbeafe; } /* text-blue-800 bg-blue-100 */+ .status-summarizing { color: #92400e; background-color: #fef3c7; } /* text-amber-800 bg-amber-100 */+ .status-completed { color: #065f46; background-color: #d1fae5; } /* text-green-800 bg-green-100 */+ .status-failed { color: #991b1b; background-color: #fee2e2; } /* text-red-800 bg-red-100 */+ .status-pending { color: #57534e; background-color: #f5f5f4; } /* text-stone-700 bg-stone-100 */++ /* Fixed height transcription box */+ .transcription-box {+ height: 400px;+ overflow-y: auto;+ position: relative;+ }++ /* Modern copy button styles */+ .copy-btn {+ position: sticky;+ top: 10px;+ right: 10px;+ float: right;+ background-color: rgba(255, 255, 255, 0.9);+ border: 1px solid #e5e7eb;+ border-radius: 0.5rem;+ padding: 0.35rem 0.75rem;+ font-size: 0.75rem;+ cursor: pointer;+ z-index: 10;+ transition: all 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);+ margin-bottom: 10px;+ box-shadow: 0 1px 2px rgba(0,0,0,0.05);+ }++ .copy-btn:hover {+ background-color: #f3f4f6;+ transform: translateY(-1px);+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);+ }++ /* Modern chat section styles */+ .chat-container {+ border: 1px solid #e5e7eb;+ border-radius: 0.75rem;+ display: flex;+ flex-direction: column;+ height: 100%;+ box-shadow: 0 1px 3px rgba(0,0,0,0.05);+ overflow: hidden;+ }++ .chat-messages {+ flex-grow: 1;+ overflow-y: auto;+ padding: 1.25rem;+ }++ .chat-input-container {+ border-top: 1px solid #e5e7eb;+ padding: 0.75rem;+ display: flex;+ background-color: var(--bg-tertiary);+ }++ .message {+ margin-bottom: 1.25rem;+ max-width: 80%;+ box-shadow: 0 1px 2px rgba(0,0,0,0.05);+ line-height: 1.5;+ }++ .user-message {+ background-color: #dbeafe;+ border-radius: 1.25rem 1.25rem 0.25rem 1.25rem;+ padding: 0.875rem 1rem;+ margin-left: auto;+ }++ .ai-message {+ background-color: #f3f4f6;+ border-radius: 1.25rem 1.25rem 1.25rem 0.25rem;+ padding: 0.875rem 1rem;+ }++ .copyable {+ position: relative;+ }++ /* Markdown styling */+ .ai-message h1, .ai-message h2, .ai-message h3,+ .summary-box h1, .summary-box h2, .summary-box h3 {+ font-weight: 600;+ margin-top: 1rem;+ margin-bottom: 0.5rem;+ }++ .ai-message h1, .summary-box h1 { font-size: 1.25rem; }+ .ai-message h2, .summary-box h2 { font-size: 1.15rem; }+ .ai-message h3, .summary-box h3 { font-size: 1.05rem; }++ .ai-message p, .summary-box p {+ margin-bottom: 0.75rem;+ }++ .ai-message ul, .ai-message ol,+ .summary-box ul, .summary-box ol {+ margin-left: 1.5rem;+ margin-bottom: 0.75rem;+ }++ .ai-message ul, .summary-box ul { list-style-type: disc; }+ .ai-message ol, .summary-box ol { list-style-type: decimal; }++ .ai-message code, .summary-box code {+ background-color: #f1f1f1;+ padding: 0.1rem 0.3rem;+ border-radius: 0.25rem;+ font-family: monospace;+ font-size: 0.9em;+ }++ .ai-message pre, .summary-box pre {+ background-color: #f1f1f1;+ padding: 0.75rem;+ border-radius: 0.25rem;+ overflow-x: auto;+ margin-bottom: 0.75rem;+ }++ .ai-message pre code, .summary-box pre code {+ background-color: transparent;+ padding: 0;+ border-radius: 0;+ }++ .ai-message table, .summary-box table {+ border-collapse: collapse;+ width: 100%;+ margin-bottom: 0.75rem;+ }++ .ai-message th, .ai-message td,+ .summary-box th, .summary-box td {+ border: 1px solid #ddd;+ padding: 0.5rem;+ text-align: left;+ }++ .ai-message th, .summary-box th {+ background-color: #f1f1f1;+ font-weight: 600;+ }++ .ai-message blockquote, .summary-box blockquote {+ border-left: 4px solid #ddd;+ padding-left: 1rem;+ margin-left: 0;+ margin-bottom: 0.75rem;+ color: #666;+ }++ /* Modern toast notification styles */+ .toast-container {+ position: fixed;+ bottom: 20px;+ right: 20px;+ z-index: 1000;+ display: flex;+ flex-direction: column;+ align-items: flex-end;+ gap: 12px;+ }++ .toast {+ padding: 12px 18px;+ border-radius: 8px;+ background-color: #4CAF50;+ color: white;+ font-size: 14px;+ box-shadow: 0 4px 12px rgba(0,0,0,0.1);+ opacity: 0;+ transform: translateY(20px);+ transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);+ display: flex;+ align-items: center;+ min-width: 200px;+ }++ .toast.show {+ opacity: 1;+ transform: translateY(0);+ }++ .toast i {+ margin-right: 8px;+ }++ /* Copy button animation */+ @keyframes copy-success {+ 0% { transform: scale(1); }+ 50% { transform: scale(1.2); }+ 100% { transform: scale(1); }+ }++ .copy-success {+ animation: copy-success 0.3s ease;+ color: #4CAF50 !important;}- .status-processing { color: #1d4ed8; background-color: #dbeafe; } /* text-blue-800 bg-blue-100 */- .status-summarizing { color: #92400e; background-color: #fef3c7; } /* text-amber-800 bg-amber-100 */- .status-completed { color: #065f46; background-color: #d1fae5; } /* text-green-800 bg-green-100 */- .status-failed { color: #991b1b; background-color: #fee2e2; } /* text-red-800 bg-red-100 */- .status-pending { color: #57534e; background-color: #f5f5f4; } /* text-stone-700 bg-stone-100 */</style></head>-<body class="bg-gray-100">+<body class="bg-[var(--bg-primary)] text-[var(--text-primary)]"><div id="app" class="container mx-auto px-4 sm:px-6 lg:px-8 py-6 flex flex-col">- <header class="flex justify-between items-center mb-6 pb-4 border-b border-gray-200">- <h1 class="text-3xl font-bold text-gray-800 cursor-pointer" @click="switchToGalleryView" title="Go to Gallery">- Audio Transcription & Summary+ <header class="flex justify-between items-center mb-6 pb-4 border-b border-[var(--border-primary)]">+ <h1 class="text-3xl font-bold text-[var(--text-primary)] cursor-pointer" @click="switchToGalleryView" title="Go to Gallery">+ Speakr</h1>- <div>- <button @click="switchToUploadView" class="px-4 py-2 mr-2 bg-blue-600 text-white rounded-lg shadow hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition duration-150 ease-in-out">+ <div class="flex items-center space-x-2">+ <button @click="toggleDarkMode" class="p-2 rounded-full text-[var(--text-muted)] hover:bg-[var(--bg-tertiary)] dark:text-gray-400 dark:hover:bg-gray-700 transition-colors duration-200" :title="isDarkMode ? 'Switch to Light Mode' : 'Switch to Dark Mode'">+ <i :class="isDarkMode ? 'fas fa-sun' : 'fas fa-moon'"></i>+ </button>+ {% if current_user.is_authenticated %}+ <button @click="switchToUploadView" class="px-4 py-2 mr-2 bg-[var(--bg-button)] text-[var(--text-button)] rounded-lg shadow hover:bg-[var(--bg-button-hover)] focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] focus:ring-offset-2 transition duration-150 ease-in-out"><i class="fas fa-plus mr-1"></i> New Recording</button>- <button+ <button@click="switchToGalleryView":class="{- 'bg-white text-gray-700 border border-gray-300': currentView !== 'gallery',- 'bg-blue-100 text-blue-700 border border-blue-300': currentView === 'gallery'+ 'bg-[var(--bg-secondary)] text-[var(--text-secondary)] border border-[var(--border-secondary)]': currentView !== 'gallery',+ 'bg-[var(--bg-accent)] text-[var(--text-accent)] border border-[var(--border-accent)]': currentView === 'gallery'}"- class="px-4 py-2 rounded-lg shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 transition duration-150 ease-in-out">+ class="px-4 py-2 rounded-lg shadow-sm hover:bg-[var(--bg-tertiary)] focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] focus:ring-offset-1 transition duration-150 ease-in-out"><i class="fas fa-images mr-1"></i> Gallery</button>+<!-- User dropdown menu -->+<div class="relative ml-2">+ <button @click="isUserMenuOpen = !isUserMenuOpen" class="flex items-center px-3 py-2 border border-[var(--border-secondary)] rounded-lg text-[var(--text-secondary)] hover:text-[var(--text-accent)] focus:outline-none">+ <i class="fas fa-user mr-2"></i>+ <span>{{ current_user.username }}</span>+ <i class="fas fa-chevron-down ml-2"></i>+ </button>+ <div v-if="isUserMenuOpen" class="absolute right-0 mt-2 w-48 bg-[var(--bg-secondary)] border border-[var(--border-primary)] rounded-lg shadow-lg z-10">+ <a href="{{ url_for('account') }}" class="block px-4 py-2 text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] hover:text-[var(--text-accent)]">+ <i class="fas fa-user-circle mr-2"></i> Account+ </a>+ {% if current_user.is_admin %}+ <a href="{{ url_for('admin') }}" class="block px-4 py-2 text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] hover:text-[var(--text-accent)]">+ <i class="fas fa-user-shield mr-2"></i> Admin+ </a>+ {% endif %}+ <a href="{{ url_for('logout') }}" class="block px-4 py-2 text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] hover:text-[var(--text-danger)]">+ <i class="fas fa-sign-out-alt mr-2"></i> Logout+ </a>+ </div>+ </div>+ {% else %}+ <a href="{{ url_for('login') }}" class="px-4 py-2 ml-2 bg-[var(--bg-button)] text-[var(--text-button)] rounded-lg shadow hover:bg-[var(--bg-button-hover)] focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] focus:ring-offset-2 transition duration-150 ease-in-out">+ <i class="fas fa-sign-in-alt mr-1"></i> Login+ </a>+ <a href="{{ url_for('register') }}" class="px-4 py-2 ml-2 text-[var(--text-secondary)] hover:text-[var(--text-accent)] border border-[var(--border-secondary)] rounded-lg">+ <i class="fas fa-user-plus mr-1"></i> Register+ </a>+ {% endif %}</div></header>- <div v-if="globalError" class="mb-4 p-4 bg-red-100 border border-red-400 text-red-700 rounded-lg" role="alert">+ <div v-if="globalError" class="mb-4 p-4 bg-[var(--bg-danger-light)] border border-[var(--border-danger)] text-[var(--text-danger-strong)] rounded-lg" role="alert"><div class="flex justify-between items-center"><div><strong class="font-bold">Error:</strong><span class="block sm:inline ml-2">${ globalError }</span></div>- <button @click="globalError = null" class="text-red-700 hover:text-red-900 font-bold">×</button>+ <button @click="globalError = null" class="text-[var(--text-danger-strong)] hover:text-[var(--text-danger)] font-bold">×</button></div></div>+ <!-- Sidebar toggle button will be positioned relative to the main container -->+<main class="flex-grow"@dragover.prevent="dragover = true"@dragleave.prevent="handleDragLeave"@drop.prevent="handleDrop">- <div v-if="dragover" class="absolute inset-0 flex items-center justify-center bg-blue-500 bg-opacity-20 z-10 rounded-lg pointer-events-none border-4 border-dashed border-blue-600">- <div class="text-center p-6 bg-white rounded-lg shadow-xl">- <i class="fas fa-upload text-4xl text-blue-500 mb-3"></i>- <p class="text-xl font-semibold text-gray-700">Drop audio file(s) here to upload</p>+ <div v-if="dragover" class="absolute inset-0 flex items-center justify-center bg-[var(--border-focus)]/20 z-10 rounded-lg pointer-events-none border-4 border-dashed border-[var(--border-focus)]">+ <div class="text-center p-6 bg-[var(--bg-secondary)] rounded-lg shadow-xl">+ <i class="fas fa-upload text-4xl text-[var(--text-accent)] mb-3"></i>+ <p class="text-xl font-semibold text-[var(--text-secondary)]">Drop audio file(s) here to upload</p></div></div>- <div v-if="currentView === 'gallery'" class="flex-grow flex flex-col rounded-lg">- <div class="grid grid-cols-1 lg:grid-cols-4 gap-6 flex-grow">- <div class="lg:col-span-1 bg-white p-4 rounded-lg shadow-md flex flex-col">- <h3 class="text-lg font-semibold mb-4 sticky top-0 bg-white pb-3 border-b border-gray-200">Recordings</h3>- <div v-if="isLoadingRecordings" class="text-center text-gray-500 py-4">+ {% if current_user.is_authenticated %}+ <div v-if="currentView === 'gallery'" class="flex-grow flex flex-col rounded-lg relative">+ <!-- Sidebar toggle button that appears when sidebar is collapsed - positioned at the left edge of main content, aligned with title -->+ <button v-if="isSidebarCollapsed"+ @click="toggleSidebar"+ class="absolute -left-3 top-6 z-20 bg-gradient-to-r from-[var(--bg-accent)] to-[var(--bg-secondary)] p-2 pl-1 pr-3 rounded-r-lg shadow-lg text-[var(--text-accent)] hover:text-[var(--text-primary)] hover:shadow-xl transition-all duration-300 transform hover:translate-x-1 border-r border-t border-b border-[var(--border-accent)]"+ title="Show Sidebar">+ <i class="fas fa-chevron-right"></i>+ </button>++ <div class="grid grid-cols-1 lg:grid-cols-4 gap-6 flex-grow">+ <div v-show="!isSidebarCollapsed" class="lg:col-span-1 bg-[var(--bg-secondary)] p-4 rounded-lg shadow-md flex flex-col relative">+ <div class="flex justify-between items-center mb-4 sticky top-0 bg-[var(--bg-secondary)] pb-3 border-b border-[var(--border-primary)]">+ <h3 class="text-lg font-semibold text-[var(--text-primary)]">Recordings</h3>+ <button @click="toggleSidebar" class="p-1 rounded-full text-[var(--text-muted)] hover:bg-[var(--bg-tertiary)] dark:text-gray-400 dark:hover:bg-gray-700 transition-colors duration-200" :title="isSidebarCollapsed ? 'Show Sidebar' : 'Hide Sidebar'">+ <i class="fas fa-chevron-left"></i>+ </button>+ </div>+ <div v-if="isLoadingRecordings" class="text-center text-[var(--text-muted)] py-4"><i class="fas fa-spinner fa-spin mr-2"></i> Loading recordings...</div>- <div v-else-if="recordings.length === 0 && uploadQueue.length === 0" class="text-center text-gray-500 py-4 flex-grow flex flex-col items-center justify-center">- <i class="fas fa-folder-open text-4xl text-gray-400 mb-3"></i>+ <div v-else-if="recordings.length === 0 && uploadQueue.length === 0" class="text-center text-[var(--text-muted)] py-4 flex-grow flex flex-col items-center justify-center">+ <i class="fas fa-folder-open text-4xl text-[var(--text-light)] mb-3"></i><p>No recordings yet.</p><p>Upload one or drag & drop anywhere!</p></div><div v-else class="space-y-4 overflow-y-auto custom-scrollbar flex-grow pr-1"><div v-for="group in groupedRecordings" :key="group.title" class="mb-3">- <h4 class="font-medium text-gray-500 text-xs uppercase tracking-wider mb-2 sticky top-0 bg-white py-1">${ group.title }</h4>+ <h4 class="font-medium text-[var(--text-muted)] text-xs uppercase tracking-wider mb-2 sticky top-0 bg-[var(--bg-secondary)] py-1">${ group.title }</h4><ul class="space-y-1"><li v-for="recording in group.items":key="recording.id"@click="selectRecording(recording)"class="cursor-pointer p-3 rounded-md flex justify-between items-center transition duration-150 ease-in-out":class="{- 'bg-blue-100 hover:bg-blue-200 ring-1 ring-blue-300': selectedRecording?.id === recording.id,- 'hover:bg-gray-100': selectedRecording?.id !== recording.id+ 'bg-[var(--bg-accent)] hover:bg-[var(--bg-accent-hover)] ring-1 ring-[var(--border-accent)] text-[var(--text-accent)]': selectedRecording?.id === recording.id,+ 'hover:bg-[var(--bg-tertiary)] text-[var(--text-primary)]': selectedRecording?.id !== recording.id}"><div class="flex items-center overflow-hidden mr-2">- <i class="fas fa-file-audio text-blue-500 mr-2 flex-shrink-0"></i>- <span class="text-sm font-medium text-gray-800 truncate" :title="recording.title || 'Loading title...'">${ recording.title || '(Processing...)' }</span>+ <i class="fas fa-file-audio text-[var(--text-accent)] mr-2 flex-shrink-0"></i>+ <span class="text-sm font-medium truncate" :title="recording.title || 'Loading title...'">${ recording.title || '(Processing...)' }</span></div><div class="flex space-x-2 flex-shrink-0 items-center">- <span v-if="recording.status === 'PROCESSING'" class="text-xs text-blue-600 italic flex items-center" title="Transcribing...">+ <span v-if="recording.status === 'PROCESSING'" class="text-xs text-[var(--text-info-strong)] italic flex items-center" title="Transcribing..."><i class="fas fa-spinner fa-spin mr-1"></i> Transcribing</span>- <span v-else-if="recording.status === 'SUMMARIZING'" class="text-xs text-amber-600 italic flex items-center" title="Generating Summary...">+ <span v-else-if="recording.status === 'SUMMARIZING'" class="text-xs text-[var(--text-warn-strong)] italic flex items-center" title="Generating Summary..."><i class="fas fa-spinner fa-spin mr-1"></i> Summarizing</span>- <span v-else-if="recording.status === 'PENDING'" class="text-xs text-gray-500 italic flex items-center" title="Waiting...">+ <span v-else-if="recording.status === 'PENDING'" class="text-xs text-[var(--text-pending-strong)] italic flex items-center" title="Waiting..."><i class="fas fa-clock mr-1"></i> Pending</span>- <span v-else-if="recording.status === 'FAILED'" class="text-xs text-red-600 italic flex items-center" title="Processing Failed">+ <span v-else-if="recording.status === 'FAILED'" class="text-xs text-[var(--text-danger-strong)] italic flex items-center" title="Processing Failed"><i class="fas fa-exclamation-triangle mr-1"></i> Failed</span>- <span v-else-if="recording.status === 'COMPLETED'" class="text-xs text-green-600" title="Completed">+ <span v-else-if="recording.status === 'COMPLETED'" class="text-xs text-[var(--text-success-strong)]" title="Completed"><i class="fas fa-check-circle"></i></span>- <button @click.stop="editRecording(recording)" class="text-gray-500 hover:text-blue-600 text-xs p-1 rounded hover:bg-gray-200" title="Edit Details">+ <button @click.stop="editRecording(recording)" class="text-[var(--text-muted)] hover:text-[var(--text-accent)] text-xs p-1 rounded hover:bg-[var(--bg-tertiary)]" title="Edit Details"><i class="fas fa-edit"></i></button>- <button @click.stop="confirmDelete(recording)" class="text-gray-500 hover:text-red-600 text-xs p-1 rounded hover:bg-gray-200" title="Delete Recording">+ <button @click.stop="confirmDelete(recording)" class="text-[var(--text-muted)] hover:text-[var(--text-danger)] text-xs p-1 rounded hover:bg-[var(--bg-tertiary)]" title="Delete Recording"><i class="fas fa-trash"></i></button></div>@@ -771,12 +3029,30 @@ python-dotenv==1.0.0</div></div>- <div class="lg:col-span-3 bg-white p-6 rounded-lg shadow-md flex flex-col">+ <div :class="isSidebarCollapsed ? 'lg:col-span-4' : 'lg:col-span-3'" class="bg-[var(--bg-secondary)] p-6 rounded-lg shadow-md flex flex-col"><div v-if="selectedRecording" class="flex-grow flex flex-col">- <div class="flex flex-col sm:flex-row justify-between items-start mb-4 border-b border-gray-200 pb-4">+ <div class="flex flex-col sm:flex-row justify-between items-start mb-4 border-b border-[var(--border-primary)] pb-4"><div class="mb-3 sm:mb-0 max-w-lg">- <h3 class="text-2xl font-semibold text-gray-900">${ selectedRecording.title || 'Loading...' }</h3>- <p class="text-sm text-gray-500 mt-1">+ <h3 class="text-2xl font-semibold text-[var(--text-primary)]">${ selectedRecording.title || 'Loading...' }</h3>+ <p class="text-sm text-[var(--text-muted)] mt-1">+ <!-- Display Meeting Date with edit functionality -->+ <span>+ <i class="fas fa-calendar-alt mr-1"></i>+ <span v-if="!editingMeetingDate">+ Meeting Date:+ <span @click="toggleEditMeetingDate" class="cursor-pointer hover:text-[var(--text-accent)]">+ ${ selectedRecording.meeting_date ? formatDisplayDate(selectedRecording.meeting_date) : 'Click to add' }+ </span> |+ </span>+ <span v-else class="inline-flex items-center">+ <input type="date" v-model="selectedRecording.meeting_date"+ @blur="saveInlineEdit('meeting_date')"+ class="p-0 w-40 bg-transparent border-b border-[var(--border-secondary)] focus:outline-none focus:border-[var(--border-focus)]" />+ <button @click="saveInlineEdit('meeting_date')" class="ml-1 text-xs text-[var(--text-accent)]">+ <i class="fas fa-check"></i>+ </button>+ </span>+ </span>Created: ${ new Date(selectedRecording.created_at).toLocaleString() } | Size: ${ formatFileSize(selectedRecording.file_size) }</p><span :class="getStatusClass(selectedRecording.status)" class="status-badge">@@ -784,70 +3060,162 @@ python-dotenv==1.0.0</span></div><div class="flex space-x-2 flex-shrink-0">- <button @click="editRecording(selectedRecording)" class="px-3 py-1.5 bg-blue-600 text-white rounded-md hover:bg-blue-700 text-sm shadow-sm">+ <button @click="editRecording(selectedRecording)" class="px-3 py-1.5 bg-[var(--bg-button)] text-[var(--text-button)] rounded-md hover:bg-[var(--bg-button-hover)] text-sm shadow-sm"><i class="fas fa-edit mr-1"></i> Edit Details</button>- <button @click="confirmDelete(selectedRecording)" class="px-3 py-1.5 bg-red-600 text-white rounded-md hover:bg-red-700 text-sm shadow-sm">+ <button @click="confirmDelete(selectedRecording)" class="px-3 py-1.5 bg-[var(--bg-danger)] text-[var(--text-button)] rounded-md hover:bg-[var(--bg-danger-hover)] text-sm shadow-sm"><i class="fas fa-trash mr-1"></i> Delete</button></div></div>- <div class="grid md:grid-cols-2 gap-6 flex-grow overflow-hidden">- <div class="flex flex-col overflow-hidden">- <h4 class="font-semibold text-gray-700 mb-2 flex-shrink-0">Transcription</h4>- <div class="flex-grow overflow-y-auto p-4 bg-gray-50 rounded border border-gray-200 text-sm custom-scrollbar">- <div v-if="selectedRecording.status === 'COMPLETED' || selectedRecording.status === 'SUMMARIZING'">- <pre class="whitespace-pre-wrap font-sans">${ selectedRecording.transcription || 'No transcription available.' }</pre>- </div>- <div v-else-if="selectedRecording.status === 'FAILED'" class="text-red-700">- <p class="font-medium mb-2">Processing Failed:</p>- <pre class="whitespace-pre-wrap font-sans">${ selectedRecording.transcription || 'An unknown error occurred.' }</pre>- </div>- <div v-else class="flex items-center justify-center text-gray-500 h-full">- <i class="fas fa-spinner fa-spin mr-2"></i> Transcription in progress...+ <!-- Adjusted Grid: md:grid-cols-5 -> Transcription (2), Right Panel (3) -->+ <div class="grid md:grid-cols-5 gap-6 flex-grow overflow-hidden">+ <!-- Left Column: Participants, Transcription, Summary & Notes -->+ <div class="md:col-span-2 flex flex-col overflow-hidden space-y-4">+ <div>+ <div class="flex justify-between items-center mb-1">+ <h4 class="font-semibold text-[var(--text-secondary)]">Participants</h4>+ <button @click="toggleEditParticipants" class="text-xs text-[var(--text-muted)] hover:text-[var(--text-accent)] p-1 rounded">+ <i class="fas" :class="editingParticipants ? 'fa-check' : 'fa-edit'"></i>+ </button></div>+ <div v-if="!editingParticipants" class="text-sm bg-[var(--bg-tertiary)] p-3 rounded-xl border border-[var(--border-primary)] min-h-[40px] text-[var(--text-secondary)]">${ selectedRecording.participants || 'None specified' }</div>+ <textarea v-else v-model="selectedRecording.participants" @blur="saveInlineEdit('participants')" class="text-sm bg-[var(--bg-tertiary)] p-3 rounded border border-[var(--border-primary)] min-h-[40px] w-full focus:ring-[var(--ring-focus)] focus:border-[var(--border-focus)] text-[var(--text-secondary)]" placeholder="Enter participants"></textarea></div>- </div>-- <div class="flex flex-col space-y-4 overflow-hidden"><div>- <h4 class="font-semibold text-gray-700 mb-2">Audio Player</h4>- <audio controls class="w-full" :key="selectedRecording.id" :src="'/audio/' + selectedRecording.id">- Your browser does not support the audio element.- </audio>+ <div class="flex justify-between items-center mb-1">+ <h4 class="font-semibold text-[var(--text-secondary)]">Transcription</h4>+ <button @click="copyTranscription($event)" class="text-xs text-[var(--text-muted)] hover:text-[var(--text-accent)] p-1 rounded" title="Copy to clipboard">+ <i class="fas fa-copy"></i>+ </button>+ </div>+ <div class="transcription-box p-4 bg-[var(--bg-tertiary)] rounded border border-[var(--border-primary)] text-sm custom-scrollbar relative text-[var(--text-secondary)]">+ <div v-if="selectedRecording.status === 'COMPLETED' || selectedRecording.status === 'SUMMARIZING'" class="copyable">+ <pre class="whitespace-pre-wrap font-sans">${ selectedRecording.transcription || 'No transcription available.' }</pre>+ </div>+ <div v-else-if="selectedRecording.status === 'FAILED'" class="text-[var(--text-danger)]">+ <p class="font-medium mb-2">Processing Failed:</p>+ <pre class="whitespace-pre-wrap font-sans">${ selectedRecording.transcription || 'An unknown error occurred.' }</pre>+ </div>+ <div v-else class="flex items-center justify-center text-[var(--text-muted)] h-full">+ <i class="fas fa-spinner fa-spin mr-2"></i> Transcription in progress...+ </div>+ </div></div>-++ <!-- Tabs for Summary and Notes (Moved from right column) --><div class="flex flex-col overflow-hidden">- <h4 class="font-semibold text-gray-700 mb-2 flex-shrink-0">Summary</h4>- <div class="flex-grow overflow-hidden">- <div v-if="selectedRecording.status === 'COMPLETED'" class="summary-box custom-scrollbar">- ${ selectedRecording.summary || 'No summary generated.' }- </div>- <div v-else-if="selectedRecording.status === 'FAILED'" class="summary-box text-red-700 custom-scrollbar">- ${ selectedRecording.summary || 'Summary generation failed or was skipped.' }+ <div class="border-b border-[var(--border-primary)]">+ <nav class="-mb-px flex space-x-4" aria-label="Tabs">+ <button @click="selectedTab = 'summary'"+ :class="selectedTab === 'summary' ? 'border-[var(--border-focus)] text-[var(--text-accent)]' : 'border-transparent text-[var(--text-muted)] hover:text-[var(--text-secondary)] hover:border-[var(--border-secondary)]'"+ class="whitespace-nowrap py-3 px-1 border-b-2 font-medium text-sm">+ Summary+ </button>+ <button @click="selectedTab = 'notes'"+ :class="selectedTab === 'notes' ? 'border-[var(--border-focus)] text-[var(--text-accent)]' : 'border-transparent text-[var(--text-muted)] hover:text-[var(--text-secondary)] hover:border-[var(--border-secondary)]'"+ class="whitespace-nowrap py-3 px-1 border-b-2 font-medium text-sm">+ Notes+ </button>+ </nav>+ </div>+ <div class="pt-4">+ <!-- Summary Panel -->+ <div v-show="selectedTab === 'summary'" class="overflow-hidden">+ <div class="flex justify-between items-center mb-1">+ <button @click="toggleEditSummary" class="text-xs text-[var(--text-muted)] hover:text-[var(--text-accent)] p-1 rounded ml-auto">+ <i class="fas" :class="editingSummary ? 'fa-check' : 'fa-edit'"></i>+ </button>+ </div>+ <div v-if="selectedRecording.status === 'COMPLETED'">+ <div v-if="!editingSummary" class="summary-box custom-scrollbar bg-[var(--bg-tertiary)] border-[var(--border-primary)] text-[var(--text-secondary)]" style="height: 200px;" v-html="selectedRecording.summary_html || selectedRecording.summary || 'No summary generated.'">+ </div>+ <textarea v-else v-model="selectedRecording.summary" @blur="saveInlineEdit('summary')" class="summary-box custom-scrollbar bg-[var(--bg-tertiary)] border-[var(--border-primary)] text-[var(--text-secondary)] w-full focus:ring-[var(--ring-focus)] focus:border-[var(--border-focus)]" style="height: 200px;" placeholder="Enter summary"></textarea>+ </div>+ <div v-else-if="selectedRecording.status === 'FAILED'" class="summary-box text-[var(--text-danger)] custom-scrollbar bg-[var(--bg-tertiary)] border-[var(--border-primary)]" style="height: 200px;" v-html="selectedRecording.summary_html || selectedRecording.summary || 'Summary generation failed or was skipped.'">+ </div>+ <div v-else class="h-24 flex items-center justify-center p-4 bg-[var(--bg-tertiary)] rounded border border-[var(--border-primary)] text-[var(--text-muted)]">+ <i class="fas fa-spinner fa-spin mr-2"></i> Summary pending...+ </div></div>- <div v-else class="h-24 flex items-center justify-center p-4 bg-gray-50 rounded border border-gray-200 text-gray-500">- <i class="fas fa-spinner fa-spin mr-2"></i> Summary pending...+ <!-- Notes Panel -->+ <div v-show="selectedTab === 'notes'" class="overflow-hidden">+ <div class="flex justify-between items-center mb-1">+ <button @click="toggleEditNotes" class="text-xs text-[var(--text-muted)] hover:text-[var(--text-accent)] p-1 rounded ml-auto">+ <i class="fas" :class="editingNotes ? 'fa-check' : 'fa-edit'"></i>+ </button>+ </div>+ <div v-if="!editingNotes" class="text-sm bg-[var(--bg-tertiary)] p-3 rounded-xl border border-[var(--border-primary)] custom-scrollbar text-[var(--text-secondary)]" style="height: 200px;" v-html="selectedRecording.notes_html || selectedRecording.notes || 'No notes'"></div>+ <textarea v-else v-model="selectedRecording.notes" @blur="saveInlineEdit('notes')" class="text-sm bg-[var(--bg-tertiary)] p-3 rounded border border-[var(--border-primary)] custom-scrollbar text-[var(--text-secondary)] w-full focus:ring-[var(--ring-focus)] focus:border-[var(--border-focus)]" style="height: 200px;" placeholder="Enter notes"></textarea></div></div></div>+ </div>+ <!-- Right Column: Audio & Chat -->+ <div class="md:col-span-3 flex flex-col space-y-4 overflow-hidden"><div>- <h4 class="font-semibold text-gray-700 mb-1">Participants</h4>- <p class="text-sm bg-gray-50 p-3 rounded border border-gray-200 min-h-[40px]">${ selectedRecording.participants || 'None specified' }</p>+ <h4 class="font-semibold text-[var(--text-secondary)] mb-2">Audio Player</h4>+ <!-- Beautified audio player container -->+ <div class="bg-[var(--bg-audio-player)] p-3 rounded-lg shadow border border-[var(--border-primary)]">+ <audio controls class="w-full h-10" :key="selectedRecording.id" :src="'/audio/' + selectedRecording.id">+ Your browser does not support the audio element.+ </audio>+ </div></div>- <div class="flex flex-col overflow-hidden flex-grow">- <h4 class="font-semibold text-gray-700 mb-1 flex-shrink-0">Notes</h4>- <div class="flex-grow overflow-hidden">- <pre class="text-sm bg-gray-50 p-3 rounded border border-gray-200 whitespace-pre-wrap h-40 overflow-y-auto custom-scrollbar font-sans">${ selectedRecording.notes || 'No notes' }</pre>++ <!-- Chat Section (Fixed height to match left column) -->+ <div class="flex flex-col overflow-hidden">+ <h4 class="font-semibold text-[var(--text-secondary)] mb-2 flex-shrink-0">Chat with Transcript</h4>+ <!-- Chat container with fixed height matching left column -->+ <div class="chat-container border-[var(--border-primary)] bg-[var(--bg-secondary)]" style="height: 684px;">+ <div class="chat-messages custom-scrollbar" ref="chatMessagesRef">+ <div v-if="chatMessages.length === 0" class="flex items-center justify-center h-full text-[var(--text-muted)]">+ <div class="text-center">+ <i class="fas fa-comments text-2xl mb-2"></i>+ <p>Ask questions about the transcript</p>+ </div>+ </div>+ <div v-for="(message, index) in chatMessages" :key="index" class="message" :class="message.role === 'user' ? 'user-message bg-[var(--bg-accent)] text-[var(--text-accent)]' : 'ai-message bg-[var(--bg-tertiary)] text-[var(--text-secondary)]'">+ <div class="flex justify-between items-start">+ <div class="flex-grow" v-if="message.role === 'user'">${ message.content }</div>+ <div class="flex-grow" v-else v-html="message.html || message.content"></div>+ <button v-if="message.role === 'assistant'" @click="copyMessage(message.content, $event)" class="ml-2 text-[var(--text-light)] hover:text-[var(--text-muted)]" title="Copy response">+ <i class="fas fa-copy text-xs"></i>+ </button>+ </div>+ </div>+ <div v-if="isChatLoading" class="message ai-message bg-[var(--bg-tertiary)] text-[var(--text-secondary)]">+ <div class="flex items-center">+ <i class="fas fa-spinner fa-spin mr-2"></i> Thinking...+ </div>+ </div>+ </div>+ <div class="chat-input-container border-t-[var(--border-primary)]">+ <input+ v-model="chatInput"+ @keyup.enter="sendChatMessage"+ type="text"+ placeholder="Ask about the transcript..."+ class="flex-grow px-3 py-2 border-0 focus:ring-0 focus:outline-none bg-[var(--bg-input)] text-[var(--text-primary)] placeholder-[var(--text-muted)]"+ :disabled="isChatLoading || !selectedRecording || selectedRecording.status !== 'COMPLETED'"+ >+ <button+ @click="sendChatMessage"+ class="px-4 py-2 bg-[var(--bg-button)] text-[var(--text-button)] rounded-md hover:bg-[var(--bg-button-hover)] disabled:bg-[var(--bg-tertiary)] disabled:text-[var(--text-muted)] disabled:cursor-not-allowed"+ :disabled="!chatInput.trim() || isChatLoading || !selectedRecording || selectedRecording.status !== 'COMPLETED'"+ >+ <i class="fas fa-paper-plane"></i>+ </button>+ </div></div></div></div></div>- </div>- <div v-else class="flex flex-col items-center justify-center text-center text-gray-500 flex-grow">- <i class="fas fa-hand-pointer text-4xl text-gray-400 mb-4"></i>+ </div>+ <div v-else class="flex flex-col items-center justify-center text-center text-[var(--text-muted)] flex-grow">+ <i class="fas fa-hand-pointer text-4xl text-[var(--text-light)] mb-4"></i><p class="text-lg font-medium mb-2">Select a recording from the list to view details.</p><p>Or, drag and drop audio file(s) anywhere on this page to upload.</p></div>@@ -857,130 +3225,160 @@ python-dotenv==1.0.0<div v-if="currentView === 'upload'"class="flex-grow flex items-center justify-center p-4">- <div class="w-full max-w-lg bg-white p-8 rounded-xl shadow-lg border border-gray-200 text-center drag-area"- :class="{'border-blue-500 bg-blue-50': dragover}">+ <div class="w-full max-w-lg bg-[var(--bg-secondary)] p-8 rounded-xl shadow-lg border border-[var(--border-primary)] text-center drag-area"+ :class="{'border-[var(--border-focus)] bg-[var(--bg-accent)]': dragover}"><div class="py-8">- <i class="fas fa-cloud-upload-alt text-5xl mb-5 text-blue-500"></i>- <h2 class="text-xl font-semibold text-gray-700 mb-2">Upload New Recordings</h2>- <p class="text-gray-500 mb-4">Drag & drop your audio files here or click below.</p>+ <i class="fas fa-cloud-upload-alt text-5xl mb-5 text-[var(--text-accent)]"></i>+ <h2 class="text-xl font-semibold text-[var(--text-secondary)] mb-2">Upload New Recordings</h2>+ <p class="text-[var(--text-muted)] mb-4">Drag & drop your audio files here or click below.</p><input type="file" @change="handleFileSelect" accept="audio/*" class="hidden" ref="fileInput" multiple>- <button @click="$refs.fileInput.click()" class="mt-4 px-6 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 shadow-sm transition duration-150 ease-in-out">+ <button @click="$refs.fileInput.click()" class="mt-4 px-6 py-2 bg-[var(--bg-button)] text-[var(--text-button)] rounded-lg hover:bg-[var(--bg-button-hover)] shadow-sm transition duration-150 ease-in-out"><i class="fas fa-file-import mr-2"></i> Select Files</button>- <p class="text-xs text-gray-400 mt-4">Max file size per file: ${ maxFileSizeMB } MB</p>+ <p class="text-xs text-[var(--text-light)] mt-4">Max file size per file: ${ maxFileSizeMB } MB</p></div></div></div>- </main>+ {% else %}+ <div class="flex-grow flex items-center justify-center">+ <div class="text-center max-w-lg p-8 bg-[var(--bg-secondary)] rounded-xl shadow-lg border border-[var(--border-primary)]">+ <i class="fas fa-lock text-5xl mb-4 text-[var(--text-accent)]"></i>+ <h2 class="text-2xl font-semibold text-[var(--text-primary)] mb-4">Welcome to Speakr</h2>+ <p class="text-[var(--text-secondary)] mb-6">+ Speakr is an audio transcription and summarization app that helps you convert your audio recordings into text and generate summaries.+ </p>+ <div class="flex flex-col sm:flex-row justify-center space-y-3 sm:space-y-0 sm:space-x-4">+ <a href="{{ url_for('login') }}" class="px-6 py-2 bg-[var(--bg-button)] text-[var(--text-button)] rounded-lg shadow hover:bg-[var(--bg-button-hover)] focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] focus:ring-offset-2 transition duration-150 ease-in-out">+ <i class="fas fa-sign-in-alt mr-2"></i> Login+ </a>+ <a href="{{ url_for('register') }}" class="px-6 py-2 text-[var(--text-secondary)] hover:text-[var(--text-accent)] border border-[var(--border-secondary)] rounded-lg">+ <i class="fas fa-user-plus mr-2"></i> Register+ </a>+ </div>+ </div>+ </div>+ {% endif %}+ </main>- <footer class="text-center py-4 mt-8 text-xs text-gray-400 border-t border-gray-200">- Audio Transcription App © ${ new Date().getFullYear() }+ <footer class="text-center py-4 mt-8 text-xs text-[var(--text-light)] border-t border-[var(--border-primary)]">+ Speakr © ${ new Date().getFullYear() }</footer><div v-if="showEditModal" class="fixed inset-0 bg-black bg-opacity-60 flex items-center justify-center z-50 p-4">- <div class="bg-white p-6 rounded-lg shadow-xl w-full max-w-lg max-h-[90vh] overflow-y-auto custom-scrollbar">+ <div class="bg-[var(--bg-secondary)] p-6 rounded-lg shadow-xl w-full max-w-lg max-h-[90vh] overflow-y-auto custom-scrollbar"><div class="flex justify-between items-center mb-4">- <h3 class="text-xl font-semibold text-gray-800">Edit Recording Details</h3>- <button @click="cancelEdit" class="text-gray-400 hover:text-gray-600 text-2xl leading-none">×</button>+ <h3 class="text-xl font-semibold text-[var(--text-primary)]">Edit Recording Details</h3>+ <button @click="cancelEdit" class="text-[var(--text-light)] hover:text-[var(--text-muted)] text-2xl leading-none">×</button></div><div v-if="editingRecording" class="space-y-4"><div>- <label class="block text-sm font-medium text-gray-700 mb-1">Title</label>- <input v-model="editingRecording.title" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-200 focus:ring-opacity-50">+ <label class="block text-sm font-medium text-[var(--text-secondary)] mb-1">Title</label>+ <input v-model="editingRecording.title" class="mt-1 block w-full rounded-md border-[var(--border-secondary)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]">+ </div>+ <div>+ <label class="block text-sm font-medium text-[var(--text-secondary)] mb-1">Participants</label>+ <input v-model="editingRecording.participants" class="mt-1 block w-full rounded-md border-[var(--border-secondary)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]"></div>+ <!-- Add Meeting Date Input --><div>- <label class="block text-sm font-medium text-gray-700 mb-1">Participants</label>- <input v-model="editingRecording.participants" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-200 focus:ring-opacity-50">+ <label class="block text-sm font-medium text-[var(--text-secondary)] mb-1">Meeting Date</label>+ <input type="date" v-model="editingRecording.meeting_date" class="mt-1 block w-full rounded-md border-[var(--border-secondary)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]"></div><div>- <label class="block text-sm font-medium text-gray-700 mb-1">Summary</label>- <textarea v-model="editingRecording.summary" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-200 focus:ring-opacity-50" rows="5"></textarea>+ <label class="block text-sm font-medium text-[var(--text-secondary)] mb-1">Summary</label>+ <textarea v-model="editingRecording.summary" class="mt-1 block w-full rounded-md border-[var(--border-secondary)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]" rows="5"></textarea></div><div>- <label class="block text-sm font-medium text-gray-700 mb-1">Notes</label>- <textarea v-model="editingRecording.notes" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-200 focus:ring-opacity-50" rows="4"></textarea>+ <label class="block text-sm font-medium text-[var(--text-secondary)] mb-1">Notes</label>+ <textarea v-model="editingRecording.notes" class="mt-1 block w-full rounded-md border-[var(--border-secondary)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]" rows="4"></textarea></div><div class="flex justify-end space-x-3 pt-4">- <button @click="cancelEdit" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300">Cancel</button>- <button @click="saveEdit" class="px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700">Save Changes</button>+ <button @click="cancelEdit" class="px-4 py-2 bg-[var(--bg-tertiary)] text-[var(--text-secondary)] rounded-md hover:bg-[var(--border-secondary)]">Cancel</button>+ <button @click="saveEdit" class="px-4 py-2 bg-[var(--bg-button)] text-[var(--text-button)] rounded-md hover:bg-[var(--bg-button-hover)]">Save Changes</button></div></div></div></div><div v-if="showDeleteModal" class="fixed inset-0 bg-black bg-opacity-60 flex items-center justify-center z-50 p-4">- <div class="bg-white p-6 rounded-lg shadow-xl max-w-md w-full">- <h3 class="text-lg font-semibold text-gray-800 mb-4">Confirm Delete</h3>- <p v-if="recordingToDelete" class="mb-2 text-gray-600">Are you sure you want to permanently delete the recording titled "<strong>${ recordingToDelete.title }</strong>"?</p>- <p class="text-sm text-red-600 mb-6">This action cannot be undone and will delete the record, transcription, summary, and the audio file.</p>+ <div class="bg-[var(--bg-secondary)] p-6 rounded-lg shadow-xl max-w-md w-full">+ <h3 class="text-lg font-semibold text-[var(--text-primary)] mb-4">Confirm Delete</h3>+ <p v-if="recordingToDelete" class="mb-2 text-[var(--text-secondary)]">Are you sure you want to permanently delete the recording titled "<strong>${ recordingToDelete.title }</strong>"?</p>+ <p class="text-sm text-[var(--text-danger)] mb-6">This action cannot be undone and will delete the record, transcription, summary, and the audio file.</p><div class="flex justify-end space-x-3">- <button @click="cancelDelete" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300">Cancel</button>- <button @click="deleteRecording" class="px-4 py-2 bg-red-600 text-white rounded-md hover:bg-red-700">Delete Permanently</button>+ <button @click="cancelDelete" class="px-4 py-2 bg-[var(--bg-tertiary)] text-[var(--text-secondary)] rounded-md hover:bg-[var(--border-secondary)]">Cancel</button>+ <button @click="deleteRecording" class="px-4 py-2 bg-[var(--bg-danger)] text-[var(--text-button)] rounded-md hover:bg-[var(--bg-danger-hover)]">Delete Permanently</button></div></div></div><div v-if="uploadQueue.length > 0 || currentlyProcessingFile"- class="progress-popup bg-white rounded-lg shadow-xl border border-gray-200 overflow-hidden"+ class="progress-popup bg-[var(--bg-secondary)] rounded-lg shadow-xl border border-[var(--border-primary)] overflow-hidden":class="{ 'minimized': progressPopupMinimized }">- <div class="flex justify-between items-center p-2 bg-gray-100 border-b border-gray-200 cursor-pointer" @click="progressPopupMinimized = !progressPopupMinimized">- <h4 class="text-sm font-semibold text-gray-700">- <i class="fas fa-upload mr-2 text-blue-500"></i>+ <div class="flex justify-between items-center p-2 bg-[var(--bg-tertiary)] border-b border-[var(--border-primary)] cursor-pointer" @click="progressPopupMinimized = !progressPopupMinimized">+ <h4 class="text-sm font-semibold text-[var(--text-secondary)]">+ <i class="fas fa-upload mr-2 text-[var(--text-accent)]"></i>Upload & Process Progress (${ completedInQueue }/${ totalInQueue } completed)</h4>- <button class="text-gray-500 hover:text-gray-700">+ <button class="text-[var(--text-muted)] hover:text-[var(--text-secondary)]"><i :class="progressPopupMinimized ? 'fa-chevron-up' : 'fa-chevron-down'" class="fas fa-fw"></i></button></div><div class="p-3 max-h-60 overflow-y-auto custom-scrollbar" v-show="!progressPopupMinimized">- <div v-if="currentlyProcessingFile" class="mb-3 pb-3 border-b border-dashed border-gray-200">+ <div v-if="currentlyProcessingFile" class="mb-3 pb-3 border-b border-dashed border-[var(--border-secondary)]"><div class="flex items-center justify-between mb-1">- <p class="text-xs font-medium text-gray-800 truncate mr-2" :title="currentlyProcessingFile.file.name">- <i class="fas fa-spinner fa-spin text-blue-500 mr-1"></i> Processing: ${ currentlyProcessingFile.file.name }+ <p class="text-xs font-medium text-[var(--text-primary)] truncate mr-2" :title="currentlyProcessingFile.file.name">+ <i class="fas fa-spinner fa-spin text-[var(--text-accent)] mr-1"></i> Processing: ${ currentlyProcessingFile.file.name }</p>- <span class="text-xs text-gray-500 flex-shrink-0">${ formatFileSize(currentlyProcessingFile.file.size) }</span>+ <span class="text-xs text-[var(--text-muted)] flex-shrink-0">${ formatFileSize(currentlyProcessingFile.file.size) }</span></div>- <p class="text-xs text-gray-600 mb-1 italic">${ processingMessage }</p>- <div class="w-full bg-gray-200 rounded-full h-1.5">- <div class="bg-blue-500 h-1.5 rounded-full transition-all duration-300" :style="{ width: processingProgress + '%' }"></div>+ <p class="text-xs text-[var(--text-secondary)] mb-1 italic">${ processingMessage }</p>+ <div class="w-full bg-[var(--border-primary)] rounded-full h-1.5">+ <div class="bg-[var(--text-accent)] h-1.5 rounded-full transition-all duration-300" :style="{ width: processingProgress + '%' }"></div></div></div><div v-if="queuedFiles.length > 0" class="mb-2">- <p class="text-xs font-semibold text-gray-500 mb-1">${ queuedFiles.length } file(s) queued:</p>+ <p class="text-xs font-semibold text-[var(--text-muted)] mb-1">${ queuedFiles.length } file(s) queued:</p><ul class="space-y-1">- <li v-for="item in queuedFiles" :key="item.clientId" class="text-xs text-gray-600 progress-list-item">- <i class="fas fa-clock text-gray-400 fa-fw"></i>+ <li v-for="item in queuedFiles" :key="item.clientId" class="text-xs text-[var(--text-secondary)] progress-list-item">+ <i class="fas fa-clock text-[var(--text-light)] fa-fw"></i><span class="truncate" :title="item.file.name">${ item.file.name }</span>- <span class="text-gray-400 flex-shrink-0">${ formatFileSize(item.file.size) }</span>+ <span class="text-[var(--text-light)] flex-shrink-0">${ formatFileSize(item.file.size) }</span></li></ul></div>- <div v-if="finishedFilesInQueue.length > 0" class="mt-2 pt-2 border-t border-dashed border-gray-200">- <p class="text-xs font-semibold text-gray-500 mb-1">Recently finished:</p>+ <div v-if="finishedFilesInQueue.length > 0" class="mt-2 pt-2 border-t border-dashed border-[var(--border-secondary)]">+ <p class="text-xs font-semibold text-[var(--text-muted)] mb-1">Recently finished:</p><ul class="space-y-1"><li v-for="item in finishedFilesInQueue.slice(-5)" :key="item.clientId" class="text-xs progress-list-item">- <i v-if="item.status === 'completed'" class="fas fa-check-circle text-green-500 fa-fw"></i>- <i v-else-if="item.status === 'failed'" class="fas fa-exclamation-triangle text-red-500 fa-fw"></i>- <i v-else class="fas fa-question-circle text-gray-400 fa-fw"></i>- <span class="truncate" :title="item.file.name">${ item.file.name }</span>- <span v-if="item.status === 'failed'" class="text-red-500 text-xs italic flex-shrink-0">Failed</span>- <span v-else class="text-gray-400 flex-shrink-0">${ formatFileSize(item.file.size) }</span>+ <i v-if="item.status === 'completed'" class="fas fa-check-circle text-[var(--text-success-strong)] fa-fw"></i>+ <i v-else-if="item.status === 'failed'" class="fas fa-exclamation-triangle text-[var(--text-danger-strong)] fa-fw"></i>+ <i v-else class="fas fa-question-circle text-[var(--text-light)] fa-fw"></i>+ <span class="truncate text-[var(--text-secondary)]" :title="item.file.name">${ item.file.name }</span>+ <span v-if="item.status === 'failed'" class="text-[var(--text-danger)] text-xs italic flex-shrink-0">Failed</span>+ <span v-else class="text-[var(--text-light)] flex-shrink-0">${ formatFileSize(item.file.size) }</span></li></ul></div>- <div v-if="uploadQueue.length > 0 && queuedFiles.length === 0 && !currentlyProcessingFile" class="text-xs text-center text-gray-500 py-2">+ <div v-if="uploadQueue.length > 0 && queuedFiles.length === 0 && !currentlyProcessingFile" class="text-xs text-center text-[var(--text-muted)] py-2">All uploads processed.</div></div></div>- </div> <script>+ </div>++ <!-- Toast container for notifications -->+ <div class="toast-container" id="toastContainer"></div>++ {% raw %}+ <script>const { createApp, ref, reactive, computed, onMounted, watch, nextTick } = VuecreateApp({@@ -989,7 +3387,7 @@ python-dotenv==1.0.0const dragover = ref(false);const recordings = ref([]);const selectedRecording = ref(null);- // const currentRecording = ref(null); // Less used now with modal editing+ const selectedTab = ref('summary'); // For Summary/Notes tabs// --- Multi-Upload State ---// Status: 'queued'|'uploading'|'processing'|'summarizing'|'completed'|'failed'@@ -1009,6 +3407,15 @@ python-dotenv==1.0.0const isLoadingRecordings = ref(true);const globalError = ref(null);const maxFileSizeMB = ref(250); // Default, could fetch from config if needed+ const isDarkMode = ref(false); // Dark mode state+ const isSidebarCollapsed = ref(false); // Sidebar state+ const isUserMenuOpen = ref(false); // User dropdown menu state++ // Inline editing state+ const editingParticipants = ref(false);+ const editingMeetingDate = ref(false);+ const editingSummary = ref(false);+ const editingNotes = ref(false);// --- Computed Properties ---const groupedRecordings = computed(() => {@@ -1064,6 +3471,52 @@ python-dotenv==1.0.0return size + ' ' + sizes[i];};+ // --- Dark Mode ---+ const toggleDarkMode = () => {+ isDarkMode.value = !isDarkMode.value;+ if (isDarkMode.value) {+ document.documentElement.classList.add('dark');+ localStorage.setItem('darkMode', 'true');+ } else {+ document.documentElement.classList.remove('dark');+ localStorage.setItem('darkMode', 'false');+ }+ };++ const initializeDarkMode = () => {+ const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;+ const savedMode = localStorage.getItem('darkMode');+ if (savedMode === 'true' || (savedMode === null && prefersDark)) {+ isDarkMode.value = true;+ document.documentElement.classList.add('dark');+ } else {+ isDarkMode.value = false;+ document.documentElement.classList.remove('dark');+ }+ };+ // --- End Dark Mode ---++ // --- Sidebar Toggle ---+ const toggleSidebar = () => {+ isSidebarCollapsed.value = !isSidebarCollapsed.value;+ // Optional: Save state to localStorage if persistence is desired+ // localStorage.setItem('sidebarCollapsed', isSidebarCollapsed.value);+ };+ // --- End Sidebar Toggle ---++ // Helper to format date for display (e.g., "May 4, 2025")+ const formatDisplayDate = (dateString) => {+ if (!dateString) return '';+ try {+ // Input is expected as 'YYYY-MM-DD'+ const date = new Date(dateString + 'T00:00:00'); // Add time to avoid timezone issues+ return date.toLocaleDateString(undefined, { year: 'numeric', month: 'long', day: 'numeric' });+ } catch (e) {+ console.error("Error formatting date:", e);+ return dateString; // Return original string if formatting fails+ }+ };+// Helper for status displayconst formatStatus = (status) => {if (!status) return 'Unknown';@@ -1358,7 +3811,8 @@ python-dotenv==1.0.0title: recordingDataToSave.title,participants: recordingDataToSave.participants,notes: recordingDataToSave.notes,- summary: recordingDataToSave.summary // <-- ADDED: Include summary+ summary: recordingDataToSave.summary, // <-- ADDED: Include summary+ meeting_date: recordingDataToSave.meeting_date // <-- ADDED: Include meeting_date (should be YYYY-MM-DD)};const response = await fetch('/save', {method: 'POST',@@ -1376,14 +3830,20 @@ python-dotenv==1.0.0recordings.value[index].title = payload.title;recordings.value[index].participants = payload.participants;recordings.value[index].notes = payload.notes;+ recordings.value[index].notes_html = data.recording.notes_html;recordings.value[index].summary = payload.summary;+ recordings.value[index].summary_html = data.recording.summary_html;+ recordings.value[index].meeting_date = payload.meeting_date; // <-- ADDED: Update meeting_date}// Update selected if it's the one being savedif (selectedRecording.value?.id === data.recording.id) {selectedRecording.value.title = payload.title;selectedRecording.value.participants = payload.participants;selectedRecording.value.notes = payload.notes;+ selectedRecording.value.notes_html = data.recording.notes_html;selectedRecording.value.summary = payload.summary;+ selectedRecording.value.summary_html = data.recording.summary_html;+ selectedRecording.value.meeting_date = payload.meeting_date; // <-- ADDED: Update meeting_date}return data.recording; // Return the full updated object from backend} catch (error) {@@ -1394,23 +3854,26 @@ python-dotenv==1.0.0};const loadRecordings = async () => {- globalError.value = null;+ globalError.value = null;isLoadingRecordings.value = true;try {+ // Since this code is inside the "if current_user.is_authenticated" block,+ // we can assume the user is authenticated and directly fetch recordingsconst response = await fetch('/recordings');const data = await response.json();if (!response.ok) throw new Error(data.error || 'Failed to load recordings');recordings.value = data;- // On load, check for any recordings stuck in PENDING, PROCESSING, or SUMMARIZING- // and ensure polling is active if the queue processor isn't running.- const incompleteRecordings = recordings.value.filter(r => ['PENDING', 'PROCESSING', 'SUMMARIZING'].includes(r.status));- if (incompleteRecordings.length > 0 && !isProcessingActive.value) {- console.warn(`Found ${incompleteRecordings.length} incomplete recording(s) on load. Attempting to resume polling if not already queued.`);- for (const recording of incompleteRecordings) {- // Is this item already being tracked in the queue?- let queueItem = uploadQueue.value.find(item => item.recordingId === recording.id);+ // On load, check for any recordings stuck in PENDING, PROCESSING, or SUMMARIZING+ // and ensure polling is active if the queue processor isn't running.+ const incompleteRecordings = recordings.value.filter(r => ['PENDING', 'PROCESSING', 'SUMMARIZING'].includes(r.status));++ if (incompleteRecordings.length > 0 && !isProcessingActive.value) {+ console.warn(`Found ${incompleteRecordings.length} incomplete recording(s) on load. Attempting to resume polling if not already queued.`);+ for (const recording of incompleteRecordings) {+ // Is this item already being tracked in the queue?+ let queueItem = uploadQueue.value.find(item => item.recordingId === recording.id);if (!queueItem) {// If not in queue (likely page reload), create a placeholder to track pollingconsole.log(`Re-attaching poll for recording ${recording.id}.`);@@ -1426,31 +3889,31 @@ python-dotenv==1.0.0// Or just manage polling without adding to queue visually?// Let's add it to the queue for consistency in management.uploadQueue.value.unshift(queueItem);- // Start processing queue if it wasn't active- if (!isProcessingActive.value) {- startProcessingQueue();- } else if (currentlyProcessingFile.value?.recordingId !== recording.id) {- // If processor is active but on a different file, just ensure polling starts- // Note: startProcessingQueue handles finding the next 'queued'. This item- // might not be 'queued'. We need direct polling.- // Let's rethink: The queue processor should handle finding PENDING/PROCESSING items.- // For simplicity, let's just trigger the queue processor. It will find this item if it's next.- // If something else is truly processing, this won't interrupt.- console.log("Triggering queue processor check due to reloaded incomplete item.")- // Ensure it's marked conceptually 'queued' for the processor to pick up- queueItem.status = 'queued';- startProcessingQueue(); // Let the queue logic handle it- }+ // Start processing queue if it wasn't active+ if (!isProcessingActive.value) {+ startProcessingQueue();+ } else if (currentlyProcessingFile.value?.recordingId !== recording.id) {+ // If processor is active but on a different file, just ensure polling starts+ // Note: startProcessingQueue handles finding the next 'queued'. This item+ // might not be 'queued'. We need direct polling.+ // Let's rethink: The queue processor should handle finding PENDING/PROCESSING items.+ // For simplicity, let's just trigger the queue processor. It will find this item if it's next.+ // If something else is truly processing, this won't interrupt.+ console.log("Triggering queue processor check due to reloaded incomplete item.")+ // Ensure it's marked conceptually 'queued' for the processor to pick up+ queueItem.status = 'queued';+ startProcessingQueue(); // Let the queue logic handle it+ }} else if (queueItem.status !== recording.status && !['completed', 'failed'].includes(queueItem.status)) {// If queue status differs from DB, update queue status- console.log(`Correcting queue status for ${queueItem.clientId} from ${queueItem.status} to ${recording.status}`);- queueItem.status = recording.status;- // Restart queue processing if needed- if (!isProcessingActive.value) startProcessingQueue();- }+ console.log(`Correcting queue status for ${queueItem.clientId} from ${queueItem.status} to ${recording.status}`);+ queueItem.status = recording.status;+ // Restart queue processing if needed+ if (!isProcessingActive.value) startProcessingQueue();+ }}- }+ }} catch (error) {console.error('Load Recordings Error:', error);@@ -1538,10 +4001,93 @@ python-dotenv==1.0.0cancelDelete(); // Still close modal on error}};++ // Inline editing methods+ const toggleEditParticipants = () => {+ editingParticipants.value = !editingParticipants.value;+ if (!editingParticipants.value) {+ saveInlineEdit('participants');+ }+ };++ const toggleEditMeetingDate = () => {+ editingMeetingDate.value = !editingMeetingDate.value;+ if (!editingMeetingDate.value) {+ saveInlineEdit('meeting_date');+ }+ };++ const toggleEditSummary = () => {+ editingSummary.value = !editingSummary.value;+ if (!editingSummary.value) {+ saveInlineEdit('summary');+ }+ };++ const toggleEditNotes = () => {+ editingNotes.value = !editingNotes.value;+ if (!editingNotes.value) {+ saveInlineEdit('notes');+ }+ };++ const saveInlineEdit = async (field) => {+ if (!selectedRecording.value) return;++ // Create a payload with just the field being edited+ const payload = {+ id: selectedRecording.value.id,+ [field]: selectedRecording.value[field]+ };++ // For completeness, include all editable fields in the payload+ // This ensures the backend has all the data it needs+ const fullPayload = {+ id: selectedRecording.value.id,+ title: selectedRecording.value.title,+ participants: selectedRecording.value.participants,+ notes: selectedRecording.value.notes,+ summary: selectedRecording.value.summary,+ meeting_date: selectedRecording.value.meeting_date+ };++ try {+ const updatedRecording = await saveMetadata(fullPayload);+ if (updatedRecording) {+ // Update the HTML versions from the response+ if (field === 'notes') {+ selectedRecording.value.notes_html = updatedRecording.notes_html;+ } else if (field === 'summary') {+ selectedRecording.value.summary_html = updatedRecording.summary_html;+ }++ // Reset the editing state for the field+ switch(field) {+ case 'participants':+ editingParticipants.value = false;+ break;+ case 'meeting_date':+ editingMeetingDate.value = false;+ break;+ case 'summary':+ editingSummary.value = false;+ break;+ case 'notes':+ editingNotes.value = false;+ break;+ }+ showToast(`${field.charAt(0).toUpperCase() + field.slice(1).replace('_', ' ')} updated successfully`);+ }+ } catch (error) {+ console.error(`Save ${field} Error:`, error);+ setGlobalError(`Failed to save ${field}: ${error.message}`);+ }+ };// --- Lifecycle Hooks ---onMounted(() => {loadRecordings();+ initializeDarkMode(); // Initialize dark mode on load});// --- Watchers ---@@ -1554,29 +4100,635 @@ python-dotenv==1.0.0}, { deep: true });+ // --- Chat functionality ---+ const showChat = ref(false);+ const chatMessages = ref([]);+ const chatInput = ref('');+ const isChatLoading = ref(false);++ // Create a ref for the chat messages container+ const chatMessagesRef = ref(null);++ const sendChatMessage = async () => {+ if (!chatInput.value.trim() || isChatLoading.value || !selectedRecording.value || selectedRecording.value.status !== 'COMPLETED') {+ return;+ }++ const message = chatInput.value.trim();++ // Ensure chatMessages.value is an array before pushing+ if (!Array.isArray(chatMessages.value)) {+ console.warn('chatMessages.value was not an array! Resetting. Value was:', chatMessages.value);+ chatMessages.value = []; // Reset if corrupted+ }++ chatMessages.value.push({ role: 'user', content: message });+ chatInput.value = '';+ isChatLoading.value = true;++ // Scroll to bottom of chat+ await nextTick();+ // Use the correctly named ref+ if (chatMessagesRef.value) {+ chatMessagesRef.value.scrollTop = chatMessagesRef.value.scrollHeight;+ }++ try {+ // Prepare message history for the API call+ // We need to convert our UI messages to the format expected by the API+ const messageHistory = chatMessages.value+ .slice(0, -1) // Exclude the message we just added (it will be sent separately)+ .map(msg => ({+ role: msg.role,+ content: msg.content+ }));++ const response = await fetch('/chat', {+ method: 'POST',+ headers: { 'Content-Type': 'application/json' },+ body: JSON.stringify({+ recording_id: selectedRecording.value.id,+ message: message,+ message_history: messageHistory+ })+ });++ const data = await response.json();+ if (!response.ok) throw new Error(data.error || 'Failed to get chat response');++ chatMessages.value.push({+ role: 'assistant',+ content: data.response,+ html: data.response_html+ });+ } catch (error) {+ console.error('Chat Error:', error);+ setGlobalError(`Chat error: ${error.message}`);+ chatMessages.value.push({ role: 'assistant', content: `Error: ${error.message}` });+ } finally {+ isChatLoading.value = false;+ // Scroll to bottom of chat+ await nextTick();+ // Use the correctly named ref+ if (chatMessagesRef.value) {+ chatMessagesRef.value.scrollTop = chatMessagesRef.value.scrollHeight;+ }+ }+ };++ // Toast notification system+ const showToast = (message, icon = 'fa-check-circle', duration = 2000) => {+ const toastContainer = document.getElementById('toastContainer');++ // Create toast element+ const toast = document.createElement('div');+ toast.className = 'toast';+ toast.innerHTML = `<i class="fas ${icon}"></i> ${message}`;++ // Add to container+ toastContainer.appendChild(toast);++ // Trigger animation+ setTimeout(() => {+ toast.classList.add('show');+ }, 10);++ // Remove after duration+ setTimeout(() => {+ toast.classList.remove('show');+ setTimeout(() => {+ toastContainer.removeChild(toast);+ }, 300);+ }, duration);+ };++ // Add animation to copy button+ const animateCopyButton = (button) => {+ button.classList.add('copy-success');++ // Store original content+ const originalContent = button.innerHTML;+ button.innerHTML = '<i class="fas fa-check"></i>';++ setTimeout(() => {+ button.classList.remove('copy-success');+ button.innerHTML = originalContent;+ }, 1500);+ };++ const copyMessage = (text, event) => {+ // Get the button that was clicked+ const button = event.currentTarget;++ if (navigator.clipboard && window.isSecureContext) {+ // Use clipboard API if available (secure context)+ navigator.clipboard.writeText(text)+ .then(() => {+ showToast('Copied to clipboard!');+ animateCopyButton(button);+ })+ .catch(err => {+ console.error('Copy failed:', err);+ showToast('Failed to copy: ' + err.message, 'fa-exclamation-circle');+ fallbackCopyTextToClipboard(text, button);+ });+ } else {+ // Fallback for non-secure contexts+ fallbackCopyTextToClipboard(text, button);+ }+ };++ // Fallback method using document.execCommand+ const fallbackCopyTextToClipboard = (text, button = null) => {+ try {+ const textArea = document.createElement("textarea");+ textArea.value = text;++ // Make the textarea out of viewport+ textArea.style.position = "fixed";+ textArea.style.left = "-999999px";+ textArea.style.top = "-999999px";+ document.body.appendChild(textArea);++ // Select and copy+ textArea.focus();+ textArea.select();+ const successful = document.execCommand('copy');++ // Clean up+ document.body.removeChild(textArea);++ if (successful) {+ showToast('Copied to clipboard!');+ if (button) animateCopyButton(button);+ } else {+ showToast('Copy failed. Your browser may not support this feature.', 'fa-exclamation-circle');+ }+ } catch (err) {+ console.error('Fallback copy failed:', err);+ showToast('Unable to copy: ' + err.message, 'fa-exclamation-circle');+ }+ };++ const copyTranscription = (event) => {+ if (!selectedRecording.value || !selectedRecording.value.transcription) {+ showToast('No transcription available to copy.', 'fa-exclamation-circle');+ return;+ }++ // Get the button that was clicked+ const button = event.currentTarget;++ // Show visual feedback on button+ animateCopyButton(button);++ if (navigator.clipboard && window.isSecureContext) {+ // Use clipboard API if available (secure context)+ navigator.clipboard.writeText(selectedRecording.value.transcription)+ .then(() => {+ showToast('Transcription copied to clipboard!');+ })+ .catch(err => {+ console.error('Copy failed:', err);+ showToast('Failed to copy: ' + err.message, 'fa-exclamation-circle');+ fallbackCopyTextToClipboard(selectedRecording.value.transcription);+ });+ } else {+ // Fallback for non-secure contexts+ fallbackCopyTextToClipboard(selectedRecording.value.transcription);+ }+ };++ // Clear chat messages when recording changes+ watch(selectedRecording, (newVal) => {+ chatMessages.value = [];+ showChat.value = false;+ selectedTab.value = 'summary'; // Reset tab when recording changes+ });+return {// StatecurrentView, dragover, recordings, selectedRecording, // currentRecording removedshowEditModal, showDeleteModal, editingRecording, recordingToDelete,- isLoadingRecordings, globalError, maxFileSizeMB,+ isLoadingRecordings, globalError, maxFileSizeMB, isDarkMode, // <-- Added isDarkMode// Multi-upload StateuploadQueue, currentlyProcessingFile, processingProgress, processingMessage,isProcessingActive, progressPopupMinimized,+ // Chat State+ showChat, chatMessages, chatInput, isChatLoading, chatMessagesRef, // <-- Added chatMessagesRef// ComputedgroupedRecordings, totalInQueue, completedInQueue, queuedFiles, finishedFilesInQueue,+ // Inline editing state+ editingParticipants, editingMeetingDate, editingSummary, editingNotes,// Methods- handleDrop, handleFileSelect, /*autoSave removed*/ loadRecordings,+ handleDrop, handleFileSelect, /*autoSave removed*/ loadRecordings, selectedTab, // <-- Added selectedTabselectRecording, editRecording, cancelEdit, saveEdit, confirmDelete,cancelDelete, deleteRecording, switchToUploadView, switchToGalleryView,formatFileSize, setGlobalError, handleDragLeave, formatStatus, getStatusClass,+ formatDisplayDate, // <-- ADDED: Expose date formatting function+ toggleDarkMode, // <-- Added toggleDarkMode+ toggleSidebar, isSidebarCollapsed, // <-- Added sidebar state and function+ // Inline editing methods+ toggleEditParticipants, toggleEditMeetingDate, toggleEditSummary, toggleEditNotes, saveInlineEdit,+ // Chat Methods+ sendChatMessage, copyMessage, copyTranscription,+ // User menu+ isUserMenuOpen,}},delimiters: ['${', '}'] // Keep Vue delimiters distinct from Flask's Jinja}).mount('#app');</script>+{% endraw %}+</body>+</html>++```+++## templates/register.html++```html++<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="UTF-8">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title>{{ title }} - Speakr</title>+ <script src="https://cdn.tailwindcss.com"></script>+ <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">+ <style>+ /* Dark Mode CSS Variables */+ :root {+ /* Light mode variables */+ --bg-primary: #f3f4f6; /* gray-100 */+ --bg-secondary: #ffffff; /* white */+ --bg-tertiary: #f9fafb; /* gray-50 */+ --bg-accent: #dbeafe; /* blue-100 */+ --bg-accent-hover: #bfdbfe; /* blue-200 */+ --bg-button: #2563eb; /* blue-600 */+ --bg-button-hover: #1d4ed8; /* blue-700 */+ --bg-danger: #dc2626; /* red-600 */+ --bg-danger-hover: #b91c1c; /* red-700 */+ --bg-danger-light: #fee2e2; /* red-100 */+ --bg-info-light: #dbeafe; /* blue-100 */+ --bg-warn-light: #fef3c7; /* amber-100 */+ --bg-success-light: #d1fae5; /* green-100 */+ --bg-pending-light: #f5f5f4; /* stone-100 */+ --bg-input: #ffffff; /* white */++ --text-primary: #1f2937; /* gray-800 */+ --text-secondary: #374151; /* gray-700 */+ --text-muted: #6b7280; /* gray-500 */+ --text-light: #9ca3af; /* gray-400 */+ --text-accent: #1d4ed8; /* blue-700 */+ --text-button: #ffffff; /* white */+ --text-danger: #b91c1c; /* red-700 */+ --text-danger-strong: #991b1b; /* red-800 */+ --text-info-strong: #1e40af; /* blue-800 */+ --text-warn-strong: #92400e; /* amber-800 */+ --text-success-strong: #065f46; /* green-800 */+ --text-pending-strong: #44403c; /* stone-700 */++ --border-primary: #e5e7eb; /* gray-200 */+ --border-secondary: #d1d5db; /* gray-300 */+ --border-accent: #93c5fd; /* blue-300 */+ --border-danger: #f87171; /* red-400 */+ --border-focus: #3b82f6; /* blue-500 */+ --ring-focus: #bfdbfe; /* blue-200 */+ }++ .dark {+ /* Dark mode variables */+ --bg-primary: #111827; /* gray-900 */+ --bg-secondary: #1f2937; /* gray-800 */+ --bg-tertiary: #374151; /* gray-700 */+ --bg-accent: #1e3a8a; /* blue-900 */+ --bg-accent-hover: #1e40af; /* blue-800 */+ --bg-button: #2563eb; /* blue-600 */+ --bg-button-hover: #3b82f6; /* blue-500 */+ --bg-danger: #dc2626; /* red-600 */+ --bg-danger-hover: #ef4444; /* red-500 */+ --bg-danger-light: #7f1d1d; /* red-900 */+ --bg-info-light: #1e3a8a; /* blue-900 */+ --bg-warn-light: #78350f; /* amber-900 */+ --bg-success-light: #064e3b; /* green-900 */+ --bg-pending-light: #292524; /* stone-800 */+ --bg-input: #374151; /* gray-700 */++ --text-primary: #f3f4f6; /* gray-100 */+ --text-secondary: #d1d5db; /* gray-300 */+ --text-muted: #9ca3af; /* gray-400 */+ --text-light: #6b7280; /* gray-500 */+ --text-accent: #60a5fa; /* blue-400 */+ --text-button: #ffffff; /* white */+ --text-danger: #f87171; /* red-400 */+ --text-danger-strong: #fca5a5; /* red-300 */+ --text-info-strong: #93c5fd; /* blue-300 */+ --text-warn-strong: #fcd34d; /* amber-300 */+ --text-success-strong: #6ee7b7; /* green-300 */+ --text-pending-strong: #d6d3d1; /* stone-300 */++ --border-primary: #374151; /* gray-700 */+ --border-secondary: #4b5563; /* gray-600 */+ --border-accent: #1d4ed8; /* blue-700 */+ --border-danger: #ef4444; /* red-500 */+ --border-focus: #3b82f6; /* blue-500 */+ --ring-focus: #1e40af; /* blue-800 */+ }++ html {+ background-color: var(--bg-primary);+ color: var(--text-primary);+ transition: background-color 0.3s, color 0.3s;+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;+ }+ html, body { height: 100%; margin: 0; }+ </style>+</head>+<body class="bg-[var(--bg-primary)] text-[var(--text-primary)]">+ <div class="container mx-auto px-4 sm:px-6 lg:px-8 py-6 flex flex-col min-h-screen">+ <header class="flex justify-between items-center mb-6 pb-4 border-b border-[var(--border-primary)]">+ <h1 class="text-3xl font-bold text-[var(--text-primary)]">+ <a href="{{ url_for('index') }}">Speakr</a>+ </h1>+ </header>++ <main class="flex-grow flex items-center justify-center">+ <div class="w-full max-w-md bg-[var(--bg-secondary)] p-8 rounded-xl shadow-lg border border-[var(--border-primary)]">+ <h2 class="text-2xl font-semibold text-[var(--text-primary)] mb-6 text-center">Create an Account</h2>++ {% with messages = get_flashed_messages(with_categories=true) %}+ {% if messages %}+ {% for category, message in messages %}+ <div class="mb-4 p-3 rounded-lg {% if category == 'success' %}bg-[var(--bg-success-light)] text-[var(--text-success-strong)]{% elif category == 'danger' %}bg-[var(--bg-danger-light)] text-[var(--text-danger-strong)]{% else %}bg-[var(--bg-info-light)] text-[var(--text-info-strong)]{% endif %}">+ {{ message }}+ </div>+ {% endfor %}+ {% endif %}+ {% endwith %}++ <form method="POST" action="{{ url_for('register') }}">+ {{ form.hidden_tag() }}++ <div class="mb-4">+ {{ form.username.label(class="block text-sm font-medium text-[var(--text-secondary)] mb-1") }}+ {% if form.username.errors %}+ {{ form.username(class="mt-1 block w-full rounded-md border-[var(--border-danger)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]") }}+ <div class="text-[var(--text-danger)] text-xs mt-1">+ {% for error in form.username.errors %}+ <span>{{ error }}</span>+ {% endfor %}+ </div>+ {% else %}+ {{ form.username(class="mt-1 block w-full rounded-md border-[var(--border-secondary)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]") }}+ {% endif %}+ </div>++ <div class="mb-4">+ {{ form.email.label(class="block text-sm font-medium text-[var(--text-secondary)] mb-1") }}+ {% if form.email.errors %}+ {{ form.email(class="mt-1 block w-full rounded-md border-[var(--border-danger)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]") }}+ <div class="text-[var(--text-danger)] text-xs mt-1">+ {% for error in form.email.errors %}+ <span>{{ error }}</span>+ {% endfor %}+ </div>+ {% else %}+ {{ form.email(class="mt-1 block w-full rounded-md border-[var(--border-secondary)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]") }}+ {% endif %}+ </div>++ <div class="mb-4">+ {{ form.password.label(class="block text-sm font-medium text-[var(--text-secondary)] mb-1") }}+ {% if form.password.errors %}+ {{ form.password(class="mt-1 block w-full rounded-md border-[var(--border-danger)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]") }}+ <div class="text-[var(--text-danger)] text-xs mt-1">+ {% for error in form.password.errors %}+ <span>{{ error }}</span>+ {% endfor %}+ </div>+ {% else %}+ {{ form.password(class="mt-1 block w-full rounded-md border-[var(--border-secondary)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]") }}+ {% endif %}+ <p class="text-xs text-[var(--text-muted)] mt-1">Password must be at least 8 characters long.</p>+ </div>++ <div class="mb-6">+ {{ form.confirm_password.label(class="block text-sm font-medium text-[var(--text-secondary)] mb-1") }}+ {% if form.confirm_password.errors %}+ {{ form.confirm_password(class="mt-1 block w-full rounded-md border-[var(--border-danger)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]") }}+ <div class="text-[var(--text-danger)] text-xs mt-1">+ {% for error in form.confirm_password.errors %}+ <span>{{ error }}</span>+ {% endfor %}+ </div>+ {% else %}+ {{ form.confirm_password(class="mt-1 block w-full rounded-md border-[var(--border-secondary)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]") }}+ {% endif %}+ </div>++ <div class="flex flex-col space-y-4">+ {{ form.submit(class="w-full py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-[var(--text-button)] bg-[var(--bg-button)] hover:bg-[var(--bg-button-hover)] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[var(--border-focus)]") }}++ <div class="text-center text-sm text-[var(--text-muted)]">+ <span>Already have an account?</span>+ <a href="{{ url_for('login') }}" class="font-medium text-[var(--text-accent)] hover:underline">Login here</a>+ </div>+ </div>+ </form>+ </div>+ </main>++ <footer class="text-center py-4 mt-8 text-xs text-[var(--text-light)] border-t border-[var(--border-primary)]">+ Speakr © {{ now.year }}+ </footer>+ </div>+</body>+</html>++```+++## templates/login.html++```html++<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="UTF-8">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title>{{ title }} - Speakr</title>+ <script src="https://cdn.tailwindcss.com"></script>+ <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">+ <style>+ /* Dark Mode CSS Variables */+ :root {+ /* Light mode variables */+ --bg-primary: #f3f4f6; /* gray-100 */+ --bg-secondary: #ffffff; /* white */+ --bg-tertiary: #f9fafb; /* gray-50 */+ --bg-accent: #dbeafe; /* blue-100 */+ --bg-accent-hover: #bfdbfe; /* blue-200 */+ --bg-button: #2563eb; /* blue-600 */+ --bg-button-hover: #1d4ed8; /* blue-700 */+ --bg-danger: #dc2626; /* red-600 */+ --bg-danger-hover: #b91c1c; /* red-700 */+ --bg-danger-light: #fee2e2; /* red-100 */+ --bg-info-light: #dbeafe; /* blue-100 */+ --bg-warn-light: #fef3c7; /* amber-100 */+ --bg-success-light: #d1fae5; /* green-100 */+ --bg-pending-light: #f5f5f4; /* stone-100 */+ --bg-input: #ffffff; /* white */++ --text-primary: #1f2937; /* gray-800 */+ --text-secondary: #374151; /* gray-700 */+ --text-muted: #6b7280; /* gray-500 */+ --text-light: #9ca3af; /* gray-400 */+ --text-accent: #1d4ed8; /* blue-700 */+ --text-button: #ffffff; /* white */+ --text-danger: #b91c1c; /* red-700 */+ --text-danger-strong: #991b1b; /* red-800 */+ --text-info-strong: #1e40af; /* blue-800 */+ --text-warn-strong: #92400e; /* amber-800 */+ --text-success-strong: #065f46; /* green-800 */+ --text-pending-strong: #44403c; /* stone-700 */++ --border-primary: #e5e7eb; /* gray-200 */+ --border-secondary: #d1d5db; /* gray-300 */+ --border-accent: #93c5fd; /* blue-300 */+ --border-danger: #f87171; /* red-400 */+ --border-focus: #3b82f6; /* blue-500 */+ --ring-focus: #bfdbfe; /* blue-200 */+ }++ .dark {+ /* Dark mode variables */+ --bg-primary: #111827; /* gray-900 */+ --bg-secondary: #1f2937; /* gray-800 */+ --bg-tertiary: #374151; /* gray-700 */+ --bg-accent: #1e3a8a; /* blue-900 */+ --bg-accent-hover: #1e40af; /* blue-800 */+ --bg-button: #2563eb; /* blue-600 */+ --bg-button-hover: #3b82f6; /* blue-500 */+ --bg-danger: #dc2626; /* red-600 */+ --bg-danger-hover: #ef4444; /* red-500 */+ --bg-danger-light: #7f1d1d; /* red-900 */+ --bg-info-light: #1e3a8a; /* blue-900 */+ --bg-warn-light: #78350f; /* amber-900 */+ --bg-success-light: #064e3b; /* green-900 */+ --bg-pending-light: #292524; /* stone-800 */+ --bg-input: #374151; /* gray-700 */++ --text-primary: #f3f4f6; /* gray-100 */+ --text-secondary: #d1d5db; /* gray-300 */+ --text-muted: #9ca3af; /* gray-400 */+ --text-light: #6b7280; /* gray-500 */+ --text-accent: #60a5fa; /* blue-400 */+ --text-button: #ffffff; /* white */+ --text-danger: #f87171; /* red-400 */+ --text-danger-strong: #fca5a5; /* red-300 */+ --text-info-strong: #93c5fd; /* blue-300 */+ --text-warn-strong: #fcd34d; /* amber-300 */+ --text-success-strong: #6ee7b7; /* green-300 */+ --text-pending-strong: #d6d3d1; /* stone-300 */++ --border-primary: #374151; /* gray-700 */+ --border-secondary: #4b5563; /* gray-600 */+ --border-accent: #1d4ed8; /* blue-700 */+ --border-danger: #ef4444; /* red-500 */+ --border-focus: #3b82f6; /* blue-500 */+ --ring-focus: #1e40af; /* blue-800 */+ }++ html {+ background-color: var(--bg-primary);+ color: var(--text-primary);+ transition: background-color 0.3s, color 0.3s;+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;+ }+ html, body { height: 100%; margin: 0; }+ </style>+</head>+<body class="bg-[var(--bg-primary)] text-[var(--text-primary)]">+ <div class="container mx-auto px-4 sm:px-6 lg:px-8 py-6 flex flex-col min-h-screen">+ <header class="flex justify-between items-center mb-6 pb-4 border-b border-[var(--border-primary)]">+ <h1 class="text-3xl font-bold text-[var(--text-primary)]">+ <a href="{{ url_for('index') }}">Speakr</a>+ </h1>+ </header>++ <main class="flex-grow flex items-center justify-center">+ <div class="w-full max-w-md bg-[var(--bg-secondary)] p-8 rounded-xl shadow-lg border border-[var(--border-primary)]">+ <h2 class="text-2xl font-semibold text-[var(--text-primary)] mb-6 text-center">Login</h2>++ {% with messages = get_flashed_messages(with_categories=true) %}+ {% if messages %}+ {% for category, message in messages %}+ <div class="mb-4 p-3 rounded-lg {% if category == 'success' %}bg-[var(--bg-success-light)] text-[var(--text-success-strong)]{% elif category == 'danger' %}bg-[var(--bg-danger-light)] text-[var(--text-danger-strong)]{% else %}bg-[var(--bg-info-light)] text-[var(--text-info-strong)]{% endif %}">+ {{ message }}+ </div>+ {% endfor %}+ {% endif %}+ {% endwith %}++ <form method="POST" action="{{ url_for('login') }}">+ {{ form.hidden_tag() }}++ <div class="mb-4">+ {{ form.email.label(class="block text-sm font-medium text-[var(--text-secondary)] mb-1") }}+ {% if form.email.errors %}+ {{ form.email(class="mt-1 block w-full rounded-md border-[var(--border-danger)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]") }}+ <div class="text-[var(--text-danger)] text-xs mt-1">+ {% for error in form.email.errors %}+ <span>{{ error }}</span>+ {% endfor %}+ </div>+ {% else %}+ {{ form.email(class="mt-1 block w-full rounded-md border-[var(--border-secondary)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]") }}+ {% endif %}+ </div>++ <div class="mb-6">+ {{ form.password.label(class="block text-sm font-medium text-[var(--text-secondary)] mb-1") }}+ {% if form.password.errors %}+ {{ form.password(class="mt-1 block w-full rounded-md border-[var(--border-danger)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]") }}+ <div class="text-[var(--text-danger)] text-xs mt-1">+ {% for error in form.password.errors %}+ <span>{{ error }}</span>+ {% endfor %}+ </div>+ {% else %}+ {{ form.password(class="mt-1 block w-full rounded-md border-[var(--border-secondary)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]") }}+ {% endif %}+ </div>++ <div class="flex items-center mb-6">+ {{ form.remember(class="h-4 w-4 text-[var(--text-accent)] focus:ring-[var(--ring-focus)] border-[var(--border-secondary)] rounded") }}+ {{ form.remember.label(class="ml-2 block text-sm text-[var(--text-secondary)]") }}+ </div>++ <div class="flex flex-col space-y-4">+ {{ form.submit(class="w-full py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-[var(--text-button)] bg-[var(--bg-button)] hover:bg-[var(--bg-button-hover)] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[var(--border-focus)]") }}++ <div class="text-center text-sm text-[var(--text-muted)]">+ <span>Don't have an account?</span>+ <a href="{{ url_for('register') }}" class="font-medium text-[var(--text-accent)] hover:underline">Register here</a>+ </div>+ </div>+ </form>+ </div>+ </main>+ <footer class="text-center py-4 mt-8 text-xs text-[var(--text-light)] border-t border-[var(--border-primary)]">+ Speakr © {{ now.year }}+ </footer>+ </div></body></html>+```@@ -1595,6 +4747,15 @@ cp app.py /opt/transcription-app/cp -r templates /opt/transcription-app/cp requirements.txt /opt/transcription-app/cp reset_db.py /opt/transcription-app/+cp migrate_db.py /opt/transcription-app/+cp create_admin.py /opt/transcription-app/+cp .env /opt/transcription-app/ # Copy the .env file with API keys++# Add SECRET_KEY to .env file if it doesn't exist+if ! grep -q "SECRET_KEY" /opt/transcription-app/.env; then+ echo "SECRET_KEY=$(openssl rand -hex 32)" >> /opt/transcription-app/.env+ echo "Added SECRET_KEY to .env file"+fi# Create and activate virtual environmentpython3 -m venv /opt/transcription-app/venv@@ -1610,8 +4771,16 @@ mkdir -p /opt/transcription-app/instancechmod 755 /opt/transcription-app/uploadschmod 755 /opt/transcription-app/instance-# Initialize the database-python reset_db.py+# Initialize or migrate the database+if [ ! -f /opt/transcription-app/instance/transcriptions.db ]; then+ # If database doesn't exist, create it from scratch+ echo "Database doesn't exist. Creating new database..."+ python reset_db.py+else+ # If database exists, migrate it to preserve data+ echo "Database exists. Migrating schema to preserve data..."+ python migrate_db.py+fi# Set proper ownership for all filessudo chown -R $USER:$USER /opt/transcription-app@@ -1647,4 +4816,14 @@ sleep 3sudo systemctl status transcriptionecho "Installation complete! The application should be running on port 8899."++# Ask if user wants to create an admin user+read -p "Do you want to create an admin user now? (y/n): " create_admin+if [[ $create_admin == "y" || $create_admin == "Y" ]]; then+ echo "Creating admin user..."+ python create_admin.py+else+ echo "You can create an admin user later by running: python create_admin.py"+fi+```diff --git a/templates/account.html b/templates/account.htmlindex 3da9d98f..91479cc1 100644--- a/templates/account.html+++ b/templates/account.html@@ -167,6 +167,9 @@<a href="{{ url_for('index') }}" class="inline-flex items-center px-4 py-2 bg-[var(--bg-button)] text-[var(--text-button)] rounded-md hover:bg-[var(--bg-button-hover)] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[var(--border-focus)] transition-colors duration-200"><i class="fas fa-microphone mr-2"></i> Go to Recordings</a>+ <button id="changePasswordBtn" class="inline-flex items-center px-4 py-2 border border-[var(--border-secondary)] text-[var(--text-secondary)] rounded-md hover:bg-[var(--bg-tertiary)] hover:text-[var(--text-accent)] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[var(--border-focus)] transition-colors duration-200">+ <i class="fas fa-key mr-2"></i> Change Password+ </button></div></div></div>@@ -215,6 +218,35 @@</footer></div>+ <!-- Change Password Modal -->+ <div id="changePasswordModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">+ <div class="bg-[var(--bg-secondary)] p-6 rounded-lg shadow-xl w-full max-w-md">+ <div class="flex justify-between items-center mb-4">+ <h3 class="text-xl font-semibold text-[var(--text-primary)]">Change Password</h3>+ <button id="closeModalBtn" class="text-[var(--text-light)] hover:text-[var(--text-muted)] text-2xl leading-none">×</button>+ </div>+ <form id="changePasswordForm" method="POST" action="{{ url_for('change_password') }}">+ <div class="mb-4">+ <label for="current_password" class="block text-sm font-medium text-[var(--text-secondary)] mb-1">Current Password</label>+ <input type="password" id="current_password" name="current_password" required class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">+ </div>+ <div class="mb-4">+ <label for="new_password" class="block text-sm font-medium text-[var(--text-secondary)] mb-1">New Password</label>+ <input type="password" id="new_password" name="new_password" required minlength="8" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">+ <p class="text-xs text-[var(--text-muted)] mt-1">Password must be at least 8 characters long</p>+ </div>+ <div class="mb-6">+ <label for="confirm_password" class="block text-sm font-medium text-[var(--text-secondary)] mb-1">Confirm New Password</label>+ <input type="password" id="confirm_password" name="confirm_password" required class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]">+ </div>+ <div class="flex justify-end space-x-3">+ <button type="button" id="cancelBtn" class="px-4 py-2 bg-[var(--bg-tertiary)] text-[var(--text-secondary)] rounded-md hover:bg-[var(--border-secondary)]">Cancel</button>+ <button type="submit" class="px-4 py-2 bg-[var(--bg-button)] text-[var(--text-button)] rounded-md hover:bg-[var(--bg-button-hover)]">Change Password</button>+ </div>+ </form>+ </div>+ </div>+<script>// Dark mode toggle functionalityconst darkModeToggle = document.getElementById('darkModeToggle');@@ -267,6 +299,45 @@// Initialize dark mode on page loadinitializeDarkMode();++ // Change Password Modal functionality+ const changePasswordBtn = document.getElementById('changePasswordBtn');+ const changePasswordModal = document.getElementById('changePasswordModal');+ const closeModalBtn = document.getElementById('closeModalBtn');+ const cancelBtn = document.getElementById('cancelBtn');+ const changePasswordForm = document.getElementById('changePasswordForm');+ const newPasswordInput = document.getElementById('new_password');+ const confirmPasswordInput = document.getElementById('confirm_password');++ // Open modal+ changePasswordBtn.addEventListener('click', () => {+ changePasswordModal.classList.remove('hidden');+ // Reset form+ changePasswordForm.reset();+ });++ // Close modal functions+ function closeModal() {+ changePasswordModal.classList.add('hidden');+ }++ closeModalBtn.addEventListener('click', closeModal);+ cancelBtn.addEventListener('click', closeModal);++ // Close modal when clicking outside+ changePasswordModal.addEventListener('click', (event) => {+ if (event.target === changePasswordModal) {+ closeModal();+ }+ });++ // Form validation+ changePasswordForm.addEventListener('submit', (event) => {+ if (newPasswordInput.value !== confirmPasswordInput.value) {+ event.preventDefault();+ alert('New password and confirmation do not match.');+ }+ });</script></body></html>diff --git a/templates/index.html b/templates/index.htmlindex 599c8443..49dadf75 100644--- a/templates/index.html+++ b/templates/index.html@@ -382,13 +382,13 @@<i class="fas fa-images mr-1"></i> Gallery</button><!-- User dropdown menu -->- <div class="relative ml-2" @click.away="isUserMenuOpen = false">+ <div class="relative ml-2"><button @click="isUserMenuOpen = !isUserMenuOpen" class="flex items-center px-3 py-2 border border-[var(--border-secondary)] rounded-lg text-[var(--text-secondary)] hover:text-[var(--text-accent)] focus:outline-none"><i class="fas fa-user mr-2"></i><span>{{ current_user.username }}</span><i class="fas fa-chevron-down ml-2"></i></button>- <div v-show="isUserMenuOpen" class="absolute right-0 mt-2 w-48 bg-[var(--bg-secondary)] border border-[var(--border-primary)] rounded-lg shadow-lg z-10">+ <div v-if="isUserMenuOpen" class="absolute right-0 mt-2 w-48 bg-[var(--bg-secondary)] border border-[var(--border-primary)] rounded-lg shadow-lg z-10"><a href="{{ url_for('account') }}" class="block px-4 py-2 text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] hover:text-[var(--text-accent)]"><i class="fas fa-user-circle mr-2"></i> Account</a>@@ -856,6 +856,7 @@<!-- Toast container for notifications --><div class="toast-container" id="toastContainer"></div>+ {% raw %}<script>const { createApp, ref, reactive, computed, onMounted, watch, nextTick } = Vue@@ -1332,7 +1333,7 @@};const loadRecordings = async () => {- globalError.value = null;+ globalError.value = null;isLoadingRecordings.value = true;try {const response = await fetch('/recordings');@@ -1340,15 +1341,16 @@if (!response.ok) throw new Error(data.error || 'Failed to load recordings');recordings.value = data;- // On load, check for any recordings stuck in PENDING, PROCESSING, or SUMMARIZING- // and ensure polling is active if the queue processor isn't running.- const incompleteRecordings = recordings.value.filter(r => ['PENDING', 'PROCESSING', 'SUMMARIZING'].includes(r.status));- if (incompleteRecordings.length > 0 && !isProcessingActive.value) {- console.warn(`Found ${incompleteRecordings.length} incomplete recording(s) on load. Attempting to resume polling if not already queued.`);- for (const recording of incompleteRecordings) {- // Is this item already being tracked in the queue?- let queueItem = uploadQueue.value.find(item => item.recordingId === recording.id);+ // On load, check for any recordings stuck in PENDING, PROCESSING, or SUMMARIZING+ // and ensure polling is active if the queue processor isn't running.+ const incompleteRecordings = recordings.value.filter(r => ['PENDING', 'PROCESSING', 'SUMMARIZING'].includes(r.status));++ if (incompleteRecordings.length > 0 && !isProcessingActive.value) {+ console.warn(`Found ${incompleteRecordings.length} incomplete recording(s) on load. Attempting to resume polling if not already queued.`);+ for (const recording of incompleteRecordings) {+ // Is this item already being tracked in the queue?+ let queueItem = uploadQueue.value.find(item => item.recordingId === recording.id);if (!queueItem) {// If not in queue (likely page reload), create a placeholder to track pollingconsole.log(`Re-attaching poll for recording ${recording.id}.`);@@ -1364,31 +1366,31 @@// Or just manage polling without adding to queue visually?// Let's add it to the queue for consistency in management.uploadQueue.value.unshift(queueItem);- // Start processing queue if it wasn't active- if (!isProcessingActive.value) {- startProcessingQueue();- } else if (currentlyProcessingFile.value?.recordingId !== recording.id) {- // If processor is active but on a different file, just ensure polling starts- // Note: startProcessingQueue handles finding the next 'queued'. This item- // might not be 'queued'. We need direct polling.- // Let's rethink: The queue processor should handle finding PENDING/PROCESSING items.- // For simplicity, let's just trigger the queue processor. It will find this item if it's next.- // If something else is truly processing, this won't interrupt.- console.log("Triggering queue processor check due to reloaded incomplete item.")- // Ensure it's marked conceptually 'queued' for the processor to pick up- queueItem.status = 'queued';- startProcessingQueue(); // Let the queue logic handle it- }+ // Start processing queue if it wasn't active+ if (!isProcessingActive.value) {+ startProcessingQueue();+ } else if (currentlyProcessingFile.value?.recordingId !== recording.id) {+ // If processor is active but on a different file, just ensure polling starts+ // Note: startProcessingQueue handles finding the next 'queued'. This item+ // might not be 'queued'. We need direct polling.+ // Let's rethink: The queue processor should handle finding PENDING/PROCESSING items.+ // For simplicity, let's just trigger the queue processor. It will find this item if it's next.+ // If something else is truly processing, this won't interrupt.+ console.log("Triggering queue processor check due to reloaded incomplete item.")+ // Ensure it's marked conceptually 'queued' for the processor to pick up+ queueItem.status = 'queued';+ startProcessingQueue(); // Let the queue logic handle it+ }} else if (queueItem.status !== recording.status && !['completed', 'failed'].includes(queueItem.status)) {// If queue status differs from DB, update queue status- console.log(`Correcting queue status for ${queueItem.clientId} from ${queueItem.status} to ${recording.status}`);- queueItem.status = recording.status;- // Restart queue processing if needed- if (!isProcessingActive.value) startProcessingQueue();- }+ console.log(`Correcting queue status for ${queueItem.clientId} from ${queueItem.status} to ${recording.status}`);+ queueItem.status = recording.status;+ // Restart queue processing if needed+ if (!isProcessingActive.value) startProcessingQueue();+ }}- }+ }} catch (error) {console.error('Load Recordings Error:', error);@@ -1814,6 +1816,6 @@delimiters: ['${', '}'] // Keep Vue delimiters distinct from Flask's Jinja}).mount('#app');</script>-+{% endraw %}</body></html>