Add contact page

This commit is contained in:
calzoneman 2014-02-13 18:15:22 -06:00
parent d24214949a
commit 1cbb1c2a6a
7 changed files with 95 additions and 7 deletions

View file

@ -68,7 +68,14 @@ var defaults = {
usernames: ["^(.*?[-_])?admin(istrator)?([-_].*)?$", "^(.*?[-_])?owner([-_].*)?$"],
channels: ["^(.*?[-_])?admin(istrator)?([-_].*)?$", "^(.*?[-_])?owner([-_].*)?$"],
pagetitles: []
}
},
"contacts": [
{
name: "calzoneman",
title: "Developer",
email: "cyzon@cytu.be"
}
]
};
/**

View file

@ -9,7 +9,7 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
const VERSION = "3.0.0-alpha";
const VERSION = "3.0.0-RC1";
var singleton = null;
var Config = require("./config");

View file

@ -177,9 +177,6 @@ function handleSocketConfig(req, res) {
"IO_URL=WEB_URL=SSL_URL;}" : ""));
}
/**
* Handles a request for the user agreement
*/
function handleUserAgreement(req, res) {
logRequest(req);
sendJade(res, "tos", {
@ -187,6 +184,36 @@ function handleUserAgreement(req, res) {
});
}
function handleContactPage(req, res) {
logRequest(req);
// Make a copy to prevent messing with the original
var contacts = Config.get("contacts").map(function (c) {
return {
name: c.name,
email: c.email,
title: c.title
};
});
// Rudimentary hiding of email addresses to prevent spambots
contacts.forEach(function (c) {
c.emkey = $util.randomSalt(16)
var email = new Array(c.email.length);
for (var i = 0; i < c.email.length; i++) {
email[i] = String.fromCharCode(
c.email.charCodeAt(i) ^ c.emkey.charCodeAt(i % c.emkey.length)
);
}
c.email = escape(email.join(""));
c.emkey = escape(c.emkey);
});
sendJade(res, "contact", {
contacts: contacts
});
}
module.exports = {
/**
* Initializes webserver callbacks
@ -210,6 +237,7 @@ module.exports = {
app.get("/", handleIndex);
app.get("/sioconfig", handleSocketConfig);
app.get("/useragreement", handleUserAgreement);
app.get("/contact", handleContactPage);
require("./auth").init(app);
require("./account").init(app);
require("./acp").init(app);