Commit a3f217e
The No Hands Company
fix+feat: comprehensive improvements across every feature
2FA — actually enforced at login
- auth.ts: OIDC callback checks totpCredentialsTable on every login
If 2FA is enabled, creates a pending session and redirects to /2fa-challenge
instead of completing login — 2FA can no longer be bypassed
- twoFactor.ts: POST /auth/2fa/complete endpoint upgrades pending → full session
- Backup code consumption now uses SELECT FOR UPDATE inside a DB transaction
preventing race conditions where two simultaneous requests could consume the
same backup code
- Session storage removed from setup route (secret returned to client directly)
- 2FA setup: removed redundant session mutation
Deploy environment — actually sent in API call
- DeploySite.tsx: environment state now included in POST /deploy body
- Toast message reflects staging vs production environment
Transfer tokens — Redis-backed, survive restarts
- transfer.ts: pendingTransfers Map replaced with Redis-backed store
getTransfer/storeTransfer/deleteTransfer helpers with Redis primary +
in-memory fallback when Redis is unavailable
- 24h TTL enforced in Redis with EX parameter
Prometheus gauges — now actually updated
- metricsCollector.ts: new background job, runs every 30s
Updates sitesTotal (by status), federationPeersTotal (by status),
syncQueueDepth, cacheEntries (domain/file) from live DB/in-memory state
- syncRetryQueue.ts: getSyncQueueDepth() exported
- index.ts: startMetricsCollector / stopMetricsCollector wired
monthlyBandwidthGb rollup — now calculated
- analyticsFlush.ts: after every buffer flush, runs SQL to update
sites.monthly_bandwidth_gb and sites.hit_count from site_analytics table
Uses current calendar month window; resets automatically on month boundary
Build pipeline improvements
- Parallel uploads: files now uploaded 8 at a time (was sequential)
- Environment variable injection: envVars object passed to build process
Dangerous server secrets stripped before env is passed to subprocess
- installCommand override: operators can bypass auto-detection
- buildEnv sanitization: removes SMTP_PASS, DATABASE_URL, REDIS_URL etc.
Analytics export + referrer breakdown
- GET /api/sites/:id/analytics/export?period=7d|30d|all — CSV download
Columns: hour, hits, bytes_served, unique_ips
- GET /api/sites/:id/analytics/referrers?period=7d|30d — aggregated referrers
Merges topReferrers JSONB across all hourly rows, returns top 50
Redirect rules — query string + regex matching
- matchRedirectPattern: complete rewrite supporting:
/page?utm_source=email — exact query key=value
/page?ref=* — wildcard value (captured as q_ref param)
/page?key — key must be present (any value)
/page?!logged_in — negation (key must be absent)
/page?a=1&!b — multiple constraints (all must pass)
^/regex.*$ — raw regex with named capture groups (?<id>\d+)
- All callers updated to pass req query string
- tests/unit/redirectPattern.test.ts: 25 test cases covering all patterns
CLI additions
- fh logs <site-id> — list recent builds
- fh logs <site-id> --build <id> — view full build log
- fh logs <site-id> --build <id> --follow — poll while running
- fh build <site-id> — trigger git build pipeline
--git-url, --branch, --command, --output, --env KEY=VAL, --install, --staging
--wait: stream logs until complete
- fh forms <site-id> — list form submissions
--form, --limit, --export <file.csv>, --json, --unread
Frontend pages
- /settings/2fa — TwoFactorSettings: full setup flow, QR code display,
backup code management, disable/regenerate
- /sites/:id/forms — FormInbox: three-pane email-client layout,
form filter sidebar, submission detail, CSV export, mark read, delete
- /sites/:id/builds — BuildHistory: live-polling build list, log viewer,
trigger new build form, auto-refresh while build running
- MySites: added Forms (Inbox icon) and Builds (GitBranch icon) buttons
to every site card alongside Analytics and Settings
DB schemas added
- emailQueue.ts: emailQueueTable + siteHealthChecksTable
- All new tables exported from schema/index.ts1 parent 2cef2d0 commit a3f217e
File tree
28 files changed
+1806
-148
lines changed- artifacts
- api-server
- src
- lib
- middleware
- routes
- tests/unit
- cli/src
- commands
- federated-hosting/src
- pages
- lib/db
- migrations
- src/schema
28 files changed
+1806
-148
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| 73 | + | |
| 74 | + | |
71 | 75 | | |
72 | 76 | | |
73 | 77 | | |
| |||
105 | 109 | | |
106 | 110 | | |
107 | 111 | | |
| 112 | + | |
| 113 | + | |
108 | 114 | | |
109 | 115 | | |
110 | 116 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
122 | 151 | | |
123 | 152 | | |
124 | 153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
| 4 | + | |
| 5 | + | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
24 | 10 | | |
25 | 11 | | |
26 | 12 | | |
| 13 | + | |
| 14 | + | |
27 | 15 | | |
28 | 16 | | |
29 | 17 | | |
| |||
34 | 22 | | |
35 | 23 | | |
36 | 24 | | |
37 | | - | |
| 25 | + | |
38 | 26 | | |
39 | 27 | | |
40 | 28 | | |
41 | 29 | | |
42 | 30 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
55 | 34 | | |
56 | 35 | | |
57 | 36 | | |
| |||
64 | 43 | | |
65 | 44 | | |
66 | 45 | | |
67 | | - | |
68 | | - | |
69 | | - | |
| 46 | + | |
| 47 | + | |
70 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
71 | 52 | | |
72 | | - | |
73 | | - | |
74 | | - | |
| 53 | + | |
75 | 54 | | |
76 | | - | |
77 | | - | |
| 55 | + | |
78 | 56 | | |
79 | 57 | | |
80 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
81 | 118 | | |
82 | 119 | | |
83 | 120 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
109 | 130 | | |
110 | 131 | | |
111 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
0 commit comments