mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-12 16:23:07 -07:00
WebUI: Implement adding categories
This commit is contained in:
parent
a939fca4ac
commit
a4dca52617
7 changed files with 71 additions and 16 deletions
|
@ -115,6 +115,7 @@ QMap<QString, QMap<QString, WebApplication::Action> > WebApplication::initialize
|
|||
ADD_ACTION(command, bottomPrio);
|
||||
ADD_ACTION(command, recheck);
|
||||
ADD_ACTION(command, setCategory);
|
||||
ADD_ACTION(command, addCategory);
|
||||
ADD_ACTION(command, getSavePath);
|
||||
ADD_ACTION(version, api);
|
||||
ADD_ACTION(version, api_min);
|
||||
|
@ -728,6 +729,21 @@ void WebApplication::action_command_setCategory()
|
|||
}
|
||||
}
|
||||
|
||||
void WebApplication::action_command_addCategory()
|
||||
{
|
||||
CHECK_URI(0);
|
||||
CHECK_PARAMETERS("category");
|
||||
|
||||
QString category = request().posts["category"].trimmed();
|
||||
|
||||
if (!BitTorrent::Session::isValidCategoryName(category) && !category.isEmpty()) {
|
||||
status(400, tr("Incorrect category name"));
|
||||
return;
|
||||
}
|
||||
|
||||
BitTorrent::Session::instance()->addCategory(category);
|
||||
}
|
||||
|
||||
void WebApplication::action_command_getSavePath()
|
||||
{
|
||||
CHECK_URI(0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue