mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 07:29:33 -05:00
improved user commandline webui startup user experience
This commit is contained in:
parent
53313670f5
commit
a64fda1fb8
@ -64,9 +64,18 @@ JsonApiPage::JsonApiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/)
|
|||||||
|
|
||||||
mEventHandlerId = 0;
|
mEventHandlerId = 0;
|
||||||
|
|
||||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> /* event */)
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
|
||||||
{
|
{
|
||||||
std::cerr << "Caught JSONAPI event!" << std::endl;
|
if(e->mType != RsEventType::JSON_API)
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto je = dynamic_cast<const RsJsonApiEvent*>(e.get());
|
||||||
|
|
||||||
|
if(!je)
|
||||||
|
return;
|
||||||
|
|
||||||
|
std::cerr << "Caught JSONAPI event! code=" << static_cast<int>(je->mJsonApiEventCode) << std::endl;
|
||||||
|
|
||||||
RsQThreadUtils::postToObject([=]() { load(); }, this );
|
RsQThreadUtils::postToObject([=]() { load(); }, this );
|
||||||
},
|
},
|
||||||
mEventHandlerId, RsEventType::JSON_API );
|
mEventHandlerId, RsEventType::JSON_API );
|
||||||
|
@ -220,7 +220,7 @@ int main(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef RS_SERVICE_TERMINAL_WEBUI_PASSWORD
|
#ifdef RS_SERVICE_TERMINAL_WEBUI_PASSWORD
|
||||||
if(!webui_pass1.empty())
|
if(askWebUiPassword && !webui_pass1.empty())
|
||||||
{
|
{
|
||||||
rsWebUi->setHtmlFilesDirectory(webui_base_directory);
|
rsWebUi->setHtmlFilesDirectory(webui_base_directory);
|
||||||
conf.webUIPasswd = webui_pass1; // cannot be set using rsWebUI methods because it calls the still non-existent rsJsonApi
|
conf.webUIPasswd = webui_pass1; // cannot be set using rsWebUI methods because it calls the still non-existent rsJsonApi
|
||||||
@ -236,6 +236,11 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
int initResult = RsInit::InitRetroShare(conf);
|
int initResult = RsInit::InitRetroShare(conf);
|
||||||
|
|
||||||
|
#ifdef RS_JSONAPI
|
||||||
|
RsInit::startupWebServices(conf);
|
||||||
|
rstime::rs_usleep(1000000); // waits for jas->restart to print stuff
|
||||||
|
#endif
|
||||||
|
|
||||||
if(initResult != RS_INIT_OK)
|
if(initResult != RS_INIT_OK)
|
||||||
{
|
{
|
||||||
RsFatal() << "Retroshare core initalization failed with: " << initResult
|
RsFatal() << "Retroshare core initalization failed with: " << initResult
|
||||||
@ -269,10 +274,11 @@ int main(int argc, char* argv[])
|
|||||||
<< colored(COLOR_PURPLE,locations[i].mPgpName + " (" + locations[i].mLocationName + ")" )
|
<< colored(COLOR_PURPLE,locations[i].mPgpName + " (" + locations[i].mLocationName + ")" )
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
uint32_t nacc = 0;
|
std::cout << std::endl;
|
||||||
|
uint32_t nacc = 0;
|
||||||
while(keepRunning && (nacc < 1 || nacc >= locations.size()))
|
while(keepRunning && (nacc < 1 || nacc >= locations.size()))
|
||||||
{
|
{
|
||||||
std::cout << colored(COLOR_GREEN,"Please enter account number:\n");
|
std::cout << colored(COLOR_GREEN,"Please enter account number: ");
|
||||||
std::cout.flush();
|
std::cout.flush();
|
||||||
|
|
||||||
std::string inputStr;
|
std::string inputStr;
|
||||||
|
Loading…
Reference in New Issue
Block a user