Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release Version 3.0.0-alpha.12 #715

Merged
merged 427 commits into from
Aug 13, 2024
Merged

Release Version 3.0.0-alpha.12 #715

merged 427 commits into from
Aug 13, 2024

Conversation

josecelano
Copy link
Member

Release Version 3.0.0-alpha.12.

josecelano and others added 30 commits March 5, 2024 13:37
…rents

instead of reusing the `pieces` field in `torrust_torrents` table.

That decouples BEP-30 implementation. In the future we migth want to
remove support for BEP 30 since it's decrecated and not supported by
clients or libs.
7390616 refactor: [#301] add independent field root_hash in DB for BEP-30 torrents (Jose Celano)
4d7091d refactor: [#301] rename table field root_hash to is_bep_30 (Jose Celano)

Pull request description:

  Refactor BEP 30 implementation to make it clearer and simplify implementation.

  - [x] Rename table field `torrust_torrents::root_hash` to `is_bep_30`. It's not the `root hash` value in BEP 30. It's a flag for BEP 30 torrents.
  - [x] Don't reuse `torrust_torrents::pieces` field for BEP 30 torrents. Add a new field `root_hash`.

  BEP 30: https://www.bittorrent.org/beps/bep_0030.html

ACKs for top commit:
  josecelano:
    ACK 7390616

Tree-SHA512: 44404db360e60951856ff04570a48ab4d4adb8db98e26a1e31409bd86bee2b281fb5b95bbaf726c3089920eb4e720c4093661633f13d4fd8370dd0e5480c4dbd
…sponse

```json
{
    "data": {
        "torrent_id": 2,
        "uploader": "admin",
        "info_hash": "0c90fbf036e28370c1ec773401bc7620146b1d48",
        "title": "Test 01",
        "description": "Test 01",
        "category": {
            "id": 5,
            "category_id": 5,
            "name": "software",
            "num_torrents": 1
        },
        "upload_date": "2024-03-05 16:05:00",
        "file_size": 602515,
        "seeders": 0,
        "leechers": 0,
        "files": [
            {
                "path": [
                    "mandelbrot_set_01"
                ],
                "length": 602515,
                "md5sum": null
            }
        ],
        "trackers": [
            "udp://localhost:6969"
        ],
        "magnet_link": "magnet:?xt=urn:btih:0c90fbf036e28370c1ec773401bc7620146b1d48&dn=Test%2001&tr=udp%3A%2F%2Flocalhost%3A6969",
        "tags": [],
        "name": "mandelbrot_set_01",
        "comment": "Mandelbrot Set 01",
        "creation_date": 1687937540,
        "created_by": "Transmission/3.00 (bb6b5a062e)",
        "encoding": "UTF-8",
        "canonical_info_hash_group": [
            "d5eaff5bc75ed274da7c5294de3f6641dc0a90ce",
            "e126f473a9dee89217d7ae5982f9b21490ed2c3f"
        ]
    }
}
```

Notice the new field: `canonical_info_hash_group` at the end of the
JSON.
…ent details response

2abb62a chore: reset log level to info for developmentWq (Jose Celano)
3c719b1 chore: remove deprecated comment (Jose Celano)
601c358 feat: [#294] add canonical info-hash group top torrent details API response (Jose Celano)

Pull request description:

  Add to the responses (torrent details and after updating a torrent) the list of info-hashes that belong to the same canonical info-hash. Table `torrust_torrent_info_hashes`

  ```sql
  CREATE TABLE "torrust_torrent_info_hashes" (
  "info_hash"TEXT NOT NULL,
  "canonical_info_hash"TEXT NOT NULL,
  "original_is_known"BOOLEAN NOT NULL,
  PRIMARY KEY("info_hash"),
  FOREIGN KEY("canonical_info_hash") REFERENCES "torrust_torrents"("info_hash") ON DELETE CASCADE
  );
  ```

  New response for torrent details:

  ```json
  {
      "data": {
          "torrent_id": 2,
          "uploader": "admin",
          "info_hash": "0c90fbf036e28370c1ec773401bc7620146b1d48",
          "title": "Test 01",
          "description": "Test 01",
          "category": {
              "id": 5,
              "category_id": 5,
              "name": "software",
              "num_torrents": 1
          },
          "upload_date": "2024-03-05 16:05:00",
          "file_size": 602515,
          "seeders": 0,
          "leechers": 0,
          "files": [
              {
                  "path": [
                      "mandelbrot_set_01"
                  ],
                  "length": 602515,
                  "md5sum": null
              }
          ],
          "trackers": [
              "udp://localhost:6969"
          ],
          "magnet_link": "magnet:?xt=urn:btih:0c90fbf036e28370c1ec773401bc7620146b1d48&dn=Test%2001&tr=udp%3A%2F%2Flocalhost%3A6969",
          "tags": [],
          "name": "mandelbrot_set_01",
          "comment": "Mandelbrot Set 01",
          "creation_date": 1687937540,
          "created_by": "Transmission/3.00 (bb6b5a062e)",
          "encoding": "UTF-8",
          "canonical_info_hash_group": [
              "d5eaff5bc75ed274da7c5294de3f6641dc0a90ce",
              "e126f473a9dee89217d7ae5982f9b21490ed2c3f"
          ]
      }
  }
  ```

  Notice the new field `canonical_info_hash_group`.

  Both the `d5eaff5bc75ed274da7c5294de3f6641dc0a90ce` and `e126f473a9dee89217d7ae5982f9b21490ed2c3f` were uploaded torrents that produced the same canonical info-hash `0c90fbf036e28370c1ec773401bc7620146b1d48`

ACKs for top commit:
  josecelano:
    ACK 2abb62a

Tree-SHA512: 1bf5015ed5a8926f942648bb9a04c018ebb8aea195ce3ded2f9fc2f8f3f207586295d3a6eed4e98817a7b7af39ce0f42dbbbbd1b22fbbdde76772e2297ca836f
… torrents

Torrents with the same original or canonical infohash.
414d468 refactor: [#290] return 4009 intead of 400 trying to upload duplicate torrents (Jose Celano)
d500634 refactor: [#290] specific error for suplidatetorrent with a original infohashes (Jose Celano)

Pull request description:

  - [x] Return a specific error when a user tries to upload a torrent with an original infohash that already exists.
  - [x] Return 409 when a user tries to upload a torrent whose canonical or original infohash already exists (instead of 400).

ACKs for top commit:
  josecelano:
    ACK 414d468

Tree-SHA512: f918d65915212d470543ea9ebf9d85536670422aeac658bd58a9f6d488eb35ebcda3fbf3792b36a989ebc8a6c09163cc519cb77383baf3ebc9affa6565e1f967
to match latest changes in the database. From:

```json
{
    "data": {
        "torrent_id": 12,
        "info_hash": "c01f910ff0cc2a1b8c7a1f6ab948377604d8c464",
        "original_info_hash": "dc0c6be689b28696319263ef27f9df4da8ded0a2"
    }
}
```

To:

```
{
    "data": {
        "torrent_id": 12,
        "canonical_info_hash": "c01f910ff0cc2a1b8c7a1f6ab948377604d8c464",
        "info_hash": "dc0c6be689b28696319263ef27f9df4da8ded0a2"
    }
}
```
a7f43dc refactor: rename fields in upload torrent response (Jose Celano)

Pull request description:

  To match the latest changes in the database.

  From:

  ```json
  {
      "data": {
          "torrent_id": 12,
          "info_hash": "c01f910ff0cc2a1b8c7a1f6ab948377604d8c464",
          "original_info_hash": "dc0c6be689b28696319263ef27f9df4da8ded0a2"
      }
  }
  ```

  To:

  ```
  {
      "data": {
          "torrent_id": 12,
          "canonical_info_hash": "c01f910ff0cc2a1b8c7a1f6ab948377604d8c464",
          "info_hash": "dc0c6be689b28696319263ef27f9df4da8ded0a2"
      }
  }
  ```

ACKs for top commit:
  josecelano:
    ACK a7f43dc

Tree-SHA512: 7dca4271cdebc89c6011ed2bfb0f692bd000cdc6baac30b8845634ed9951c183fbbe7508045431e37a63b323869ce3368920e97b8ac98e35e8e9d6e17adf9c74
The table `torrust_torrents` has 8 secondary tables that reference it
with a foreign key:

```sql
FOREIGN KEY("torrent_id") REFERENCES "torrust_torrents"("torrent_id") ON DELETE CASCADE,
```

The migration fixed in this commit creates a new table in order to alter
it and drops the old one. However, when you drop the old table, SQLite
uses an implicit DELETE query for the `torrust_torrents` table which
triggers a DELETE ON CASCADE, deleting all the related records in
secondary tables.

The secondary tables are:

- torrust_torrent_files
- torrust_torrent_announce_urls
- torrust_torrent_info
- torrust_torrent_tracker_stats
- torrust_torrent_tag_links
- torrust_torrent_info_hashes
- torrust_torrent_http_seeds
- torrust_torrent_nodes

These tables store the torrent file fiel together with the master
`torrust_torrents`.
…void losing data

094ab8a fix: linter errors (Jose Celano)
bd935b3 fix: [#526] DB migration for SQLite. Backup secondary tables (Jose Celano)

Pull request description:

  The table `torrust_torrents` has 8 secondary tables that reference it with a foreign key:

  ```sql
  FOREIGN KEY("torrent_id") REFERENCES "torrust_torrents"("torrent_id") ON DELETE CASCADE,
  ```

  The migration fixed in this commit creates a new table in order to alter it and drops the old one. However, when you drop the old table, SQLite uses an implicit DELETE query for the `torrust_torrents` table which triggers a DELETE ON CASCADE, deleting all the related records in secondary tables.

  The secondary tables are:

  - torrust_torrent_files
  - torrust_torrent_announce_urls
  - torrust_torrent_info
  - torrust_torrent_tracker_stats
  - torrust_torrent_tag_links
  - torrust_torrent_info_hashes
  - torrust_torrent_http_seeds
  - torrust_torrent_nodes

  These tables store the torrent file fiel together with the master `torrust_torrents`.

ACKs for top commit:
  josecelano:
    ACK 094ab8a

Tree-SHA512: 631a40ac3645c67430831a681e04d91c0dc4a62efe9bb65036abb3bf992c1bb289b7af7ca3ca417c4cec0911a64c778b0e0fffedfe7dbf9f5ba1c8af28933f23
67f82b0 chore: bump which from 5.0.0 to 6.0.0 (Mario)
d7e3287 chore: bump log from 0.4.20 to 0.4.21 (Mario)
7148cf1 chore: bump indexmap from 2.2.3 to 2.2.5 (Mario)
7183953 chore: bump http from 1.0.0 to 1.1.0 (Mario)
0df72de chore(deps): bump clap from 4.5.1 to 4.5.2 (Mario)

Pull request description:

  Updates dependencies.

ACKs for top commit:
  josecelano:
    ACK 67f82b0

Tree-SHA512: eb118f20a1a432176b3d0092d835b8082e2c372a7f2cf251580f2471dfb820dbc8d4218e5ff039606846fe9d13a3eda49f10e1fefa78e8148eca8ed6081b991c
Add a new column to the table `torrust_torrent_tracker_stats` with the
datetime of the update date, which means the date when the stats
(leechers and seeders) were synchronized from the tracker API.
Instead of importing all torrents statistics from the tracker every
hour, this change imports 50 torrents every 100 milliseconds.

Batches only include torrents that have not been updated in the last
hour (or whatever is the `torrent_info_update_interval` value in the
configuration).

This change avoid loading the whole set of torrents in memory every time
the importation starts.

In the future, It could also allow to handle the nunber of request per
second to the tracker (statically, from config value or dinamically,
depending on the tracler load).

Althought it saves memory, it runs more SQL queries to get the list of
torrents pending to update.
… endpoint

There is a new feature inthe tracker API where you can get stats for a
list of infohashes:

<http://localhost:1212/api/v1/torrents?token=MyAccessToken&info_hash=f584cba7dd4008ecc026ac2dc0ce1ad179822f5f&info_hash=f59caeaf12e7bc8a289c39b698d085bc27eec1c2&info_hash=f6465cb6bd227e7c97d1de7cb426551af97eae41&info_hash=f655996ba112da8d0835463e6be4f47ff0bfef0c&info_hash=f68b7d6296d3e933b455c6107badf8dc6eeccadc&info_hash=f6a4eec77008786d91c344716ed2bb58570cdbd6&info_hash=f6ae9710af2d09faf8d337855e441087e2ff9286&info_hash=f6f89b0a54f3944f36027ff38ec950781e654836&info_hash=f77cfff1ab500a203c73141f98947acd7b5d0686&info_hash=f792faf15179d7c01fbf4647e96c28b155810f90&info_hash=f7c895711191b602211bc267fc0468c302f6974d&info_hash=f7d4589f96974ec030a798f943a82ecfdeb2f013&info_hash=f7ec8c6963cefcaf4c1b322358ac5d9edfb5b8b6&info_hash=f7fc543c48f1535692efa8e623e738bc67997eab&info_hash=f80ba0b3ad573a403e16d7b3d7c17863676f8f1f&info_hash=f871d2a6d41b30c4caa6255c653e1f02cd8996c1&info_hash=f894f06b6d0411f28d5906177103354db3f8340d&info_hash=f89b08ae4a4af5d1327b31bb1a6ed2f9b3d227b4&info_hash=f913667273b8562ec30366f8ba32e7e4a2f65742&info_hash=f9d5713cdf9539f1feffae05c04cfdbbcaea18a8&info_hash=f9eb982706d058dc855cc9a7528048631fff3d33&info_hash=f9fb61ad5aadf585dd86cb63e5bcc6dfed71f6fc&info_hash=faae957e9a3d7f9fd11074b3a49ce6dfd8d1c75b&info_hash=fb08e03e518fb7d5ae6ff73af3854d3e75a6b228&info_hash=fb25d2c0a0a109d90db1459547c926c8fd32f888&info_hash=fb6a3274e36bd2b4f5e3833308e57a0d7eb1cc27&info_hash=fb765107b4029569009003eeb4c87a5707612807&info_hash=fb994291a47627fa3b84849709965aa9bf781f58&info_hash=fba2da365997d3aab086cc2998274051f5a3cc8c&info_hash=fba992473ac2b1760fcda77b9877eeb4e48e4990&info_hash=fbdeb27908830e438eafd1a3f84a114ff0f428bf&info_hash=fbee94aeda72de1035ef8ee2dca861c722d5cf26&info_hash=fc82989b9f718f2fc3cb8487d1fe4ced411f9630&info_hash=fc89b80f119bc6ae91e7263b3f21db55b3fd16ad&info_hash=fcb85658c7ca1a82b5cc563af8165c4d20aa2d9e&info_hash=fcf40cb66b0bb72c9e478f07957a1ee9d140ce75&info_hash=fcf57886742d297d2017b2f83fa69ec8814a0d3d&info_hash=fd0bf9d869d2886a370f81838f978c2c26da4222&info_hash=fd3a4be495bd64a7e2ba4dc8b78eed1f8958f644&info_hash=fe0a1913ad2a1dfa8ddc93e02217c5d8ef384306&info_hash=fe28c9463c50d8febc1b7757553c05b725b42879&info_hash=fe7089ca13b7b218f4af8e98303cf1fbaacc90eb&info_hash=fea586402fccca172470715aa3558978d952799d&info_hash=fee8409338d889ee130dcee19bda84deee72da65&info_hash=ff01f0bf22e5f8483b8e82b2bc88c9c536a76bfa&info_hash=ff52b816d9bad366c2ed1232efd0711b3e262f92&info_hash=ff589afca896eb04bacf245e3c041e6feb54ab05&info_hash=ff6a1c9c60c16ff96115ee95a814017b5c1709a8&info_hash=ffe46c2247e844804adff54d770fe274d2d2e873&info_hash=fff0f6bb2eaae8b2e0e163d1acddd8ff2e4dec7e>

This way you can get many torrents stasts in one request.

This commit replaces the statistics importer to use this new endpoint
feature.
af7150b feat: [#469] import torrent stats using multiple torrents tracker API endpoint (Jose Celano)
16cbea8 feat: [#469] import torrent statistics in batches (Jose Celano)
feffd09 feat: [#469] add update datetime for tracker stasts importation (Jose Celano)

Pull request description:

  Currently, the Index imports statistics for all torrents every hour (1 hour is the default value in the configuration). We need to import stats for all torrents because we allow users to sort torrents by torrent stats (number of seeders and leechers). This PR improves a little bit the process.

  - [x] Add a new field (`updated_at`) to the table `torrust_torrent_tracker_stats` with the datetime when the stats were imported from the tracker. This is for logging purposes but it also helps to import torrents in batches. Regarding logging, it could help to check that the cronjob is running correctly.
  - [x] We get all torrents (`get_all_torrents_compact`) from the database. That could be big array of infohashes. We could obtain the 50 records that have not been updated for the longest time and run the importation every 100 milliseconds. We request the tracker API every 100 milliseconds getting 50 torrents. Those values can be adjusted in the future.
  - [x] A [new filter was added to the tracker API to get statistics for a list of torrents with one request](torrust/torrust-tracker#728). We can use it instead of getting one torrent at a time.

  **Pros:**

  - With millions of torrents we don't need to load all of them into memory.
  - The new field `updated_at` helps to monitor the importation process.
  - We get torrent stats for 50 torrents in one request instead of one request per torrent.

  **Cons:**

  - Every 100 milliseconds we run a query to check which torrent stats are pending to update.

ACKs for top commit:
  josecelano:
    ACK af7150b

Tree-SHA512: af1632282419457e20cc86e447b65d36c8e52dbff47e5c79cc1802fc6f67c759d572568f2846f65d4d5540049240ea82246df21d773ed1e6a285bde681fb423b
Minor refactoring to update deprecated functions calls
mario-nt and others added 25 commits August 3, 2024 17:01
```console
cargo update
    Updating crates.io index
     Locking 43 packages to latest compatible versions
      Adding aws-lc-rs v1.8.1
      Adding aws-lc-sys v0.20.1
    Updating axum-server v0.6.0 -> v0.7.1
      Adding bindgen v0.69.4
    Updating bytemuck v1.16.1 -> v1.16.3
    Updating bytes v1.6.1 -> v1.7.1
    Updating cc v1.1.6 -> v1.1.7
      Adding cexpr v0.6.0
      Adding clang-sys v1.8.1
    Updating clap v4.5.11 -> v4.5.13
    Updating clap_builder v4.5.11 -> v4.5.13
    Updating clap_derive v4.5.11 -> v4.5.13
      Adding cmake v0.1.50
      Adding dunce v1.0.5
    Updating email_address v0.2.7 -> v0.2.9
    Updating flate2 v1.0.30 -> v1.0.31
      Adding fs_extra v1.3.0
      Adding glob v0.3.1
    Updating indexmap v2.2.6 -> v2.3.0
      Adding itertools v0.12.1 (latest: v0.13.0)
      Adding lazycell v1.3.0
      Adding libloading v0.8.5
      Adding mirai-annotations v1.12.0
    Updating ppv-lite86 v0.2.17 -> v0.2.20
      Adding prettyplease v0.2.20
    Updating regex v1.10.5 -> v1.10.6
    Updating rgb v0.8.45 -> v0.8.47
      Adding rustc-hash v1.1.0 (latest: v2.0.0)
    Removing rustls v0.21.12
    Updating rustls-pemfile v2.1.2 -> v2.1.3
    Removing rustls-webpki v0.101.7
    Removing sct v0.7.1
    Updating serde_json v1.0.121 -> v1.0.122
      Adding shlex v1.3.0
    Updating tempfile v3.10.1 -> v3.11.0
    Removing tokio-rustls v0.24.1
    Updating toml v0.8.16 -> v0.8.19
    Updating toml_datetime v0.6.7 -> v0.6.8
    Updating toml_edit v0.22.17 -> v0.22.20
    Removing which v6.0.1
      Adding which v4.4.2 (latest: v6.0.2)
      Adding which v6.0.2
    Updating winapi-util v0.1.8 -> v0.1.9
      Adding windows-sys v0.59.0
    Updating winnow v0.6.16 -> v0.6.18
      Adding zeroize_derive v1.4.2
    Updating zstd-safe v7.2.0 -> v7.2.1
```
394a705 chore(deps): update depedencies (Jose Celano)

Pull request description:

  ```console
  cargo update
      Updating crates.io index
       Locking 43 packages to latest compatible versions
        Adding aws-lc-rs v1.8.1
        Adding aws-lc-sys v0.20.1
      Updating axum-server v0.6.0 -> v0.7.1
        Adding bindgen v0.69.4
      Updating bytemuck v1.16.1 -> v1.16.3
      Updating bytes v1.6.1 -> v1.7.1
      Updating cc v1.1.6 -> v1.1.7
        Adding cexpr v0.6.0
        Adding clang-sys v1.8.1
      Updating clap v4.5.11 -> v4.5.13
      Updating clap_builder v4.5.11 -> v4.5.13
      Updating clap_derive v4.5.11 -> v4.5.13
        Adding cmake v0.1.50
        Adding dunce v1.0.5
      Updating email_address v0.2.7 -> v0.2.9
      Updating flate2 v1.0.30 -> v1.0.31
        Adding fs_extra v1.3.0
        Adding glob v0.3.1
      Updating indexmap v2.2.6 -> v2.3.0
        Adding itertools v0.12.1 (latest: v0.13.0)
        Adding lazycell v1.3.0
        Adding libloading v0.8.5
        Adding mirai-annotations v1.12.0
      Updating ppv-lite86 v0.2.17 -> v0.2.20
        Adding prettyplease v0.2.20
      Updating regex v1.10.5 -> v1.10.6
      Updating rgb v0.8.45 -> v0.8.47
        Adding rustc-hash v1.1.0 (latest: v2.0.0)
      Removing rustls v0.21.12
      Updating rustls-pemfile v2.1.2 -> v2.1.3
      Removing rustls-webpki v0.101.7
      Removing sct v0.7.1
      Updating serde_json v1.0.121 -> v1.0.122
        Adding shlex v1.3.0
      Updating tempfile v3.10.1 -> v3.11.0
      Removing tokio-rustls v0.24.1
      Updating toml v0.8.16 -> v0.8.19
      Updating toml_datetime v0.6.7 -> v0.6.8
      Updating toml_edit v0.22.17 -> v0.22.20
      Removing which v6.0.1
        Adding which v4.4.2 (latest: v6.0.2)
        Adding which v6.0.2
      Updating winapi-util v0.1.8 -> v0.1.9
        Adding windows-sys v0.59.0
      Updating winnow v0.6.16 -> v0.6.18
        Adding zeroize_derive v1.4.2
      Updating zstd-safe v7.2.0 -> v7.2.1
  ```

ACKs for top commit:
  josecelano:
    ACK 394a705

Tree-SHA512: 287b747a0af2e15a18d4a2e368bc5f07d7571cacc6e21f13fdb494768041cd2573dd5e918520311dccb01f295e524894ff41de7c31b52264e1e28d391c81a9dc
f38b628 refactor: [#615] new authorization error for guest users (Mario)
d8b3ee2 refactor: [#615] change test http return code (Mario)
0360517 refactor: [#615] changed status code so tests pass (Mario)
6010155 refactor: [#615] handlers and functions now use optional user id (Mario)
c22c919 refactor: [#615] change password handler and function now use optional user id (Mario)
dbcd0e1  refactor: [#615] added missing error to handler comments (Mario)
00c293c  refactor: [#615] added missing error to function comments (Mario)
e527867 fix: [#615] adjusted http error code for test so it pass (Mario)
42fb031 refactor: [#615] renamed error to be more human friendly (Mario)
836c94d refactor: [#615] upload torrent handler now uses an optional user id (Mario)
935eb53 refactor: [#615] rearrange actions (Mario)
93b15ac refactor: [#615] renamed variables to maybe_user_id (Mario)
e614e2f feat: [#615] authorization layer added to the change password method of the user service (Mario)
543d804 refactor: [#615] redirect to details url with infohash method now calls the torrent service that implements the authorization layer (Mario)
f8e7570 feat: [#615] authorization layer added to the get torrent info method of the torrent service (Mario)
1342dce feat: [#615] authorization layer implemented for the get torrents handler (Mario)
f264e75 fix: [#615] fix unfinished comment (Mario)
d56d66c refactor: [#615] download torrent handler now calls the torrent service to get the canonical infohash (Mario)
b3ffc9f feat: [#615] new get canonical info hash method (Mario)
7bb6ff7 feat: [#615] authorization layer implemented for the get torrent method of the torrent service (Mario)
b5171bf feat: [#615] authorization layer added for add torrent method of the torrent service (Mario)
1c607c2 refactor: [#615] added optional logged in user to public handlers and methods (Mario)
b483c8e refactor: [#615] renamed variable (Mario)
2880f7c feat: [#615] added authorization layer for get public settings method of the settings service (Mario)
530f37a feat: [#615] admin user is now authorize to see proxied images (Mario)
d1d2941 refactor: [#615] fix linting errors (Mario)
056cb83 refactor: [#615] methods used by the proxy service now use the user id instead of the user compact type (Mario)
173f43d feat: [#615] authorization layer implemented for the proxy service (Mario)
4f6ea18 refactor: [#615] new action and reordered old ones for cohesion (Mario)
0ac5f9b refactor: [#615] get all categories handler now calls the category service which uses the authorization layer (Mario)
839a00d feat: [#615] New get categories service method (Mario)
fe11c2f refactor: [#615] added comments for new functions (Mario)
cd8f609 feat: [#615] authorization implemented for get tags method (Mario)
eee3349 refactor: [#615] new get tags service method (Mario)
6f8de80 feat: [#615] authorization service implemented for the about service (Mario)
a757c5c refactor: [#615] new about service and minor refactor to existing code (Mario)

Pull request description:

  Parent issue: #615

ACKs for top commit:
  josecelano:
    ACK f38b628

Tree-SHA512: d8d710af481b2480b0035ad13feaab15e6299f5767f4d68837a4a05c237fd3e0bdbccdfa46c0c625b11e7109dcb73879036debf7a51b7d83c856403878ce70d2
This is an unsatble feature. You can overwrite casbin configuration to
change permissions for roles:  guest, registered and admin.

You can do it by adding this toml file config section:

```toml
[unstable.auth.casbin]
model = """
[request_definition]
r = role, action

[policy_definition]
p = role, action

[policy_effect]
e = some(where (p.eft == allow))

[matchers]
m = r.role == p.role && r.action == p.action
"""

policy = """
admin, GetAboutPage
admin, GetLicensePage
admin, AddCategory
admin, DeleteCategory
admin, GetCategories
admin, GetImageByUrl
admin, GetSettings
admin, GetSettingsSecret
admin, GetPublicSettings
admin, AddTag
admin, DeleteTag
admin, GetTags
admin, AddTorrent
admin, GetTorrent
admin, DeleteTorrent
admin, GetTorrentInfo
admin, GenerateTorrentInfoListing
admin, GetCanonicalInfoHash
admin, ChangePassword
admin, BanUser
registered, GetAboutPage
registered, GetLicensePage
registered, GetCategories
registered, GetImageByUrl
registered, GetPublicSettings
registered, GetTags
registered, AddTorrent
registered, GetTorrent
registered, GetTorrentInfo
registered, GenerateTorrentInfoListing
registered, GetCanonicalInfoHash
registered, ChangePassword
guest, GetAboutPage
guest, GetLicensePage
guest, GetCategories
guest, GetPublicSettings
guest, GetTags
guest, GetTorrent
guest, GetTorrentInfo
guest, GenerateTorrentInfoListing
guest, GetCanonicalInfoHash
"""
```

For example, if you wnat to force users to login to see the torrent list
you can remove the following line from the policy:

```
guest, GenerateTorrentInfoListing
```

NOTICE: This is an unstable feature. It will panic with wrong
casbin configuration, invalid roles, etcetera.
c1a5c25 feat: [#702] allow overwriting casbin configuration (Jose Celano)

Pull request description:

  This is an **unstable** feature. You can overwrite casbin configuration to change permissions for roles:  guest, registered and admin.

  You can do it by adding this new section to the TOML config file:

  ```toml
  [unstable.auth.casbin]
  model = """
  [request_definition]
  r = role, action

  [policy_definition]
  p = role, action

  [policy_effect]
  e = some(where (p.eft == allow))

  [matchers]
  m = r.role == p.role && r.action == p.action
  """

  policy = """
  admin, GetAboutPage
  admin, GetLicensePage
  admin, AddCategory
  admin, DeleteCategory
  admin, GetCategories
  admin, GetImageByUrl
  admin, GetSettings
  admin, GetSettingsSecret
  admin, GetPublicSettings
  admin, AddTag
  admin, DeleteTag
  admin, GetTags
  admin, AddTorrent
  admin, GetTorrent
  admin, DeleteTorrent
  admin, GetTorrentInfo
  admin, GenerateTorrentInfoListing
  admin, GetCanonicalInfoHash
  admin, ChangePassword
  admin, BanUser
  registered, GetAboutPage
  registered, GetLicensePage
  registered, GetCategories
  registered, GetImageByUrl
  registered, GetPublicSettings
  registered, GetTags
  registered, AddTorrent
  registered, GetTorrent
  registered, GetTorrentInfo
  registered, GenerateTorrentInfoListing
  registered, GetCanonicalInfoHash
  registered, ChangePassword
  guest, GetAboutPage
  guest, GetLicensePage
  guest, GetCategories
  guest, GetPublicSettings
  guest, GetTags
  guest, GetTorrent
  guest, GetTorrentInfo
  guest, GenerateTorrentInfoListing
  guest, GetCanonicalInfoHash
  """
  ```

  For example, if you want to force users to log in to see the torrent list, you can remove the following line from the policy:

  ```
  guest, GenerateTorrentInfoListing
  ```

  **NOTICE**: This is an unstable feature. It will panic with wrong casbin configuration, invalid roles, etcetera.

ACKs for top commit:
  josecelano:
    ACK c1a5c25

Tree-SHA512: 2bcc4bc69befd081aeef730768b4fa0f13bed14dc9c5f522ddbd0aa534b7679dc7adb870147e17120ff70af8e626b76b8662ea9d584ec4b1e11e9842f7fca8e4
12316b1 chore: remove debugging code (Jose Celano)

Pull request description:

  Remove debugging code.

ACKs for top commit:
  josecelano:
    ACK 12316b1

Tree-SHA512: 97477a38ea4715fcee8c6a8a9f51a471e9d413a7eb198fda24adeb522fe6953525ca61a64912fc53c1685c72f7d397415fccc80143bc0a0fbfc6c2612da64a1d
```console
cargo update
    Updating crates.io index
     Locking 15 packages to latest compatible versions
    Updating cc v1.1.7 -> v1.1.10
    Updating clap v4.5.13 -> v4.5.15
    Updating clap_builder v4.5.13 -> v4.5.15
    Updating core-foundation-sys v0.8.6 -> v0.8.7
    Updating hyper-util v0.1.6 -> v0.1.7
    Updating mio v1.0.1 -> v1.0.2
    Updating object v0.36.2 -> v0.36.3
    Updating rgb v0.8.47 -> v0.8.48
    Updating rustls-pki-types v1.7.0 -> v1.8.0
    Updating serde v1.0.204 -> v1.0.206
    Updating serde_derive v1.0.204 -> v1.0.206
    Updating serde_json v1.0.122 -> v1.0.124
    Updating syn v2.0.72 -> v2.0.74
    Updating tempfile v3.11.0 -> v3.12.0
    Updating xml-rs v0.8.20 -> v0.8.21
```
6cb94c4 fix: linter errors (Jose Celano)
04c3199 chore(deps): update dependencies (Jose Celano)

Pull request description:

  Update dependencies and fix linter errors.

  ```console
  cargo update
      Updating crates.io index
       Locking 15 packages to latest compatible versions
      Updating cc v1.1.7 -> v1.1.10
      Updating clap v4.5.13 -> v4.5.15
      Updating clap_builder v4.5.13 -> v4.5.15
      Updating core-foundation-sys v0.8.6 -> v0.8.7
      Updating hyper-util v0.1.6 -> v0.1.7
      Updating mio v1.0.1 -> v1.0.2
      Updating object v0.36.2 -> v0.36.3
      Updating rgb v0.8.47 -> v0.8.48
      Updating rustls-pki-types v1.7.0 -> v1.8.0
      Updating serde v1.0.204 -> v1.0.206
      Updating serde_derive v1.0.204 -> v1.0.206
      Updating serde_json v1.0.122 -> v1.0.124
      Updating syn v2.0.72 -> v2.0.74
      Updating tempfile v3.11.0 -> v3.12.0
      Updating xml-rs v0.8.20 -> v0.8.21
  ```

ACKs for top commit:
  josecelano:
    ACK 6cb94c4

Tree-SHA512: 6d3f7d3aa0077043a799d42582e9bc48b6a926ee6637bfba9ce32d510c2cb6b2e000742939730d9698e9a6bf2bc3286e7dc94a49ddfcf89e43f454eca36f5dd8
- `tracker.token`
- `auth.user_claim_token_pepper`

It keeps the default for the SMPT server credential ebcuase they are not
always needed.

- `mail.smpt.credentials.password`
This changes were missing when the issue was implemented.

See #653.
cb0e375 fix: [#653] rename auth.secret_key config option (Jose Celano)
7b3cc13 fix: [710] make secrets in config options mandatory (Jose Celano)

Pull request description:

  Make secrets in config options mandatory:

  - `tracker.token`
  - `auth.user_claim_token_pepper`

  It keeps the SMPT server credentials default because they are not always needed:

  - `mail.smpt.credentials.password`

  For example, for the mailcatcher.

ACKs for top commit:
  josecelano:
    ACK cb0e375

Tree-SHA512: e5ab0e297143ba57513ed370c7e1227200ae454d7232c6302bf0fe6e0194e790e3f241bdeea256ceddd0ae1b808d67c4b45a8e9de2bf2d035f35bca1c31e964b
…velop

4c568f8 chore: synchronize version with tracker 3.0.0-alpha.12-develop (Jose Celano)

Pull request description:

  I'm releasing the version `3.0.0-alpha.12` for all Tracker, Index and Index GUI packages following the [release plan](https://github.com/torrust/torrust-index/wiki/Releases).

Top commit has no ACKs.

Tree-SHA512: 0623db7e45beb8b4621ebdece5df2054b5f32bd67d77e51c272cbfb96542598a76e8de8506e8b0dbb959cc7dda45478fd5ebc9315585786ac26f53bc9fcaabd2
@josecelano josecelano changed the base branch from develop to main August 13, 2024 11:27
@josecelano josecelano requested a review from a team as a code owner August 13, 2024 11:27
@josecelano josecelano requested a review from da2ce7 August 13, 2024 11:27
@josecelano josecelano merged commit 9da22d8 into main Aug 13, 2024
17 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants