import {createCryptoBackend} from './crypto-backend.js' import {getServers} from './servers.js' import {createProgressRing} from './progress.js' import {t} from './i18n.js' import { newXFTPAgent, closeXFTPAgent, uploadFile, encodeDescriptionURI, type EncryptedFileMetadata } from '../src/agent.js' import {getDescriptionServers, serverOrigin} from '../src/protocol/address.js' import {XFTPPermanentError} from '../src/client.js' const MAX_SIZE = 100 * 1024 * 1024 const ENCRYPT_WEIGHT = 0.15 const ENCRYPT_MIN_FILE_SIZE = 100 * 1024 const ENCRYPT_MIN_DISPLAY_MS = 1000 export function initUpload(app: HTMLElement) { app.innerHTML = `
${t('dropZone', 'Drag & drop a file here')}
${t('dropZoneHint', 'or')}
${t('maxSizeHint', 'Max 100 MB')}
${t('encrypting', 'Encrypting\u2026')}
${t('fileUploaded', 'File uploaded')}
${t('expiryHint', 'Files are typically available for 48 hours.')}
${t('securityNote1', 'Your file was encrypted in the browser before upload \u2014 the server never sees file contents.')}
${t('securityNote2', 'The link contains the decryption key in the hash fragment, which the browser never sends to any server.')}
${t('securityNote3', 'For maximum security, use the SimpleX app.')}