respect passed-in hostUrl

This commit is contained in:
David Rose 2009-10-19 18:06:00 +00:00
parent d7f56e852d
commit 217580661d
4 changed files with 30 additions and 10 deletions

View File

@ -96,8 +96,8 @@ P3DInstance(P3D_request_ready_func *func,
_has_log_basename = false;
_hidden = (_fparams.lookup_token_int("hidden") != 0);
_allow_python_dev = false;
_keep_user_env = false;
_auto_start = false;
_keep_user_env = (_fparams.lookup_token_int("keep_user_env") != 0);
_auto_start = (_fparams.lookup_token_int("auto_start") != 0);
_auth_button_approved = false;
_failed = false;
_session = NULL;
@ -174,7 +174,7 @@ P3DInstance(P3D_request_ready_func *func,
// it eventually, and it's good to have it loaded early, so we can
// put up a splash image (for instance, the above IT_download image)
// while we download the real contents.
P3DHost *host = inst_mgr->get_host(PANDA_PACKAGE_HOST_URL);
P3DHost *host = inst_mgr->get_host(inst_mgr->get_host_url());
_image_package = host->get_package("images", "");
if (_image_package != NULL) {
_image_package->add_instance(this);
@ -1261,7 +1261,7 @@ mark_p3d_untrusted() {
if (_p3dcert_package == NULL) {
// We have to go download this package.
P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
P3DHost *host = inst_mgr->get_host(PANDA_PACKAGE_HOST_URL);
P3DHost *host = inst_mgr->get_host(inst_mgr->get_host_url());
_p3dcert_package = host->get_package("p3dcert", "");
if (_p3dcert_package != NULL) {
_p3dcert_package->add_instance(this);
@ -1395,11 +1395,6 @@ scan_app_desc_file(TiXmlDocument *doc) {
}
}
// auto_start is true if it is set in the application itself, or in
// the web tokens.
if (_fparams.lookup_token_int("auto_start") != 0) {
_auto_start = true;
}
if (_auth_button_approved) {
// But finally, if the user has already clicked through the red
// "auth" button, no need to present him/her with another green

View File

@ -51,6 +51,22 @@ reset_verify_contents() {
}
////////////////////////////////////////////////////////////////////
// Function: P3DInstanceManager::get_host_url
// Access: Public
// Description: Returns the standard host_url which the instances
// should attempt to contact to download auxiliary
// packages associated with the core API, such as the
// p3dcert and images packages. This is normally the
// compiled-in PANDA_PACKAGE_HOST_URL, but it might be
// set to something different by the -u parameter on the
// panda3d executable.
////////////////////////////////////////////////////////////////////
inline const string &P3DInstanceManager::
get_host_url() const {
return _host_url;
}
////////////////////////////////////////////////////////////////////
// Function: P3DInstanceManager::get_root_dir
// Access: Public
@ -212,7 +228,9 @@ get_plugin_distributor() const {
// Function: P3DInstanceManager::get_coreapi_host_url
// Access: Public
// Description: Returns the host URL from which this Core API was
// downloaded (according to the plugin).
// downloaded (according to the plugin). This is for
// reporting purposes only; see get_host_url() for the
// URL to contact to actually download content.
////////////////////////////////////////////////////////////////////
inline const string &P3DInstanceManager::
get_coreapi_host_url() const {

View File

@ -189,6 +189,11 @@ initialize(const string &contents_filename, const string &host_url,
_platform = DTOOL_PLATFORM;
}
_host_url = host_url;
if (_host_url.empty()) {
_host_url = PANDA_PACKAGE_HOST_URL;
}
_root_dir = find_root_dir();
// Allow the caller (e.g. panda3d.exe) to specify a log directory.

View File

@ -62,6 +62,7 @@ public:
inline bool get_verify_contents() const;
inline void reset_verify_contents();
inline const string &get_host_url() const;
inline const string &get_root_dir() const;
inline const string &get_platform() const;
inline const string &get_temp_directory() const;
@ -139,6 +140,7 @@ private:
private:
bool _is_initialized;
string _host_url;
string _root_dir;
string _certs_dir;
bool _verify_contents;