mirror of
https://github.com/thelounge/thelounge
synced 2024-11-26 05:50:22 +00:00
Remove express-handlebars, read manifest.json to get theme-color
This commit is contained in:
parent
c30f4aaaeb
commit
e86a155ec2
4 changed files with 19 additions and 16 deletions
|
@ -9,23 +9,23 @@
|
|||
<link rel="preload" as="script" href="js/bundle.js">
|
||||
<link rel="stylesheet" href="css/bootstrap.css">
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
<link id="theme" rel="stylesheet" href="{{ theme }}">
|
||||
<link id="theme" rel="stylesheet" href="<%- theme %>">
|
||||
<style id="user-specified-css"></style>
|
||||
|
||||
<title>The Lounge</title>
|
||||
|
||||
<link rel="shortcut icon" href="img/favicon.png" data-other="img/favicon-notification.png" data-toggled="false" id="favicon">
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="img/apple-touch-icon-120x120.png">
|
||||
<link rel="mask-icon" href="img/logo.svg" color="#455164">
|
||||
<link rel="mask-icon" href="img/logo.svg" color="<%- themeColor %>">
|
||||
<link rel="manifest" href="manifest.json">
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="theme-color" content="#455164">
|
||||
<meta name="theme-color" content="<%- themeColor %>">
|
||||
|
||||
</head>
|
||||
<body class="signed-out {{#if public}}public{{/if}}" data-transports="{{tojson transports}}">
|
||||
<body class="signed-out<%- public ? " public" : "" %>" data-transports="<%- JSON.stringify(transports) %>">
|
||||
|
||||
<div id="wrap">
|
||||
<div id="viewport">
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
"colors": "1.1.2",
|
||||
"commander": "2.11.0",
|
||||
"express": "4.16.2",
|
||||
"express-handlebars": "3.0.0",
|
||||
"fs-extra": "4.0.2",
|
||||
"irc-framework": "2.9.1",
|
||||
"ldapjs": "1.0.1",
|
||||
|
|
|
@ -78,6 +78,10 @@ function setHome(homePath) {
|
|||
log.warn(`${colors.bold("displayNetwork")} and ${colors.bold("lockNetwork")} are false, setting ${colors.bold("lockNetwork")} to true.`);
|
||||
}
|
||||
|
||||
// Load theme color from manifest.json
|
||||
const manifest = require("../public/manifest.json");
|
||||
this.config.themeColor = manifest.theme_color;
|
||||
|
||||
// TODO: Remove in future release
|
||||
if (this.config.debug === true) {
|
||||
log.warn("debug option is now an object, see defaults file for more information.");
|
||||
|
|
|
@ -5,7 +5,6 @@ var pkg = require("../package.json");
|
|||
var Client = require("./client");
|
||||
var ClientManager = require("./clientManager");
|
||||
var express = require("express");
|
||||
var expressHandlebars = require("express-handlebars");
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
var io = require("socket.io");
|
||||
|
@ -39,21 +38,14 @@ module.exports = function() {
|
|||
}
|
||||
|
||||
var app = express()
|
||||
.disable("x-powered-by")
|
||||
.use(allRequests)
|
||||
.use(index)
|
||||
.use(express.static("public"))
|
||||
.use("/storage/", express.static(Helper.getStoragePath(), {
|
||||
redirect: false,
|
||||
maxAge: 86400 * 1000,
|
||||
}))
|
||||
.engine("html", expressHandlebars({
|
||||
extname: ".html",
|
||||
helpers: {
|
||||
tojson: (c) => JSON.stringify(c),
|
||||
},
|
||||
}))
|
||||
.set("view engine", "html")
|
||||
.set("views", path.join(__dirname, "..", "public"));
|
||||
}));
|
||||
|
||||
app.get("/themes/:theme.css", (req, res) => {
|
||||
const themeName = req.params.theme;
|
||||
|
@ -221,9 +213,17 @@ function index(req, res, next) {
|
|||
policies.unshift("block-all-mixed-content");
|
||||
}
|
||||
|
||||
res.setHeader("Content-Type", "text/html");
|
||||
res.setHeader("Content-Security-Policy", policies.join("; "));
|
||||
res.setHeader("Referrer-Policy", "no-referrer");
|
||||
res.render("index", Helper.config);
|
||||
|
||||
return fs.readFile(path.join(__dirname, "..", "public", "index.html"), "utf-8", (err, file) => {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
res.send(_.template(file)(Helper.config));
|
||||
});
|
||||
}
|
||||
|
||||
function initializeClient(socket, client, token, lastMessage) {
|
||||
|
|
Loading…
Reference in a new issue