mirror of
https://github.com/shuaiplus/nodewarden.git
synced 2026-06-20 21:00:41 +00:00
feat: implement direct file upload for sends with JWT token validation
- Added `processSendFileUpload` function to handle file uploads for sends. - Integrated JWT token creation and verification for secure file uploads. - Updated `handleCreateFileSendV2` and `handleGetSendFileUpload` to use new upload URL generation. - Refactored upload handling in `handleUploadSendFile` and `handlePublicUploadSendFile` to utilize the new upload process. - Introduced `uploadDirectEncryptedPayload` for handling direct uploads with progress tracking. - Enhanced API routes to support both POST and PUT methods for attachment uploads. - Added localization strings for upload progress messages. - Created utility functions for direct upload URL building and payload parsing.
This commit is contained in:
@@ -18,6 +18,8 @@ interface VaultEditorProps {
|
||||
localError: string;
|
||||
downloadingAttachmentKey: string;
|
||||
attachmentDownloadPercent: number | null;
|
||||
uploadingAttachmentName: string;
|
||||
attachmentUploadPercent: number | null;
|
||||
onUpdateDraft: (patch: Partial<VaultDraft>) => void;
|
||||
onSeedSshDefaults: (force?: boolean) => void;
|
||||
onUpdateSshPublicKey: (value: string) => void;
|
||||
@@ -42,6 +44,13 @@ export default function VaultEditor(props: VaultEditorProps) {
|
||||
? t('txt_downloading')
|
||||
: t('txt_downloading_percent', { percent: props.attachmentDownloadPercent });
|
||||
};
|
||||
const uploadLabel =
|
||||
props.attachmentUploadPercent == null
|
||||
? t('txt_uploading_attachment_named', { name: props.uploadingAttachmentName || t('txt_attachment') })
|
||||
: t('txt_uploading_attachment_named_percent', {
|
||||
name: props.uploadingAttachmentName || t('txt_attachment'),
|
||||
percent: props.attachmentUploadPercent,
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -220,6 +229,7 @@ export default function VaultEditor(props: VaultEditorProps) {
|
||||
<Plus size={14} className="btn-icon" />
|
||||
</button>
|
||||
</div>
|
||||
{!!props.uploadingAttachmentName && <div className="detail-sub">{uploadLabel}</div>}
|
||||
{!props.isCreating && props.selectedCipher && props.editExistingAttachments.length > 0 && (
|
||||
<div className="attachment-list">
|
||||
{props.editExistingAttachments.map((attachment) => {
|
||||
|
||||
Reference in New Issue
Block a user