Small fixes
This commit is contained in:
parent
026618b8d1
commit
572fcbed6d
|
@ -33,4 +33,5 @@ EXPOSE 8080/tcp
|
||||||
# Copy in the code
|
# Copy in the code
|
||||||
COPY slinky slinky/
|
COPY slinky slinky/
|
||||||
COPY templates templates/
|
COPY templates templates/
|
||||||
|
COPY config.yaml .
|
||||||
COPY main.py .
|
COPY main.py .
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
---
|
---
|
||||||
db: sqlite:///slinky.db
|
db: sqlite:///slinky.db
|
||||||
|
allowed_ips:
|
||||||
|
- 127.0.0.1
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
flask
|
flask
|
||||||
flask_bootstrap
|
flask_bootstrap
|
||||||
flask_wtf
|
flask_wtf
|
||||||
|
psycopg2-binary
|
||||||
pyyaml
|
pyyaml
|
||||||
waitress
|
waitress
|
||||||
Flask-SQLAlchemy
|
Flask-SQLAlchemy
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<!-- Begin page content -->
|
<!-- Begin page content -->
|
||||||
<main class="container">
|
<main class="container">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1 class="mt-5">Add a shortcode</h1>
|
<h1 class="mt-5">Shortcodes</h1>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<div id="content">
|
<div id="content">
|
||||||
|
|
|
@ -82,7 +82,7 @@ def protect(func: Callable[..., Response]) -> Callable[..., Response]:
|
||||||
|
|
||||||
@wraps(func)
|
@wraps(func)
|
||||||
def check_ip(*args: Any, **kwargs: Any) -> Response:
|
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}')
|
print(f'Protected URL access attempt from {request.remote_addr}')
|
||||||
return Response('Not found', 404)
|
return Response('Not found', 404)
|
||||||
return func(*args, **kwargs)
|
return func(*args, **kwargs)
|
||||||
|
|
Loading…
Reference in a new issue