2016-09-15 07:07:13 -04:00
|
|
|
import QtQuick 2.0
|
|
|
|
import QtQuick.Controls 1.4
|
|
|
|
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-09-22 06:48:08 -04:00
|
|
|
id: colLayout
|
2016-09-15 07:07:13 -04:00
|
|
|
anchors.top: parent.top
|
2016-09-22 06:48:08 -04:00
|
|
|
anchors.bottom: rowLayout.top
|
2016-09-15 07:07:13 -04:00
|
|
|
|
2016-09-22 06:48:08 -04:00
|
|
|
|
|
|
|
TextField { id: myKeyField }
|
2016-09-15 07:07:13 -04:00
|
|
|
TextField { id: otherKeyField }
|
|
|
|
}
|
|
|
|
|
2016-09-22 06:48:08 -04:00
|
|
|
RowLayout
|
|
|
|
{
|
|
|
|
id: rowLayout
|
|
|
|
anchors.top: colLayout.bottom
|
|
|
|
|
|
|
|
Button
|
|
|
|
{
|
|
|
|
text: "Copy"
|
|
|
|
onClicked:
|
|
|
|
{
|
|
|
|
myKeyField.selectAll()
|
|
|
|
myKeyField.copy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Button
|
|
|
|
{
|
|
|
|
text: "Paste"
|
|
|
|
onClicked:
|
|
|
|
{
|
|
|
|
otherKeyField.selectAll()
|
|
|
|
otherKeyField.paste()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-15 07:07:13 -04:00
|
|
|
Button
|
|
|
|
{
|
|
|
|
id: bottomButton
|
|
|
|
text: "Add trusted node"
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
onClicked:
|
|
|
|
{
|
2016-09-22 06:48:08 -04:00
|
|
|
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 }))
|
2016-09-22 10:01:46 -04:00
|
|
|
rsApi.request("PUT /peers", JSON.stringify(jsonData))
|
2016-09-15 07:07:13 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|