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

@ -96,3 +96,9 @@ reserved-names:
- '^(.*?[-_])?admin(istrator)?([-_].*)?$'
- '^(.*?[-_])?owner([-_].*)?$'
pagetitles: []
# Provide a contact list for the /contact page
contacts:
- name: 'calzoneman'
title: 'Developer'
email: 'cyzon@cytu.be'

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);

View File

@ -2,7 +2,7 @@
"author": "Calvin Montgomery",
"name": "CyTube",
"description": "Online media synchronizer and chat",
"version": "3.0.0-alpha",
"version": "3.0.0-RC1",
"repository": {
"url": "http://github.com/calzoneman/sync"
},

47
templates/contact.jade Normal file
View File

@ -0,0 +1,47 @@
mixin email(e, k)
button.btn.btn-xs.btn-default(onclick="showEmail(this, '#{e}', '#{k}')") Show Email
doctype html
html(lang="en")
head
include head
mixin head()
body
#wrap
nav.navbar.navbar-inverse.navbar-fixed-top(role="navigation")
include nav
mixin navheader()
#nav-collapsible.collapse.navbar-collapse
ul.nav.navbar-nav
mixin navdefaultlinks("/contact")
mixin navloginlogout("/contact")
section#mainpage
.container
.col-md-8.col-md-offset-2
h1 Contact
h3 Email
each contact in contacts
strong= contact.name
p.text-muted= contact.title
mixin email(contact.email, contact.emkey)
br
hr
h3 IRC
p.
The developer and other knowledgeable people are usually available on IRC for quick questions or comments. Official support can be provided for cytu.be and synchtube.6irc.net at <a href="http://webchat.6irc.net/?channels=cytube">irc.6irc.net#cytube</a>. These people can also address general questions about the software, but cannot provide technical support for third-party websites using this code.
include footer
mixin footer()
script(type="text/javascript").
function showEmail(btn, email, key) {
email = unescape(email);
key = unescape(key);
var dest = new Array(email.length);
for (var i = 0; i < email.length; i++) {
dest[i] = String.fromCharCode(email.charCodeAt(i) ^ key.charCodeAt(i % key.length));
}
email = dest.join("");
$("<a/>").attr("href", "mailto:" + email)
.text(email)
.insertBefore(btn);
$(btn).remove();
}

View File

@ -2,7 +2,7 @@ mixin footer
footer#footer
.container
p.text-muted.credit.
Copyright &copy; 2013 Calvin Montgomery&nbsp;&middot;&nbsp;<a href="https://github.com/calzoneman/sync">Fork me on GitHub</a>&nbsp;&middot;&nbsp;<a href="/useragreement">User Agreement</a>
Copyright &copy; 2013 Calvin Montgomery&nbsp;&middot;&nbsp;<a href="https://github.com/calzoneman/sync">GitHub</a>&nbsp;&middot;&nbsp;<a href="/useragreement">User Agreement</a>&nbsp;&middot;&nbsp;<a href="/contact">Contact</a>
script(src="/js/jquery.js")
// Must be included before jQuery-UI since jQuery-UI overrides jQuery.fn.button
// I should really abandon this crap one day