can create

This commit is contained in:
Cai
2025-09-15 09:16:38 +00:00
parent 873bdb4452
commit 1fcd52a6cc
2 changed files with 6 additions and 5 deletions

1
.gitignore vendored
View File

@@ -127,3 +127,4 @@ Thumbs.db
_build/ _build/
node_modules node_modules
*/node_modules

View File

@@ -17,10 +17,10 @@ def vsc_like(user_uuid, user_id, course_id, chapter_name, lesson_name):
session['chapter_name'] = chapter_name session['chapter_name'] = chapter_name
session['lesson_name'] = lesson_name session['lesson_name'] = lesson_name
config = load_config(path) config = load_config(path)
if not config: # if not config:
return jsonify({"error": "Configuration file not found or invalid"}), 404 # return jsonify({"error": "Configuration file not found or invalid"}), 404
if config.get('uuid') != uuid: # if config.get('uuid') != uuid:
return jsonify({"error": "UUID does not match"}), 403 # return jsonify({"error": "UUID does not match"}), 403
user_root = os.path.join(base_path, user_id) user_root = os.path.join(base_path, user_id)
try: try:
@@ -47,7 +47,7 @@ def vsc_like(user_uuid, user_id, course_id, chapter_name, lesson_name):
print(f"Error adding user {user_id} to shared_group: {e}") print(f"Error adding user {user_id} to shared_group: {e}")
try:#将文件 try:#将文件
subprocess.run(["sudo", "chown", "-R", f"shared_group_{user_id}", path], check=True) subprocess.run(["sudo", "chown", "-R", f"{user_id}:shared_group_{user_id}", path], check=True)
subprocess.run(["sudo", "chmod", "-R", "770", path], check=True) subprocess.run(["sudo", "chmod", "-R", "770", path], check=True)
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
print(f"Error changing directory {path} to shared_group_{user_id}: {e}") print(f"Error changing directory {path} to shared_group_{user_id}: {e}")