more fuckingfixes
This commit is contained in:
parent
74839c86bf
commit
c294ce4cff
@ -1621,10 +1621,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const baseUrl = window.location.origin;
|
const baseUrl = window.location.origin;
|
||||||
|
const magnetHash = file.torrent_info?.InfoHash || hash;
|
||||||
const links = {
|
const links = {
|
||||||
direct: `${baseUrl}/api/download/${hash}`,
|
direct: `${baseUrl}/api/download/${hash}`,
|
||||||
torrent: `${baseUrl}/api/torrent/${hash}`,
|
torrent: `${baseUrl}/api/torrent/${hash}`,
|
||||||
magnet: `magnet:?xt=urn:btih:${hash}&dn=${encodeURIComponent(file.name)}`,
|
magnet: `magnet:?xt=urn:btih:${magnetHash}&dn=${encodeURIComponent(file.name)}`,
|
||||||
stream: file.name.match(/\.(mp4|mkv|avi|mov)$/i) ? `${baseUrl}/api/stream/${hash}` : null
|
stream: file.name.match(/\.(mp4|mkv|avi|mov)$/i) ? `${baseUrl}/api/stream/${hash}` : null
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -613,10 +613,20 @@ class GatewayUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const baseUrl = window.location.origin;
|
const baseUrl = window.location.origin;
|
||||||
|
|
||||||
|
// Use torrent info hash for magnet link if available, otherwise use file hash
|
||||||
|
let magnetHash = hash;
|
||||||
|
if (fileData && fileData.torrent_info && fileData.torrent_info.InfoHash) {
|
||||||
|
magnetHash = fileData.torrent_info.InfoHash;
|
||||||
|
console.log('Using torrent InfoHash for magnet:', magnetHash);
|
||||||
|
} else {
|
||||||
|
console.log('No torrent InfoHash found, using file hash:', magnetHash);
|
||||||
|
}
|
||||||
|
|
||||||
const links = {
|
const links = {
|
||||||
direct: `${baseUrl}/api/download/${hash}`,
|
direct: `${baseUrl}/api/download/${hash}`,
|
||||||
torrent: `${baseUrl}/api/torrent/${hash}`,
|
torrent: `${baseUrl}/api/torrent/${hash}`,
|
||||||
magnet: `magnet:?xt=urn:btih:${hash}&dn=${encodeURIComponent(name)}`
|
magnet: `magnet:?xt=urn:btih:${magnetHash}&dn=${encodeURIComponent(name)}`
|
||||||
};
|
};
|
||||||
|
|
||||||
// Add streaming links if available
|
// Add streaming links if available
|
||||||
@ -628,7 +638,7 @@ class GatewayUI {
|
|||||||
this.showShareModal(name, links);
|
this.showShareModal(name, links);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to get file metadata:', error);
|
console.error('Failed to get file metadata:', error);
|
||||||
// Fallback to basic links
|
// Fallback to basic links (using file hash for magnet since we can't get torrent info)
|
||||||
const baseUrl = window.location.origin;
|
const baseUrl = window.location.origin;
|
||||||
const links = {
|
const links = {
|
||||||
direct: `${baseUrl}/api/download/${hash}`,
|
direct: `${baseUrl}/api/download/${hash}`,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user