feat: Add optional public upload folder naming
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
@@ -219,6 +219,8 @@ async function uploadWhole(next){
|
||||
form.append('session_id', sessionId);
|
||||
form.append('last_modified', next.file.lastModified || '');
|
||||
if (INVITE_TOKEN) form.append('invite_token', INVITE_TOKEN);
|
||||
const publicFolderName = document.getElementById('publicFolderName')?.value?.trim();
|
||||
if (publicFolderName) form.append('public_folder_name', publicFolderName);
|
||||
form.append('fingerprint', FINGERPRINT);
|
||||
const res = await fetch('/api/upload', { method:'POST', body: form });
|
||||
const body = await res.json().catch(()=>({}));
|
||||
@@ -240,6 +242,7 @@ async function uploadWhole(next){
|
||||
async function uploadChunked(next){
|
||||
const chunkBytes = Math.max(1, CFG.chunk_size_mb|0) * 1024 * 1024;
|
||||
const total = Math.ceil(next.file.size / chunkBytes) || 1;
|
||||
const publicFolderName = document.getElementById('publicFolderName')?.value?.trim();
|
||||
// init
|
||||
try {
|
||||
await fetch('/api/upload/chunk/init', { method:'POST', headers:{'Content-Type':'application/json','Accept':'application/json'}, body: JSON.stringify({
|
||||
@@ -250,7 +253,8 @@ async function uploadChunked(next){
|
||||
last_modified: next.file.lastModified || '',
|
||||
invite_token: INVITE_TOKEN || '',
|
||||
content_type: next.file.type || 'application/octet-stream',
|
||||
fingerprint: FINGERPRINT
|
||||
fingerprint: FINGERPRINT,
|
||||
public_folder_name: publicFolderName || ''
|
||||
}) });
|
||||
} catch {}
|
||||
// upload parts
|
||||
|
||||
@@ -45,6 +45,8 @@
|
||||
</div>
|
||||
|
||||
<div class="mt-4 text-sm text-gray-500 dark:text-gray-400">
|
||||
<label for="publicFolderName" class="font-medium">Optional folder name:</label>
|
||||
<input type="text" id="publicFolderName" name="publicFolderName" maxlength="64" placeholder="e.g., Soccer game" class="mt-1 mx-auto block w-full max-w-sm rounded-lg border border-gray-300 bg-gray-50 p-2 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500">
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user