-
-
Notifications
You must be signed in to change notification settings - Fork 1
update Socket.IO connection handling and enforce HTTPS #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,13 @@ | ||||
| .qrcode-wrapper { | ||||
| display: inline-block; | ||||
| background: #c2c2c2 !important; | ||||
| padding: 0px; | ||||
| height: 286px; /* 256px height + 15px border top + 15px border bottom */ | ||||
| border: 15px solid #ffffff !important; | ||||
| border-radius: 10px; | ||||
| } | ||||
| .qrcode-wrapper canvas, | ||||
| .qrcode-wrapper img { | ||||
| display: block; | ||||
| margin-top: -15px; | ||||
|
||||
| margin-top: -15px; |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,14 +6,26 @@ | |||||||||||||||||||||||||||||
| from config import Config | ||||||||||||||||||||||||||||||
| from pathlib import Path | ||||||||||||||||||||||||||||||
| from app.utils import is_port_free, find_free_port, setup_logging | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| from werkzeug.middleware.proxy_fix import ProxyFix | ||||||||||||||||||||||||||||||
| from app.utils import get_readable_ip | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| logger = logging.getLogger(__name__) | ||||||||||||||||||||||||||||||
| __version__ = (Path(__file__).parent / "VERSION").read_text().strip() | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| def run_flask(config: object | str, host="0.0.0.0", port=4444): | ||||||||||||||||||||||||||||||
| app = create_app(config) | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Za reverzní proxy – respektuj X-Forwarded-* (host, proto, port, prefix) | ||||||||||||||||||||||||||||||
| app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_host=1, x_proto=1, x_port=1, x_prefix=1) | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Preferuj https pro generované URL a zabezpeč cookies | ||||||||||||||||||||||||||||||
| app.config.update( | ||||||||||||||||||||||||||||||
| PREFERRED_URL_SCHEME="https", | ||||||||||||||||||||||||||||||
| SESSION_COOKIE_SECURE=True, | ||||||||||||||||||||||||||||||
| REMEMBER_COOKIE_SECURE=True, | ||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
| ) | |
| # Preferuj https pro generované URL a zabezpeč cookies pouze pokud je povolen HTTPS | |
| if getattr(config, "PREFERRED_URL_SCHEME", "http") == "https": | |
| app.config.update( | |
| PREFERRED_URL_SCHEME="https", | |
| SESSION_COOKIE_SECURE=True, | |
| REMEMBER_COOKIE_SECURE=True, | |
| ) | |
| else: | |
| app.config.update( | |
| PREFERRED_URL_SCHEME="http", | |
| SESSION_COOKIE_SECURE=False, | |
| REMEMBER_COOKIE_SECURE=False, | |
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hardcoded height calculation (256px + 30px border) creates a magic number that's tightly coupled to QR code dimensions. Consider using CSS calc() or making this more flexible to accommodate different QR code sizes.