diff --git a/docker-compose.yml b/docker-compose.yml index d0bcac72e..ea8351575 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,11 +7,6 @@ services: - "./:/rDrama" - "./nginx.conf:/etc/nginx/sites-enabled/1" - "./nginx-serve-static.conf:/etc/nginx/includes/serve-static" - env_file: env - environment: - - DATABASE_URL=postgresql://postgres@postgres:5432 - - REDIS_URL=redis://redis - - PROXY_URL=http://opera-proxy:18080 links: - "redis" - "postgres" diff --git a/env b/env index 082eee376..05e4644da 100644 --- a/env +++ b/env @@ -1,38 +1,40 @@ -FLASK_APP=/rDrama/files/cli:app -SITE=localhost -SITE_NAME=rDrama -MASTER_KEY=blahblahblah -PROXY_URL=http://localhost:18080 -GIPHY_KEY=blahblahblah -DISCORD_SERVER_ID=blahblahblah -DISCORD_CLIENT_ID=blahblahblah -DISCORD_CLIENT_SECRET=blahblahblah -DISCORD_BOT_TOKEN=blahblahblah -HCAPTCHA_SITEKEY=blahblahblah -HCAPTCHA_SECRET=blahblahblah -YOUTUBE_KEY=blahblahblah -PUSHER_ID=blahblahblah -PUSHER_KEY=blahblahblah -IMGUR_KEY=blahblahblah -SPAM_SIMILARITY_THRESHOLD=0.5 -SPAM_URL_SIMILARITY_THRESHOLD=0.1 -SPAM_SIMILAR_COUNT_THRESHOLD=10 -COMMENT_SPAM_SIMILAR_THRESHOLD=0.5 -COMMENT_SPAM_COUNT_THRESHOLD=10 -DEFAULT_TIME_FILTER=all -GUMROAD_TOKEN=blahblahblah -GUMROAD_LINK=https://marsey1.gumroad.com/l/rdrama -GUMROAD_ID=rdrama -CARD_VIEW=0 -DISABLE_DOWNVOTES=0 -DUES=0 -DEFAULT_THEME=midnight -DEFAULT_COLOR=805ad5 -EMAIL=blahblahblah@gmail.com -MAILGUN_KEY=blahblahblah -DESCRIPTION=rdrama.net caters to drama in all forms such as: Real life, videos, photos, gossip, rumors, news sites, Reddit, and Beyond™. There isn't drama we won't touch, and we want it all! -CF_KEY=blahblahblah -CF_ZONE=blahblahblah -DEBIAN_FRONTEND=noninteractive -NODE_VERSION=16.13.0 -NVM_DIR=/root/.nvm +export FLASK_APP="/rDrama/files/cli:app" +export SITE="localhost" +export SITE_NAME="rDrama" +export SECRET_KEY="blahblahblah" +export DATABASE_URL="postgresql://postgres@localhost:5432" +export REDIS_URL="redis://localhost:6379" +export PROXY_URL="http://localhost:18080" +export GIPHY_KEY="blahblahblah" +export DISCORD_SERVER_ID="blahblahblah" +export DISCORD_CLIENT_ID="blahblahblah" +export DISCORD_CLIENT_SECRET="blahblahblah" +export DISCORD_BOT_TOKEN="blahblahblah" +export HCAPTCHA_SITEKEY="blahblahblah" +export HCAPTCHA_SECRET="blahblahblah" +export YOUTUBE_KEY="blahblahblah" +export PUSHER_ID="blahblahblah" +export PUSHER_KEY="blahblahblah" +export IMGUR_KEY="blahblahblah" +export SPAM_SIMILARITY_THRESHOLD="0.5" +export SPAM_URL_SIMILARITY_THRESHOLD="0.1" +export SPAM_SIMILAR_COUNT_THRESHOLD="10" +export COMMENT_SPAM_SIMILAR_THRESHOLD="0.5" +export COMMENT_SPAM_COUNT_THRESHOLD="10" +export DEFAULT_TIME_FILTER="all" +export GUMROAD_TOKEN="blahblahblah" +export GUMROAD_LINK="https://marsey1.gumroad.com/l/rdrama" +export GUMROAD_ID="rdrama" +export CARD_VIEW="0" +export DISABLE_DOWNVOTES="0" +export DUES="0" +export DEFAULT_THEME="midnight" +export DEFAULT_COLOR="805ad5" +export EMAIL="blahblahblah@gmail.com" +export MAILGUN_KEY="blahblahblah" +export DESCRIPTION="rdrama.net caters to drama in all forms such as: Real life, videos, photos, gossip, rumors, news sites, Reddit, and Beyond™. There isn't drama we won't touch, and we want it all!" +export CF_KEY="blahblahblah" +export CF_ZONE="blahblahblah" +export DEBIAN_FRONTEND="noninteractive" +export NODE_VERSION="16.13.0" +export NVM_DIR="/root/.nvm" diff --git a/files/__main__.py b/files/__main__.py index 5c4b88197..6fbf0b30e 100644 --- a/files/__main__.py +++ b/files/__main__.py @@ -24,7 +24,7 @@ app.jinja_env.auto_reload = True app.jinja_env.add_extension('jinja2.ext.do') faulthandler.enable() -app.config['SECRET_KEY'] = environ.get('MASTER_KEY') +app.config['SECRET_KEY'] = environ.get('SECRET_KEY').strip() app.config["SERVER_NAME"] = environ.get("SITE").strip() app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 3153600 app.config["SESSION_COOKIE_NAME"] = "session_" + environ.get("SITE_NAME").strip().lower() @@ -35,15 +35,15 @@ app.config["PERMANENT_SESSION_LIFETIME"] = 60 * 60 * 24 * 365 app.config['SESSION_REFRESH_EACH_REQUEST'] = False app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False -app.config['SQLALCHEMY_DATABASE_URL'] = environ.get("DATABASE_URL", "postgresql://postgres@localhost:5432") +app.config['SQLALCHEMY_DATABASE_URL'] = environ.get("DATABASE_URL").strip() app.config["CACHE_TYPE"] = "RedisCache" -app.config["CACHE_REDIS_URL"] = environ.get("REDIS_URL", "redis://localhost") +app.config["CACHE_REDIS_URL"] = environ.get("REDIS_URL").strip() app.config['SETTINGS'] = {} -r=redis.Redis(host=environ.get("REDIS_URL", "redis://localhost"), decode_responses=True, ssl_cert_reqs=None) +r=redis.Redis(host=environ.get("REDIS_URL").strip(), decode_responses=True, ssl_cert_reqs=None) def get_CF(): with app.app_context(): diff --git a/files/helpers/const.py b/files/helpers/const.py index a6f999e07..ec7d00e10 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -12,7 +12,7 @@ from os import path SITE = environ.get("SITE").strip() SITE_NAME = environ.get("SITE_NAME").strip() -MASTER_KEY = environ.get("MASTER_KEY").strip() +SECRET_KEY = environ.get("SECRET_KEY").strip() PROXY_URL = environ.get("PROXY_URL").strip() GIPHY_KEY = environ.get('GIPHY_KEY').strip() DISCORD_SERVER_ID = environ.get("DISCORD_SERVER_ID").strip() diff --git a/files/helpers/security.py b/files/helpers/security.py index 257bb9544..45470217c 100644 --- a/files/helpers/security.py +++ b/files/helpers/security.py @@ -6,7 +6,7 @@ def generate_hash(string): msg = bytes(string, "utf-16") - return hmac.new(key=bytes(MASTER_KEY, "utf-16"), + return hmac.new(key=bytes(SECRET_KEY, "utf-16"), msg=msg, digestmod='md5' ).hexdigest() diff --git a/files/routes/login.py b/files/routes/login.py index 3d6f9da0e..28e4ce073 100644 --- a/files/routes/login.py +++ b/files/routes/login.py @@ -219,7 +219,7 @@ def sign_up_get(v): formkey_hashstr = str(now) + token + g.agent - formkey = hmac.new(key=bytes(MASTER_KEY, "utf-16"), + formkey = hmac.new(key=bytes(SECRET_KEY, "utf-16"), msg=bytes(formkey_hashstr, "utf-16"), digestmod='md5' ).hexdigest() @@ -258,7 +258,7 @@ def sign_up_post(v): correct_formkey_hashstr = form_timestamp + submitted_token + g.agent - correct_formkey = hmac.new(key=bytes(MASTER_KEY, "utf-16"), + correct_formkey = hmac.new(key=bytes(SECRET_KEY, "utf-16"), msg=bytes(correct_formkey_hashstr, "utf-16"), digestmod='md5' ).hexdigest() diff --git a/startup_docker.sh b/startup_docker.sh index 5144d291c..7f9606d65 100644 --- a/startup_docker.sh +++ b/startup_docker.sh @@ -1,3 +1,7 @@ +. ./env +export DATABASE_URL="postgresql://postgres@postgres:5432" +export REDIS_URL="redis://redis:6379" +export PROXY_URL="http://opera-proxy:18080" /etc/init.d/nginx start cd ./chat yarn install diff --git a/ubuntu_setup.sh b/ubuntu_setup.sh index c69ad1f66..284e58cca 100644 --- a/ubuntu_setup.sh +++ b/ubuntu_setup.sh @@ -6,7 +6,6 @@ apt -y install git redis-server python3-pip ffmpeg imagemagick tmux nginx snapd git config --global credential.helper store cd /rDrama cp ./env /env -sed -i 's/^/export /g;s/=/="/g;s/$/"/g' /env . /env mkdir /scripts