merged
This commit is contained in:
@@ -7,6 +7,10 @@ import node from '@astrojs/node';
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
output: 'server',
|
||||
image: {
|
||||
service: { entrypoint: 'astro/assets/services/noop' }
|
||||
},
|
||||
vite: {
|
||||
plugins: [tailwindcss()]
|
||||
},
|
||||
|
||||
20
frontend/src/pages/uploads/[...path].astro
Normal file
20
frontend/src/pages/uploads/[...path].astro
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
const { path } = Astro.params;
|
||||
const API_URL = import.meta.env.PUBLIC_API_URL || 'http://localhost:3000';
|
||||
|
||||
const response = await fetch(`${API_URL}/uploads/${path}`);
|
||||
|
||||
if (!response.ok) {
|
||||
return new Response(null, { status: 404 });
|
||||
}
|
||||
|
||||
const blob = await response.blob();
|
||||
const contentType = response.headers.get('content-type');
|
||||
|
||||
return new Response(blob, {
|
||||
headers: {
|
||||
'content-type': contentType || 'application/octet-stream',
|
||||
'cache-control': 'public, max-age=3600'
|
||||
}
|
||||
});
|
||||
---
|
||||
Reference in New Issue
Block a user