From f56d9b893bcc3b435e53ad0b71ac63b8c8c0e554 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 22 Feb 2022 15:34:41 +0200 Subject: [PATCH] vc --- Dockerfile | 12 +----------- docker-compose.yml | 2 +- env | 3 ++- files/routes/comments.py | 11 +++-------- files/templates/comments.html | 2 +- requirements.txt | 2 +- ubuntu_setup | 6 +++--- 7 files changed, 12 insertions(+), 26 deletions(-) diff --git a/Dockerfile b/Dockerfile index 494da0606..d574dcfe6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,6 @@ FROM ubuntu:20.04 -RUN apt update - -RUN apt -y upgrade - -RUN apt install -y supervisor - -RUN apt install -y python3-pip - -RUN apt install -y python3-enchant - -RUN apt install -y libenchant1c2a +RUN apt update && apt -y upgrade && apt install -y supervisor python3-pip libenchant1c2a ffmpeg COPY supervisord.conf /etc/supervisord.conf diff --git a/docker-compose.yml b/docker-compose.yml index d6b6279e8..691c16797 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ services: context: . volumes: - "./:/service" - env_file: ../env + env_file: env environment: - DATABASE_URL=postgresql://postgres@postgres:5432 - REDIS_URL=redis://redis diff --git a/env b/env index 9adb301e9..fa07c3756 100644 --- a/env +++ b/env @@ -31,4 +31,5 @@ export MAIL_USERNAME="blahblahblah@gmail.com" export MAIL_PASSWORD="3435tdfsdudebussylmaoxxt43" 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="3435tdfsdudebussylmaoxxt43" -export CF_ZONE="3435tdfsdudebussylmaoxxt43" \ No newline at end of file +export CF_ZONE="3435tdfsdudebussylmaoxxt43" +export DEBIAN_FRONTEND="noninteractive" \ No newline at end of file diff --git a/files/routes/comments.py b/files/routes/comments.py index e22afab97..2896cdf2e 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -17,14 +17,9 @@ import requests from shutil import copyfile from json import loads from collections import Counter +from enchant import Dict -import nltk -nltk.download('words') - -from nltk.corpus import words - -words = set(WORDLE_LIST) | set(words.words()) -words = set([x for x in words if len(x) == 5]) +d = Dict("en_US") IMGUR_KEY = environ.get("IMGUR_KEY").strip() @@ -1106,7 +1101,7 @@ def handle_wordle_action(cid, v): try: guess = request.values.get("guess").strip().lower() except: abort(400) - if len(guess) != 5 or guess not in words: + if len(guess) != 5 or not d.check(guess) and guess not in WORDLE_LIST: return {"error": "Not a valid guess!"}, 400 if status == "active": diff --git a/files/templates/comments.html b/files/templates/comments.html index ec6ce234c..9190c8b3d 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -871,7 +871,7 @@ {% if v %} - + {% endif %} diff --git a/requirements.txt b/requirements.txt index d48e24e1c..17a01ccb4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,7 +11,6 @@ gunicorn lxml mistletoe matplotlib -nltk Pillow psutil pyotp @@ -21,6 +20,7 @@ requests SQLAlchemy psycopg2-binary pusher_push_notifications +pyenchant youtube-dl yattag webptools \ No newline at end of file diff --git a/ubuntu_setup b/ubuntu_setup index 521673c50..4a8add038 100644 --- a/ubuntu_setup +++ b/ubuntu_setup @@ -1,7 +1,9 @@ cd /Drama +cp ./env /env +. /env sudo apt update sudo apt -y upgrade -sudo apt -y install postgresql postgresql-contrib redis-server python3-pip ffmpeg +sudo apt -y install postgresql postgresql-contrib redis-server python3-pip libenchant1c2a ffmpeg cp pg_hba.conf /etc/postgresql/12/main/pg_hba.conf sudo service postgresql restart sudo psql -U postgres -f schema.sql postgres @@ -10,6 +12,4 @@ sudo pip3 install -r requirements.txt mkdir /songs mkdir /images . imei.sh -cp ./env /env -. /env sudo -E gunicorn files.__main__:app -k gevent -w 2 --reload -b 0.0.0.0:80:80 --max-requests 1000 --max-requests-jitter 500 \ No newline at end of file