Web interface: Fix base_location setting for register.shtml page
This commit is contained in:
parent
68527d73e2
commit
3a19c755fb
4 changed files with 12 additions and 2 deletions
|
@ -11,6 +11,7 @@
|
||||||
<script src="/js/jquery.js"></script>
|
<script src="/js/jquery.js"></script>
|
||||||
<script src="/js/jquery-ui.js"></script>
|
<script src="/js/jquery-ui.js"></script>
|
||||||
<script src="/js/jquery.cookie.js"></script>
|
<script src="/js/jquery.cookie.js"></script>
|
||||||
|
<script src="/js/config.js"></script>
|
||||||
<script src="/js/app.js"></script>
|
<script src="/js/app.js"></script>
|
||||||
<title>Spectrum 2</title>
|
<title>Spectrum 2</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -214,7 +214,7 @@ function fill_users_register_form() {
|
||||||
"password": $("#password").val()
|
"password": $("#password").val()
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post("/api/v1/users/add", postdata, function(data) {
|
$.post(BaseLocation + "api/v1/users/add", postdata, function(data) {
|
||||||
if (data.error) {
|
if (data.error) {
|
||||||
$('#error').text(data.message);
|
$('#error').text(data.message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,6 +105,14 @@ Server::Server(ManagerConfig *config, const std::string &config_file) {
|
||||||
footer.close();
|
footer.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::ofstream output;
|
||||||
|
output.open(std::string(CONFIG_STRING(config, "service.data_dir") + "/js/config.js").c_str(), std::ios::out);
|
||||||
|
if (output.fail()) {
|
||||||
|
LOG4CXX_ERROR(logger, "Cannot open " << std::string(CONFIG_STRING(config, "service.data_dir") + "/js/config.js") << " for writing: " << strerror(errno));
|
||||||
|
}
|
||||||
|
output << "var BaseLocation = \"" << CONFIG_STRING(m_config, "service.base_location") << "\";\n";
|
||||||
|
output.close();
|
||||||
|
|
||||||
m_storageCfg = new Config();
|
m_storageCfg = new Config();
|
||||||
m_storageCfg->load(config_file);
|
m_storageCfg->load(config_file);
|
||||||
|
|
||||||
|
@ -235,6 +243,7 @@ bool Server::is_authorized(const struct mg_connection *conn, struct http_message
|
||||||
!mg_vcmp(&hm->uri, "/js/jquery.js") ||
|
!mg_vcmp(&hm->uri, "/js/jquery.js") ||
|
||||||
!mg_vcmp(&hm->uri, "/js/jquery-ui.js") ||
|
!mg_vcmp(&hm->uri, "/js/jquery-ui.js") ||
|
||||||
!mg_vcmp(&hm->uri, "/js/jquery.cookie.js") ||
|
!mg_vcmp(&hm->uri, "/js/jquery.cookie.js") ||
|
||||||
|
!mg_vcmp(&hm->uri, "/js/config.js") ||
|
||||||
!mg_vcmp(&hm->uri, "/js/app.js") ||
|
!mg_vcmp(&hm->uri, "/js/app.js") ||
|
||||||
!mg_vcmp(&hm->uri, "/users/register.shtml") ||
|
!mg_vcmp(&hm->uri, "/users/register.shtml") ||
|
||||||
!mg_vcmp(&hm->uri, "/api/v1/users/add") ||
|
!mg_vcmp(&hm->uri, "/api/v1/users/add") ||
|
||||||
|
|
|
@ -20,8 +20,8 @@ return {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
["attr"] = {
|
["attr"] = {
|
||||||
["version"] = "2.0";
|
|
||||||
["prodid"] = "-//HandGen//NONSGML vGen v1.0//EN";
|
["prodid"] = "-//HandGen//NONSGML vGen v1.0//EN";
|
||||||
|
["version"] = "2.0";
|
||||||
["xmlns"] = "vcard-temp";
|
["xmlns"] = "vcard-temp";
|
||||||
};
|
};
|
||||||
["name"] = "vCard";
|
["name"] = "vCard";
|
||||||
|
|
Loading…
Add table
Reference in a new issue