The Puggening: Update from Jade to Pug

1.) module dependency updated from jade 1.11.0 to pug 2.0.0-beta3
2.) All references to Jade have been changed to Pug
3.) /srv/web/jade.js is renamed to pug.js
4.) all template files renamed accordingly
5.) "mixin somename" is automatically considered a declaration, invocations must use "+somename"
6.) variable interpolation is no longer supported inside element attributes, use direct references and string concatenation instead.
7.) bumped minor version
This commit is contained in:
Xaekai 2016-07-07 01:11:56 -07:00
parent f75d40d278
commit df5c5cd54f
31 changed files with 233 additions and 233 deletions

View file

@ -2,7 +2,7 @@
"author": "Calvin Montgomery",
"name": "CyTube",
"description": "Online media synchronizer and chat",
"version": "3.17.5",
"version": "3.18.0",
"repository": {
"url": "http://github.com/calzoneman/sync"
},
@ -25,13 +25,13 @@
"express-minify": "^0.1.6",
"graceful-fs": "^4.1.2",
"http-errors": "^1.3.1",
"jade": "^1.11.0",
"json-typecheck": "^0.1.3",
"lodash": "^4.13.1",
"morgan": "^1.6.1",
"mysql": "^2.9.0",
"nodemailer": "^1.4.0",
"oauth": "^0.9.12",
"pug": "^2.0.0-beta3",
"q": "^1.4.1",
"redis": "^2.4.2",
"sanitize-html": "git://github.com/calzoneman/sanitize-html",

View file

