generated from dellevin/template
22
This commit is contained in:
@@ -5,16 +5,17 @@
|
||||
"""
|
||||
import sys
|
||||
import os
|
||||
import json
|
||||
import time
|
||||
from datetime import datetime
|
||||
from flask import Flask, render_template, jsonify, g, request, session, redirect
|
||||
|
||||
from config import PORT, LOGIN_ENABLED, LOGIN_USERNAME, LOGIN_PASSWORD, SECRET_KEY
|
||||
from blueprints import pin_tu_bp, base64_bp, down_video_bp, fen_ci_bp, content_tag_bp, chmod_calc_bp, json_format_bp, qr_code_bp, http_status_bp, url_parser_bp, token_gen_bp, sovits_tts_bp, stt_bp, ai_dubbing_bp, rvc_bp, audio_slicer_bp, uvr_sep_bp
|
||||
from blueprints import pin_tu_bp, base64_bp, down_video_bp, fen_ci_bp, content_tag_bp, chmod_calc_bp, json_format_bp, qr_code_bp, http_status_bp, url_parser_bp, token_gen_bp, sovits_tts_bp, stt_bp, ai_dubbing_bp, rvc_bp, audio_slicer_bp, uvr_sep_bp, mp4_to_audio_bp, ai_translate_bp
|
||||
from utils.stats_db import init_db, record_call, get_total_count, get_avg_duration, get_daily_counts, get_monthly_counts, get_available_years, get_available_months, get_daily_counts_by_month, get_hourly_counts, get_endpoint_stats, get_today_count, get_yesterday_count, get_month_count, get_success_rate, get_duration_distribution, get_slowest_endpoints, get_week_compare, get_recent_calls, get_active_days
|
||||
from utils.stats_db import ALLOWED_TABLES, get_table_info, get_table_rows, get_table_count, insert_row, update_row, delete_rows, clear_table
|
||||
|
||||
TOOL_COUNT = 17
|
||||
TOOL_COUNT = 19
|
||||
|
||||
|
||||
def create_app():
|
||||
@@ -57,6 +58,24 @@ def create_app():
|
||||
def data_manage():
|
||||
return render_template('data_manage.html')
|
||||
|
||||
# 侧边栏功能显示配置
|
||||
SIDEBAR_CONFIG_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'config', 'sidebar_config.json')
|
||||
|
||||
@app.route('/api/sidebar-config', methods=['GET'])
|
||||
def get_sidebar_config():
|
||||
if os.path.exists(SIDEBAR_CONFIG_PATH):
|
||||
with open(SIDEBAR_CONFIG_PATH, 'r', encoding='utf-8') as f:
|
||||
return jsonify(json.load(f))
|
||||
return jsonify({'hidden_features': []})
|
||||
|
||||
@app.route('/api/sidebar-config', methods=['POST'])
|
||||
def save_sidebar_config():
|
||||
data = request.get_json(force=True)
|
||||
os.makedirs(os.path.dirname(SIDEBAR_CONFIG_PATH), exist_ok=True)
|
||||
with open(SIDEBAR_CONFIG_PATH, 'w', encoding='utf-8') as f:
|
||||
json.dump(data, f, ensure_ascii=False, indent=2)
|
||||
return jsonify({'success': True})
|
||||
|
||||
# 仪表盘统计接口
|
||||
@app.route('/api/stats')
|
||||
def api_stats():
|
||||
@@ -228,6 +247,8 @@ def create_app():
|
||||
app.register_blueprint(rvc_bp)
|
||||
app.register_blueprint(audio_slicer_bp)
|
||||
app.register_blueprint(uvr_sep_bp)
|
||||
app.register_blueprint(mp4_to_audio_bp)
|
||||
app.register_blueprint(ai_translate_bp)
|
||||
|
||||
return app
|
||||
|
||||
|
||||
Reference in New Issue
Block a user