mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 10:49:33 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into dk/transactionHistoryDisplay
This commit is contained in:
commit
b942faa60e
11 changed files with 68 additions and 52 deletions
|
@ -247,6 +247,9 @@ endif()
|
||||||
|
|
||||||
set_packaging_parameters()
|
set_packaging_parameters()
|
||||||
|
|
||||||
|
option(BUILD_TESTS "Build tests" ON)
|
||||||
|
MESSAGE(STATUS "Build tests: " ${BUILD_TESTS})
|
||||||
|
|
||||||
# add subdirectories for all targets
|
# add subdirectories for all targets
|
||||||
if (NOT ANDROID)
|
if (NOT ANDROID)
|
||||||
add_subdirectory(assignment-client)
|
add_subdirectory(assignment-client)
|
||||||
|
@ -259,8 +262,10 @@ if (NOT ANDROID)
|
||||||
if (NOT SERVER_ONLY)
|
if (NOT SERVER_ONLY)
|
||||||
add_subdirectory(interface)
|
add_subdirectory(interface)
|
||||||
set_target_properties(interface PROPERTIES FOLDER "Apps")
|
set_target_properties(interface PROPERTIES FOLDER "Apps")
|
||||||
|
if (BUILD_TESTS)
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
add_subdirectory(plugins)
|
add_subdirectory(plugins)
|
||||||
add_subdirectory(tools)
|
add_subdirectory(tools)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -40,12 +40,10 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onKeyFilePathResult: {
|
onKeyFilePathIfExistsResult: {
|
||||||
if (path !== "") {
|
|
||||||
keyFilePath.text = path;
|
keyFilePath.text = path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
SecurityImageModel {
|
SecurityImageModel {
|
||||||
id: securityImageModel;
|
id: securityImageModel;
|
||||||
|
@ -264,7 +262,7 @@ Item {
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
commerce.getKeyFilePath();
|
commerce.getKeyFilePathIfExists();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,9 @@ Rectangle {
|
||||||
|
|
||||||
id: root;
|
id: root;
|
||||||
|
|
||||||
property string activeView: "walletHome";
|
property string activeView: "initialize";
|
||||||
|
property bool securityImageResultReceived: false;
|
||||||
|
property bool keyFilePathIfExistsResultReceived: false;
|
||||||
|
|
||||||
// Style
|
// Style
|
||||||
color: hifi.colors.baseGray;
|
color: hifi.colors.baseGray;
|
||||||
|
@ -33,16 +35,20 @@ Rectangle {
|
||||||
id: commerce;
|
id: commerce;
|
||||||
|
|
||||||
onSecurityImageResult: {
|
onSecurityImageResult: {
|
||||||
if (!exists) { // "If security image is not set up"
|
securityImageResultReceived = true;
|
||||||
if (root.activeView !== "notSetUp") {
|
if (!exists && root.activeView !== "notSetUp") { // "If security image is not set up"
|
||||||
root.activeView = "notSetUp";
|
root.activeView = "notSetUp";
|
||||||
}
|
} else if (root.securityImageResultReceived && exists && root.keyFilePathIfExistsResultReceived && root.activeView === "initialize") {
|
||||||
|
root.activeView = "walletHome";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onKeyFilePathResult: {
|
onKeyFilePathIfExistsResult: {
|
||||||
|
keyFilePathIfExistsResultReceived = true;
|
||||||
if (path === "" && root.activeView !== "notSetUp") {
|
if (path === "" && root.activeView !== "notSetUp") {
|
||||||
root.activeView = "notSetUp";
|
root.activeView = "notSetUp";
|
||||||
|
} else if (root.securityImageResultReceived && root.keyFilePathIfExistsResultReceived && path !== "" && root.activeView === "initialize") {
|
||||||
|
root.activeView = "walletHome";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,6 +157,22 @@ Rectangle {
|
||||||
//
|
//
|
||||||
// TAB CONTENTS START
|
// TAB CONTENTS START
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: initialize;
|
||||||
|
visible: root.activeView === "initialize";
|
||||||
|
anchors.top: titleBarContainer.bottom;
|
||||||
|
anchors.bottom: parent.top;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
color: hifi.colors.baseGray;
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
commerce.getSecurityImage();
|
||||||
|
commerce.getKeyFilePathIfExists();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NotSetUp {
|
NotSetUp {
|
||||||
id: notSetUp;
|
id: notSetUp;
|
||||||
visible: root.activeView === "notSetUp";
|
visible: root.activeView === "notSetUp";
|
||||||
|
@ -283,13 +305,6 @@ Rectangle {
|
||||||
onEntered: parent.color = hifi.colors.blueHighlight;
|
onEntered: parent.color = hifi.colors.blueHighlight;
|
||||||
onExited: parent.color = root.activeView === "walletHome" ? hifi.colors.blueAccent : hifi.colors.black;
|
onExited: parent.color = root.activeView === "walletHome" ? hifi.colors.blueAccent : hifi.colors.black;
|
||||||
}
|
}
|
||||||
|
|
||||||
onVisibleChanged: {
|
|
||||||
if (visible) {
|
|
||||||
commerce.getSecurityImage();
|
|
||||||
commerce.balance();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// "SEND MONEY" tab button
|
// "SEND MONEY" tab button
|
||||||
|
@ -382,13 +397,6 @@ Rectangle {
|
||||||
onEntered: parent.color = hifi.colors.blueHighlight;
|
onEntered: parent.color = hifi.colors.blueHighlight;
|
||||||
onExited: parent.color = root.activeView === "security" ? hifi.colors.blueAccent : hifi.colors.black;
|
onExited: parent.color = root.activeView === "security" ? hifi.colors.blueAccent : hifi.colors.black;
|
||||||
}
|
}
|
||||||
|
|
||||||
onVisibleChanged: {
|
|
||||||
if (visible) {
|
|
||||||
commerce.getSecurityImage();
|
|
||||||
commerce.getKeyFilePath();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// "HELP" tab button
|
// "HELP" tab button
|
||||||
|
|
|
@ -56,12 +56,10 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onKeyFilePathResult: {
|
onKeyFilePathIfExistsResult: {
|
||||||
if (path !== "") {
|
|
||||||
keyFilePath.text = path;
|
keyFilePath.text = path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// LOGIN PAGE START
|
// LOGIN PAGE START
|
||||||
|
@ -455,10 +453,10 @@ Rectangle {
|
||||||
text: "Next";
|
text: "Next";
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (passphraseSelection.validateAndSubmitPassphrase()) {
|
if (passphraseSelection.validateAndSubmitPassphrase()) {
|
||||||
root.lastPage = "passphrase";
|
root.lastPage = "choosePassphrase";
|
||||||
|
commerce.balance(); // Do this here so that keys are generated. Order might change as backend changes?
|
||||||
choosePassphraseContainer.visible = false;
|
choosePassphraseContainer.visible = false;
|
||||||
privateKeysReadyContainer.visible = true;
|
privateKeysReadyContainer.visible = true;
|
||||||
commerce.balance(); // Do this here so that keys are generated. Order might change as backend changes?
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -562,7 +560,7 @@ Rectangle {
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
commerce.getKeyFilePath();
|
commerce.getKeyFilePathIfExists();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -702,8 +702,8 @@ private:
|
||||||
bool _saveAvatarOverrideUrl { false };
|
bool _saveAvatarOverrideUrl { false };
|
||||||
QObject* _renderEventHandler{ nullptr };
|
QObject* _renderEventHandler{ nullptr };
|
||||||
|
|
||||||
LaserPointerManager _laserPointerManager;
|
|
||||||
RayPickManager _rayPickManager;
|
RayPickManager _rayPickManager;
|
||||||
|
LaserPointerManager _laserPointerManager;
|
||||||
|
|
||||||
friend class RenderEventHandler;
|
friend class RenderEventHandler;
|
||||||
};
|
};
|
||||||
|
|
|
@ -25,8 +25,8 @@ QmlCommerce::QmlCommerce(QQuickItem* parent) : OffscreenQmlDialog(parent) {
|
||||||
connect(ledger.data(), &Ledger::balanceResult, this, &QmlCommerce::balanceResult);
|
connect(ledger.data(), &Ledger::balanceResult, this, &QmlCommerce::balanceResult);
|
||||||
connect(ledger.data(), &Ledger::inventoryResult, this, &QmlCommerce::inventoryResult);
|
connect(ledger.data(), &Ledger::inventoryResult, this, &QmlCommerce::inventoryResult);
|
||||||
connect(wallet.data(), &Wallet::securityImageResult, this, &QmlCommerce::securityImageResult);
|
connect(wallet.data(), &Wallet::securityImageResult, this, &QmlCommerce::securityImageResult);
|
||||||
connect(wallet.data(), &Wallet::keyFilePathResult, this, &QmlCommerce::keyFilePathResult);
|
|
||||||
connect(ledger.data(), &Ledger::historyResult, this, &QmlCommerce::historyResult);
|
connect(ledger.data(), &Ledger::historyResult, this, &QmlCommerce::historyResult);
|
||||||
|
connect(wallet.data(), &Wallet::keyFilePathIfExistsResult, this, &QmlCommerce::keyFilePathIfExistsResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlCommerce::buy(const QString& assetId, int cost, const QString& buyerUsername) {
|
void QmlCommerce::buy(const QString& assetId, int cost, const QString& buyerUsername) {
|
||||||
|
@ -81,8 +81,7 @@ void QmlCommerce::setPassphrase(const QString& passphrase) {
|
||||||
void QmlCommerce::getPassphraseSetupStatus() {
|
void QmlCommerce::getPassphraseSetupStatus() {
|
||||||
emit passphraseSetupStatusResult(false);
|
emit passphraseSetupStatusResult(false);
|
||||||
}
|
}
|
||||||
|
void QmlCommerce::getKeyFilePathIfExists() {
|
||||||
void QmlCommerce::getKeyFilePath() {
|
|
||||||
auto wallet = DependencyManager::get<Wallet>();
|
auto wallet = DependencyManager::get<Wallet>();
|
||||||
wallet->getKeyFilePath();
|
wallet->sendKeyFilePathIfExists();
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,8 +36,8 @@ signals:
|
||||||
void securityImageResult(bool exists);
|
void securityImageResult(bool exists);
|
||||||
void loginStatusResult(bool isLoggedIn);
|
void loginStatusResult(bool isLoggedIn);
|
||||||
void passphraseSetupStatusResult(bool passphraseIsSetup);
|
void passphraseSetupStatusResult(bool passphraseIsSetup);
|
||||||
void keyFilePathResult(const QString& path);
|
|
||||||
void historyResult(QJsonObject result);
|
void historyResult(QJsonObject result);
|
||||||
|
void keyFilePathIfExistsResult(const QString& path);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Q_INVOKABLE void buy(const QString& assetId, int cost, const QString& buyerUsername = "");
|
Q_INVOKABLE void buy(const QString& assetId, int cost, const QString& buyerUsername = "");
|
||||||
|
@ -49,7 +49,7 @@ protected:
|
||||||
Q_INVOKABLE void getLoginStatus();
|
Q_INVOKABLE void getLoginStatus();
|
||||||
Q_INVOKABLE void setPassphrase(const QString& passphrase);
|
Q_INVOKABLE void setPassphrase(const QString& passphrase);
|
||||||
Q_INVOKABLE void getPassphraseSetupStatus();
|
Q_INVOKABLE void getPassphraseSetupStatus();
|
||||||
Q_INVOKABLE void getKeyFilePath();
|
Q_INVOKABLE void getKeyFilePathIfExists();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_QmlCommerce_h
|
#endif // hifi_QmlCommerce_h
|
||||||
|
|
|
@ -220,8 +220,8 @@ static const unsigned char IVEC[16] = "IAmAnIVecYay123";
|
||||||
void initializeAESKeys(unsigned char* ivec, unsigned char* ckey, const QByteArray& salt) {
|
void initializeAESKeys(unsigned char* ivec, unsigned char* ckey, const QByteArray& salt) {
|
||||||
// first ivec
|
// first ivec
|
||||||
memcpy(ivec, IVEC, 16);
|
memcpy(ivec, IVEC, 16);
|
||||||
auto hash = QCryptographicHash::hash(salt, QCryptographicHash::Md5);
|
auto hash = QCryptographicHash::hash(salt, QCryptographicHash::Sha256);
|
||||||
memcpy(ckey, hash.data(), 16);
|
memcpy(ckey, hash.data(), 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wallet::setPassphrase(const QString& passphrase) {
|
void Wallet::setPassphrase(const QString& passphrase) {
|
||||||
|
@ -238,7 +238,7 @@ bool Wallet::encryptFile(const QString& inputFilePath, const QString& outputFile
|
||||||
// a constant. We can review this later - there are ways to generate keys
|
// a constant. We can review this later - there are ways to generate keys
|
||||||
// from a password that may be better.
|
// from a password that may be better.
|
||||||
unsigned char ivec[16];
|
unsigned char ivec[16];
|
||||||
unsigned char ckey[16];
|
unsigned char ckey[32];
|
||||||
|
|
||||||
initializeAESKeys(ivec, ckey, _salt);
|
initializeAESKeys(ivec, ckey, _salt);
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ bool Wallet::encryptFile(const QString& inputFilePath, const QString& outputFile
|
||||||
|
|
||||||
bool Wallet::decryptFile(const QString& inputFilePath, unsigned char** outputBufferPtr, int* outputBufferSize) {
|
bool Wallet::decryptFile(const QString& inputFilePath, unsigned char** outputBufferPtr, int* outputBufferSize) {
|
||||||
unsigned char ivec[16];
|
unsigned char ivec[16];
|
||||||
unsigned char ckey[16];
|
unsigned char ckey[32];
|
||||||
initializeAESKeys(ivec, ckey, _salt);
|
initializeAESKeys(ivec, ckey, _salt);
|
||||||
|
|
||||||
// read encrypted file
|
// read encrypted file
|
||||||
|
@ -331,7 +331,6 @@ bool Wallet::decryptFile(const QString& inputFilePath, unsigned char** outputBuf
|
||||||
*outputBufferSize += tempSize;
|
*outputBufferSize += tempSize;
|
||||||
*outputBufferPtr = outputBuffer;
|
*outputBufferPtr = outputBuffer;
|
||||||
qCDebug(commerce) << "decrypted buffer size" << *outputBufferSize;
|
qCDebug(commerce) << "decrypted buffer size" << *outputBufferSize;
|
||||||
delete[] outputBuffer;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,6 +358,7 @@ bool Wallet::createIfNeeded() {
|
||||||
bool Wallet::generateKeyPair() {
|
bool Wallet::generateKeyPair() {
|
||||||
qCInfo(commerce) << "Generating keypair.";
|
qCInfo(commerce) << "Generating keypair.";
|
||||||
auto keyPair = generateRSAKeypair();
|
auto keyPair = generateRSAKeypair();
|
||||||
|
sendKeyFilePathIfExists();
|
||||||
QString oldKey = _publicKeys.count() == 0 ? "" : _publicKeys.last();
|
QString oldKey = _publicKeys.count() == 0 ? "" : _publicKeys.last();
|
||||||
QString key = keyPair.first->toBase64();
|
QString key = keyPair.first->toBase64();
|
||||||
_publicKeys.push_back(key);
|
_publicKeys.push_back(key);
|
||||||
|
@ -465,12 +465,19 @@ void Wallet::getSecurityImage() {
|
||||||
auto imageProvider = reinterpret_cast<ImageProvider*>(engine->imageProvider(ImageProvider::PROVIDER_NAME));
|
auto imageProvider = reinterpret_cast<ImageProvider*>(engine->imageProvider(ImageProvider::PROVIDER_NAME));
|
||||||
imageProvider->setSecurityImage(_securityImage);
|
imageProvider->setSecurityImage(_securityImage);
|
||||||
|
|
||||||
|
delete[] data;
|
||||||
emit securityImageResult(true);
|
emit securityImageResult(true);
|
||||||
} else {
|
} else {
|
||||||
qCDebug(commerce) << "failed to decrypt security image (maybe none saved yet?)";
|
qCDebug(commerce) << "failed to decrypt security image (maybe none saved yet?)";
|
||||||
emit securityImageResult(false);
|
emit securityImageResult(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void Wallet::getKeyFilePath() {
|
void Wallet::sendKeyFilePathIfExists() {
|
||||||
emit keyFilePathResult(keyFilePath());
|
QString filePath(keyFilePath());
|
||||||
|
QFileInfo fileInfo(filePath);
|
||||||
|
if (fileInfo.exists()) {
|
||||||
|
emit keyFilePathIfExistsResult(filePath);
|
||||||
|
} else {
|
||||||
|
emit keyFilePathIfExistsResult("");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ public:
|
||||||
QString signWithKey(const QByteArray& text, const QString& key);
|
QString signWithKey(const QByteArray& text, const QString& key);
|
||||||
void chooseSecurityImage(const QString& imageFile);
|
void chooseSecurityImage(const QString& imageFile);
|
||||||
void getSecurityImage();
|
void getSecurityImage();
|
||||||
void getKeyFilePath();
|
void sendKeyFilePathIfExists();
|
||||||
|
|
||||||
void setSalt(const QByteArray& salt) { _salt = salt; }
|
void setSalt(const QByteArray& salt) { _salt = salt; }
|
||||||
QByteArray getSalt() { return _salt; }
|
QByteArray getSalt() { return _salt; }
|
||||||
|
@ -40,7 +40,7 @@ public:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void securityImageResult(bool exists) ;
|
void securityImageResult(bool exists) ;
|
||||||
void keyFilePathResult(const QString& path);
|
void keyFilePathIfExistsResult(const QString& path);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
enum SecurityImage {
|
enum SecurityImage {
|
||||||
|
|
|
@ -24,12 +24,12 @@ var DEFAULT_SCRIPTS_COMBINED = [
|
||||||
"system/makeUserConnection.js",
|
"system/makeUserConnection.js",
|
||||||
"system/tablet-goto.js",
|
"system/tablet-goto.js",
|
||||||
"system/marketplaces/marketplaces.js",
|
"system/marketplaces/marketplaces.js",
|
||||||
|
"system/commerce/wallet.js",
|
||||||
"system/edit.js",
|
"system/edit.js",
|
||||||
"system/notifications.js",
|
"system/notifications.js",
|
||||||
"system/dialTone.js",
|
"system/dialTone.js",
|
||||||
"system/firstPersonHMD.js",
|
"system/firstPersonHMD.js",
|
||||||
"system/tablet-ui/tabletUI.js",
|
"system/tablet-ui/tabletUI.js"
|
||||||
"system/commerce/wallet.js"
|
|
||||||
];
|
];
|
||||||
var DEFAULT_SCRIPTS_SEPARATE = [
|
var DEFAULT_SCRIPTS_SEPARATE = [
|
||||||
"system/controllers/controllerScripts.js",
|
"system/controllers/controllerScripts.js",
|
||||||
|
|
|
@ -126,7 +126,8 @@
|
||||||
button = tablet.addButton({
|
button = tablet.addButton({
|
||||||
text: buttonName,
|
text: buttonName,
|
||||||
icon: "icons/tablet-icons/wallet-i.svg",
|
icon: "icons/tablet-icons/wallet-i.svg",
|
||||||
activeIcon: "icons/tablet-icons/wallet-a.svg"
|
activeIcon: "icons/tablet-icons/wallet-a.svg",
|
||||||
|
sortOrder: 10
|
||||||
});
|
});
|
||||||
button.clicked.connect(onButtonClicked);
|
button.clicked.connect(onButtonClicked);
|
||||||
tablet.screenChanged.connect(onTabletScreenChanged);
|
tablet.screenChanged.connect(onTabletScreenChanged);
|
||||||
|
|
Loading…
Reference in a new issue