SHA256
Перевести вложения DM на R2 и обновить файловый API
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { bytesToBase64Url } from './crypto-utils.js';
|
||||
import { encodePublicPiecesRoot } from './public-pieces-root.js';
|
||||
import { computeTorrentV2PieceRoot, TorrentV2PieceAccumulator, TORRENT_V2_PIECE_BYTES } from './torrent-v2-service.js';
|
||||
|
||||
export const R2_MAX_FILE_BYTES = 500 * 1024 * 1024;
|
||||
@@ -18,5 +18,5 @@ export async function preparePublicFile(file, { onProgress = null } = {}) {
|
||||
onProgress?.(Math.min(file.size, offset + bytes.byteLength), file.size);
|
||||
}
|
||||
const root = await accumulator.finalize();
|
||||
return { file, name: String(file.name || 'file'), size: file.size, mm: fileMime(file), pr: bytesToBase64Url(root) };
|
||||
return { file, name: String(file.name || 'file'), size: file.size, mm: fileMime(file), pr: encodePublicPiecesRoot(root) };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user