Skip to content

Commit d2764e2

Browse files
committed
bug fixes: correct infohash on upload when torrent manipulated, handle undefined ext blacklist, fix disabled download with no ratio
1 parent f19e76f commit d2764e2

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

api/src/controllers/torrent.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ export const uploadTorrent = async (req, res, next) => {
6666

6767
const user = await User.findOne({ _id: req.userId }).lean();
6868

69+
parsed.info.private = 1;
70+
parsed.announce = `${process.env.SQ_BASE_URL}/sq/${user.uid}/announce`;
71+
delete parsed["announce-list"];
72+
6973
const infoHash = crypto
7074
.createHash("sha1")
7175
.update(bencode.encode(parsed.info))
@@ -78,10 +82,6 @@ export const uploadTorrent = async (req, res, next) => {
7882
return;
7983
}
8084

81-
parsed.info.private = 1;
82-
parsed.announce = `${process.env.SQ_BASE_URL}/sq/${user.uid}/announce`;
83-
delete parsed["announce-list"];
84-
8585
let files;
8686
if (parsed.info.files) {
8787
files = parsed.info.files.map((file) => ({

client/pages/torrent/[infoHash].js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ const Torrent = ({ token, torrent = {}, userId, userRole, uid, userStats }) => {
485485

486486
const downloadDisabled =
487487
(Number(SQ_MINIMUM_RATIO) !== -1 &&
488+
userStats.ratio !== -1 &&
488489
userStats.ratio < Number(SQ_MINIMUM_RATIO)) ||
489490
(Number(SQ_MAXIMUM_HIT_N_RUNS) !== -1 &&
490491
userStats.hitnruns > Number(SQ_MAXIMUM_HIT_N_RUNS));

client/pages/upload.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ const Upload = ({ token, userId }) => {
191191
SQ_API_URL,
192192
SQ_TORRENT_CATEGORIES,
193193
SQ_ALLOW_ANONYMOUS_UPLOAD,
194-
SQ_EXTENSION_BLACKLIST,
194+
SQ_EXTENSION_BLACKLIST = [],
195195
},
196196
} = getConfig();
197197

0 commit comments

Comments
 (0)