Commit cb5e0de
committed
refactor(storage): trim to local + S3-compatible; add NAS exposure guide
Storage adapters trimmed from 9 to 2: keep LocalStorageAdapter and
S3StorageAdapter. Remove Google Drive, OneDrive, Dropbox, FTP, GCS,
Azure, and rclone-as-adapter. S3-compatible object storage covers
all of these use cases (MinIO, Cloudflare R2, Garage, SeaweedFS, Ceph
RGW, etc.) with a single, vendor-neutral code path that supports the
multipart semantics OpenCodeHub needs for large blobs.
Code:
- src/lib/storage.ts: rewrite (2331 -> 762 lines). Drop 7 adapter
classes and the driver-specific StorageConfig fields. Factory is
now strictly { local, s3 }.
- src/lib/git-storage.ts: isCloudStorage() = type === 's3' (fixes a
pre-existing bug where dropbox/ftp were silently treated as local).
- src/lib/validation.ts: StorageConfigSchema restricted to
['local', 's3'].
- src/lib/env-validation.ts: STORAGE_TYPE validator + S3-required
fields; gdrive/rclone validators removed.
- src/pages/api/admin/config/storage.ts: normalizeConfig() whitelists
drivers and sanitises the payload (was a passthrough spread, which
silently accepted removed fields).
- scripts/verify-env-config.ts: rewritten to verify the two supported
drivers end-to-end (was hardcoded to STORAGE_TYPE=gdrive).
- package.json: drop @google-cloud/storage, @azure/storage-blob,
googleapis, basic-ftp (4 packages, ~12 MB of transitive deps).
Configuration:
- .env.example: STORAGE_TYPE is the canonical var; drop the gcs/azure/
ftp/rclone/gdrive sections. Document that any S3-v4 vendor works
via STORAGE_ENDPOINT.
Documentation:
- docs/guides/storage-adapters.md + docs-site mirror: full rewrite
for local + S3 with preset configs for AWS S3, MinIO, Cloudflare R2,
Garage, SeaweedFS, Ceph RGW, Wasabi, Backblaze B2, DigitalOcean
Spaces.
- docs/administration/configuration.md (both versions): storage env
table updated; removed drivers called out explicitly.
- docs/administration/deployment.md, deploy-cpanel.md,
deploy-cyberpanel.md, deploy-cloudflare.md, installation.md
(both versions): STORAGE_DRIVER -> STORAGE_TYPE; canonical env
variable names throughout.
- docs/development/architecture.md: storage-layer diagram reduced to
two adapters; removed driver rows replaced with explanatory note.
- AGENTS.md: 8+ backends -> 2 backends; env table; section 6.4
rewritten.
- src/pages/admin/_storage-disabled.txt: rclone + rclone-sub-remote
options removed (file is intentionally not routed).
NEW: docs/administration/expose-nas.md + docs-site mirror
How to put OpenCodeHub on the public internet from a NAS or home
server WITHOUT port forwarding, covering:
1. Tailscale Funnel (WireGuard mesh + edge ingress)
2. Cloudflare Tunnel (outbound cloudflared daemon)
with a side-by-side comparison, NAS-specific install snippets
(Synology DSM, TrueNAS SCALE, QNAP, generic Linux), the right
TRUSTED_PROXIES values for each, an 8-item hardening checklist,
SSH-git note, and a troubleshooting section.
Validation:
- bun install -> 4 packages removed cleanly.
- bun run typecheck -> 0 errors.
- bun run lint -> 0 errors, 0 warnings, 478 hints.
- SKIP_REDIS_CHECK=1 bun run test -> 546/546 pass.
- bun run security:audit -> PASSED (0 disallowed high/critical).
- bun run scripts/verify-env-config.ts -> 10/10 storage checks pass.1 parent b382597 commit cb5e0de
27 files changed
Lines changed: 1594 additions & 2290 deletions
File tree
- docs-site/src/content/docs
- administration
- getting-started
- guides
- docs
- administration
- development
- getting-started
- guides
- scripts
- src
- lib
- pages
- admin
- api/admin/config
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
69 | 78 | | |
70 | 79 | | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
92 | 87 | | |
93 | 88 | | |
94 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
| 253 | + | |
| 254 | + | |
261 | 255 | | |
262 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
263 | 259 | | |
264 | 260 | | |
265 | 261 | | |
| |||
328 | 324 | | |
329 | 325 | | |
330 | 326 | | |
331 | | - | |
| 327 | + | |
332 | 328 | | |
333 | 329 | | |
334 | 330 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 12 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
43 | 48 | | |
44 | 49 | | |
45 | 50 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
134 | | - | |
| 133 | + | |
| 134 | + | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| |||
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
301 | | - | |
302 | | - | |
| 301 | + | |
| 302 | + | |
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
| 156 | + | |
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
| 146 | + | |
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
100 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
104 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
105 | 108 | | |
106 | 109 | | |
107 | 110 | | |
| |||
0 commit comments