Fix bugs: office auth, PDF worker, sidebar pins, direct downloads
All checks were successful
Automated Container Build / build-and-push (push) Successful in 1m0s
All checks were successful
Automated Container Build / build-and-push (push) Successful in 1m0s
This commit is contained in:
parent
e88243f097
commit
bfe55e2bfc
6 changed files with 74 additions and 32 deletions
|
|
@ -1395,7 +1395,27 @@ export default function FileExplorer({ onLogout }: FileExplorerProps) {
|
|||
<div className="w-4 h-4 flex items-center justify-center flex-shrink-0 [&>svg]:w-4 [&>svg]:h-4">
|
||||
{getFileIcon(file)}
|
||||
</div>
|
||||
<span className="truncate flex-1" title={getFileDisplayName(file.name, file.is_dir)}>{getFileDisplayName(file.name, file.is_dir)}</span>
|
||||
{renaming === file.path ? (
|
||||
<input
|
||||
type="text"
|
||||
value={newName}
|
||||
onChange={(e) => setNewName(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter') handleRename(file.path, file.name, file.is_dir);
|
||||
if (e.key === 'Escape') setRenaming(null);
|
||||
}}
|
||||
onBlur={() => handleRename(file.path, file.name, file.is_dir)}
|
||||
autoFocus
|
||||
onFocus={(e) => e.target.select()}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
className="flex-1 text-sm bg-transparent outline-none w-full"
|
||||
style={{ color: 'var(--color-text-primary)', borderBottom: '1px solid var(--color-accent)' }}
|
||||
/>
|
||||
) : (
|
||||
<span className="truncate flex-1" title={getFileDisplayName(file.name, file.is_dir)}>
|
||||
{getFileDisplayName(file.name, file.is_dir)}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
))
|
||||
)}
|
||||
|
|
@ -2274,23 +2294,27 @@ export default function FileExplorer({ onLogout }: FileExplorerProps) {
|
|||
className="p-2 hover:bg-white/5 rounded-lg transition-colors flex items-center gap-2 text-sm"
|
||||
style={{ color: 'var(--color-text-primary)' }}
|
||||
title="Download Selected"
|
||||
onClick={() => {
|
||||
if (!downloadToken) return;
|
||||
const form = document.createElement('form');
|
||||
form.method = 'POST';
|
||||
form.action = api.getBulkDownloadUrl(downloadToken);
|
||||
form.target = '_blank';
|
||||
|
||||
const input = document.createElement('input');
|
||||
input.type = 'hidden';
|
||||
input.name = 'paths';
|
||||
input.value = JSON.stringify(Array.from(selectedFiles));
|
||||
form.appendChild(input);
|
||||
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
document.body.removeChild(form);
|
||||
setSelectedFiles(new Set());
|
||||
onClick={async () => {
|
||||
try {
|
||||
const token = await api.createDownloadToken();
|
||||
const form = document.createElement('form');
|
||||
form.method = 'POST';
|
||||
form.action = api.getBulkDownloadUrl(token);
|
||||
form.target = '_blank';
|
||||
|
||||
const input = document.createElement('input');
|
||||
input.type = 'hidden';
|
||||
input.name = 'paths';
|
||||
input.value = JSON.stringify(Array.from(selectedFiles));
|
||||
form.appendChild(input);
|
||||
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
document.body.removeChild(form);
|
||||
setSelectedFiles(new Set());
|
||||
} catch (err) {
|
||||
console.error("Failed to download selected files", err);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Download className="w-4 h-4" />
|
||||
|
|
@ -2385,20 +2409,28 @@ export default function FileExplorer({ onLogout }: FileExplorerProps) {
|
|||
<ContextMenuItem
|
||||
icon={<Download className="w-4 h-4" />}
|
||||
label="Download Folder"
|
||||
onClick={() => {
|
||||
if (!downloadToken) return;
|
||||
window.location.href = api.getDownloadFolderUrl(contextMenu.file.path, downloadToken);
|
||||
setContextMenu(null);
|
||||
onClick={async () => {
|
||||
try {
|
||||
const token = await api.createDownloadToken();
|
||||
window.location.href = api.getDownloadFolderUrl(contextMenu.file.path, token);
|
||||
setContextMenu(null);
|
||||
} catch (err) {
|
||||
console.error("Failed to download folder", err);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<ContextMenuItem
|
||||
icon={<Download className="w-4 h-4" />}
|
||||
label="Download"
|
||||
onClick={() => {
|
||||
if (!downloadToken) return;
|
||||
window.location.href = api.getDownloadUrl(contextMenu.file.path, downloadToken);
|
||||
setContextMenu(null);
|
||||
onClick={async () => {
|
||||
try {
|
||||
const token = await api.createDownloadToken();
|
||||
window.location.href = api.getDownloadUrl(contextMenu.file.path, token, true);
|
||||
setContextMenu(null);
|
||||
} catch (err) {
|
||||
console.error("Failed to download file", err);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
|
|
|||
Reference in a new issue