Add Django site, Docker packaging, and beta/prod Gitea deploys.
Deploy Beta / unit-tests (push) Successful in 9s
Deploy Beta / docker (push) Successful in 17s
Deploy Beta / deploy-beta (push) Successful in 2m31s

Unignore site/ (was blocked by mkdocs /site rule), add compose/Docker/uv tooling, and split deploys so push to main goes to beta while prod stays manual.
This commit is contained in:
2026-08-08 07:32:55 -05:00
parent 7dca98bbf6
commit 1f7d78de64
204 changed files with 21662 additions and 70 deletions
+27
View File
@@ -0,0 +1,27 @@
"""Token encryption helpers for SocialAccount."""
from cryptography.fernet import Fernet, InvalidToken
from django.conf import settings
def _fernet() -> Fernet:
key = settings.SOCIAL_TOKEN_ENCRYPTION_KEY
if not key:
# Dev-only fallback — generate is not stable across restarts; set the env var.
key = Fernet.generate_key().decode()
if isinstance(key, str):
key = key.encode()
return Fernet(key)
def encrypt_tokens(plaintext: str) -> str:
return _fernet().encrypt(plaintext.encode()).decode()
def decrypt_tokens(ciphertext: str) -> str:
if not ciphertext:
return ""
try:
return _fernet().decrypt(ciphertext.encode()).decode()
except InvalidToken as exc:
raise ValueError("Unable to decrypt social tokens") from exc