code-server-like

This commit is contained in:
CakeCN
2025-09-15 14:15:20 +08:00
parent 306bf48754
commit ec45771376
19 changed files with 962 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
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')