Fixed https issue with socketio

This commit is contained in:
FrederikBaerentsen 2024-06-29 17:32:47 +02:00
parent ef04293355
commit f4c48a798a
3 changed files with 8 additions and 3 deletions

5
app.py
View File

@ -14,9 +14,12 @@ import shutil # save img locally
import eventlet
from downloadRB import download_and_unzip,get_nil_images
from db import initialize_database,get_rows,delete_tables
from werkzeug.middleware.proxy_fix import ProxyFix
app = Flask(__name__)
socketio = SocketIO(app)
app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_proto=1, x_host=1, x_port=1, x_prefix=1)
socketio = SocketIO(app,cors_allowed_origins="https://lego.baerentsen.space")
count = 0
@app.route('/favicon.ico')

View File

@ -3,7 +3,7 @@ services:
container_name: LEGOOrganizer
build: .
ports:
- "5111:3333"
- "3333:3333"
volumes:
- .:/app
env_file:

View File

@ -80,7 +80,9 @@
<script>
var socket = io.connect('http://' + document.domain + ':' + location.port + '/progress');
var socket = io.connect(window.location.protocol + '//' + document.domain + ':' + location.port + '/progress', {
transports: ['websocket'],
});
// Event listener for receiving progress updates
socket.on('update_progress', function (msg) {
var progress = msg.progress;