mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 17:35:34 -04:00
more work towards p3dcert
This commit is contained in:
parent
ea41a5a834
commit
f1dc8538f6
@ -1429,7 +1429,17 @@ class Packager:
|
|||||||
else:
|
else:
|
||||||
self.multifile.addSubfile(file.newName, file.filename, compressionLevel)
|
self.multifile.addSubfile(file.newName, file.filename, compressionLevel)
|
||||||
if file.extract:
|
if file.extract:
|
||||||
xextract = self.getFileSpec('extract', file.filename, file.newName)
|
if file.text:
|
||||||
|
# Better write it to a temporary file, so we can
|
||||||
|
# get its hash.
|
||||||
|
tfile = Filename.temporary('', 'p3d_')
|
||||||
|
open(tfile.toOsSpecific(), 'wb').write(file.text)
|
||||||
|
xextract = self.getFileSpec('extract', tfile, file.newName)
|
||||||
|
tfile.unlink()
|
||||||
|
|
||||||
|
else:
|
||||||
|
# The file data exists on disk already.
|
||||||
|
xextract = self.getFileSpec('extract', file.filename, file.newName)
|
||||||
self.extracts.append((file.newName.lower(), xextract))
|
self.extracts.append((file.newName.lower(), xextract))
|
||||||
|
|
||||||
xcomponent = TiXmlElement('component')
|
xcomponent = TiXmlElement('component')
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from pandac.PandaModules import getModelPath, Filename
|
from pandac.PandaModules import getModelPath, Filename, ConfigVariableFilename
|
||||||
|
|
||||||
# This file defines a number of standard "packages" that correspond to
|
# This file defines a number of standard "packages" that correspond to
|
||||||
# a Panda3D distribution. These packages are built by passing this
|
# a Panda3D distribution. These packages are built by passing this
|
||||||
@ -63,8 +63,18 @@ class images(package):
|
|||||||
class p3dcert(package):
|
class p3dcert(package):
|
||||||
# This special application, used to pop up a dialog to prompt the
|
# This special application, used to pop up a dialog to prompt the
|
||||||
# user to accept or deny unknown applications, is its own package.
|
# user to accept or deny unknown applications, is its own package.
|
||||||
|
config(display_name = "Authorization Dialog")
|
||||||
|
|
||||||
file('p3dcert.exe')
|
file('p3dcert.exe')
|
||||||
|
|
||||||
|
# Also add the certificate authority file.
|
||||||
|
cvar = ConfigVariableFilename('ca-bundle-filename')
|
||||||
|
filename = Filename(cvar.getValue())
|
||||||
|
if not filename.empty():
|
||||||
|
print filename
|
||||||
|
file(filename, newName = 'ca-bundle.crt', extract = True)
|
||||||
|
|
||||||
|
|
||||||
class panda3d(package):
|
class panda3d(package):
|
||||||
# The core Panda3D package. Contains Python and most of the graphics
|
# The core Panda3D package. Contains Python and most of the graphics
|
||||||
# code in Panda3D.
|
# code in Panda3D.
|
||||||
|
@ -73,22 +73,8 @@ no_cert_text = _T
|
|||||||
|
|
||||||
"Click Cancel to avoid running this application.");
|
"Click Cancel to avoid running this application.");
|
||||||
|
|
||||||
// the event tables connect the wxWidgets events with the functions
|
// wxWidgets boilerplate macro to define main() and start up the
|
||||||
// (event handlers) which process them. It can be also done at
|
// application.
|
||||||
// run-time, but for the simple menu events like this the static
|
|
||||||
// method is much simpler.
|
|
||||||
/*
|
|
||||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|
||||||
EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
|
|
||||||
EVT_MENU(Minimal_About, MyFrame::OnAbout)
|
|
||||||
END_EVENT_TABLE()
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Create a new application object: this macro will allow wxWidgets to
|
|
||||||
// create the application object during program execution (it's better
|
|
||||||
// than using a static object for many reasons) and also implements
|
|
||||||
// the accessor function wxGetApp() which will return the reference of
|
|
||||||
// the right type (i.e. P3DCertApp and not wxApp)
|
|
||||||
IMPLEMENT_APP(P3DCertApp)
|
IMPLEMENT_APP(P3DCertApp)
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -118,6 +104,7 @@ OnInit() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
AuthDialog *dialog = new AuthDialog(_cert_filename, _ca_filename);
|
AuthDialog *dialog = new AuthDialog(_cert_filename, _ca_filename);
|
||||||
|
SetTopWindow(dialog);
|
||||||
dialog->Show(true);
|
dialog->Show(true);
|
||||||
|
|
||||||
// Return true to enter the main loop and wait for user input.
|
// Return true to enter the main loop and wait for user input.
|
||||||
@ -149,6 +136,15 @@ OnCmdLineParsed(wxCmdLineParser &parser) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// The event table for AuthDialog.
|
||||||
|
#define VIEW_CERT_BUTTON (wxID_HIGHEST + 1)
|
||||||
|
BEGIN_EVENT_TABLE(AuthDialog, wxDialog)
|
||||||
|
EVT_BUTTON(wxID_OK, AuthDialog::run_clicked)
|
||||||
|
EVT_BUTTON(VIEW_CERT_BUTTON, AuthDialog::view_cert_clicked)
|
||||||
|
EVT_BUTTON(wxID_CANCEL, AuthDialog::cancel_clicked)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: AuthDialog::Constructor
|
// Function: AuthDialog::Constructor
|
||||||
// Access: Public
|
// Access: Public
|
||||||
@ -185,6 +181,38 @@ AuthDialog::
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: AuthDialog::run_clicked
|
||||||
|
// Access: Public
|
||||||
|
// Description: The user clicks the "Run" button.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void AuthDialog::
|
||||||
|
run_clicked(wxCommandEvent &event) {
|
||||||
|
cerr << "run\n";
|
||||||
|
Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: AuthDialog::run_clicked
|
||||||
|
// Access: Public
|
||||||
|
// Description: The user clicks the "View Certificate" button.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void AuthDialog::
|
||||||
|
view_cert_clicked(wxCommandEvent &event) {
|
||||||
|
cerr << "view cert\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: AuthDialog::run_clicked
|
||||||
|
// Access: Public
|
||||||
|
// Description: The user clicks the "Cancel" button.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void AuthDialog::
|
||||||
|
cancel_clicked(wxCommandEvent &event) {
|
||||||
|
cerr << "cancel\n";
|
||||||
|
Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: AuthDialog::read_cert_file
|
// Function: AuthDialog::read_cert_file
|
||||||
// Access: Private
|
// Access: Private
|
||||||
@ -328,6 +356,7 @@ layout() {
|
|||||||
wxStaticText *text0 = new wxStaticText
|
wxStaticText *text0 = new wxStaticText
|
||||||
(panel, wxID_ANY, header, wxDefaultPosition, wxDefaultSize,
|
(panel, wxID_ANY, header, wxDefaultPosition, wxDefaultSize,
|
||||||
wxALIGN_CENTER);
|
wxALIGN_CENTER);
|
||||||
|
text0->SetFont(*bold_font);
|
||||||
vsizer->Add(text0, 0, wxCENTER | wxALL, 10);
|
vsizer->Add(text0, 0, wxCENTER | wxALL, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,7 +374,7 @@ layout() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_cert != NULL) {
|
if (_cert != NULL) {
|
||||||
wxButton *view_button = new wxButton(panel, wxID_ANY, _T("View Certificate"));
|
wxButton *view_button = new wxButton(panel, VIEW_CERT_BUTTON, _T("View Certificate"));
|
||||||
bsizer->Add(view_button, 0, wxALIGN_CENTER | wxALL, 5);
|
bsizer->Add(view_button, 0, wxALIGN_CENTER | wxALL, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,7 +410,7 @@ get_text(wxString &header, wxString &text) {
|
|||||||
case X509_V_ERR_CERT_HAS_EXPIRED:
|
case X509_V_ERR_CERT_HAS_EXPIRED:
|
||||||
case X509_V_ERR_CRL_NOT_YET_VALID:
|
case X509_V_ERR_CRL_NOT_YET_VALID:
|
||||||
case X509_V_ERR_CRL_HAS_EXPIRED:
|
case X509_V_ERR_CRL_HAS_EXPIRED:
|
||||||
header = _T("Expired signatured!");
|
header = _T("Expired signature!");
|
||||||
text.Printf(expired_cert_text, _common_name.c_str());
|
text.Printf(expired_cert_text, _common_name.c_str());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -56,12 +56,10 @@ class AuthDialog : public wxDialog {
|
|||||||
public:
|
public:
|
||||||
AuthDialog(const wxString &cert_filename, const wxString &ca_filename);
|
AuthDialog(const wxString &cert_filename, const wxString &ca_filename);
|
||||||
virtual ~AuthDialog();
|
virtual ~AuthDialog();
|
||||||
|
|
||||||
/*
|
void run_clicked(wxCommandEvent &event);
|
||||||
// event handlers (these functions should _not_ be virtual)
|
void view_cert_clicked(wxCommandEvent &event);
|
||||||
void OnQuit(wxCommandEvent &event);
|
void cancel_clicked(wxCommandEvent &event);
|
||||||
void OnAbout(wxCommandEvent &event);
|
|
||||||
*/
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void read_cert_file(const wxString &cert_filename);
|
void read_cert_file(const wxString &cert_filename);
|
||||||
@ -73,7 +71,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// any class wishing to process wxWidgets events must use this macro
|
// any class wishing to process wxWidgets events must use this macro
|
||||||
// DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
|
||||||
X509 *_cert;
|
X509 *_cert;
|
||||||
STACK *_stack;
|
STACK *_stack;
|
||||||
|
@ -220,8 +220,8 @@ set_p3d_url(const string &p3d_url) {
|
|||||||
// Maybe it's time to open a splash window now.
|
// Maybe it's time to open a splash window now.
|
||||||
make_splash_window();
|
make_splash_window();
|
||||||
|
|
||||||
// Mark the time we started downloading, so we'll know when to set
|
// Mark the time we started downloading, so we'll know when to reveal
|
||||||
// the install label.
|
// the progress bar.
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
_start_dl_instance_tick = GetTickCount();
|
_start_dl_instance_tick = GetTickCount();
|
||||||
#else
|
#else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user