Skip to content

feat: Start supporting magnet upload#17

Open
angrynode wants to merge 7 commits intoaxumfrom
magnet-form
Open

feat: Start supporting magnet upload#17
angrynode wants to merge 7 commits intoaxumfrom
magnet-form

Conversation

@angrynode
Copy link
Owner

@angrynode angrynode commented Nov 14, 2025

Only parsing of the magnet upload is supported yet.

TODO:

  • Create magnet table in DB with migration
  • Save magnet in DB

In a future PR:

  • Create torrent table in DB
  • Start background task to resolve magnets
  • Save resolved magnets in the torrents table

@angrynode angrynode force-pushed the magnet-form branch 4 times, most recently from b570938 to 6d6f2f9 Compare November 15, 2025 11:11
@angrynode angrynode force-pushed the magnet-form branch 4 times, most recently from d468b29 to db8d769 Compare January 20, 2026 10:09
@angrynode
Copy link
Owner Author

This is very basic right now only a "successfully imported" page, plus a list, and upload form. Maybe the success page is completely useless and can be removed.

Right now nothing is done with the magnets we're just storing them in the DB.

Feedback welcome @Gabatxo1312

@angrynode angrynode force-pushed the magnet-form branch 2 times, most recently from 8aedba2 to 9db740e Compare January 25, 2026 12:09
@Gabatxo1312 Gabatxo1312 self-requested a review February 16, 2026 20:56
@Gabatxo1312
Copy link
Collaborator

Gabatxo1312 commented Feb 17, 2026

@angrynode I think you can merge this PR !

@angrynode angrynode force-pushed the magnet-form branch 3 times, most recently from 64ded3a to 1bdfb08 Compare February 17, 2026 19:05
@angrynode angrynode force-pushed the magnet-form branch 2 times, most recently from 70ad423 to 2a34db6 Compare February 18, 2026 20:02
<i class="fa fa-download me-2"></i>
Download new torrent
</a>
{% if state.resolved_magnets_count != 0 %}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to still have a link to the magnet list (with a counter) so a user is not tempted to add one more magnet that has already been uploaded.

@angrynode
Copy link
Owner Author

angrynode commented Feb 18, 2026

  • MagnetForm accepts Some(category) + Option<content_folder>
  • the modal is added on the category page
  • pending magnets are displayed on the content_folder/category views
  • links in the magnet list view are corrected
  • dedicated magnet upload page is removed

@angrynode angrynode force-pushed the magnet-form branch 2 times, most recently from 9f6ea24 to 4b70914 Compare February 20, 2026 10:54
@angrynode
Copy link
Owner Author

OK the basic features are here. I'm not really happy with the implementation.

I feel like we have a lot of boilerplate due to separation of category / content_folder. I think we could make the FolderRequest (maybe rename it) a unified interface for this.

I'll try something along those lines.

@@ -4,13 +4,18 @@ <h2 class="text-center">
<label for="magnet">Magnet link</label>
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be removed.

@@ -2,13 +2,19 @@
<div class="card-body">
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be removed.

pub torrent_id: TorrentID,
pub link: MagnetLink,
pub name: String,
pub resolved: bool,
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be changed to an actual TorrentFile so we don't have to perform additional checks. When the background resolver resolves the magnet, it just sets the torrent accordingly.

@angrynode
Copy link
Owner Author

Before rebasing or opening a new PR, time for some cleanup.

pub content_folder: HasOne<content_folder::Entity>,
pub category_id: i32,
#[sea_orm(belongs_to, from = "category_id", to = "id")]
pub category: HasOne<category::Entity>,
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the folder is changed from a category to another? It's better to have a single source of truth, the content folder ID.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha no because the usecase was having a Magnet at the top of a category. So in this case we should either have a category ID, or a content folder ID. On the rust side this is a simple enum but how to represent it on seaorm ?

@angrynode angrynode force-pushed the magnet-form branch 3 times, most recently from dddf795 to e345809 Compare February 22, 2026 15:28
@angrynode
Copy link
Owner Author

For failing the forms we should have something like:

/// A template which contains a form which can fail.
pub trait FormTemplate: FallibleTemplate + Sized {
    type Form;

    fn with_form(&mut self, form: Self::Form);

    fn with_failed_form(&mut self, form: Self::Form, message: String) {
        self.with_form(form);
        self.with_optional_flash(OperationStatus::error_message(message));
    }
}

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