diff --git a/app.py b/app.py
index 2de18f3..8bf2df4 100644
--- a/app.py
+++ b/app.py
@@ -26,7 +26,10 @@ def get_base_path():
app = Flask("Beamer+",
static_folder=os.path.join(BASE_PATH, 'static'),
template_folder=BASE_PATH)
-socketio = SocketIO(app, cors_allowed_origins='*', async_mode='threading')
+# socketio allows different webpages in our app (viewer, index, etc) to share data
+socketio = SocketIO(app,
+ cors_allowed_origins='*', # meaning of *: all webpages can communicate
+ async_mode='threading')
# Store active surveys and responses
surveys = {}
@@ -34,7 +37,9 @@ def get_base_path():
# Store current presentation
UPLOAD_FOLDER = 'uploads'
-os.makedirs(UPLOAD_FOLDER, exist_ok=True)
+os.makedirs(UPLOAD_FOLDER, exist_ok=True)
+# exist_ok=True ensures that even if '/uploads' already exists,
+# the program shouldn't crash
current_presentation = {
'file': None,
@@ -146,12 +151,28 @@ def upload_presentation():
'models': available_models
})
-@app.route('/api/presentation/current')
+# Getter for upload.zip:
+@app.route('/api/presentation/current') # by default: methods=['GET']
def get_current_presentation():
if current_presentation['file'] and os.path.exists(current_presentation['file']):
return send_file(current_presentation['file'], as_attachment=True, download_name='presentation.zip')
return jsonify({'error': 'No presentation loaded'}), 404
+# Getter for metadata about upload.zip
+@app.route('/api/presentation/info') # by default: methods=['GET']
+def get_presentation_info():
+ if current_presentation['file'] and os.path.exists(current_presentation['file']):
+ return jsonify({
+ 'loaded': True,
+ 'models': current_presentation.get('available_models', []),
+ 'filename': os.path.basename(current_presentation['file'])
+ })
+
+ return jsonify({
+ 'loaded': False
+ })
+
+
# Model endpoints
@app.route('/api/models')
def get_models():
@@ -384,4 +405,4 @@ def handle_screen_frame(data):
emit("screen_frame", data, room='viewer')
if __name__ == '__main__':
- socketio.run(app, host='0.0.0.0', port=5000, debug=True)
\ No newline at end of file
+ socketio.run(app, host='0.0.0.0', port=5000, debug=False)
\ No newline at end of file
diff --git a/index.html b/index.html
index 6cdfc32..7d12b10 100644
--- a/index.html
+++ b/index.html
@@ -21,8 +21,7 @@
@@ -73,7 +72,9 @@
}, 2000);
});
-
+
+
+