Remove all references to socket.io
This commit is contained in:
11
app.py
11
app.py
@@ -8,7 +8,6 @@ import jinja_partials
|
||||
from flask_htmx import HTMX
|
||||
import minify_html
|
||||
from urllib.parse import urlparse
|
||||
from flask_socketio import SocketIO
|
||||
|
||||
from db import DataBase
|
||||
from graph import generate_graph
|
||||
@@ -18,7 +17,6 @@ app = Flask(__name__)
|
||||
app.config['SECRET_KEY'] = 'secret!'
|
||||
jinja_partials.register_extensions(app)
|
||||
htmx = HTMX(app)
|
||||
#socketio = SocketIO(app, cors_allowed_origins='*')
|
||||
db = DataBase(app)
|
||||
|
||||
|
||||
@@ -37,14 +35,6 @@ def response_minify(response):
|
||||
return response
|
||||
|
||||
|
||||
# @socketio.on('message')
|
||||
# def handle_message(data):
|
||||
# current_time = datetime.now().replace(
|
||||
# microsecond=0).isoformat()
|
||||
# print('' + current_time + ' ' + json.dumps(data))
|
||||
# db.insert_cadence(data['rpm'], data['id'])
|
||||
|
||||
|
||||
@ app.route("/")
|
||||
def home():
|
||||
return render_template('base.html')
|
||||
@@ -85,5 +75,4 @@ def cadence():
|
||||
if __name__ == '__main__':
|
||||
# Bind to PORT if defined, otherwise default to 5000.
|
||||
port = int(os.environ.get('PORT', 5000))
|
||||
#socketio.run(app, host='127.0.0.1', port=port)
|
||||
app.run(host='127.0.0.1', port=port)
|
||||
|
||||
@@ -7,8 +7,4 @@ flask-htmx==0.2.0
|
||||
python-dateutil==2.8.2
|
||||
minify-html==0.10.3
|
||||
bidict==0.22.1
|
||||
flask-socketio==5.3.2
|
||||
python-engineio==4.3.4
|
||||
python-socketio==5.7.2
|
||||
eventlet==0.30.2
|
||||
pygal==3.0.0
|
||||
@@ -1,4 +1,3 @@
|
||||
let socket = null;
|
||||
let characteristic = null;
|
||||
let prevRes = null;
|
||||
|
||||
@@ -25,29 +24,8 @@ async function connect(props) {
|
||||
characteristic.addEventListener("characteristicvaluechanged", props.onChange);
|
||||
console.log("> Characteristic value changed event listener added");
|
||||
|
||||
btn.classList.remove("bg-red-600");
|
||||
btn.classList.remove("bg-blue-600");
|
||||
btn.classList.add("bg-green-600");
|
||||
/*
|
||||
socket = io({
|
||||
reconnection: true,
|
||||
reconnectionDelay: 1000,
|
||||
reconnectionAttempts: 20,
|
||||
forceNew: true,
|
||||
});
|
||||
|
||||
socket.on("connect", () => {
|
||||
btn.classList.remove("bg-red-600");
|
||||
btn.classList.add("bg-green-600");
|
||||
});
|
||||
|
||||
socket.on("disconnect", (reason) => {
|
||||
if (reason === "io server disconnect") {
|
||||
// the disconnection was initiated by the server, you need to reconnect manually
|
||||
socket.connect();
|
||||
}
|
||||
// else the socket will automatically try to reconnect
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
async function disconnect() {
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
class="p-0 w-16 h-16 bg-red-600 rounded-full hover:bg-red-700 active:shadow-lg mouse shadow transition ease-in duration-200 focus:outline-none"
|
||||
class="fixed z-90 bottom-10 right-8 bg-blue-600 w-20 h-20 rounded-full drop-shadow-lg flex justify-center items-center text-white text-4xl hover:bg-blue-700 hover:drop-shadow-2xl hover:animate-bounce duration-300"
|
||||
id="ble-connect">
|
||||
<svg viewBox="0 0 20 20" enable-background="new 0 0 20 20" class="w-6 h-6 inline-block">
|
||||
<path fill="#FFFFFF" d="M16,10c0,0.553-0.048,1-0.601,1H11v4.399C11,15.951,10.553,16,10,16c-0.553,0-1-0.049-1-0.601V11H4.601
|
||||
@@ -65,9 +65,6 @@
|
||||
</main>
|
||||
</div>
|
||||
<script src="/static/js/BLE.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.5.4/socket.io.min.js"
|
||||
integrity="sha512-HTENHrkQ/P0NGDFd5nk6ibVtCkcM7jhr2c7GyvXp5O+4X6O5cQO9AhqFzM+MdeBivsX7Hoys2J7pp2wdgMpCvw=="
|
||||
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user