mirror of
https://github.com/GOSTSec/gostcoin
synced 2025-01-30 16:34:29 +00:00
elimiated setupdarknet
This commit is contained in:
parent
c2d560f834
commit
f9c265513a
@ -211,8 +211,7 @@ HEADERS += src/qt/bitcoingui.h \
|
|||||||
src/qt/macnotificationhandler.h \
|
src/qt/macnotificationhandler.h \
|
||||||
src/qt/splashscreen.h \
|
src/qt/splashscreen.h \
|
||||||
src/qt/showi2paddresses.h \
|
src/qt/showi2paddresses.h \
|
||||||
src/qt/i2poptionswidget.h \
|
src/qt/i2poptionswidget.h
|
||||||
src/qt/setupdarknet.h
|
|
||||||
|
|
||||||
SOURCES += src/qt/gostcoin.cpp \
|
SOURCES += src/qt/gostcoin.cpp \
|
||||||
src/qt/bitcoingui.cpp \
|
src/qt/bitcoingui.cpp \
|
||||||
@ -287,7 +286,6 @@ SOURCES += src/qt/gostcoin.cpp \
|
|||||||
src/qt/splashscreen.cpp \
|
src/qt/splashscreen.cpp \
|
||||||
src/qt/showi2paddresses.cpp \
|
src/qt/showi2paddresses.cpp \
|
||||||
src/qt/i2poptionswidget.cpp \
|
src/qt/i2poptionswidget.cpp \
|
||||||
src/qt/setupdarknet.cpp \
|
|
||||||
i2psam/i2psam.cpp
|
i2psam/i2psam.cpp
|
||||||
|
|
||||||
RESOURCES += src/qt/bitcoin.qrc
|
RESOURCES += src/qt/bitcoin.qrc
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include "ui_interface.h"
|
#include "ui_interface.h"
|
||||||
#include "paymentserver.h"
|
#include "paymentserver.h"
|
||||||
#include "splashscreen.h"
|
#include "splashscreen.h"
|
||||||
#include "setupdarknet.h"
|
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#if QT_VERSION < 0x050000
|
#if QT_VERSION < 0x050000
|
||||||
@ -192,11 +191,10 @@ int main(int argc, char *argv[])
|
|||||||
QString("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(mapArgs["-datadir"])));
|
QString("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(mapArgs["-datadir"])));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
// Anoncoin
|
// Gostcoin
|
||||||
if (!boost::filesystem::exists(GetConfigFile().string()))
|
if (!boost::filesystem::exists(GetConfigFile().string()))
|
||||||
{
|
{
|
||||||
// Run wizard
|
writeFirstConfig(); // create default config
|
||||||
runFirstRunWizard();
|
|
||||||
}
|
}
|
||||||
// Read config after it's potentional written by the wizard.
|
// Read config after it's potentional written by the wizard.
|
||||||
ReadConfigFile(mapArgs, mapMultiArgs);
|
ReadConfigFile(mapArgs, mapMultiArgs);
|
||||||
|
@ -1,103 +0,0 @@
|
|||||||
// Copyright 2013 The Anoncoin Developers
|
|
||||||
|
|
||||||
#include <QApplication>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QPushButton>
|
|
||||||
|
|
||||||
#include "setupdarknet.h"
|
|
||||||
#include "bitcoingui.h"
|
|
||||||
#include "util.h"
|
|
||||||
|
|
||||||
|
|
||||||
void runFirstRunWizard()
|
|
||||||
{
|
|
||||||
QString strMessage = BitcoinGUI::tr("Do you run I2P on your computer?\n"
|
|
||||||
"If so, press yes to let Gostcoin configure it's "
|
|
||||||
"connection to the prefered darknet of yours.");
|
|
||||||
QMessageBox::StandardButton isRunningDarknet = QMessageBox::question(NULL,
|
|
||||||
BitcoinGUI::tr("Gostcoin Wizard - Step #1"), strMessage,
|
|
||||||
QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes);
|
|
||||||
if (isRunningDarknet == QMessageBox::No)
|
|
||||||
{
|
|
||||||
// Tell user to download
|
|
||||||
strMessage = BitcoinGUI::tr("Do you want to download I2P, and "
|
|
||||||
"continue darknet setup?\nIf you select yes Gostcoin will quit, "
|
|
||||||
"so you can continue the wizard after installing a darknet.\n"
|
|
||||||
"If you select no, Gostcoin will write a default clearnet "
|
|
||||||
"(regular internet) config file for you. (unsafe mode)\n");
|
|
||||||
QMessageBox::StandardButton wantDownloadDarknet = QMessageBox::question(NULL,
|
|
||||||
BitcoinGUI::tr("Gostcoin Wizard - Step #2"), strMessage,
|
|
||||||
QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes);
|
|
||||||
if (wantDownloadDarknet == QMessageBox::No)
|
|
||||||
{
|
|
||||||
writeFirstConfig(false, false, false, false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
QApplication::quit();
|
|
||||||
exit(7); // Exit code 7 = awaiting darknet
|
|
||||||
}
|
|
||||||
// Step #2 passed
|
|
||||||
QMessageBox msgBox;
|
|
||||||
msgBox.setText(BitcoinGUI::tr("Great! Then which darknet do you run? Or maybe both?"));
|
|
||||||
QPushButton *i2pButton = msgBox.addButton(BitcoinGUI::tr("I2P"), QMessageBox::ActionRole);
|
|
||||||
QPushButton *torButton = msgBox.addButton(BitcoinGUI::tr("Tor"), QMessageBox::ActionRole);
|
|
||||||
QPushButton *bothButton = msgBox.addButton(BitcoinGUI::tr("Both"), QMessageBox::ActionRole);
|
|
||||||
msgBox.exec();
|
|
||||||
if (msgBox.clickedButton() == i2pButton)
|
|
||||||
{
|
|
||||||
FinishWizard(1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (msgBox.clickedButton() == torButton)
|
|
||||||
{
|
|
||||||
FinishWizard(2);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (msgBox.clickedButton() == bothButton)
|
|
||||||
{
|
|
||||||
FinishWizard(3);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void FinishWizard(int darknet)
|
|
||||||
{
|
|
||||||
QMessageBox msgBox;
|
|
||||||
QPushButton *darknetOnlyButton;
|
|
||||||
QPushButton *sharedButton = msgBox.addButton(BitcoinGUI::tr("Shared"), QMessageBox::ActionRole);
|
|
||||||
switch (darknet)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
darknetOnlyButton = msgBox.addButton(BitcoinGUI::tr("I2P only"), QMessageBox::ActionRole);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
darknetOnlyButton = msgBox.addButton(BitcoinGUI::tr("Tor only"), QMessageBox::ActionRole);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
msgBox.setText(BitcoinGUI::tr("Ok, last question!\nDo you want to run shared "
|
|
||||||
"(which means you work as a bridge between the "
|
|
||||||
"darknet and internet) or only darknet?"));
|
|
||||||
msgBox.exec();
|
|
||||||
if (msgBox.clickedButton() == darknetOnlyButton)
|
|
||||||
{
|
|
||||||
if (darknet == 1) // I2P
|
|
||||||
writeFirstConfig(true, false, false, false);
|
|
||||||
if (darknet == 2) // Tor
|
|
||||||
writeFirstConfig(false, true, false, false);
|
|
||||||
}
|
|
||||||
else if (msgBox.clickedButton() == sharedButton)
|
|
||||||
{
|
|
||||||
if (darknet == 1) // I2P
|
|
||||||
writeFirstConfig(false, false, true, false);
|
|
||||||
if (darknet == 2) // Tor
|
|
||||||
writeFirstConfig(false, false, false, true);
|
|
||||||
}
|
|
||||||
if (darknet == 3) // Both
|
|
||||||
writeFirstConfig(false, false, true, true);
|
|
||||||
QMessageBox msgBoxThanks;
|
|
||||||
msgBoxThanks.setText(BitcoinGUI::tr("Thanks! That was all. Enjoy your wallet :)"));
|
|
||||||
msgBoxThanks.exec();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
|||||||
#ifndef SETUPDARKNET_H
|
|
||||||
#define SETUPDARKNET_H
|
|
||||||
|
|
||||||
void runFirstRunWizard();
|
|
||||||
void FinishWizard(int darknet);
|
|
||||||
|
|
||||||
#endif
|
|
15
src/util.cpp
15
src/util.cpp
@ -996,22 +996,13 @@ bool writeConfig(boost::filesystem::path configFile, boost::property_tree::ptree
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Used by GUI wizard
|
// Used by GUI wizard
|
||||||
bool writeFirstConfig(bool i2pOnlyEnabled, bool torOnlyEnabled, bool i2pEnabled, bool torEnabled)
|
bool writeFirstConfig()
|
||||||
{
|
{
|
||||||
using boost::property_tree::ptree;
|
using boost::property_tree::ptree;
|
||||||
ptree pt;
|
ptree pt;
|
||||||
|
|
||||||
if (i2pOnlyEnabled)
|
pt.put("onlynet", "i2p");
|
||||||
pt.put("onlynet", "i2p");
|
pt.put("i2p", 1);
|
||||||
if (torOnlyEnabled)
|
|
||||||
{
|
|
||||||
pt.put("tor", "127.0.0.1:9050");
|
|
||||||
pt.put("onlynet", "tor");
|
|
||||||
}
|
|
||||||
if (i2pEnabled)
|
|
||||||
pt.put("i2p", 1);
|
|
||||||
if (torEnabled)
|
|
||||||
pt.put("proxy", "127.0.0.1:9050");
|
|
||||||
unsigned char rand_pwd[32];
|
unsigned char rand_pwd[32];
|
||||||
RAND_bytes(rand_pwd, 32);
|
RAND_bytes(rand_pwd, 32);
|
||||||
pt.put("rpcuser", "gostcoinrpc");
|
pt.put("rpcuser", "gostcoinrpc");
|
||||||
|
@ -133,7 +133,7 @@ inline void MilliSleep(int64 n)
|
|||||||
|
|
||||||
// Gostcoin
|
// Gostcoin
|
||||||
bool WriteConfig(boost::filesystem::path configFile, boost::property_tree::ptree data);
|
bool WriteConfig(boost::filesystem::path configFile, boost::property_tree::ptree data);
|
||||||
bool writeFirstConfig(bool i2pOnlyEnabled, bool torOnlyEnabled, bool i2pEnabled, bool torEnabled);
|
bool writeFirstConfig(); // always I2P
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user