2016-09-15 07:07:13 -04:00
|
|
|
import QtQuick 2.0
|
2017-03-24 07:02:13 -04:00
|
|
|
import QtQuick.Controls 2.0
|
2016-09-15 07:07:13 -04:00
|
|
|
import QtQuick.Layouts 1.3
|
|
|
|
import org.retroshare.qml_components.LibresapiLocalClient 1.0
|
|
|
|
|
|
|
|
Item
|
|
|
|
{
|
2016-09-16 06:04:49 -04:00
|
|
|
function refreshData() { rsApi.request("/peers/self/certificate/", "") }
|
|
|
|
|
2016-09-15 07:07:13 -04:00
|
|
|
Component.onCompleted:
|
|
|
|
{
|
|
|
|
rsApi.openConnection(apiSocketPath)
|
2016-09-16 06:04:49 -04:00
|
|
|
refreshData()
|
2016-09-15 07:07:13 -04:00
|
|
|
}
|
2016-09-16 06:04:49 -04:00
|
|
|
onFocusChanged: focus && refreshData()
|
2016-09-15 07:07:13 -04:00
|
|
|
|
|
|
|
LibresapiLocalClient
|
|
|
|
{
|
|
|
|
id: rsApi
|
2016-09-16 06:04:49 -04:00
|
|
|
onGoodResponseReceived:
|
|
|
|
{
|
|
|
|
var jsonData = JSON.parse(msg)
|
|
|
|
if(jsonData && jsonData.data && jsonData.data.cert_string)
|
|
|
|
myKeyField.text = jsonData.data.cert_string
|
|
|
|
}
|
2016-09-15 07:07:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout
|
|
|
|
{
|
2016-10-26 14:37:28 -04:00
|
|
|
anchors.fill: parent
|
2016-09-15 07:07:13 -04:00
|
|
|
|
2016-10-26 14:37:28 -04:00
|
|
|
Button
|
|
|
|
{
|
|
|
|
id: bottomButton
|
|
|
|
text: "Add trusted node"
|
|
|
|
onClicked:
|
|
|
|
{
|
|
|
|
console.log("retroshare addtrusted: ", otherKeyField.text)
|
|
|
|
var jsonData =
|
|
|
|
{
|
|
|
|
cert_string: otherKeyField.text,
|
|
|
|
flags:
|
|
|
|
{
|
|
|
|
allow_direct_download: true,
|
|
|
|
allow_push: false,
|
|
|
|
require_whitelist: false,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log("retroshare addtrusted jsonData: ", JSON.stringify(jsonData))
|
|
|
|
//rsApi.request("/peers/examine_cert/", JSON.stringify({ cert_string: otherKeyField.text }))
|
|
|
|
rsApi.request("PUT /peers", JSON.stringify(jsonData))
|
|
|
|
}
|
|
|
|
}
|
2016-09-22 06:48:08 -04:00
|
|
|
|
|
|
|
Button
|
|
|
|
{
|
|
|
|
text: "Copy"
|
|
|
|
onClicked:
|
|
|
|
{
|
|
|
|
myKeyField.selectAll()
|
|
|
|
myKeyField.copy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Button
|
|
|
|
{
|
|
|
|
text: "Paste"
|
|
|
|
onClicked:
|
|
|
|
{
|
|
|
|
otherKeyField.selectAll()
|
|
|
|
otherKeyField.paste()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-26 14:37:28 -04:00
|
|
|
TextField { id: myKeyField }
|
|
|
|
TextField { id: otherKeyField }
|
2016-09-15 07:07:13 -04:00
|
|
|
}
|
|
|
|
}
|