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

Add a permission to hide all torrent options #2868

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions js/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function makeContent() {
$("<form>").attr(
{action: "addtorrent.php", id: "addtorrent", method: "post", enctype: "multipart/form-data", target: "uploadfrm"}
).append(
$("<fieldset>").append(
$("<fieldset>").attr({id: "torrent_options"}).append(
$("<legend>").text(theUILang.Torrent_options),
$("<div>").addClass("row").append(
$("<div>").addClass("d-none col-md-3 d-md-flex justify-content-end").append(
Expand Down Expand Up @@ -227,12 +227,18 @@ function makeContent() {
req.push('not_add_path=1');
if($("#randomize_hash").prop("checked"))
req.push('randomize_hash=1');
var dir = $("#dir_edit").val().trim();
if(dir.length)
req.push('dir_edit='+encodeURIComponent(dir));
var lbl = $("#tadd_label").val().trim();
if(lbl.length)
req.push('label='+encodeURIComponent(lbl));
var dirEle = $$("#dir_edit");
if (dirEle) {
var dir = dirEle.val().trim();
if(dir.length)
req.push('dir_edit='+encodeURIComponent(dir));
}
var lblEle = $$("#tadd_label")
if (lblEle) {
var lbl = lblEle.val().trim();
if(lbl.length)
req.push('label='+encodeURIComponent(lbl));
}
if(req.length)
s+=('?'+req.join('&'));
frm.action = s;
Expand Down Expand Up @@ -793,7 +799,8 @@ function correctContent()
canAddTorrentsWithoutPath: 0x0100,
canAddTorrentsWithoutStarting: 0x0200,
canAddTorrentsWithResume: 0x0400,
canAddTorrentsWithRandomizeHash: 0x0800
canAddTorrentsWithRandomizeHash: 0x0800,
canChangeTorrentOptions: 0x1000
};

if(!$type(theWebUI.systemInfo))
Expand Down Expand Up @@ -831,6 +838,10 @@ function correctContent()
$("#lbl_prop-superseed").remove();
$("#dlgProps .OK").remove();
}
if(!(theWebUI.showFlags & showEnum.canChangeTorrentOptions))
{
$("#addtorrent #torrent_options").remove();
}
if(!(theWebUI.showFlags & showEnum.canAddTorrentsWithoutPath))
{
$("#addtorrent #not_add_path_option").remove();
Expand Down
5 changes: 3 additions & 2 deletions php/getplugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,9 @@ function testRemoteRequests($remoteRequests)
"canChangeTorrentProperties" => 0x0080,
"canAddTorrentsWithoutPath" => 0x0100,
"canAddTorrentsWithoutStarting" => 0x0200,
"canAddTorrentsWithResume" => 0x0400,
"canAddTorrentsWithRandomizeHash" => 0x0800,
"canAddTorrentsWithResume" => 0x0400,
"canAddTorrentsWithRandomizeHash" => 0x0800,
"canChangeTorrentOptions" => 0x1000
);
$perms = 0;
foreach($settingsFlags as $flagName=>$flagVal)
Expand Down