Skip to content

Commit

Permalink
Merge branch 'main' into update_pbp
Browse files Browse the repository at this point in the history
  • Loading branch information
milankowww authored Nov 29, 2023
2 parents baaecd0 + 0c5b3d2 commit 6491394
Show file tree
Hide file tree
Showing 17 changed files with 249 additions and 558 deletions.
4 changes: 2 additions & 2 deletions docker/Dockerfile.bots
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7-alpine3.14 AS build_shared
FROM python:3.12-alpine3.18 AS build_shared

WORKDIR /build_shared/

Expand All @@ -8,7 +8,7 @@ RUN python -m build



FROM python:3.7-alpine3.14 AS production
FROM python:3.12-alpine3.18 AS production

WORKDIR /app/

Expand Down
4 changes: 2 additions & 2 deletions docker/Dockerfile.collectors
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7-alpine3.14 AS build_shared
FROM python:3.12-alpine3.18 AS build_shared

WORKDIR /build_shared/

Expand All @@ -8,7 +8,7 @@ RUN python -m build



FROM python:3.7-alpine3.14 AS production
FROM python:3.12-alpine3.18 AS production

WORKDIR /app/

Expand Down
54 changes: 5 additions & 49 deletions docker/Dockerfile.presenters
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7-alpine3.14 AS build_shared
FROM python:3.12-alpine3.18 AS build_shared

WORKDIR /build_shared/

Expand All @@ -8,7 +8,7 @@ RUN python -m build



FROM python:3.7-alpine3.14 AS production
FROM python:3.12-alpine3.18 AS production

WORKDIR /app/

Expand All @@ -20,59 +20,15 @@ RUN \
apk add --no-cache \
libpng \
libjpeg \
wkhtmltopdf
py3-gobject3 \
pango

# install fonts
RUN \
apk add --no-cache \
msttcorefonts-installer \
fontconfig \
font-noto \
font-noto-adlam \
font-noto-adlamunjoined \
font-noto-arabic \
font-noto-armenian \
font-noto-avestan \
font-noto-bamum \
font-noto-bengali \
font-noto-buhid \
font-noto-carian \
font-noto-chakma \
font-noto-cherokee \
font-noto-cypriot \
font-noto-deseret \
font-noto-devanagari \
font-noto-ethiopic \
font-noto-extra \
font-noto-georgian \
font-noto-glagolitic \
font-noto-gothic \
font-noto-gujarati \
font-noto-gurmukhi \
font-noto-hebrew \
font-noto-kannada \
font-noto-kayahli \
font-noto-khmer \
font-noto-lao \
font-noto-lisu \
font-noto-malayalam \
font-noto-mandaic \
font-noto-myanmar \
font-noto-nko \
font-noto-olchiki \
font-noto-oldturkic \
font-noto-oriya \
font-noto-osage \
font-noto-osmanya \
font-noto-shavian \
font-noto-sinhala \
font-noto-tamil \
font-noto-telugu \
font-noto-thaana \
font-noto-thai \
font-noto-tibetan \
font-noto-tifinagh \
font-noto-vai \
font-noto-all \
terminus-font \
ttf-opensans \
font-bakoma \
Expand Down
8 changes: 4 additions & 4 deletions docker/Dockerfile.publishers
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.9-alpine3.17 AS build_shared
FROM python:3.12-alpine3.18 AS build_shared

WORKDIR /build_shared/

Expand All @@ -8,7 +8,7 @@ RUN python -m build



FROM python:3.9-alpine3.17 AS production
FROM python:3.12-alpine3.18 AS production

WORKDIR /app/

Expand All @@ -25,9 +25,9 @@ RUN pip install --no-cache-dir ./custom_packages/taranis_ng_shared-*.whl && rm -

COPY ./src/publishers/requirements.txt /app/requirements.txt
RUN apk add --no-cache \
swig\
swig \
libmagic \
gnupg
gnupg

RUN \
apk add --no-cache --virtual .build-deps build-base \
Expand Down
22 changes: 17 additions & 5 deletions src/bots/managers/auth_manager.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
"""Authorization manager for the API.
Returns:
wrapper: Wrapper function for the API endpoints.
"""
from functools import wraps
from flask import request
import os
import ssl

api_key = os.getenv('API_KEY')
api_key = os.getenv("API_KEY")

if os.getenv('SSL_VERIFICATION') == "False":
if os.getenv("SSL_VERIFICATION") == "False":
try:
_create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
Expand All @@ -15,11 +20,18 @@


def api_key_required(fn):
"""Check for API key in the request header.
Arguments:
fn -- The function to be decorated.
Returns:
wrapper: Wrapper function for the API endpoints.
"""

@wraps(fn)
def wrapper(*args, **kwargs):

if not request.headers.has_key('Authorization') or request.headers['Authorization'] != ('Bearer ' + api_key):
return {'error': 'not authorized'}, 401
if "Authorization" not in request.headers.keys() or request.headers["Authorization"] != ("Bearer " + api_key):
return {"error": "not authorized"}, 401
else:
return fn(*args, **kwargs)

Expand Down
35 changes: 11 additions & 24 deletions src/bots/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,13 @@
certifi==2019.11.28
Flask==1.1.4
Flask-Cors==3.0.10
Flask-RESTful==0.3.7
gevent==21.8.0
greenlet==1.1.1
gunicorn==20.0.4
idna==2.8
marshmallow==3.18.0
Flask==3.0.0
Flask-Cors==4.0.0
Flask-RESTful==0.3.10
gevent==23.9.1
gunicorn==21.2.0
marshmallow==3.20.1
marshmallow-enum==1.5.1
Jinja2==2.11.3
MarkupSafe==1.1.0
oauthlib==3.1.0
oauthlib==3.2.2
PySocks==1.7.1
python-dateutil==2.8.1
python-dotenv==0.10.5
pytz==2019.3
requests==2.26.0
requests-oauthlib==1.3.0
schedule==0.6.0
six==1.14.0
sseclient-py==1.7
tweepy==3.8.0
urllib3==1.26.7
Werkzeug==0.16.0
zipp==3.1.0
python-dotenv==1.0.0
requests==2.31.0
schedule==1.2.1
sseclient-py==1.8.0
Loading

0 comments on commit 6491394

Please sign in to comment.