ready to code-like

This commit is contained in:
Cai
2025-09-21 14:03:40 +08:00
parent b1f832a2fb
commit 588fc3b697
14 changed files with 562 additions and 20 deletions

View File

@@ -5,10 +5,12 @@ from flask import Blueprint, current_app, session, redirect, url_for, render_tem
from ..services.backboard_service import realtime_response
from ..extension_ase.ase_client.manager import ChatManager
import subprocess
from ..auth.decorators import require_role
bp = Blueprint("vscode", __name__)
@bp.route("/desktop/<user_uuid>/<course_id>/<chapter_name>/<lesson_name>")
@require_role
def desktop(user_uuid, course_id, chapter_name, lesson_name):
username2uuid = current_app.extensions["username2uuid"]
uuid2username = current_app.extensions["uuid2username"]
@@ -117,13 +119,18 @@ def desktop(user_uuid, course_id, chapter_name, lesson_name):
)
# 确保文件的所有权归 user_id
subprocess.run(
["sudo", "chown", f"{user_id}:{user_id}", config_path],
["sudo", "chown", f"{user_id}:shared_group_{user_id}", config_path],
check=True
)
subprocess.run(
["sudo", "chmod", "-R", "770", config_path],
check=True
)
return render_template(
"desktop.html",
vscode_web_url=current_app.config["VSCODE_WEB_URL"]+f"/vsc{user_id}",
user_uuid=session["user_uuid"], course_id=course_id, chapter_name=chapter_name, lesson_name=lesson_name,
"code-like-desktop.html",
# vscode_web_url=current_app.config["VSCODE_WEB_URL"]+f"/vsc{user_id}",
vscode_web_url=current_app.config["CODE_LIKE_URL"],
user_uuid=session["user_uuid"], course_id=course_id, chapter_name=chapter_name, lesson_name=lesson_name,user_id=user_id,
workspace_path=path_for_vscode,
)