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 7f5538d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 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
14 changes: 3 additions & 11 deletions src/default_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,10 @@
import secrets

Check warning on line 2 in src/default_settings.py

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

F401 'secrets' imported but unused

Check warning on line 2 in src/default_settings.py

View workflow job for this annotation

GitHub Actions / build (windows-latest)

F401 'secrets' imported but unused
import sys

Check warning on line 3 in src/default_settings.py

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

F401 'sys' imported but unused

Check warning on line 3 in src/default_settings.py

View workflow job for this annotation

GitHub Actions / build (windows-latest)

F401 'sys' imported but unused

# 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 19 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 7f5538d

Please sign in to comment.