Skip to content

Commit d19179e

Browse files
authored
Docs update
1 parent b1f48db commit d19179e

16 files changed

Lines changed: 483 additions & 278 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ devbox creates isolated development environments, contained in a project's Docke
2424
```bash
2525
# Using the install script
2626
curl -fsSL https://raw.githubusercontent.com/itzCozi/devbox/main/install.sh | bash
27-
# Or manually: https://devbox.ar0.eu/install/#manual-build-from-source
27+
# Or manually: https://devbox.ar0.eu/docs/install/#manual-build-from-source
2828
```
2929

3030
## Quick Start

docs/astro.config.mjs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export default defineConfig({
1616
light: './src/assets/logo-dark.png',
1717
dark: './src/assets/logo.png',
1818
},
19+
lastUpdated: true,
1920
components: {
2021
Footer: './src/components/CustomFooter.astro',
2122
},
@@ -30,31 +31,31 @@ export default defineConfig({
3031
{
3132
label: 'Getting Started',
3233
items: [
33-
{ label: 'Introduction', slug: 'intro' },
34-
{ label: 'Quick Start', slug: 'start' },
35-
{ label: 'Installation', slug: 'install' },
34+
{ label: 'Introduction', slug: 'docs/intro' },
35+
{ label: 'Quick Start', slug: 'docs/start' },
36+
{ label: 'Installation', slug: 'docs/install' },
3637
],
3738
},
3839
{
3940
label: 'Configuration',
4041
collapsed: true,
4142
items: [
42-
{ label: 'Configuration Files', slug: 'configuration' },
43-
{ label: 'Templates & Setup', slug: 'templates' },
43+
{ label: 'Configuration Files', slug: 'docs/configuration' },
44+
{ label: 'Templates & Setup', slug: 'docs/templates' },
4445
],
4546
},
4647
{
4748
label: 'Maintenance',
4849
collapsed: true,
4950
items: [
50-
{ label: 'Cleanup & Maintenance', slug: 'cleanup-maintenance' },
51-
{ label: 'Troubleshooting', slug: 'troubleshooting' },
51+
{ label: 'Cleanup & Maintenance', slug: 'docs/cleanup-maintenance' },
52+
{ label: 'Troubleshooting', slug: 'docs/troubleshooting' },
5253
],
5354
},
5455
{
5556
label: 'Reference',
5657
items: [
57-
{ label: 'CLI Commands', slug: 'cli' },
58+
{ label: 'CLI Commands', slug: 'docs/cli' },
5859
],
5960
},
6061
],

docs/functions/install.sh.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Cloudflare Pages Function: Serve /install.sh by proxying the GitHub raw file.
2+
// Keeps https://devbox.ar0.eu/install.sh in sync with the repository's install.sh.
3+
4+
export async function onRequest(context) {
5+
const upstreamUrl = 'https://raw.githubusercontent.com/itzCozi/devbox/main/install.sh';
6+
7+
// Forward conditional request headers for better caching (ETag support)
8+
const headers = new Headers();
9+
const ifNoneMatch = context.request.headers.get('If-None-Match');
10+
const ifModifiedSince = context.request.headers.get('If-Modified-Since');
11+
if (ifNoneMatch) headers.set('If-None-Match', ifNoneMatch);
12+
if (ifModifiedSince) headers.set('If-Modified-Since', ifModifiedSince);
13+
14+
try {
15+
const upstream = await fetch(upstreamUrl, {
16+
headers,
17+
// Hint Cloudflare cache; even if ignored, upstream ETag will help
18+
cf: { cacheEverything: true, cacheTtl: 300 },
19+
});
20+
21+
if (upstream.status === 304) {
22+
return new Response(null, { status: 304 });
23+
}
24+
25+
if (upstream.ok) {
26+
const respHeaders = new Headers(upstream.headers);
27+
// Ensure correct content type
28+
respHeaders.set('Content-Type', 'text/x-shellscript; charset=utf-8');
29+
// Cache for 5 minutes at edge/browsers
30+
respHeaders.set('Cache-Control', 'public, max-age=300, s-maxage=300');
31+
// Optional CORS for curl/wget from other origins
32+
respHeaders.set('Access-Control-Allow-Origin', '*');
33+
return new Response(upstream.body, { status: 200, headers: respHeaders });
34+
}
35+
36+
// Fallback: temporary redirect to the upstream if proxy fetch fails
37+
return Response.redirect(upstreamUrl, 302);
38+
} catch (err) {
39+
return Response.redirect(upstreamUrl, 302);
40+
}
41+
}

0 commit comments

Comments
 (0)