mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
webui: allow to set peer flags when adding friends (whitelist flag is set to false)
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8364 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
399340ef38
commit
aea5a77aeb
@ -224,6 +224,7 @@ StreamBase& JsonStream::getStreamToMember(std::string name)
|
||||
mChild = new JsonStream();
|
||||
if(!serialise())
|
||||
{
|
||||
mChild->mSerialise = false;
|
||||
if(checkDeserialisation() && checkObjectMember(name))
|
||||
{
|
||||
mChild->mValue = mObject[name];
|
||||
|
@ -191,11 +191,32 @@ void PeersHandler::handleWildcard(Request &req, Response &resp)
|
||||
{
|
||||
std::string cert_string;
|
||||
req.mStream << makeKeyValueReference("cert_string", cert_string);
|
||||
|
||||
ServicePermissionFlags flags;
|
||||
StreamBase& flags_stream = req.mStream.getStreamToMember("flags");
|
||||
if(req.mStream.isOK())
|
||||
{
|
||||
bool direct_dl = RS_NODE_PERM_DEFAULT & RS_NODE_PERM_DIRECT_DL;
|
||||
flags_stream << makeKeyValueReference("allow_direct_download", direct_dl);
|
||||
if(direct_dl) flags |= RS_NODE_PERM_DIRECT_DL;
|
||||
|
||||
bool allow_push = RS_NODE_PERM_DEFAULT & RS_NODE_PERM_ALLOW_PUSH;
|
||||
flags_stream << makeKeyValueReference("allow_push", allow_push);
|
||||
if(allow_push) flags |= RS_NODE_PERM_ALLOW_PUSH;
|
||||
|
||||
bool require_whitelist = RS_NODE_PERM_DEFAULT & RS_NODE_PERM_REQUIRE_WL;
|
||||
flags_stream << makeKeyValueReference("require_whitelist", require_whitelist);
|
||||
if(require_whitelist) flags |= RS_NODE_PERM_REQUIRE_WL;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags = RS_NODE_PERM_DEFAULT;
|
||||
}
|
||||
RsPeerId peer_id;
|
||||
RsPgpId pgp_id;
|
||||
std::string error_string;
|
||||
if(mRsPeers->loadCertificateFromString(cert_string, peer_id, pgp_id, error_string)
|
||||
&& mRsPeers->addFriend(peer_id, pgp_id))
|
||||
&& mRsPeers->addFriend(peer_id, pgp_id, flags))
|
||||
{
|
||||
ok = true;
|
||||
resp.mDataStream << makeKeyValueReference("pgp_id", pgp_id);
|
||||
|
@ -85,6 +85,10 @@ input:hover{
|
||||
background-color: midnightblue;
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.flexbox{
|
||||
display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
|
||||
display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
|
||||
|
@ -373,6 +373,9 @@ var OwnCert = React.createClass({
|
||||
var AddPeerWidget = React.createClass({
|
||||
getInitialState: function(){
|
||||
return {page: "start"};
|
||||
|
||||
// for testing
|
||||
//return {page: "peer", data: {name: "some_test_name"}};
|
||||
},
|
||||
add_friend_handler: function(){
|
||||
var cert_string = this.refs.cert.getDOMNode().value;
|
||||
@ -388,7 +391,19 @@ var AddPeerWidget = React.createClass({
|
||||
},
|
||||
final_add_handler: function(){
|
||||
this.setState({page: "start"});
|
||||
RS.request({path: "peers", data: {cert_string: this.state.cert_string}});
|
||||
RS.request(
|
||||
{
|
||||
path: "peers",
|
||||
data: {
|
||||
cert_string: this.state.cert_string,
|
||||
flags:{
|
||||
allow_direct_download: this.refs.cb_direct_dl.getDOMNode().checked,
|
||||
allow_push: this.refs.cb_push.getDOMNode().checked,
|
||||
// set to false, until the webinterface supports managment of the blacklist/whitelist
|
||||
require_whitelist: false,
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
render: function(){
|
||||
if(this.state.page === "start")
|
||||
@ -415,7 +430,9 @@ var AddPeerWidget = React.createClass({
|
||||
return(
|
||||
<div>
|
||||
<p>Do you want to add {this.state.data.name} to your friendslist?</p>
|
||||
<span onClick={this.final_add_handler} className="btn">yes</span>
|
||||
<input className="checkbox" type="checkbox" ref="cb_direct_dl"/> Allow direct downloads from this node<br/>
|
||||
<input className="checkbox" type="checkbox" ref="cb_push"/> Auto download recommended files from this node<br/>
|
||||
<div onClick={this.final_add_handler} className="btn2">add to friendslist</div>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
|
@ -85,6 +85,10 @@ input:hover{
|
||||
background-color: midnightblue;
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.flexbox{
|
||||
display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
|
||||
display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
|
||||
|
@ -373,6 +373,9 @@ var OwnCert = React.createClass({
|
||||
var AddPeerWidget = React.createClass({
|
||||
getInitialState: function(){
|
||||
return {page: "start"};
|
||||
|
||||
// for testing
|
||||
//return {page: "peer", data: {name: "some_test_name"}};
|
||||
},
|
||||
add_friend_handler: function(){
|
||||
var cert_string = this.refs.cert.getDOMNode().value;
|
||||
@ -388,7 +391,19 @@ var AddPeerWidget = React.createClass({
|
||||
},
|
||||
final_add_handler: function(){
|
||||
this.setState({page: "start"});
|
||||
RS.request({path: "peers", data: {cert_string: this.state.cert_string}});
|
||||
RS.request(
|
||||
{
|
||||
path: "peers",
|
||||
data: {
|
||||
cert_string: this.state.cert_string,
|
||||
flags:{
|
||||
allow_direct_download: this.refs.cb_direct_dl.getDOMNode().checked,
|
||||
allow_push: this.refs.cb_push.getDOMNode().checked,
|
||||
// set to false, until the webinterface supports managment of the blacklist/whitelist
|
||||
require_whitelist: false,
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
render: function(){
|
||||
if(this.state.page === "start")
|
||||
@ -415,7 +430,9 @@ var AddPeerWidget = React.createClass({
|
||||
return(
|
||||
<div>
|
||||
<p>Do you want to add {this.state.data.name} to your friendslist?</p>
|
||||
<span onClick={this.final_add_handler} className="btn">yes</span>
|
||||
<input className="checkbox" type="checkbox" ref="cb_direct_dl"/> Allow direct downloads from this node<br/>
|
||||
<input className="checkbox" type="checkbox" ref="cb_push"/> Auto download recommended files from this node<br/>
|
||||
<div onClick={this.final_add_handler} className="btn2">add to friendslist</div>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user