mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-02 10:52:27 +00:00
Refactor R2 key prefix for deterministic identifiers
This commit is contained in:
1 parent
00b0e85438
commit
c02db755ac
6 files changed
+42
-12
No files matched your search
@@ -844,6 +844,11 @@ class R2Service {
|
||||
this.updateCloudflareProgress(0);
|
||||
this.setCloudflareUploading(true);
|
||||
|
||||
const normalizedInfoHash = normalizeInfoHash(infoHash);
|
||||
const keyIdentifier = isValidInfoHash(normalizedInfoHash)
|
||||
? normalizedInfoHash
|
||||
: "";
|
||||
|
||||
let bucketResult = null;
|
||||
try {
|
||||
bucketResult = await this.ensureBucketConfigForNpub(npub, {
|
||||
@@ -880,7 +885,7 @@ class R2Service {
|
||||
this.setCloudflareUploadStatus(statusMessage, "info");
|
||||
|
||||
// Use forced keys if provided, otherwise generate them
|
||||
const key = forcedVideoKey || buildR2Key(npub, file);
|
||||
const key = forcedVideoKey || buildR2Key(npub, file, keyIdentifier);
|
||||
const publicUrl = forcedVideoUrl || buildPublicUrl(bucketEntry.publicBaseUrl, key);
|
||||
|
||||
const buildTorrentKey = () => {
|
||||
@@ -978,7 +983,6 @@ class R2Service {
|
||||
// - `xs` (eXact Source): The URL to the .torrent file on R2. This allows
|
||||
// clients to fetch metadata (file structure, piece hashes) instantly via HTTP
|
||||
// instead of waiting to fetch it from the DHT (which can take minutes).
|
||||
const normalizedInfoHash = normalizeInfoHash(infoHash);
|
||||
const hasValidInfoHash = isValidInfoHash(normalizedInfoHash);
|
||||
let generatedMagnet = "";
|
||||
let generatedWs = "";
|
||||
|
||||
Reference in new issue
Block a user