Review changes

(Should be squashed before merge)
This commit is contained in:
Alistair McKinlay 2017-04-21 09:26:02 +01:00
parent cc85b2143c
commit b4310dbc03
6 changed files with 14 additions and 38 deletions

View File

@ -25,7 +25,7 @@
<meta name="theme-color" content="#455164">
</head>
<body class="signed-out {{ternary public 'public' '' }}">
<body class="signed-out {{#if public}}public{{/if}}">
<div id="wrap">
<div id="viewport">
@ -122,7 +122,7 @@
<div class="row">
<div class="col-sm-12">
<h1 class="title">
{{ternary public "The Lounge " " " }}
{{#if public}}The Lounge - {{/if}}
Connect
{{#unless displayNetwork}}
{{#if lockNetwork}}
@ -146,11 +146,11 @@
<label for="connect:host">Server</label>
</div>
<div class="col-sm-6 col-xs-8">
<input class="input" id="connect:host" name="host" value="{{defaults.host}}" aria-label="Server address" {{ternary lockNetwork "disabled" ""}}>
<input class="input" id="connect:host" name="host" value="{{defaults.host}}" aria-label="Server address" {{#if lockNetwork}}disabled{{/if}}>
</div>
<div class="col-sm-3 col-xs-4">
<div class="port">
<input class="input" type="number" min="1" max="65535" name="port" value="{{defaults.port}}" aria-label="Server port" {{ternary lockNetwork "disabled" ""}}>
<input class="input" type="number" min="1" max="65535" name="port" value="{{defaults.port}}" aria-label="Server port" {{#if lockNetwork}}disabled{{/if}}>
</div>
</div>
<div class="clearfix"></div>
@ -162,7 +162,7 @@
</div>
<div class="col-sm-9 col-sm-offset-3">
<label class="tls">
<input type="checkbox" name="tls" {{ternary defaults.tls "checked" ""}} {{ternary lockNetwork "disabled" ""}}>
<input type="checkbox" name="tls" {{#if defaults.tls}}checked{{/if}} {{#if lockNetwork}}disabled{{/if}}>
Enable TLS/SSL
</label>
</div>
@ -268,8 +268,8 @@
<label for="theme-select" class="sr-only">Theme</label>
<select id="theme-select" name="theme" class="input">
{{#each themes}}
<option value="{{this}}">
{{firstLetterUppercase this}}
<option value="{{filename}}">
{{name}}
</option>
{{/each}}
</select>

View File

@ -1,5 +0,0 @@
"use strict";
module.exports = function(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
};

View File

@ -1,18 +0,0 @@
"use strict";
module.exports = {
colorClass: require("./colorClass"),
diff: require("./diff"),
equal: require("./equal"),
firstLetterUppercase: require("./firstLetterUppercase"),
localedate: require("./localedate"),
localetime: require("./localetime"),
modes: require("./modes"),
parse: require("./parse"),
roundBadgeNumber: require("./roundBadgeNumber"),
slugify: require("./slugify"),
ternary: require("./ternary"),
tojson: require("./tojson"),
tz: require("./tz"),
users: require("./users"),
};

View File

@ -1,5 +0,0 @@
"use strict";
module.exports = function(test, yes, no) {
return test ? yes : no;
};

View File

@ -46,7 +46,7 @@
"commander": "2.9.0",
"event-stream": "3.3.4",
"express": "4.15.2",
"express-handlebars": "^3.0.0",
"express-handlebars": "3.0.0",
"fs-extra": "2.1.2",
"irc-framework": "2.6.1",
"ldapjs": "1.0.1",

View File

@ -32,7 +32,7 @@ module.exports = function() {
.use(allRequests)
.use(index)
.use(express.static("client"))
.engine("html", expressHandlebars({extname: ".html", helpers: require("../client/js/libs/handlebars")}))
.engine("html", expressHandlebars({extname: ".html"}))
.set("view engine", "html")
.set("views", path.join(__dirname, "..", "client"));
@ -138,7 +138,11 @@ function index(req, res, next) {
data.themes = fs.readdirSync("client/themes/").filter(function(themeFile) {
return themeFile.endsWith(".css");
}).map(function(css) {
return css.slice(0, -4);
const filename = css.slice(0, -4);
return {
name: filename.charAt(0).toUpperCase() + filename.slice(1),
filename: filename
};
});
res.setHeader("Content-Security-Policy", "default-src *; connect-src 'self' ws: wss:; style-src * 'unsafe-inline'; script-src 'self'; child-src 'self'; object-src 'none'; form-action 'none';");
res.setHeader("Referrer-Policy", "no-referrer");