diff --git a/TheBattleCar/.idea/.gitignore b/TheBattleCar/.idea/.gitignore
new file mode 100644
index 0000000..359bb53
--- /dev/null
+++ b/TheBattleCar/.idea/.gitignore
@@ -0,0 +1,3 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
diff --git a/TheBattleCar/.idea/TheBattleCar.iml b/TheBattleCar/.idea/TheBattleCar.iml
new file mode 100644
index 0000000..d0876a7
--- /dev/null
+++ b/TheBattleCar/.idea/TheBattleCar.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TheBattleCar/.idea/inspectionProfiles/profiles_settings.xml b/TheBattleCar/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/TheBattleCar/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TheBattleCar/.idea/misc.xml b/TheBattleCar/.idea/misc.xml
new file mode 100644
index 0000000..db8786c
--- /dev/null
+++ b/TheBattleCar/.idea/misc.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TheBattleCar/.idea/modules.xml b/TheBattleCar/.idea/modules.xml
new file mode 100644
index 0000000..7e19b66
--- /dev/null
+++ b/TheBattleCar/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TheBattleCar/app.py b/TheBattleCar/app.py
new file mode 100644
index 0000000..e853682
--- /dev/null
+++ b/TheBattleCar/app.py
@@ -0,0 +1,131 @@
+from flask import Flask, render_template, request, redirect, url_for, session
+from flask import Flask, request, jsonify, send_from_directory
+import os
+
+app = Flask(__name__)
+app.secret_key = 'your_secret_key' # 用于会话管理,请替换为更安全的密钥
+app.config['UPLOAD_FOLDER'] = 'uploads' # 设置上传文件存储目录
+os.makedirs(app.config['UPLOAD_FOLDER'], exist_ok=True) # 确保目录存在
+
+# EXTERNAL_SCOUT_URL = 'http://192.168.78.178:5000/' # 外部侦查者页面URL
+
+# 处理文件上传
+@app.route('/upload', methods=['POST'])
+def upload_file():
+ if 'file' not in request.files:
+ return jsonify({'message': 'No file part'}), 400
+ file = request.files['file']
+ if file.filename == '':
+ return jsonify({'message': 'No selected file'}), 400
+ if file:
+ filepath = os.path.join(app.config['UPLOAD_FOLDER'], file.filename)
+ file.save(filepath)
+ return jsonify({'message': 'File uploaded successfully', 'filepath': filepath}), 201
+
+ # 提供上传文件的访问
+
+
+@app.route('/uploads/')
+def uploaded_file(filename):
+ return send_from_directory(app.config['UPLOAD_FOLDER'], filename)
+
+# 登录页面
+@app.route('/login', methods=['GET', 'POST'])
+def login():
+ if request.method == 'POST':
+ username = request.form['username']
+ password = request.form['password']
+ # 在这里添加你的认证逻辑(例如,从数据库验证用户名和密码)
+ # 假设我们总是接受任何用户名和密码为'admin'的登录
+ if username == 'admin' and password == 'admin':
+ role = request.form['role']
+ session['username'] = username
+ session['role'] = role
+ if role == '侦查者':
+ return redirect(url_for('scout'))
+ elif role == '指挥者':
+ return redirect(url_for('commander'))
+ elif role == '攻击者':
+ return redirect(url_for('attacker'))
+ else:
+ return "Invalid credentials. Please try again."
+ return render_template('login.html')
+
+
+# 侦查者页面
+@app.route('/scout')
+def scout():
+ if 'username' not in session or session['role'] != '侦查者':
+ return redirect(url_for('login'))
+ return render_template('scout.html')
+
+
+# 指挥者页面
+@app.route('/commander')
+def commander():
+ if 'username' not in session or session['role'] != '指挥者':
+ return redirect(url_for('login'))
+ return render_template('commander.html')
+
+
+# 攻击者页面
+@app.route('/attacker')
+def attacker():
+ if 'username' not in session or session['role'] != '攻击者':
+ return redirect(url_for('login'))
+ return render_template('attacker.html')
+
+
+# 退出登录(清除会话)
+@app.route('/logout')
+def logout():
+ session.pop('username', None)
+ session.pop('role', None)
+ return redirect(url_for('login'))
+
+
+from werkzeug.utils import secure_filename
+import uuid
+
+ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif'}
+
+
+def allowed_file(filename):
+ return '.' in filename and \
+ filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
+
+
+@app.route('/send_message', methods=['GET', 'POST'])
+def send_message():
+ if request.method == 'POST':
+ # 处理照片上传
+ if 'photo' in request.files:
+ file = request.files['photo']
+ if file.filename == '':
+ return "No selected file", 400
+ if file and allowed_file(file.filename):
+ filename = secure_filename(f"{uuid.uuid4().hex}_{file.filename}")
+ filepath = os.path.join(app.config['UPLOAD_FOLDER'], filename)
+ file.save(filepath)
+ photo_url = url_for('uploaded_file', filename=filename, _external=True)
+ else:
+ return "Allowed file types are png, jpg, jpeg, gif", 400
+ else:
+ photo_url = None
+
+ # 处理消息文本上传
+ message = request.form.get('message')
+ if not message:
+ return "No message provided", 400
+
+ # 在这里处理消息和照片的存储或进一步处理
+ # 例如,将消息和照片URL存储到数据库
+
+ # 返回成功响应或重定向
+ return f"Message and photo (if uploaded) have been received. Message: {message}\nPhoto URL: {photo_url if photo_url else 'N/A'}"
+
+ # 如果是GET请求,渲染发送消息的表单
+ return render_template('send_message.html')
+
+if __name__ == '__main__':
+ app.run(debug=True, host='0.0.0.0', port=8000)
\ No newline at end of file
diff --git a/TheBattleCar/templates/attacker.html b/TheBattleCar/templates/attacker.html
new file mode 100644
index 0000000..b0e05c2
--- /dev/null
+++ b/TheBattleCar/templates/attacker.html
@@ -0,0 +1,10 @@
+
+
+
+ 攻击者界面
+
+
+
攻击者界面
+
功能待实现
+
+
\ No newline at end of file
diff --git a/TheBattleCar/templates/commander.html b/TheBattleCar/templates/commander.html
new file mode 100644
index 0000000..207b6a4
--- /dev/null
+++ b/TheBattleCar/templates/commander.html
@@ -0,0 +1,14 @@
+
+
+
+ 指挥者界面
+
+
+
指挥者查看照片
+
+ {% for media in media_items %}
+
+ {% endfor %}
+
+
+
\ No newline at end of file
diff --git a/TheBattleCar/templates/login.html b/TheBattleCar/templates/login.html
new file mode 100644
index 0000000..719011d
--- /dev/null
+++ b/TheBattleCar/templates/login.html
@@ -0,0 +1,24 @@
+
+
+
+
+
+ Login
+
+
+
Login
+
+
+
\ No newline at end of file
diff --git a/TheBattleCar/templates/scout.html b/TheBattleCar/templates/scout.html
new file mode 100644
index 0000000..0bc330f
--- /dev/null
+++ b/TheBattleCar/templates/scout.html
@@ -0,0 +1,13 @@
+
+
+
+
+
+ Scout Page
+
+
+
Scout Page
+
+
+
+
\ No newline at end of file
diff --git a/TheBattleCar/templates/send_message.html b/TheBattleCar/templates/send_message.html
new file mode 100644
index 0000000..7931699
--- /dev/null
+++ b/TheBattleCar/templates/send_message.html
@@ -0,0 +1,18 @@
+
+
+
+
+
+ Send Message
+
+
+
Send Message
+
+
+
\ No newline at end of file
diff --git a/TheBattleCar/uploads/2d7d87c11e2f45c49a8e4ff7a699661a__20241015171033.png b/TheBattleCar/uploads/2d7d87c11e2f45c49a8e4ff7a699661a__20241015171033.png
new file mode 100644
index 0000000..c791c49
Binary files /dev/null and b/TheBattleCar/uploads/2d7d87c11e2f45c49a8e4ff7a699661a__20241015171033.png differ