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

Persistent add and create torrent options #2728

Closed
liquid187 opened this issue Oct 12, 2024 · 7 comments
Closed

Persistent add and create torrent options #2728

liquid187 opened this issue Oct 12, 2024 · 7 comments

Comments

@liquid187
Copy link

Is your feature request related to a problem?

it saves time and is used by every user anyway

Describe the solution you'd like

Is there a way to make the check mark for add torrent fast resum stay permanently? The same with greate new torrent private torrent? Previously it worked by adding a line to the relevant js files. checked=''checked''. This no longer works with the new version.

Additional context

No response

@stickz stickz changed the title permanently marked Persistent add and create torrent options Oct 12, 2024
@stickz stickz added v5.1 and removed v5.0 labels Oct 12, 2024
@stickz
Copy link
Collaborator

stickz commented Oct 13, 2024

@jevenski We are going straight to v5.1 next from the master branch. This issue report is authorized for the next release.

@jevenski
Copy link
Contributor

@jevenski We are going straight to v5.1 next from the master branch. This issue report is authorized for the next release.

Copy that. This issue is going to my next task to accomplish.

@allixx
Copy link
Contributor

allixx commented Oct 14, 2024

Can we go even deeper and explore possibility of adding "Presets" feature for "Add torrent" dialog? A preset will contain state of checkboxes, specific download directory, and label. Added presets will be available for choosing via drop-down menu or individual dynamic button in the dialog.

Currently I'm hard-coding those "preset" buttons in personal fork and am finding it very convenient.

@stickz
Copy link
Collaborator

stickz commented Oct 14, 2024

Can we go even deeper and explore possibility of adding "Presets" feature for "Add torrent" dialog? A preset will contain state of checkboxes, specific download directory, and label. Added presets will be available for choosing via drop-down menu or individual dynamic button in the dialog.

Currently I'm hard-coding those "preset" buttons in personal fork and am finding it very convenient.

We need to keep this simple for the first implementation. My suggestion is as follows:

  1. Remember the last set of checkboxes for "Add torrent".
  2. Remember the last set of trackers, checkboxes and piece size for "Create Torrent".

We can explore the possibility of tracker list presets for "Create Torrent" in v5.2.

@jevenski Create torrent already has an rCache class with rtrackers.dat. It's writing the recent trackers to the webserver and remembering them. We just need to populate the textarea/textbox again, when we refresh the page. https://github.com/Novik/ruTorrent/blob/master/plugins/create/action.php

@jevenski
Copy link
Contributor

jevenski commented Oct 14, 2024

Yeah, I saw that. I've implemented default options for add torrent using the theWebUI.settings object. It has a built in mechanism to read and set WebUI settings so it's relatively easy. Users will be able to check the options on/off in the settings dialog and the options in the add torrent dialog will be set by default.

As for the create torrent part, I'm still in the middle of figuring out a proper way to utilize the existing class to remember default options and populate the new dialog. Can we just mix the default options within the same class and .dat file, or is it a better solution to create a separate class and .dat for them?

@stickz
Copy link
Collaborator

stickz commented Oct 14, 2024

As for the create torrent part, I'm still in the middle of figuring out a proper way to utilize the existing class to remember default options and populate the new dialog. Can we just mix the default options within the same class and .dat file, or is it a better solution to create a separate class and .dat for them?

Yes, you can rename the class and the functions to mix the settings all into the same .dat file. It makes sense to do this, to avoid loading two .dat for the same plugin. All public members are serialized and restored to their original value when load() is called. Here's an example implementation you can use with the appropriate getters and setters.

class createTorrentSettings
{
	public $hash = "rcreate.dat";
	public $modified = false;
	public $recentTrackers = array();
        public $dialogCheckboxes = array();
        public $pieceSize = "4MB";
}

This example would require 2 additional request parameters to action.php.

  1. A list of dialog checkboxes with their true or false state.
  2. A piece size parameter for the dropdown menu.

@stickz
Copy link
Collaborator

stickz commented Oct 16, 2024

@jevenski Please pollute the settings object for now in webui.js. Any value added to this JS object will automatically save. No PHP code required! I'm going to create a new PluginSettings.dat file in ruTorrent v5.2 to improve performance by:

  1. Threading plugin setting loading async without waiting for getplugins.php.
  2. Eliminate hundreds of lines of code size getplugins.php needs to echo.

Here's an example:

"webui.create_torrent.start_seeding":   0,
"webui.create_torrent.private_torrent": 0,
"webui.create_torrent.hydrid_torrent":  0,

Here's the current settings object:

ruTorrent/js/webui.js

Lines 134 to 193 in 830b3d6

settings:
{
"webui.fls.view": 0,
"webui.show_cats": 1,
"webui.show_dets": 1,
"webui.needmessage": 1,
"webui.reqtimeout": 10000,
"webui.confirm_when_deleting": 1,
"webui.alternate_color": 0,
"webui.side_panel_min_width": 200,
"webui.list_table_min_height": 300,
"webui.update_interval": 2500,
"webui.hsplit": 0.88,
"webui.vsplit": 0.5,
"webui.effects": 0,
"webui.fullrows": 0,
"webui.no_delaying_draw": 1,
"webui.search": -1,
"webui.speedlistdl": "128,512,1024,2048,3072,4096,5120,6144,7168,8192,9216,10240",
"webui.speedlistul": "128,512,1024,2048,3072,4096,5120,6144,7168,8192,9216,10240",
"webui.ignore_timeouts": 0,
"webui.retry_on_error": 120,
"webui.category_panels": ['pview', 'pstate', 'plabel', 'flabel', 'ptrackers', 'prss'],
"webui.closed_panels": {},
"webui.open_tegs.last": [],
"webui.open_tegs.keep": 0,
"webui.selected_labels.last": {},
"webui.selected_labels.keep": 0,
"webui.selected_labels.views": [],
"webui.selected_tab.last": {},
"webui.selected_tab.keep": 0,
"webui.timeformat": 0,
"webui.dateformat": 0,
"webui.speedintitle": 0,
"webui.speedgraph.max_seconds": 600,
"webui.log_autoswitch": 1,
"webui.labelsize_rightalign": 0,
"webui.show_labelsize": 1,
"webui.show_searchlabelsize": 0,
"webui.show_statelabelsize": 0,
"webui.show_viewlabelsize": 1,
"webui.show_label_path_tree": 1,
"webui.show_empty_path_labels": 0,
"webui.show_label_text_overflow": 0,
"webui.show_open_status": 1,
"webui.show_view_panel": 1,
"webui.register_magnet": 0,
...(() => {
const defaults = {};
const units = ['default', 'kb', 'mb', 'gb', 'tb', 'pb'];
for(const [context, udef] of Object.entries({
catlist: [2, 0,1,1], table: [2], details: [2], other: [1]
})) {
for (let u = 0; u < units.length; u++) {
defaults['webui.size_decimal_places.' + context + '.' + units[u]] = udef[u] == null ? '' : udef[u].toString();
}
}
return defaults;
})(),
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants