22 lines
558 B
TypeScript
22 lines
558 B
TypeScript
import { proxyBox, withBox } from '@/lib/agent-worker-proxy';
|
|
|
|
export const GET = async (request: Request) =>
|
|
await withBox(async (username) => {
|
|
const url = new URL(request.url);
|
|
return await proxyBox(
|
|
username,
|
|
'file',
|
|
{ method: 'GET' },
|
|
new URLSearchParams({ path: url.searchParams.get('path') ?? '' }),
|
|
);
|
|
});
|
|
|
|
export const PUT = async (request: Request) =>
|
|
await withBox(
|
|
async (username) =>
|
|
await proxyBox(username, 'file', {
|
|
method: 'PUT',
|
|
body: await request.text(),
|
|
}),
|
|
);
|