From 4048b311870a45272594e22e6d2ce5d565517705 Mon Sep 17 00:00:00 2001 From: Iliana Weller Date: Tue, 3 Apr 2018 18:31:14 -0700 Subject: [PATCH] Add AGPLv3 compliance --- emojos.py | 12 ++++++++++++ requirements.txt | 1 + static/site.css | 4 ++++ templates/base.html | 13 +++++++++++++ templates/emojo.html | 4 +++- zappa_settings.json | 9 ++++++++- 6 files changed, 41 insertions(+), 2 deletions(-) diff --git a/emojos.py b/emojos.py index 6bcf367..e306ed0 100644 --- a/emojos.py +++ b/emojos.py @@ -13,6 +13,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +import botocore.session import operator import requests import urllib.parse @@ -41,6 +42,17 @@ def no_content(): return ('', 204) +@app.route('/code') +def code(): + context = request.environ.get('lambda.context') + session = botocore.session.get_session() + # region name is detected from lambda environment + client = session.create_client('lambda') + code = client.get_function(FunctionName=context.function_name, + Qualifier=context.function_version) + return redirect(code['Code']['Location'], code=303) + + @app.route('/', methods=('GET', 'POST')) def index(): if request.method == 'POST': diff --git a/requirements.txt b/requirements.txt index 308e3da..1efeb54 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ Flask +botocore requests zappa diff --git a/static/site.css b/static/site.css index 8a8889e..be07f2f 100644 --- a/static/site.css +++ b/static/site.css @@ -43,3 +43,7 @@ dl.emojo dd { dl.emojo dd.success { color: rgb(202, 143, 4); } + +footer { + font-size: smaller; +} diff --git a/templates/base.html b/templates/base.html index e1dbbc3..cb24de2 100644 --- a/templates/base.html +++ b/templates/base.html @@ -8,5 +8,18 @@ {% block body %} {% endblock body %} + + {% block script %} + {% endblock script %} diff --git a/templates/emojo.html b/templates/emojo.html index 01602a5..d045f3a 100644 --- a/templates/emojo.html +++ b/templates/emojo.html @@ -13,5 +13,7 @@ {% endfor %} - {% endblock body %} +{% block script %} + +{% endblock script %} diff --git a/zappa_settings.json b/zappa_settings.json index 6cad85c..f69b3ce 100644 --- a/zappa_settings.json +++ b/zappa_settings.json @@ -7,6 +7,13 @@ "runtime": "python3.6", "s3_bucket": "zappa-ha6nqt04p", "domain": "emojos.in", - "certificate_arn": "arn:aws:acm:us-east-1:672373865878:certificate/b82eba06-6091-460e-af21-4f265e1206e9" + "certificate_arn": "arn:aws:acm:us-east-1:672373865878:certificate/b82eba06-6091-460e-af21-4f265e1206e9", + "extra_permissions": [ + { + "Effect": "Allow", + "Action": "lambda:GetFunction", + "Resource": "*" + } + ] } }