feat: Add optional public upload folder naming

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2026-01-06 16:15:46 -07:00
parent 4de027cfc3
commit 1004b4ab7f
3 changed files with 31 additions and 4 deletions

View File

@@ -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