Skip to content

Commit

Permalink
Remove really bad hacky code
Browse files Browse the repository at this point in the history
  • Loading branch information
jdabtieu committed Jan 20, 2024
1 parent 43603f2 commit b976a56
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
1 change: 1 addition & 0 deletions INSTALL.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ EOF
mkdir -p "$DATA_DIR/logs" "$DATA_DIR/dl" "$DATA_DIR/backups" "$DATA_DIR/metadata/contests"
mkdir -p "$DATA_DIR/metadata/problems" "$DATA_DIR/metadata/announcements"
echo "Finishing setup..."
python -c "import secrets; print(secrets.token_hex(48))" > secret_key.txt # 384 bits
ln -s "$DATA_DIR/logs" logs
ln -s "$DATA_DIR/dl" dl
ln -s "$DATA_DIR/metadata" metadata
Expand Down
16 changes: 3 additions & 13 deletions src/default_settings.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
import os
import secrets
import sys

# DO NOT MODIFY THESE SETTINGS! Scroll down to line 27 for settings that you should change
# DO NOT MODIFY THESE SETTINGS! Scroll down to line 17 for settings that you should change
# The secret key is located in secret_key.txt by default
try:
with open("secret_key.txt", "r") as file:
secret_key = file.readline().strip()
SECRET_KEY = secret_key
except Exception as e:
sys.stderr.write(str(e))
with open("secret_key.txt", "w") as file:
SECRET_KEY = secrets.token_hex(48) # 384 bits
file.write(SECRET_KEY)

with open("secret_key.txt", "r") as file:
SECRET_KEY = file.readline().strip()
TEMPLATES_AUTO_RELOAD = True
SESSION_PERMANENT = True
PERMANENT_SESSION_LIFETIME = 30 * 24 * 60 * 60 # 30d
Expand Down

0 comments on commit b976a56

Please sign in to comment.