Mercurial > mercurial > hgweb_rsearcher.cgi
diff src/main.cpp @ 10:36811fd22bd2
v1.4
author | pyon@macmini |
---|---|
date | Thu, 08 Nov 2018 19:15:43 +0900 |
parents | ae89ce4793d8 |
children | 799b6008db8e |
line wrap: on
line diff
--- a/src/main.cpp Wed Oct 31 20:10:29 2018 +0900 +++ b/src/main.cpp Thu Nov 08 19:15:43 2018 +0900 @@ -1,7 +1,8 @@ // Filename : main.cpp -// Last Change: 2018-10-31 水 15:18:12. +// Last Change: 2018-11-01 木 11:39:22. // +#include <wx/socket.h> #include "id.h" #include "main.h" #include "auth.h" @@ -31,6 +32,7 @@ // Main Window MainFrame *mainframe = new MainFrame( NULL, ID_MAIN, wxEmptyString, wxPoint( rect.x, rect.y ), rect.GetSize(), wxDEFAULT_FRAME_STYLE ); mainframe->SetServer( m_serveraddr, m_serverport ); + mainframe->InDevelop( true ); if ( !mainframe->GetDB() ) { mainframe->Destroy(); return true; @@ -39,7 +41,30 @@ // Splash Screen SplashScreen( splash ); - // User Dialgo + // Mode + if ( !unlock_key.IsEmpty() ) { + wxIPV4address addr; + addr.Hostname( wxGetFullHostName() ); + + wxString key = wxT( "re:searcher" ) + addr.IPAddress(); + wxArrayString args; + args.Add( wxT( "crypto.exe" ) ); + args.Add( wxT( "-a" ) ); + args.Add( key ); + + wxArrayString output, errors; + wxExecute( wxJoin( args, ' ', '\\' ), output, errors ); + + if ( unlock_key.IsSameAs( output[0] ) ) { + mainframe->SetUser( wxT( "root" ) ); + mainframe->SetTitle( wxT( "Re:Searcher - root" ) ); + mainframe->LoadDB(); + mainframe->Show( true ); + return true; + } + } + + // User Dialog AuthDialog *authdlg = new AuthDialog( NULL, wxID_ANY, wxT( "Who are you ?" ), wxDefaultPosition, wxDefaultSize, wxCAPTION ); if ( !authdlg->LoadDB() ) { authdlg->Destroy(); @@ -69,7 +94,6 @@ mainframe->SetUser( authdlg->GetUser() ); mainframe->SetTitle( wxT( "Re:Searcher - " ) + authdlg->GetUser() ); mainframe->LoadDB(); - mainframe->InDevelop( true ); mainframe->Show( true ); } else { mainframe->Destroy(); @@ -114,6 +138,7 @@ config->SetPath( wxT( "/Misc" ) ); config->Read( wxT( "splash" ), &splash ); + config->Read( wxT( "unlock_key" ), &unlock_key ); delete config; }