diff --git a/Html/apps/views/vscode.py b/Html/apps/views/vscode.py index 0a1d142..70511ab 100644 --- a/Html/apps/views/vscode.py +++ b/Html/apps/views/vscode.py @@ -41,7 +41,7 @@ def desktop(user_uuid, course_id, chapter_name, lesson_name): caddy_conf = f""" - handle_path /vsc{user_uuid}/* {{ + handle_path /vsc{user_id}/* {{ reverse_proxy localhost:{code_server_port} }} """ @@ -65,7 +65,7 @@ def desktop(user_uuid, course_id, chapter_name, lesson_name): lines.insert(insert_position, caddy_conf) with open(caddy_config_path, "w") as f: f.writelines(lines) - + try: subprocess.run(["sudo", "caddy", "reload", "--config", "/etc/caddy/Caddyfile"]) except subprocess.CalledProcessError as e: @@ -77,6 +77,7 @@ def desktop(user_uuid, course_id, chapter_name, lesson_name): config_path = os.path.join(path_dir, ".config") tmpd = { "user_uuid": session["user_uuid"], + "user_id": user_id, "course_id": course_id, "chapter_name": chapter_name, "lesson_name": lesson_name, @@ -96,7 +97,7 @@ def desktop(user_uuid, course_id, chapter_name, lesson_name): ) return render_template( "desktop.html", - vscode_web_url=current_app.config["VSCODE_WEB_URL"]+f"/vsc{user_uuid}", + 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, workspace_path=path_for_vscode, )