Files
profilarr/backend/app/__init__.py
Sam Chau ca84a1c95b feature: merge conflict detection and resolution (#6)
- pulls now correctly identify merge conflicts and enter a merge state
- user resolves each file individually
- commit resolve merge state
- allows users to keep custom changes and pull in updates
- improve commit message component
- seperated commit / add functionality
2025-02-05 16:09:58 +10:30

44 lines
1.3 KiB
Python

import os
from flask import Flask, jsonify
from flask_cors import CORS
from .regex import bp as regex_bp
from .format import bp as format_bp
from .profile import bp as profile_bp
from .git import bp as git_bp
from .settings_utils import create_empty_settings_if_not_exists, load_settings
REGEX_DIR = os.path.join('data', 'db', 'regex_patterns')
FORMAT_DIR = os.path.join('data', 'db', 'custom_formats')
PROFILE_DIR = os.path.join('data', 'db', 'profiles')
DATA_DIR = '/app/data'
def create_app():
app = Flask(__name__)
CORS(app, resources={r"/*": {"origins": "*"}})
# Initialize directories and create empty settings file if it doesn't exist
initialize_directories()
create_empty_settings_if_not_exists()
# Register Blueprints
app.register_blueprint(regex_bp)
app.register_blueprint(format_bp)
app.register_blueprint(profile_bp)
app.register_blueprint(git_bp)
# Add settings route
@app.route('/settings', methods=['GET'])
def handle_settings():
settings = load_settings()
return jsonify(settings), 200
return app
def initialize_directories():
os.makedirs(REGEX_DIR, exist_ok=True)
os.makedirs(FORMAT_DIR, exist_ok=True)
os.makedirs(PROFILE_DIR, exist_ok=True)
os.makedirs(DATA_DIR, exist_ok=True)