Remote-Mouse/src/core/__init__.py

58 lines
1.8 KiB
Python
Raw Normal View History

2020-05-28 18:07:53 +00:00
# Python imports
2021-08-03 03:35:19 +00:00
import os, secrets
from datetime import timedelta
2020-05-28 18:07:53 +00:00
# Lib imports
2020-06-12 03:38:20 +00:00
import eventlet
2021-07-19 02:59:33 +00:00
from engineio.payload import Payload
2020-11-22 23:00:20 +00:00
2020-05-28 18:07:53 +00:00
from flask import Flask
from flask_bcrypt import Bcrypt
2020-06-12 03:38:20 +00:00
from flask_socketio import SocketIO
2021-08-03 03:35:19 +00:00
from flask_login import current_user, login_user, logout_user, LoginManager
2020-05-28 18:07:53 +00:00
# Apoplication imports
2021-08-03 03:35:19 +00:00
2020-05-28 18:07:53 +00:00
# Configs and 'init'
app = Flask(__name__)
2021-07-19 02:59:33 +00:00
app.config['TITLE'] = 'RemoteMouse'
2021-08-03 03:35:19 +00:00
app.config['SECRET_KEY'] = "2A#GQafbREoblgMSQYomZSxbaPE6dt#" # For csrf and some other stuff...
2020-05-28 18:07:53 +00:00
2021-08-03 03:35:19 +00:00
# app.config.from_object("core.config.ProductionConfig")
# app.config.from_object("core.config.DevelopmentConfig")
# app.config.from_object("core.config.TestingConfig")
# app.jinja_env.globals['TITLE'] = app.config['TITLE']
# app.config['SECRET_KEY'] = app.config['SECRET_KEY'] # For csrf and some other stuff...
# Some fixers for Websockets
2021-07-19 02:59:33 +00:00
# eventlet.monkey_patch()
2021-08-03 03:35:19 +00:00
# eventlet.debug.hub_prevent_multiple_readers(False)
2021-07-19 02:59:33 +00:00
Payload.max_decode_packets = 120 # Fix too many small packets causing error
2021-08-03 03:35:19 +00:00
# For Websockets
2021-07-19 02:59:33 +00:00
socketio = SocketIO(app, async_mode='eventlet')
2021-08-03 03:35:19 +00:00
# socketio = SocketIO(app, async_mode = 'eventlet',
# cors_allowed_origins = [
# "http://localhost:5000",
# "http://localhost:8088",
# "http://www.remoteconn.com",
# "https://www.remoteconn.com",
# "https://www.remoteconn.com/",
# "http://www.remoteconn.com/"
# ],
# # allow_upgrades = True,
# engineio_logger = True,
# # manage_session = False,
# # cookie = None,
# logger = True,
# )
2020-11-22 23:40:18 +00:00
2020-05-28 18:07:53 +00:00
from core import routes