Small fixes

This commit is contained in:
Scott Wallace 2021-12-28 16:13:33 +00:00
parent 026618b8d1
commit 572fcbed6d
Signed by: scott
GPG key ID: AA742FDC5AFE2A72
5 changed files with 6 additions and 2 deletions

View file

@ -33,4 +33,5 @@ EXPOSE 8080/tcp
# Copy in the code
COPY slinky slinky/
COPY templates templates/
COPY config.yaml .
COPY main.py .

View file

@ -1,2 +1,4 @@
---
db: sqlite:///slinky.db
allowed_ips:
- 127.0.0.1

View file

@ -1,6 +1,7 @@
flask
flask_bootstrap
flask_wtf
psycopg2-binary
pyyaml
waitress
Flask-SQLAlchemy

View file

@ -3,7 +3,7 @@
<!-- Begin page content -->
<main class="container">
<div class="container">
<h1 class="mt-5">Add a shortcode</h1>
<h1 class="mt-5">Shortcodes</h1>
</div>
<br />
<div id="content">

View file

@ -82,7 +82,7 @@ def protect(func: Callable[..., Response]) -> Callable[..., Response]:
@wraps(func)
def check_ip(*args: Any, **kwargs: Any) -> Response:
if request.remote_addr not in cfg['allowed_ips']:
if request.headers['X-Forwarded-For'] not in cfg['allowed_ips']:
print(f'Protected URL access attempt from {request.remote_addr}')
return Response('Not found', 404)
return func(*args, **kwargs)