mirror of https://github.com/BOINC/boinc.git
Move client_version_check_url, client_download_url and client_new_version_text tags from cc_config.xml into new nvc_config.xml file.
If nvc_config.cml file is absent, use default values. Branded installers can create or replace this file to customize these values. Standard (unbranded) BOINC installers should either delete the file or create or replace it with one containing default values.
This commit is contained in:
parent
80a2cae9b7
commit
4f09c1979b
|
@ -24,15 +24,95 @@
|
|||
|
||||
#include "client_msgs.h"
|
||||
#include "client_state.h"
|
||||
#include "log_flags.h"
|
||||
#include "file_names.h"
|
||||
|
||||
#include "current_version.h"
|
||||
|
||||
NVC_CONFIG nvc_config;
|
||||
|
||||
NVC_CONFIG::NVC_CONFIG() {
|
||||
defaults();
|
||||
}
|
||||
|
||||
// this is called first thing by client
|
||||
//
|
||||
void NVC_CONFIG::defaults() {
|
||||
client_download_url = "https://boinc.berkeley.edu/download.php";
|
||||
client_new_version_text = "";
|
||||
client_version_check_url = "https://boinc.berkeley.edu/download.php?xml=1";
|
||||
};
|
||||
|
||||
int NVC_CONFIG::parse(FILE* f) {
|
||||
MIOFILE mf;
|
||||
XML_PARSER xp(&mf);
|
||||
|
||||
mf.init_file(f);
|
||||
if (!xp.parse_start("nvc_config")) {
|
||||
msg_printf_notice(NULL, false,
|
||||
"https://boinc.berkeley.edu/manager_links.php?target=notice&controlid=config",
|
||||
"%s",
|
||||
_("Missing start tag in nvc_config.xml")
|
||||
);
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
while (!xp.get_tag()) {
|
||||
if (!xp.is_tag) {
|
||||
msg_printf_notice(NULL, false,
|
||||
"https://boinc.berkeley.edu/manager_links.php?target=notice&controlid=config",
|
||||
"%s: %s",
|
||||
_("Unexpected text in nvc_config.xml"),
|
||||
xp.parsed_tag
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (xp.match_tag("/nvc_config")) {
|
||||
notices.remove_notices(NULL, REMOVE_CONFIG_MSG);
|
||||
return 0;
|
||||
}
|
||||
if (xp.parse_string("client_download_url", client_download_url)) {
|
||||
downcase_string(client_download_url);
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_string("client_new_version_text", client_new_version_text)) {
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_string("client_version_check_url", client_version_check_url)) {
|
||||
downcase_string(client_version_check_url);
|
||||
continue;
|
||||
}
|
||||
msg_printf_notice(NULL, false,
|
||||
"https://boinc.berkeley.edu/manager_links.php?target=notice&controlid=config",
|
||||
"%s: <%s>",
|
||||
_("Unrecognized tag in nvc_config.xml"),
|
||||
xp.parsed_tag
|
||||
);
|
||||
xp.skip_unexpected(true, "NVC_CONFIG.parse");
|
||||
}
|
||||
msg_printf_notice(NULL, false,
|
||||
"https://boinc.berkeley.edu/manager_links.php?target=notice&controlid=config",
|
||||
"%s",
|
||||
_("Missing end tag in nvc_config.xml")
|
||||
);
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
|
||||
int read_vc_config_file() {
|
||||
nvc_config.defaults();
|
||||
FILE* f = boinc_fopen(NVC_CONFIG_FILE, "r");
|
||||
if (!f) {
|
||||
msg_printf(NULL, MSG_INFO, "nvc_config.xml not found - using defaults");
|
||||
return ERR_FOPEN;
|
||||
}
|
||||
nvc_config.parse(f);
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GET_CURRENT_VERSION_OP::do_rpc() {
|
||||
int retval;
|
||||
|
||||
retval = gui_http->do_rpc(
|
||||
this, cc_config.client_version_check_url.c_str(),
|
||||
this, nvc_config.client_version_check_url.c_str(),
|
||||
GET_CURRENT_VERSION_FILENAME,
|
||||
true
|
||||
);
|
||||
|
@ -84,21 +164,21 @@ static bool parse_version(FILE* f, char* new_version, int len) {
|
|||
}
|
||||
|
||||
static void show_newer_version_msg(const char* new_vers) {
|
||||
if (cc_config.client_new_version_text.empty()) {
|
||||
if (nvc_config.client_new_version_text.empty()) {
|
||||
msg_printf_notice(0, true,
|
||||
"https://boinc.berkeley.edu/manager_links.php?target=notice&controlid=download",
|
||||
"%s (%s). <a href=%s>%s</a>",
|
||||
_("A new version of BOINC is available"),
|
||||
new_vers,
|
||||
cc_config.client_download_url.c_str(),
|
||||
nvc_config.client_download_url.c_str(),
|
||||
_("Download")
|
||||
);
|
||||
} else {
|
||||
msg_printf_notice(0, true, NULL,
|
||||
"%s (%s). <a href=%s>%s</a>",
|
||||
cc_config.client_new_version_text.c_str(),
|
||||
nvc_config.client_new_version_text.c_str(),
|
||||
new_vers,
|
||||
cc_config.client_download_url.c_str(),
|
||||
nvc_config.client_download_url.c_str(),
|
||||
_("Download")
|
||||
);
|
||||
}
|
||||
|
|
|
@ -34,4 +34,18 @@ struct GET_CURRENT_VERSION_OP: public GUI_HTTP_OP {
|
|||
|
||||
extern void newer_version_startup_check();
|
||||
|
||||
struct NVC_CONFIG {
|
||||
std::string client_download_url;
|
||||
std::string client_new_version_text;
|
||||
std::string client_version_check_url;
|
||||
|
||||
NVC_CONFIG();
|
||||
void defaults();
|
||||
int parse(FILE*);
|
||||
};
|
||||
|
||||
extern NVC_CONFIG nvc_config;
|
||||
|
||||
extern int read_vc_config_file(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -70,6 +70,7 @@ extern void send_log_after(const char* filename, double t, MIOFILE& mf);
|
|||
#endif
|
||||
#define CLIENT_OPAQUE_FILENAME "client_opaque.txt"
|
||||
#define CONFIG_FILE "cc_config.xml"
|
||||
#define NVC_CONFIG_FILE "nvc_config.xml"
|
||||
#define COPROC_INFO_FILENAME "coproc_info.xml"
|
||||
#define CPU_BENCHMARKS_FILE_NAME "cpu_benchmarks"
|
||||
#define CREATE_ACCOUNT_FILENAME "create_account.xml"
|
||||
|
|
|
@ -1030,7 +1030,7 @@ static void handle_get_newer_version(GUI_RPC_CONN& grc) {
|
|||
"<newer_version>%s</newer_version>\n"
|
||||
"<download_url>%s</download_url>\n",
|
||||
gstate.newer_version.c_str(),
|
||||
cc_config.client_download_url.c_str()
|
||||
nvc_config.client_download_url.c_str()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -331,17 +331,6 @@ int CC_CONFIG::parse_options_client(XML_PARSER& xp) {
|
|||
alt_platforms.push_back(s);
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_string("client_download_url", client_download_url)) {
|
||||
downcase_string(client_download_url);
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_string("client_new_version_text", client_new_version_text)) {
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_string("client_version_check_url", client_version_check_url)) {
|
||||
downcase_string(client_version_check_url);
|
||||
continue;
|
||||
}
|
||||
if (xp.match_tag("coproc")) {
|
||||
COPROC c;
|
||||
retval = c.parse(xp);
|
||||
|
|
|
@ -185,6 +185,7 @@ static void init_core_client(int argc, char** argv) {
|
|||
setbuf(stderr, 0);
|
||||
|
||||
cc_config.defaults();
|
||||
nvc_config.defaults();
|
||||
gstate.parse_cmdline(argc, argv);
|
||||
gstate.now = dtime();
|
||||
|
||||
|
@ -233,7 +234,8 @@ static void init_core_client(int argc, char** argv) {
|
|||
#endif
|
||||
|
||||
read_config_file(true);
|
||||
|
||||
read_vc_config_file();
|
||||
|
||||
// Win32 - detach from console if requested
|
||||
#ifdef _WIN32
|
||||
if (gstate.detach_console) {
|
||||
|
|
|
@ -210,9 +210,6 @@ void CC_CONFIG::defaults() {
|
|||
allow_multiple_clients = false;
|
||||
allow_remote_gui_rpc = false;
|
||||
alt_platforms.clear();
|
||||
client_download_url = "https://boinc.berkeley.edu/download.php";
|
||||
client_new_version_text = "";
|
||||
client_version_check_url = "https://boinc.berkeley.edu/download.php?xml=1";
|
||||
config_coprocs.clear();
|
||||
disallow_attach = false;
|
||||
dont_check_file_sizes = false;
|
||||
|
@ -330,17 +327,6 @@ int CC_CONFIG::parse_options(XML_PARSER& xp) {
|
|||
alt_platforms.push_back(s);
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_string("client_download_url", client_download_url)) {
|
||||
downcase_string(client_download_url);
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_string("client_new_version_text", client_new_version_text)) {
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_string("client_version_check_url", client_version_check_url)) {
|
||||
downcase_string(client_version_check_url);
|
||||
continue;
|
||||
}
|
||||
if (xp.match_tag("coproc")) {
|
||||
COPROC c;
|
||||
retval = c.parse(xp);
|
||||
|
@ -524,15 +510,6 @@ int CC_CONFIG::write(MIOFILE& out, LOG_FLAGS& log_flags) {
|
|||
);
|
||||
}
|
||||
|
||||
out.printf(
|
||||
" <client_version_check_url>%s</client_version_check_url>\n"
|
||||
" <client_new_version_text>%s</client_new_version_text>\n"
|
||||
" <client_download_url>%s</client_download_url>\n",
|
||||
client_version_check_url.c_str(),
|
||||
client_new_version_text.c_str(),
|
||||
client_download_url.c_str()
|
||||
);
|
||||
|
||||
for (int k=1; k<config_coprocs.n_rsc; k++) {
|
||||
if (!config_coprocs.coprocs[k].specified_in_config) continue;
|
||||
out.printf(
|
||||
|
|
|
@ -146,9 +146,6 @@ struct CC_CONFIG {
|
|||
bool allow_multiple_clients;
|
||||
bool allow_remote_gui_rpc;
|
||||
std::vector<std::string> alt_platforms;
|
||||
std::string client_download_url;
|
||||
std::string client_new_version_text;
|
||||
std::string client_version_check_url;
|
||||
COPROCS config_coprocs;
|
||||
bool disallow_attach;
|
||||
bool dont_check_file_sizes;
|
||||
|
|
|
@ -19,3 +19,5 @@ INSTALLERICON="WCGrid"
|
|||
|
||||
READMEFILE="WCGrid-ReadMe.rtf"
|
||||
BRANDING_INFO="BrandId=4"
|
||||
|
||||
NEWVERSIONCHECKDIR="WCG"
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
## INSTALLERICON="WCGridInstaller.icns" ##The icon for the branded installer
|
||||
## READMEFILE="WCGrid-ReadMe.rtf" ##The branded readme file
|
||||
## BRANDING_INFO="BrandId=4" ##Info to write into the branding file
|
||||
## NEWVERSIONCHECKDIR="WCG" ##The nvc_config.xml file to use, or empty string if none
|
||||
##
|
||||
## NOTE: This script requires Mac OS 10.6 or later, and uses XCode developer
|
||||
## tools. So you must have installed XCode Developer Tools on the Mac
|
||||
|
@ -191,6 +192,10 @@ cp -fp curl/ca-bundle.crt ../BOINC_Installer/Pkg_Root/Library/Application\ Suppo
|
|||
|
||||
cp -fp win_build/installerv2/redist/all_projects_list.xml ../BOINC_Installer/Pkg_Root/Library/Application\ Support/BOINC\ Data/installer_projects_list.xml
|
||||
|
||||
if [ -n "${NEWVERSIONCHECKDIR}" ]; then
|
||||
cp -fp "win_build/installerv2/redist/${NEWVERSIONCHECKDIR}/nvc_config.xml" ../BOINC_Installer/Pkg_Root/Library/Application\ Support/BOINC\ Data/installer_projects_list.xml
|
||||
fi
|
||||
|
||||
cp -fp clientscr/res/boinc_logo_black.jpg ../BOINC_Installer/Pkg_Root/Library/Application\ Support/BOINC\ Data/
|
||||
cp -fp api/ttf/liberation-fonts-ttf-2.00.0/LiberationSans-Regular.ttf ../BOINC_Installer/Pkg_Root/Library/Application\ Support/BOINC\ Data/LiberationSans-Regular.ttf
|
||||
cp -fp clientscr/ss_config.xml ../BOINC_Installer/Pkg_Root/Library/Application\ Support/BOINC\ Data/
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<nvc_config>
|
||||
<client_download_url>https://www.worldcommunitygrid.org/reg/ms/viewDownloadAgain.do</client_download_url>
|
||||
<client_version_check_url>https://www.worldcommunitygrid.org/download_all.php?xml=1</client_version_check_url>
|
||||
<client_new_version_text>"A new version of World Community Grid is available"</client_new_version_text>
|
||||
</nvc_config>
|
Loading…
Reference in New Issue