-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from ineshbose/updates
Leap to v1.11.0
- Loading branch information
Showing
63 changed files
with
1,400 additions
and
954 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,4 +127,7 @@ dmypy.json | |
.pytype/ | ||
|
||
# Cython debug symbols | ||
cython_debug/ | ||
cython_debug/ | ||
|
||
# Misc | ||
*.key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
web: gunicorn app:app | ||
web: gunicorn --workers 1 run:app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import os | ||
import logging | ||
from flask import Flask, Blueprint | ||
|
||
|
||
app = Flask(__name__) | ||
app.logger.setLevel(logging.DEBUG) | ||
|
||
app_url = os.environ.get("APP_URL", "http://127.0.0.1") | ||
app.config["SECRET_KEY"] = os.environ.get("FLASK_KEY") | ||
|
||
from . import _config | ||
|
||
blueprint = Blueprint("boyd_bot", __name__, template_folder="templates") | ||
|
||
from . import views | ||
from .forms import * | ||
|
||
webhook_token = os.environ.get("VERIFY_TOKEN") | ||
wb_arg_name = os.environ.get("WB_ARG_NAME") | ||
|
||
|
||
from .timetable import Timetable | ||
|
||
timetable = Timetable( | ||
"https://frontdoor.spa.gla.ac.uk/spacett/download/uogtimetable.ics" | ||
) | ||
|
||
|
||
from .services.guard import Guard | ||
|
||
guard = Guard(key=os.environ.get("GUARD_KEY")) | ||
|
||
|
||
from .services.database import Database | ||
|
||
db = Database( | ||
db_token=os.environ.get("DB_MAIN_TOKEN"), | ||
key1=os.environ.get("DB_KEY1", "key1"), | ||
key2=os.environ.get("DB_KEY2", "key2"), | ||
) | ||
|
||
|
||
from .services.parser import Parser | ||
|
||
parser = Parser() | ||
|
||
|
||
from .services.platform import Platform | ||
|
||
platform = Platform(platform_token=os.environ.get("PLATFORM_TOKEN")) | ||
|
||
|
||
def log(message): | ||
app.logger.info(message) | ||
|
||
|
||
from .app import * | ||
|
||
app.register_blueprint(blueprint, url_prefix=app.config["URL_ROOT"]) | ||
|
||
|
||
@app.after_request | ||
def secure_http_header(response): | ||
response.headers[ | ||
"Strict-Transport-Security" | ||
] = "max-age=31536000; includeSubDomains" | ||
response.headers["Content-Security-Policy"] = "default-src * 'unsafe-inline'" | ||
response.headers["X-Frame-Options"] = "SAMEORIGIN" | ||
response.headers["X-Content-Type-Options"] = "nosniff" | ||
response.headers["Referrer-Policy"] = "same-origin" | ||
response.headers["Feature-Policy"] = "none" | ||
return response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from . import app | ||
|
||
|
||
# URL root for the app | ||
app.config["URL_ROOT"] = "/" | ||
|
||
|
||
# Template Option | ||
app.config["TEMPLATES"] = { | ||
"REG_FORM": "uni_theme_reg.html", # uni_theme or default | ||
} | ||
|
||
|
||
# Simple string messages that can be replaced | ||
app.config["MSG"] = { | ||
"REG_ACKNOWLEDGE": "Alrighty! We can get started. :D", | ||
"SUCCESS_MSG": "Login successful! You can now close this page and chat to the bot.", | ||
"ONE_TIME_DONE": "You were logged out and since we don't have your credentials, you'll have to register again!", | ||
"ERROR_MSG": "I'm sorry, something went wrong understanding that. :(", | ||
} | ||
|
||
|
||
# Features you can switch on/off | ||
app.config["FEATURES"] = { | ||
"ONE_TIME_USE": True, # On-going issue (read https://github.com/ineshbose/boyd_bot_messenger/issues/8) | ||
"DEMO": True, # Works for chatbots without platform user-accounts (eg Dialogflow Web Demo / Embedded) | ||
} |
Oops, something went wrong.