Commit Graph
9 Commits
Author SHA1 Message Date
westfarn bc7c47a69c Mint short links on piha.lc / beta.piha.li (#12)
Deploy Beta / unit-tests (push) Successful in 21s
Deploy Beta / docker (push) Successful in 24s
Deploy Beta / deploy-beta (push) Successful in 2m4s
## Summary
- Point `SHORTENER_BASE_URL` at `https://piha.lc` (prod) and `https://beta.piha.li` (beta).
- Stop documenting `shortener.aimloperations.com` as the mint host.

Closes #11.

Depends on url_shortening_service serving `/api/` on the short host.

## Test plan
- [ ] Set `SHORTENER_BASE_URL=https://beta.piha.li` and matching token in beta env
- [ ] Compose a campaign SMS and confirm mint hits beta.piha.li (not shortener-beta)
- [ ] Body contains `https://beta.piha.li/<code>`

Reviewed-on: #12
2026-08-30 17:27:51 -07:00
westfarn 2b3f10e784 Mint campaign UTM links through the piha.li shortener (#10)
Deploy Beta / unit-tests (push) Successful in 21s
Deploy Beta / docker (push) Successful in 26s
Deploy Beta / deploy-beta (push) Successful in 5m20s
## Summary
Closes #9.

- Campaign composer auto-inserts a tracked homepage link (`utm_source=monica`, `utm_medium` = channel, `utm_campaign` = slug of the name) for email, SMS, and postcard QR — no manual UTM paste.
- When `SHORTENER_BASE_URL` + `SHORTENER_API_TOKEN` are set, the app mints that long HTTPS URL via `POST /api/links/` on the shortener **API host** and puts the returned `piha.li` / `beta.piha.li` short URL in SMS, email hrefs, and QR codes. Empty env (local) falls back to the long UTM URL.
- Live composer resolves shorts through a portal JSON endpoint (login + CSRF). Browser never calls the shortener.

## Secrets (control node, not git)

**monica_site** (`~/Documents/secrets/monica_site/`):
```
# prod
SHORTENER_BASE_URL=https://shortener.aimloperations.com
SHORTENER_API_TOKEN=monica:<secret>

# beta
SHORTENER_BASE_URL=https://shortener-beta.aimloperations.com
SHORTENER_API_TOKEN=monica:<beta-secret>
```

**url_shortening_service** (same secret, named token):
```
SHORTENER_API_TOKENS=monica:<secret>
SHORT_ALLOWED_HOSTS=mkdrealtor.com,aimloperations.com
```
Prod public short host: `piha.li`. Beta: `beta.piha.li`. Generate with `python -c "import secrets; print(secrets.token_urlsafe(32))"`.

Template port: westfarn/web_django_template#3

## Test plan
- [ ] `cd site && uv run python manage.py test messaging.tests.CampaignUtmLinkTests`
- [ ] Composer: type a campaign name — email gets an HTML link, SMS gets a URL, postcard shows a QR
- [ ] With shortener env set: SMS/QR show `piha.li` (or `beta.piha.li`); without it, long UTM URL still works
- [ ] Copy/download QR into postcard designer
- [ ] Secret files have `SHORTENER_*` on both caller and operator sides before beta/prod deploy

Reviewed-on: #10
2026-08-30 13:24:40 -07:00
westfarn c8dacd0d94 Reject invalid SOCIAL_TOKEN_ENCRYPTION_KEY instead of 500ing.
Deploy Beta / unit-tests (push) Successful in 13s
Deploy Beta / docker (push) Successful in 18s
Deploy Beta / deploy-beta (push) Successful in 1m39s
Placeholder Fernet values like replace-with-fernet-key now raise a clear SocialCryptoError in the portal, and prod env examples no longer ship a fake key.
2026-08-11 07:59:36 -05:00
westfarn 44d300271a Add LinkedIn OAuth connect with portal-saved app credentials.
Deploy Beta / unit-tests (push) Successful in 12s
Deploy Beta / docker (push) Successful in 17s
Deploy Beta / deploy-beta (push) Successful in 1m41s
Replace manual token paste with Authorization Code flow; store Client ID/secret in the DB from the social accounts UI and surface a copyable callback URL for LinkedIn Auth setup.
2026-08-11 07:52:10 -05:00
westfarn 2643ba7a96 Require a complete PCM return address before placing orders.
Deploy Beta / unit-tests (push) Successful in 14s
Deploy Beta / docker (push) Successful in 17s
Deploy Beta / deploy-beta (push) Successful in 1m40s
Empty PCM_RETURN_ADDRESS was sending SITE_NAME as firstName with blank street fields, which PCM rejects with 400; validate early and wire PCM env through compose.
2026-08-11 05:52:39 -05:00
westfarn d3db6eed76 Document compose-safe DEFAULT_FROM_EMAIL quoting.
Deploy Beta / docker (push) Successful in 14s
Deploy Beta / unit-tests (push) Successful in 8s
Deploy Beta / deploy-beta (push) Successful in 1m39s
Docker Compose .env rejects "Name" <addr>; prefer a bare address or one pair of quotes around the whole From value.
2026-08-09 07:23:47 -05:00
westfarn 5b53ef376d Show SITE_NAME as the email From display name.
Deploy Beta / unit-tests (push) Successful in 9s
Deploy Beta / docker (push) Successful in 14s
Deploy Beta / deploy-beta (push) Failing after 1m20s
Bare DEFAULT_FROM_EMAIL addresses were rendering as "noreply" in inboxes; wrap them as "Monica Dhillon" <address>.
2026-08-09 06:54:20 -05:00
westfarn 7496af72d0 Fix PCM auth: login for API token and multi webhook secrets.
Deploy Beta / unit-tests (push) Successful in 8s
Deploy Beta / docker (push) Successful in 14s
Deploy Beta / deploy-beta (push) Successful in 1m34s
PCM DirectMail v3 needs POST /auth/login (apiKey+apiSecret) before design/order calls; accept each subscription's copy-only signature secret via PCM_WEBHOOK_SECRETS.
2026-08-09 06:02:32 -05:00
westfarn 1f7d78de64 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.
2026-08-08 07:32:55 -05:00