25 lines
807 B
Python
25 lines
807 B
Python
import os
|
|
from flask import Blueprint, request, jsonify, current_app, render_template, session
|
|
from ..services.file_service import get_file_tree, load_config
|
|
|
|
main_bp = Blueprint('main', __name__, url_prefix='/vsc-like')
|
|
|
|
@main_bp.route('/', methods=['GET'])
|
|
def vsc_like():
|
|
uuid = request.args.get('uuid')
|
|
path = request.args.get('path')
|
|
session['uuid'] = uuid
|
|
session['path'] = path
|
|
# 加载 .config 文件并验证 uuid
|
|
base_path = current_app.config['ROOT_WORKSPACE_PATH']
|
|
path = f'{base_path}/{path}'
|
|
config = load_config(path)
|
|
if not config:
|
|
return jsonify({"error": "Configuration file not found or invalid"}), 404
|
|
if config.get('uuid') != uuid:
|
|
return jsonify({"error": "UUID does not match"}), 403
|
|
|
|
return render_template('index.html')
|
|
|
|
|