feat: add scoped upload tokens
This commit is contained in:
17
nextjs/app/manage/_components/curl-upload-example.js
Normal file
17
nextjs/app/manage/_components/curl-upload-example.js
Normal file
@@ -0,0 +1,17 @@
|
||||
'use client';
|
||||
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
export function CurlUploadExample({ path, token = '', fileName = 'datei.pdf' }) {
|
||||
const [url, setUrl] = useState(path);
|
||||
|
||||
useEffect(() => {
|
||||
setUrl(new URL(path, window.location.origin).toString());
|
||||
}, [path]);
|
||||
|
||||
const header = token
|
||||
? `-H 'Authorization: Bearer ${token}'`
|
||||
: `-H 'X-File-Name: ${fileName}'`;
|
||||
|
||||
return <pre><code>{`curl -T ./${fileName} ${header} '${url}'`}</code></pre>;
|
||||
}
|
||||
Reference in New Issue
Block a user