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"> <meta name="theme-color" content="#455164">
</head> </head>
<body class="signed-out {{ternary public 'public' '' }}"> <body class="signed-out {{#if public}}public{{/if}}">
<div id="wrap"> <div id="wrap">
<div id="viewport"> <div id="viewport">
@ -122,7 +122,7 @@
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<h1 class="title"> <h1 class="title">
{{ternary public "The Lounge " " " }} {{#if public}}The Lounge - {{/if}}
Connect Connect
{{#unless displayNetwork}} {{#unless displayNetwork}}
{{#if lockNetwork}} {{#if lockNetwork}}
@ -146,11 +146,11 @@
<label for="connect:host">Server</label> <label for="connect:host">Server</label>
</div> </div>
<div class="col-sm-6 col-xs-8"> <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>
<div class="col-sm-3 col-xs-4"> <div class="col-sm-3 col-xs-4">
<div class="port"> <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> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
@ -162,7 +162,7 @@
</div> </div>
<div class="col-sm-9 col-sm-offset-3"> <div class="col-sm-9 col-sm-offset-3">
<label class="tls"> <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 Enable TLS/SSL
</label> </label>
</div> </div>
@ -268,8 +268,8 @@
<label for="theme-select" class="sr-only">Theme</label> <label for="theme-select" class="sr-only">Theme</label>
<select id="theme-select" name="theme" class="input"> <select id="theme-select" name="theme" class="input">
{{#each themes}} {{#each themes}}
<option value="{{this}}"> <option value="{{filename}}">
{{firstLetterUppercase this}} {{name}}
</option> </option>
{{/each}} {{/each}}
</select> </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", "commander": "2.9.0",
"event-stream": "3.3.4", "event-stream": "3.3.4",
"express": "4.15.2", "express": "4.15.2",
"express-handlebars": "^3.0.0", "express-handlebars": "3.0.0",
"fs-extra": "2.1.2", "fs-extra": "2.1.2",
"irc-framework": "2.6.1", "irc-framework": "2.6.1",
"ldapjs": "1.0.1", "ldapjs": "1.0.1",

View File

@ -32,7 +32,7 @@ module.exports = function() {
.use(allRequests) .use(allRequests)
.use(index) .use(index)
.use(express.static("client")) .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("view engine", "html")
.set("views", path.join(__dirname, "..", "client")); .set("views", path.join(__dirname, "..", "client"));
@ -138,7 +138,11 @@ function index(req, res, next) {
data.themes = fs.readdirSync("client/themes/").filter(function(themeFile) { data.themes = fs.readdirSync("client/themes/").filter(function(themeFile) {
return themeFile.endsWith(".css"); return themeFile.endsWith(".css");
}).map(function(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("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"); res.setHeader("Referrer-Policy", "no-referrer");