Skip to content

Speakr is a personal, self-hosted web application designed for transcribing audio recordings

Python
1.6 KB
Raw Blame
"""
Utility functions package for the Speakr application.

This package contains various utility modules for:
- JSON parsing and handling
- Markdown to HTML conversion
- Datetime formatting and timezone handling
- Security utilities
"""

from .json_parser import (
    auto_close_json,
    safe_json_loads,
    preprocess_json_escapes,
    extract_json_object
)

from .markdown import (
    md_to_html,
    sanitize_html
)

from .security import (
    password_check,
    is_safe_url
)

from .database import (
    add_column_if_not_exists,
    migrate_column_type,
    create_index_if_not_exists,
    drop_not_null,
    migration_lock,
    run_once
)

from .token_auth import (
    extract_token_from_request,
    hash_token,
    load_user_from_token,
    load_user_from_token_headers_only,
)

from .error_formatting import (
    is_transcription_error,
    format_error_for_user,
    format_error_for_storage,
    parse_stored_error
)

__all__ = [
    # JSON parsing
    'auto_close_json',
    'safe_json_loads',
    'preprocess_json_escapes',
    'extract_json_object',
    # Markdown/HTML
    'md_to_html',
    'sanitize_html',
    # Security
    'password_check',
    'is_safe_url',
    # Database
    'add_column_if_not_exists',
    'migrate_column_type',
    'create_index_if_not_exists',
    'drop_not_null',
    'migration_lock',
    'run_once',
    # Token authentication
    'extract_token_from_request',
    'hash_token',
    'load_user_from_token',
    'load_user_from_token_headers_only',
    # Error formatting
    'is_transcription_error',
    'format_error_for_user',
    'format_error_for_storage',
    'parse_stored_error',
]