@ -5,7 +5,7 @@
*/
var webserver = require("./webserver");
var sendJade = require("./jade").sendJade;
var sendPug = require("./pug").sendPug;
var Logger = require("../logger");
var db = require("../database");
var $util = require("../utilities");
@ -22,7 +22,7 @@ function handleAccountEditPage(req, res) {
return;
}
sendJade(res, "account-edit", {});
sendPug(res, "account-edit", {});
}
/**
@ -61,14 +61,14 @@ function handleChangePassword(req, res) {
}
if (newpassword.length === 0) {
sendJade(res, "account-edit", {
sendPug(res, "account-edit", {
errorMessage: "New password must not be empty"
});
return;
}
if (!req.user) {
sendJade(res, "account-edit", {
sendPug(res, "account-edit", {
errorMessage: "You must be logged in to change your password"
});
return;
@ -78,7 +78,7 @@ function handleChangePassword(req, res) {
db.users.verifyLogin(name, oldpassword, function (err, user) {
if (err) {
sendJade(res, "account-edit", {
sendPug(res, "account-edit", {
errorMessage: err
});
return;
@ -86,7 +86,7 @@ function handleChangePassword(req, res) {
db.users.setPassword(name, newpassword, function (err, dbres) {
if (err) {
sendJade(res, "account-edit", {
sendPug(res, "account-edit", {
errorMessage: err
});
return;
@ -97,7 +97,7 @@ function handleChangePassword(req, res) {
db.users.getUser(name, function (err, user) {
if (err) {
return sendJade(res, "account-edit", {
return sendPug(res, "account-edit", {
errorMessage: err
});
}
@ -106,7 +106,7 @@ function handleChangePassword(req, res) {
var expiration = new Date(parseInt(req.signedCookies.auth.split(":")[1]));
session.genSession(user, expiration, function (err, auth) {
if (err) {
return sendJade(res, "account-edit", {
return sendPug(res, "account-edit", {
errorMessage: err
});
}
@ -126,7 +126,7 @@ function handleChangePassword(req, res) {
});
}
sendJade(res, "account-edit", {
sendPug(res, "account-edit", {
successMessage: "Password changed."
});
});
@ -151,7 +151,7 @@ function handleChangeEmail(req, res) {
}
if (!$util.isValidEmail(email) && email !== "") {
sendJade(res, "account-edit", {
sendPug(res, "account-edit", {
errorMessage: "Invalid email address"
});
return;
@ -159,7 +159,7 @@ function handleChangeEmail(req, res) {
db.users.verifyLogin(name, password, function (err, user) {
if (err) {
sendJade(res, "account-edit", {
sendPug(res, "account-edit", {
errorMessage: err
});
return;
@ -167,7 +167,7 @@ function handleChangeEmail(req, res) {
db.users.setEmail(name, email, function (err, dbres) {
if (err) {
sendJade(res, "account-edit", {
sendPug(res, "account-edit", {
errorMessage: err
});
return;
@ -175,7 +175,7 @@ function handleChangeEmail(req, res) {
Logger.eventlog.log("[account] " + req.realIP +
" changed email for " + name +
" to " + email);
sendJade(res, "account-edit", {
sendPug(res, "account-edit", {
successMessage: "Email address changed."
});
});
@ -191,13 +191,13 @@ function handleAccountChannelPage(req, res) {
}
if (!req.user) {
return sendJade(res, "account-channels", {
return sendPug(res, "account-channels", {
channels: []
});
}
db.channels.listUserChannels(req.user.name, function (err, channels) {
sendJade(res, "account-channels", {
sendPug(res, "account-channels", {
channels: channels
});
});
@ -235,14 +235,14 @@ function handleNewChannel(req, res) {
}
if (!req.user) {
return sendJade(res, "account-channels", {
return sendPug(res, "account-channels", {
channels: []
});
}
db.channels.listUserChannels(req.user.name, function (err, channels) {
if (err) {
sendJade(res, "account-channels", {
sendPug(res, "account-channels", {
channels: [],
newChannelError: err
});
@ -250,7 +250,7 @@ function handleNewChannel(req, res) {
}
if (name.match(Config.get("reserved-names.channels"))) {
sendJade(res, "account-channels", {
sendPug(res, "account-channels", {
channels: channels,
newChannelError: "That channel name is reserved"
});
@ -259,7 +259,7 @@ function handleNewChannel(req, res) {
if (channels.length >= Config.get("max-channels-per-user") &&
req.user.global_rank < 255) {
sendJade(res, "account-channels", {
sendPug(res, "account-channels", {
channels: channels,
newChannelError: "You are not allowed to register more than " +
Config.get("max-channels-per-user") + " channels."
@ -290,7 +290,7 @@ function handleNewChannel(req, res) {
}
sendJade(res, "account-channels", {
sendPug(res, "account-channels", {
channels: channels,
newChannelError: err ? err : undefined
});
@ -309,7 +309,7 @@ function handleDeleteChannel(req, res) {
}
if (!req.user) {
return sendJade(res, "account-channels", {
return sendPug(res, "account-channels", {
channels: [],
});
}
@ -317,7 +317,7 @@ function handleDeleteChannel(req, res) {
db.channels.lookup(name, function (err, channel) {
if (err) {
sendJade(res, "account-channels", {
sendPug(res, "account-channels", {
channels: [],
deleteChannelError: err
});
@ -326,7 +326,7 @@ function handleDeleteChannel(req, res) {
if (channel.owner !== req.user.name && req.user.global_rank < 255) {
db.channels.listUserChannels(req.user.name, function (err2, channels) {
sendJade(res, "account-channels", {
sendPug(res, "account-channels", {
channels: err2 ? [] : channels,
deleteChannelError: "You do not have permission to delete this channel"
});
@ -354,7 +354,7 @@ function handleDeleteChannel(req, res) {
}
}
db.channels.listUserChannels(req.user.name, function (err2, channels) {
sendJade(res, "account-channels", {
sendPug(res, "account-channels", {
channels: err2 ? [] : channels,
deleteChannelError: err ? err : undefined
});
@ -372,7 +372,7 @@ function handleAccountProfilePage(req, res) {
}
if (!req.user) {
return sendJade(res, "account-profile", {
return sendPug(res, "account-profile", {
profileImage: "",
profileText: ""
});
@ -380,7 +380,7 @@ function handleAccountProfilePage(req, res) {
db.users.getProfile(req.user.name, function (err, profile) {
if (err) {
sendJade(res, "account-profile", {
sendPug(res, "account-profile", {
profileError: err,
profileImage: "",
profileText: ""
@ -388,7 +388,7 @@ function handleAccountProfilePage(req, res) {
return;
}
sendJade(res, "account-profile", {
sendPug(res, "account-profile", {
profileImage: profile.image,
profileText: profile.text,
profileError: false
@ -403,7 +403,7 @@ function handleAccountProfile(req, res) {
csrf.verify(req);
if (!req.user) {
return sendJade(res, "account-profile", {
return sendPug(res, "account-profile", {
profileImage: "",
profileText: "",
profileError: "You must be logged in to edit your profile",
@ -415,7 +415,7 @@ function handleAccountProfile(req, res) {
db.users.setProfile(req.user.name, { image: image, text: text }, function (err) {
if (err) {
sendJade(res, "account-profile", {
sendPug(res, "account-profile", {
profileImage: "",
profileText: "",
profileError: err
@ -423,7 +423,7 @@ function handleAccountProfile(req, res) {
return;
}
sendJade(res, "account-profile", {
sendPug(res, "account-profile", {
profileImage: image,
profileText: text,
profileError: false
@ -439,7 +439,7 @@ function handlePasswordResetPage(req, res) {
return;
}
sendJade(res, "account-passwordreset", {
sendPug(res, "account-passwordreset", {
reset: false,
resetEmail: "",
resetErr: false
@ -461,7 +461,7 @@ function handlePasswordReset(req, res) {
}
if (!$util.isValidUserName(name)) {
sendJade(res, "account-passwordreset", {
sendPug(res, "account-passwordreset", {
reset: false,
resetEmail: "",
resetErr: "Invalid username '" + name + "'"
@ -471,7 +471,7 @@ function handlePasswordReset(req, res) {
db.users.getEmail(name, function (err, actualEmail) {
if (err) {
sendJade(res, "account-passwordreset", {
sendPug(res, "account-passwordreset", {
reset: false,
resetEmail: "",
resetErr: err
@ -480,14 +480,14 @@ function handlePasswordReset(req, res) {
}
if (actualEmail !== email.trim()) {
sendJade(res, "account-passwordreset", {
sendPug(res, "account-passwordreset", {
reset: false,
resetEmail: "",
resetErr: "Provided email does not match the email address on record for " + name
});
return;
} else if (actualEmail === "") {
sendJade(res, "account-passwordreset", {
sendPug(res, "account-passwordreset", {
reset: false,
resetEmail: "",
resetErr: name + " doesn't have an email address on record. Please contact an " +
@ -509,7 +509,7 @@ function handlePasswordReset(req, res) {
expire: expire
}, function (err, dbres) {
if (err) {
sendJade(res, "account-passwordreset", {
sendPug(res, "account-passwordreset", {
reset: false,
resetEmail: "",
resetErr: err
@ -521,7 +521,7 @@ function handlePasswordReset(req, res) {
name + " <" + email + ">");
if (!Config.get("mail.enabled")) {
sendJade(res, "account-passwordreset", {
sendPug(res, "account-passwordreset", {
reset: false,
resetEmail: email,
resetErr: "This server does not have mail support enabled. Please " +
@ -548,14 +548,14 @@ function handlePasswordReset(req, res) {
Config.get("mail.nodemailer").sendMail(mail, function (err, response) {
if (err) {
Logger.errlog.log("mail fail: " + err);
sendJade(res, "account-passwordreset", {
sendPug(res, "account-passwordreset", {
reset: false,
resetEmail: email,
resetErr: "Sending reset email failed. Please contact an " +
"administrator for assistance."
});
} else {
sendJade(res, "account-passwordreset", {
sendPug(res, "account-passwordreset", {
reset: true,
resetEmail: email,
resetErr: false
@ -580,7 +580,7 @@ function handlePasswordRecover(req, res) {
db.lookupPasswordReset(hash, function (err, row) {
if (err) {
sendJade(res, "account-passwordrecover", {
sendPug(res, "account-passwordrecover", {
recovered: false,
recoverErr: err
});
@ -588,7 +588,7 @@ function handlePasswordRecover(req, res) {
}
if (Date.now() >= row.expire) {
sendJade(res, "account-passwordrecover", {
sendPug(res, "account-passwordrecover", {
recovered: false,
recoverErr: "This password recovery link has expired. Password " +
"recovery links are valid only for 24 hours after " +
@ -604,7 +604,7 @@ function handlePasswordRecover(req, res) {
}
db.users.setPassword(row.name, newpw, function (err) {
if (err) {
sendJade(res, "account-passwordrecover", {
sendPug(res, "account-passwordrecover", {
recovered: false,
recoverErr: "Database error. Please contact an administrator if " +
"this persists."
@ -616,7 +616,7 @@ function handlePasswordRecover(req, res) {
db.deletePasswordReset(hash);
Logger.eventlog.log("[account] " + ip + " recovered password for " + row.name);
sendJade(res, "account-passwordrecover", {
sendPug(res, "account-passwordrecover", {
recovered: true,
recoverPw: newpw
});

View file

@ -1,7 +1,7 @@
var path = require("path");
var fs = require("fs");
var webserver = require("./webserver");
var sendJade = require("./jade").sendJade;
var sendPug = require("./pug").sendPug;
var Logger = require("../logger");
var db = require("../database");
var Config = require("../config");
@ -35,7 +35,7 @@ function handleAcp(req, res, user) {
}
sio += "/socket.io/socket.io.js";
sendJade(res, "acp", {
sendPug(res, "acp", {
sioSource: sio
});
}

View file

@ -4,11 +4,11 @@
* @author Calvin Montgomery <cyzon@cyzon.us>
*/
var jade = require("jade");
var pug = require("pug");
var path = require("path");
var webserver = require("./webserver");
var cookieall = webserver.cookieall;
var sendJade = require("./jade").sendJade;
var sendPug = require("./pug").sendPug;
var Logger = require("../logger");
var $util = require("../utilities");
var db = require("../database");
@ -56,7 +56,7 @@ function handleLogin(req, res) {
Logger.eventlog.log("[loginfail] Login failed (bad password): " + name
+ "@" + req.realIP);
}
sendJade(res, "login", {
sendPug(res, "login", {
loggedIn: false,
loginError: err
});
@ -65,7 +65,7 @@ function handleLogin(req, res) {
session.genSession(user, expiration, function (err, auth) {
if (err) {
sendJade(res, "login", {
sendPug(res, "login", {
loggedIn: false,
loginError: err
});
@ -93,7 +93,7 @@ function handleLogin(req, res) {
res.redirect(dest);
} else {
res.user = user;
sendJade(res, "login", {});
sendPug(res, "login", {});
}
});
});
@ -108,12 +108,12 @@ function handleLoginPage(req, res) {
}
if (req.user) {
return sendJade(res, "login", {
return sendPug(res, "login", {
wasAlreadyLoggedIn: true
});
}
sendJade(res, "login", {
sendPug(res, "login", {
redirect: req.query.dest || req.header("referer")
});
}
@ -138,7 +138,7 @@ function handleLogout(req, res) {
if (dest) {
res.redirect(dest);
} else {
sendJade(res, "logout", {});
sendPug(res, "logout", {});
}
}
@ -151,11 +151,11 @@ function handleRegisterPage(req, res) {
}
if (req.user) {
sendJade(res, "register", {});
sendPug(res, "register", {});
return;
}
sendJade(res, "register", {
sendPug(res, "register", {
registered: false,
registerError: false
});
@ -181,21 +181,21 @@ function handleRegister(req, res) {
}
if (name.length === 0) {
sendJade(res, "register", {
sendPug(res, "register", {
registerError: "Username must not be empty"
});
return;
}
if (name.match(Config.get("reserved-names.usernames"))) {
sendJade(res, "register", {
sendPug(res, "register", {
registerError: "That username is reserved"
});
return;
}
if (password.length === 0) {
sendJade(res, "register", {
sendPug(res, "register", {
registerError: "Password must not be empty"
});
return;
@ -204,7 +204,7 @@ function handleRegister(req, res) {
password = password.substring(0, 100);
if (email.length > 0 && !$util.isValidEmail(email)) {
sendJade(res, "register", {
sendPug(res, "register", {
registerError: "Invalid email address"
});
return;
@ -212,13 +212,13 @@ function handleRegister(req, res) {
db.users.register(name, password, email, ip, function (err) {
if (err) {
sendJade(res, "register", {
sendPug(res, "register", {
registerError: err
});
} else {
Logger.eventlog.log("[register] " + ip + " registered account: " + name +
(email.length > 0 ? " <" + email + ">" : ""));
sendJade(res, "register", {
sendPug(res, "register", {
registered: true,
registerName: name,
redirect: req.body.redirect

View file

@ -1,4 +1,4 @@
var jade = require("jade");
var pug = require("pug");
var fs = require("fs");
var path = require("path");
var Config = require("../config");
@ -6,7 +6,7 @@ var templates = path.join(__dirname, "..", "..", "templates");
var cache = {};
/**
* Merges locals with globals for jade rendering
* Merges locals with globals for pug rendering
*/
function merge(locals, res) {
var _locals = {
@ -33,14 +33,14 @@ function getBaseUrl(res) {
}
/**
* Renders and serves a jade template
* Renders and serves a pug template
*/
function sendJade(res, view, locals) {
function sendPug(res, view, locals) {
locals.loggedIn = locals.loggedIn || !!res.user;
locals.loginName = locals.loginName || res.user ? res.user.name : false;
if (!(view in cache) || Config.get("debug")) {
var file = path.join(templates, view + ".jade");
var fn = jade.compile(fs.readFileSync(file), {
var file = path.join(templates, view + ".pug");
var fn = pug.compile(fs.readFileSync(file), {
filename: file,
pretty: !Config.get("http.minify")
});
@ -51,5 +51,5 @@ function sendJade(res, view, locals) {
}
module.exports = {
sendJade: sendJade
sendPug: sendPug
};

View file

@ -1,6 +1,6 @@
import CyTubeUtil from '../../utilities';
import { sanitizeText } from '../../xss';
import { sendJade } from '../jade';
import { sendPug } from '../pug';
import * as HTTPStatus from '../httpstatus';
import { HTTPError } from '../../errors';
@ -17,7 +17,7 @@ export default function initialize(app, ioConfig) {
}
const socketBaseURL = endpoints[0].url;
sendJade(res, 'channel', {
sendPug(res, 'channel', {
channelName: req.params.channel,
sioSource: `${socketBaseURL}/socket.io/socket.io.js`
});

View file

@ -1,5 +1,5 @@
import CyTubeUtil from '../../utilities';
import { sendJade } from '../jade';
import { sendPug } from '../pug';
export default function initialize(app, webConfig) {
app.get('/contact', (req, res) => {
@ -19,7 +19,7 @@ export default function initialize(app, webConfig) {
return contact;
});
return sendJade(res, 'contact', {
return sendPug(res, 'contact', {
contacts: contacts
});
});

View file

@ -1,4 +1,4 @@
import { sendJade } from '../jade';
import { sendPug } from '../pug';
export default function initialize(app, channelIndex, maxEntries) {
app.get('/', (req, res) => {
@ -13,7 +13,7 @@ export default function initialize(app, channelIndex, maxEntries) {
channels = channels.slice(0, maxEntries);
sendJade(res, 'index', {
sendPug(res, 'index', {
channels: channels
});
});

View file

@ -2,7 +2,7 @@ import fs from 'fs';
import path from 'path';
import net from 'net';
import express from 'express';
import { sendJade } from './jade';
import { sendPug } from './pug';
import Logger from '../logger';
import Config from '../config';
import bodyParser from 'body-parser';
@ -76,7 +76,7 @@ function handleLegacySocketConfig(req, res) {
}
function handleUserAgreement(req, res) {
sendJade(res, 'tos', {
sendPug(res, 'tos', {
domain: Config.get('http.domain')
});
}
@ -92,7 +92,7 @@ function initializeErrorHandlers(app) {
if (err) {
if (err instanceof CSRFError) {
res.status(HTTPStatus.FORBIDDEN);
return sendJade(res, 'csrferror', {
return sendPug(res, 'csrferror', {
path: req.path,
referer: req.header('referer')
});
@ -104,7 +104,7 @@ function initializeErrorHandlers(app) {
}
if (!message) {
message = 'An unknown error occurred.';
} else if (/\.(jade|js)/.test(message)) {
} else if (/\.(pug|js)/.test(message)) {
// Prevent leakage of stack traces
message = 'An internal error occurred.';
}
@ -115,7 +115,7 @@ function initializeErrorHandlers(app) {
}
res.status(status);
return sendJade(res, 'httperror', {
return sendPug(res, 'httperror', {
path: req.path,
status: status,
message: message

View file

@ -2,16 +2,16 @@ doctype html
html(lang="en")
head
include head
mixin head()
+head()
body
#wrap
nav.navbar.navbar-inverse.navbar-fixed-top(role="navigation")
include nav
mixin navheader()
+navheader()
#nav-collapsible.collapse.navbar-collapse
ul.nav.navbar-nav
mixin navdefaultlinks("/account/channels")
mixin navloginlogout("/account/channels")
+navdefaultlinks("/account/channels")
+navloginlogout("/account/channels")
section#mainpage
.container
if !loggedIn
@ -38,13 +38,13 @@ html(lang="en")
for c in channels
tr
th
form.form-inline.pull-right(action="/account/channels", method="post", onsubmit="return confirm('Are you sure you want to delete #{c.name}? This cannot be undone');")
form.form-inline.pull-right(action="/account/channels", method="post", onsubmit="return confirm('Are you sure you want to delete " +c.name+ "? This cannot be undone');")
input(type="hidden", name="_csrf", value=csrfToken)
input(type="hidden", name="action", value="delete_channel")
input(type="hidden", name="name", value="#{c.name}")
input(type="hidden", name="name", value=c.name)
button.btn.btn-xs.btn-danger(type="submit") Delete
span.glyphicon.glyphicon-trash
a(href="/r/#{c.name}", style="margin-left: 5px")= c.name
a(href="/r/"+c.name, style="margin-left: 5px")= c.name
.col-lg-6.col-md-6
h3 Register a new channel
if newChannelError
@ -60,4 +60,4 @@ html(lang="en")
button.btn.btn-primary.btn-block(type="submit") Register
include footer
mixin footer()
+footer()

View file

@ -2,16 +2,16 @@ doctype html
html(lang="en")
head
include head
mixin head()
+head()
body
#wrap
nav.navbar.navbar-inverse.navbar-fixed-top(role="navigation")
include nav
mixin navheader()
+navheader()
#nav-collapsible.collapse.navbar-collapse
ul.nav.navbar-nav
mixin navdefaultlinks("/account/edit")
mixin navloginlogout("/account/edit")
+navdefaultlinks("/account/edit")
+navloginlogout("/account/edit")
section#mainpage
.container
if !loggedIn
@ -60,7 +60,7 @@ html(lang="en")
input#email.form-control(type="email", name="email")
button#changeemailbtn.btn.btn-danger.btn-block(type="submit") Change Email
include footer
mixin footer()
+footer()
script(type="text/javascript").
function validatePasswordChange() {
var pw = $("#newpassword").val();

View file

@ -2,16 +2,16 @@ doctype html
html(lang="en")
head
include head
mixin head()
+head()
body
#wrap
nav.navbar.navbar-inverse.navbar-fixed-top(role="navigation")
include nav
mixin navheader()
+navheader()
#nav-collapsible.collapse.navbar-collapse
ul.nav.navbar-nav
mixin navdefaultlinks("/account/passwordrecover/")
mixin navloginlogout("/account/passwordrecover/")
+navdefaultlinks("/account/passwordrecover/")
+navloginlogout("/account/passwordrecover/")
section#mainpage
.container
.col-lg-6.col-lg-offset-3.col-md-6.col-md-offset-3
@ -25,4 +25,4 @@ html(lang="en")
strong Password recovery failed
p= recoverErr
include footer
mixin footer()
+footer()

View file

@ -2,16 +2,16 @@ doctype html
html(lang="en")
head
include head
mixin head()
+head()
body
#wrap
nav.navbar.navbar-inverse.navbar-fixed-top(role="navigation")
include nav
mixin navheader()
+navheader()
#nav-collapsible.collapse.navbar-collapse
ul.nav.navbar-nav
mixin navdefaultlinks("/account/passwordreset")
mixin navloginlogout("/account/passwordreset")
+navdefaultlinks("/account/passwordreset")
+navloginlogout("/account/passwordreset")
section#mainpage
.container
.col-lg-6.col-lg-offset-3.col-md-6.col-md-offset-3
@ -35,4 +35,4 @@ html(lang="en")
button.btn.btn-primary.btn-block(type="submit") Send reset request
include footer
mixin footer()
+footer()

View file

@ -2,16 +2,16 @@ doctype html
html(lang="en")
head
include head
mixin head()
+head()
body
#wrap
nav.navbar.navbar-inverse.navbar-fixed-top(role="navigation")
include nav
mixin navheader()
+navheader()
#nav-collapsible.collapse.navbar-collapse
ul.nav.navbar-nav
mixin navdefaultlinks("/account/profile")
mixin navloginlogout("/account/profile")
+navdefaultlinks("/account/profile")
+navloginlogout("/account/profile")
section#mainpage
.container
if !loggedIn
@ -42,6 +42,6 @@ html(lang="en")
button.btn.btn-primary.btn-block(type="submit") Save
include footer
mixin footer()
+footer()
script(type="text/javascript").
$("#profileimage").val("#{profileImage}");

View file

@ -2,21 +2,21 @@ doctype html
html(lang="en")
head
include head
mixin head()
+head()
link(rel="stylesheet", type="text/css", href="/css/acp.css")
body
#wrap
nav.navbar.navbar-inverse.navbar-fixed-top(role="navigation")
include nav
mixin navheader()
+navheader()
#nav-collapsible.collapse.navbar-collapse
ul.nav.navbar-nav
mixin navdefaultlinks("/acp")
+navdefaultlinks("/acp")
li#nav-acp-section.dropdown
a#nav-acp-dd-toggle.dropdown-toggle(data-toggle="dropdown", href="javascript:void(0)") Menu
span.caret
ul.dropdown-menu
mixin navloginlogout("/acp")
+navloginlogout("/acp")
section#mainpage
.container
.row
@ -125,7 +125,7 @@ html(lang="en")
canvas#stat_mem(width="1140", height="400")
include footer
mixin footer()
+footer()
script(type="text/javascript").
var USEROPTS = { secure_connection: true };
script(src=sioSource)

View file

@ -2,18 +2,18 @@ doctype html
html(lang="en")
head
include head
mixin head()
+head()
link(href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css", rel="stylesheet")
link(rel="stylesheet", href="/css/video-js.css")
body
#wrap
nav.navbar.navbar-inverse.navbar-fixed-top(role="navigation")
include nav
mixin navheader()
+navheader()
#nav-collapsible.collapse.navbar-collapse
- var cname = "/r/" + channelName
ul.nav.navbar-nav
mixin navdefaultlinks(cname)
+navdefaultlinks(cname)
li: a(href="javascript:void(0)", onclick="javascript:showUserOptions()") Options
li: a#showchansettings(href="javascript:void(0)", onclick="javascript:showChannelSettings()") Channel Settings
li.dropdown
@ -22,7 +22,7 @@ html(lang="en")
ul.dropdown-menu
li: a(href="#" onclick="javascript:chatOnly()") Chat Only
li: a(href="#" onclick="javascript:removeVideo(event)") Remove Video
mixin navloginlogout(cname)
+navloginlogout(cname)
section#mainpage
.container
#motdrow.row
@ -168,11 +168,11 @@ html(lang="en")
.modal-body
.tab-content
include useroptions
mixin us-general()
mixin us-playback()
mixin us-chat()
mixin us-scripts()
mixin us-mod()
+us-general()
+us-playback()
+us-chat()
+us-scripts()
+us-mod()
.modal-footer
button.btn.btn-primary(type="button", data-dismiss="modal", onclick="javascript:saveUserOptions()") Save
button.btn.btn-default(type="button", data-dismiss="modal") Close
@ -219,23 +219,23 @@ html(lang="en")
.modal-body
.tab-content
include channeloptions
mixin miscoptions()
mixin adminoptions()
mixin motdeditor()
mixin csseditor()
mixin jseditor()
mixin banlist()
mixin recentjoins()
mixin chanranks()
mixin chatfilters()
mixin emotes()
mixin chanlog()
mixin permeditor()
+miscoptions()
+adminoptions()
+motdeditor()
+csseditor()
+jseditor()
+banlist()
+recentjoins()
+chanranks()
+chatfilters()
+emotes()
+chanlog()
+permeditor()
.modal-footer
button.btn.btn-default(type="button", data-dismiss="modal") Close
#pmbar
include footer
mixin footer()
+footer()
script(id="socketio-js", src=sioSource)
script(src="/js/data.js")
script(src="/js/util.js")

View file

@ -50,19 +50,19 @@ mixin miscoptions
#cs-miscoptions.tab-pane.active
h4 General Settings
form.form-horizontal(action="javascript:void(0)")
mixin rcheckbox-auto("cs-allow_voteskip", "Allow voteskip")
mixin rcheckbox-auto("cs-allow_dupes", "Allow duplicate videos on the playlist")
mixin textbox-auto("cs-voteskip_ratio", "Voteskip ratio", "0.5")
mixin textbox-auto("cs-maxlength", "Max video length", "HH:MM:SS")
mixin textbox-auto("cs-afk_timeout", "Auto-AFK Delay", "0 (disabled)")
+rcheckbox-auto("cs-allow_voteskip", "Allow voteskip")
+rcheckbox-auto("cs-allow_dupes", "Allow duplicate videos on the playlist")
+textbox-auto("cs-voteskip_ratio", "Voteskip ratio", "0.5")
+textbox-auto("cs-maxlength", "Max video length", "HH:MM:SS")
+textbox-auto("cs-afk_timeout", "Auto-AFK Delay", "0 (disabled)")
.form-group
.col-sm-offset-4
h4 Chat Settings
form.form-horizontal(action="javascript:void(0)")
mixin rcheckbox-auto("cs-enable_link_regex", "Convert URLs in chat to links")
mixin rcheckbox-auto("cs-chat_antiflood", "Throttle chat")
mixin textbox-auto("cs-chat_antiflood_burst", "# of messages allowed before throttling")
mixin textbox-auto("cs-chat_antiflood_sustained", "# of messages (after burst) allowed per second")
+rcheckbox-auto("cs-enable_link_regex", "Convert URLs in chat to links")
+rcheckbox-auto("cs-chat_antiflood", "Throttle chat")
+textbox-auto("cs-chat_antiflood_burst", "# of messages allowed before throttling")
+textbox-auto("cs-chat_antiflood_sustained", "# of messages (after burst) allowed per second")
.form-group
.col-sm-8.col-sm-offset-4
span.text-info Changes are automatically saved.
@ -72,14 +72,14 @@ mixin adminoptions
h4 Admin-Only Settings
form.form-horizontal(action="javascript:void(0)")
- var defname = "CyTube - /r/" + channelName
mixin textbox-auto("cs-pagetitle", "Page title", defname)
mixin textbox-auto("cs-password", "Password", "leave blank to disable")
mixin textbox-auto("cs-externalcss", "External CSS", "Stylesheet URL")
mixin textbox-auto("cs-externaljs", "External Javascript", "Script URL")
mixin rcheckbox-auto("cs-show_public", "List channel publicly")
mixin rcheckbox-auto("cs-torbanned", "Block connections from Tor")
mixin rcheckbox-auto("cs-allow_ascii_control", "Allow ASCII control characters (e.g. newlines)")
mixin textbox-auto("cs-playlist_max_per_user", "Maximum # of videos per user")
+textbox-auto("cs-pagetitle", "Page title", defname)
+textbox-auto("cs-password", "Password", "leave blank to disable")
+textbox-auto("cs-externalcss", "External CSS", "Stylesheet URL")
+textbox-auto("cs-externaljs", "External Javascript", "Script URL")
+rcheckbox-auto("cs-show_public", "List channel publicly")
+rcheckbox-auto("cs-torbanned", "Block connections from Tor")
+rcheckbox-auto("cs-allow_ascii_control", "Allow ASCII control characters (e.g. newlines)")
+textbox-auto("cs-playlist_max_per_user", "Maximum # of videos per user")
.form-group
.col-sm-8.col-sm-offset-4
span.text-info Set to 0 for no limit

View file

@ -1,20 +1,20 @@
mixin email(e, k)
button.btn.btn-xs.btn-default(onclick="showEmail(this, '#{e}', '#{k}')") Show Email
button.btn.btn-xs.btn-default(onclick="showEmail(this, '"+e+"', '"+k+"')") Show Email
doctype html
html(lang="en")
head
include head
mixin head()
+head()
body
#wrap
nav.navbar.navbar-inverse.navbar-fixed-top(role="navigation")
include nav
mixin navheader()
+navheader()
#nav-collapsible.collapse.navbar-collapse
ul.nav.navbar-nav
mixin navdefaultlinks("/contact")
mixin navloginlogout("/contact")
+navdefaultlinks("/contact")
+navloginlogout("/contact")
section#mainpage
.container
.col-md-8.col-md-offset-2
@ -23,14 +23,14 @@ html(lang="en")
each contact in contacts
strong= contact.name
p.text-muted= contact.title
mixin email(contact.email, contact.emkey)
+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()
+footer()
script(type="text/javascript").
function showEmail(btn, email, key) {
email = unescape(email);

View file

@ -2,16 +2,16 @@ doctype html
html(lang="en")
head
include head
mixin head()
+head()
body
#wrap
nav.navbar.navbar-inverse.navbar-fixed-top(role="navigation")
include nav
mixin navheader()
+navheader()
#nav-collapsible.collapse.navbar-collapse
ul.nav.navbar-nav
mixin navdefaultlinks(path)
mixin navloginlogout(path)
+navdefaultlinks(path)
+navloginlogout(path)
section#mainpage.container
.col-md-12
@ -28,4 +28,4 @@ html(lang="en")
a(href=referer) Return to previous page
include footer
mixin footer()
+footer()

View file

@ -1,8 +1,8 @@
mixin head()
meta(charset="utf-8")
meta(name="viewport", content="width=device-width, initial-scale=1.0")
meta(name="description", content="#{siteDescription}")
meta(name="author", content="#{siteAuthor}")
meta(name="description", content=siteDescription)
meta(name="author", content=siteAuthor)
title= siteTitle
link(href="/css/sticky-footer-navbar.css", rel="stylesheet")

View file

@ -13,26 +13,26 @@ doctype html
html(lang="en")
head
include head
mixin head()
+head()
body
#wrap
nav.navbar.navbar-inverse.navbar-fixed-top(role="navigation")
include nav
mixin navheader()
+navheader()
#nav-collapsible.collapse.navbar-collapse
ul.nav.navbar-nav
mixin navdefaultlinks(path)
mixin navloginlogout(path)
+navdefaultlinks(path)
+navloginlogout(path)
section#mainpage.container
.col-md-12
.alert.alert-danger
if status == 404
mixin notfound()
+notfound()
else if status == 403
mixin forbidden()
+forbidden()
else
mixin genericerror()
+genericerror()
include footer
mixin footer()
+footer()

View file

@ -2,16 +2,16 @@ doctype html
html(lang="en")
head
include head
mixin head()
+head()
body
#wrap
nav.navbar.navbar-inverse.navbar-fixed-top(role="navigation")
include nav
mixin navheader()
+navheader()
#nav-collapsible.collapse.navbar-collapse
ul.nav.navbar-nav
mixin navdefaultlinks("/")
mixin navloginlogout("/")
+navdefaultlinks("/")
+navloginlogout("/")
section#mainpage
.container
.col-lg-9.col-md-9
@ -24,7 +24,7 @@ html(lang="en")
tbody
each chan in channels
tr
td: a(href="/r/#{chan.name}") #{chan.pagetitle} (#{chan.name})
td: a(href="/r/"+chan.name) #{chan.pagetitle} (#{chan.name})
td= chan.usercount
td= chan.mediatitle
.col-lg-3.col-md-3
@ -32,7 +32,7 @@ html(lang="en")
input#channelname.form-control(type="text", placeholder="Channel Name")
p.text-muted New channels can be registered from the <a href="/account/channels">My Channels</a> page.
include footer
mixin footer()
+footer()
script(type="text/javascript").
$("#channelname").keydown(function (ev) {
if (ev.keyCode === 13) {

View file

@ -2,17 +2,17 @@ doctype html
html(lang="en")
head
include head
mixin head()
+head()
body
#wrap
nav.navbar.navbar-inverse.navbar-fixed-top(role="navigation")
include nav
mixin navheader()
+navheader()
#nav-collapsible.collapse.navbar-collapse
ul.nav.navbar-nav
mixin navdefaultlinks("/login")
+navdefaultlinks("/login")
if loggedIn
mixin navlogoutform("/")
+navlogoutform("/")
section#mainpage.container
if wasAlreadyLoggedIn
.col-lg-6.col-lg-offset-3.col-md-6.col-md-offset-3
@ -51,4 +51,4 @@ html(lang="en")
br
a(href=redirect) Return to previous page
include footer
mixin footer()
+footer()

View file

@ -2,16 +2,16 @@ doctype html
html(lang="en")
head
include head
mixin head()
+head()
body
#wrap
nav.navbar.navbar-inverse.navbar-fixed-top(role="navigation")
include nav
mixin navheader()
+navheader()
#nav-collapsible.collapse.navbar-collapse
ul.nav.navbar-nav
mixin navdefaultlinks("/logout")
mixin navloginform("/")
+navdefaultlinks("/logout")
+navloginform("/")
section#mainpage.container
.col-lg-6.col-lg-offset-3.col-md-6.col-md-offset-3
.alert.alert-info.center.messagebox
@ -20,4 +20,4 @@ html(lang="en")
if redirect
a(href=redirect) Return to previous page
include footer
mixin footer()
+footer()

View file

@ -1,4 +1,4 @@
- var links = { "/": "Home" }
- var links = { "/": "Home" };
mixin navlink(page, title, active)
if active
@ -19,9 +19,9 @@ mixin navheader()
mixin navdefaultlinks(page)
each t, p in links
if p == page
mixin navlink(p, t, true)
+navlink(p, t, true)
else
mixin navlink(p, t, false)
+navlink(p, t, false)
li.dropdown
a.dropdown-toggle(href="#", data-toggle="dropdown") Account
b.caret
@ -29,24 +29,24 @@ mixin navdefaultlinks(page)
if loggedIn
li: a(href="javascript:$('#logoutform').submit();") Log out
li.divider
li: a(href="#{loginDomain}/account/channels") Channels
li: a(href="#{loginDomain}/account/profile") Profile
li: a(href="#{loginDomain}/account/edit") Change Password/Email
li: a(href=loginDomain+"/account/channels") Channels
li: a(href=loginDomain+"/account/profile") Profile
li: a(href=loginDomain+"/account/edit") Change Password/Email
else
li: a(href="#{loginDomain}/login?dest=#{encodeURIComponent(baseUrl + page)}") Login
li: a(href="#{loginDomain}/register") Register
li: a(href=loginDomain+"/login?dest=" + encodeURIComponent(baseUrl + page)) Login
li: a(href=loginDomain+"/register") Register
mixin navloginlogout(redirect)
if loggedIn
mixin navlogoutform(redirect)
+navlogoutform(redirect)
else
mixin navloginform(redirect)
+navloginform(redirect)
mixin navloginform(redirect)
if loginDomain == null
- loginDomain = ""
.visible-lg
form#loginform.navbar-form.navbar-right(action="#{loginDomain}/login", method="post")
form#loginform.navbar-form.navbar-right(action=loginDomain+"/login", method="post")
input(type="hidden", name="_csrf", value=csrfToken)
input(type="hidden", name="dest", value=baseUrl + redirect)
.form-group
@ -61,7 +61,7 @@ mixin navloginform(redirect)
button#login.btn.btn-default(type="submit") Login
.visible-md
p#loginform.navbar-text.pull-right
a#login.navbar-link(href="#{loginDomain}/login?dest=#{encodeURIComponent(baseUrl + redirect)}") Log in
a#login.navbar-link(href=loginDomain+"/login?dest="+encodeURIComponent(baseUrl+redirect)) Log in
span &nbsp;&middot;&nbsp;
a#register.navbar-link(href="/register") Register

View file

@ -2,16 +2,16 @@ doctype html
html(lang="en")
head
include head
mixin head()
+head()
body
#wrap
nav.navbar.navbar-inverse.navbar-fixed-top(role="navigation")
include nav
mixin navheader()
+navheader()
#nav-collapsible.collapse.navbar-collapse
ul.nav.navbar-nav
mixin navdefaultlinks("/policies/privacy")
mixin navloginlogout("/policies/privacy")
+navdefaultlinks("/policies/privacy")
+navloginlogout("/policies/privacy")
section#mainpage
.container
.col-md-12
@ -50,4 +50,4 @@ html(lang="en")
p
| When you register a channel on #{siteTitle}, you may optionally provide certain information
include footer
mixin footer()
+footer()

View file

@ -2,17 +2,17 @@ doctype html
html(lang="en")
head
include head
mixin head()
+head()
body
#wrap
nav.navbar.navbar-inverse.navbar-fixed-top(role="navigation")
include nav
mixin navheader()
+navheader()
#nav-collapsible.collapse.navbar-collapse
ul.nav.navbar-nav
mixin navdefaultlinks("/register")
+navdefaultlinks("/register")
if loggedIn
mixin navlogoutform("/register")
+navlogoutform("/register")
section#mainpage.container
if loggedIn
.col-lg-6.col-lg-offset-3.col-md-6.col-md-offset-3
@ -50,7 +50,7 @@ html(lang="en")
strong Registration Successful
p Thanks for registering, #{registerName}! Now you can <a href="/login">Login</a> to use your account.
include footer
mixin footer()
+footer()
script(src="/js/jquery.js")
script(type="text/javascript").
function verify() {

View file

@ -2,16 +2,16 @@ doctype html
html(lang="en")
head
include head
mixin head()
+head()
body
#wrap
nav.navbar.navbar-inverse.navbar-fixed-top(role="navigation")
include nav
mixin navheader()
+navheader()
#nav-collapsible.collapse.navbar-collapse
ul.nav.navbar-nav
mixin navdefaultlinks("/useragreement")
mixin navloginlogout("/useragreement")
+navdefaultlinks("/useragreement")
+navloginlogout("/useragreement")
section#mainpage
.container
.col-md-12
@ -38,4 +38,4 @@ html(lang="en")
li Attempting to exploit the site in order to gain unauthorized access or interrupt service is not allowed. If you believe you have found an exploit, please responsibly disclose it to an administrator.
li Use good judgement when representing #{siteTitle} on other websites. Do not spam links to your channel.
include footer
mixin footer()
+footer()

View file

@ -47,8 +47,8 @@ mixin us-general
.col-sm-4
.col-sm-8
p.text-danger Changing layouts may require refreshing to take effect.
mixin rcheckbox("us-no-channelcss", "Ignore Channel CSS")
mixin rcheckbox("us-no-channeljs", "Ignore Channel Javascript")
+rcheckbox("us-no-channelcss", "Ignore Channel CSS")
+rcheckbox("us-no-channeljs", "Ignore Channel Javascript")
.clear
mixin us-scripts
@ -66,15 +66,15 @@ mixin us-playback
#us-playback.tab-pane
h4 Playback Preferences
form.form-horizontal(action="javascript:void(0)")
mixin rcheckbox("us-synch", "Synchronize video playback")
mixin textbox("us-synch-accuracy", "Synch threshold (seconds)", "2")
mixin rcheckbox("us-wmode-transparent", "Set wmode=transparent")
+rcheckbox("us-synch", "Synchronize video playback")
+textbox("us-synch-accuracy", "Synch threshold (seconds)", "2")
+rcheckbox("us-wmode-transparent", "Set wmode=transparent")
.col-sm-4
.col-sm-8
p.text-info Setting <code>wmode=transparent</code> allows objects to be displayed above the video player, but may cause performance issues on some systems.
mixin rcheckbox("us-hidevideo", "Remove the video player")
mixin rcheckbox("us-playlistbuttons", "Hide playlist buttons by default")
mixin rcheckbox("us-oldbtns", "Old style playlist buttons")
+rcheckbox("us-hidevideo", "Remove the video player")
+rcheckbox("us-playlistbuttons", "Hide playlist buttons by default")
+rcheckbox("us-oldbtns", "Old style playlist buttons")
.form-group
label.control-label.col-sm-4(for="#us-default-quality") Quality Preference
.col-sm-8
@ -91,9 +91,9 @@ mixin us-chat
#us-chat.tab-pane
h4 Chat Preferences
form.form-horizontal(action="javascript:void(0)")
mixin rcheckbox("us-chat-timestamp", "Show timestamps in chat")
mixin rcheckbox("us-sort-rank", "Sort userlist by rank")
mixin rcheckbox("us-sort-afk", "Sort AFKers to bottom")
+rcheckbox("us-chat-timestamp", "Show timestamps in chat")
+rcheckbox("us-sort-rank", "Sort userlist by rank")
+rcheckbox("us-sort-afk", "Sort AFKers to bottom")
.col-sm-4
.col-sm-8
p.text-info The following 2 options apply to how and when you will be notified if a new chat message is received while CyTube is not the active window.
@ -111,12 +111,12 @@ mixin us-chat
option(value="never") Never
option(value="onlyping") Only when I am mentioned or PMed
option(value="always") Always
mixin rcheckbox("us-sendbtn", "Add a send button to chat")
mixin rcheckbox("us-no-emotes", "Disable chat emotes")
+rcheckbox("us-sendbtn", "Add a send button to chat")
+rcheckbox("us-no-emotes", "Disable chat emotes")
mixin us-mod
#us-mod.tab-pane
h4 Moderator Preferences
form.form-horizontal(action="javascript:void(0)")
mixin rcheckbox("us-modflair", "Show name color")
mixin rcheckbox("us-shadowchat", "Show shadowmuted messages")
+rcheckbox("us-modflair", "Show name color")
+rcheckbox("us-shadowchat", "Show shadowmuted messages")