Skip to content

Commit 384a07f

Browse files
committed
Merge #498: After uploading a torrent show a message to the user if the torrent info-hash changes
32b07df docs: add Canonical Infohash Group info to user guide (Jose Celano) 4afc1a8 feat: [#242] improve message after uploading when infohash changes (Jose Celano) Pull request description: After uploading a torrent show a message to the user if the torrent info-hash changes. ACKs for top commit: josecelano: ACK 32b07df Tree-SHA512: 07c557d25f90025395726d062ccdb0ca532d15889a5a3e54d682adef7f0a26f1f504f0e2035854791fa66ffe6b2b47a127112b890041a1a2ceb585163ee2488b
2 parents ab9769a + 32b07df commit 384a07f

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

docs/user_guide.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,33 @@ You can add a PNG image with:
2424

2525
The image will be proxied by the backend. This means that the image will be downloaded by the backend and served by the backend itself. The backend will cache the image but you have to make sure that the image is available at the URL you provided.
2626

27+
### Canonical Infohash Group
28+
29+
We only support standard fields in the torrent info dictionary.
30+
31+
```rust
32+
pub struct TorrentInfoDictionary {
33+
pub name: String,
34+
pub pieces: Option<ByteBuf>,
35+
pub piece_length: i64,
36+
pub md5sum: Option<String>,
37+
pub length: Option<i64>,
38+
pub files: Option<Vec<TorrentFile>>,
39+
pub private: Option<u8>,
40+
pub path: Option<Vec<String>>,
41+
pub root_hash: Option<String>,
42+
pub source: Option<String>,
43+
}
44+
```
45+
46+
Check the data structure [TorrentInfoDictionary](https://github.com/torrust/torrust-index/blob/develop/src/models/torrent_file.rs) for an updated version of the supported fields.
47+
48+
We allow uploading torrents with other custom fields, however those extra fields are removed from the torrent `info` dictionary. That causes the infohash to change. We call the "Canonical Infohash" the resulting infohash after removing the non-standard fields from the `info` dictionary.
49+
50+
You can use the original infohash in URLs to navigate to the torrent details and you also have a list of original infohashes belonging to the same infohash group in the torrent details.
51+
52+
If you think there is an important field missing in the `info` dictionary, please open an issue.
53+
2754
## Categories
2855

2956
Torrents can have only one category. You have to assign a category to your torrent when you upload it.

pages/upload.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,17 @@ function submitForm () {
160160
.then((new_torrent) => {
161161
uploading.value = false;
162162
163+
let text = "Torrent uploaded!";
164+
165+
if (new_torrent.canonical_info_hash !== new_torrent.info_hash) {
166+
text += ` Original infohash ${new_torrent.info_hash} has changed because non-standard info dictionary fields were removed. New infohash is ${new_torrent.canonical_info_hash}`;
167+
}
168+
163169
notify({
164170
group: "success",
165171
title: "Success",
166-
text: "Torrent uploaded!"
167-
}, 4000);
172+
text
173+
}, 8000);
168174
169175
navigateTo(`/torrent/${new_torrent.canonical_info_hash}`, { replace: true });
170176
})

project-words.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ nuxtjs
1616
proxied
1717
Quickstart
1818
signin
19+
struct
1920
uuidv
2021
vuex

0 commit comments

Comments
 (0)