mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-17 22:18:05 -06:00
WebUI: Implement adding categories
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user