Merge pull request #2895 from thelounge/xpaw/manifest

Rename `manifest.json` to `thelounge.webmanifest`
This commit is contained in:
Pavel Djundik 2018-11-21 11:48:17 +02:00 committed by GitHub
commit e97db8e244
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 17 deletions

View File

@ -24,7 +24,7 @@
<!-- Safari pinned tab icon -->
<link rel="mask-icon" href="img/icon-black-transparent-bg.svg" color="#415363">
<link rel="manifest" href="manifest.json">
<link rel="manifest" href="thelounge.webmanifest">
<!-- iPhone 4, iPhone 4s, iPhone 5, iPhone 5c, iPhone 5s, iPhone 6, iPhone 6s, iPhone 7, iPhone 7s, iPhone8 -->
<link rel="apple-touch-icon" sizes="120x120" href="img/logo-grey-bg-120x120px.png">

View File

@ -5,7 +5,6 @@ const log = require("../log");
const fs = require("fs");
const path = require("path");
const program = require("commander");
const colors = require("chalk");
const Helper = require("../helper");
const Utils = require("./utils");
@ -20,18 +19,6 @@ program.version(Helper.getVersion(), "-v, --version")
// Parse options from `argv` returning `argv` void of these options.
const argvWithoutOptions = program.parseOptions(process.argv);
// Check if the app was built before calling setHome as it wants to load manifest.json from the public folder
if (!fs.existsSync(path.join(
__dirname,
"..",
"..",
"public",
"manifest.json"
))) {
log.error(`The client application was not built. Run ${colors.bold("NODE_ENV=production yarn build")} to resolve this.`);
process.exit(1);
}
Helper.setHome(process.env.THELOUNGE_HOME || Utils.defaultHome());
// Check config file owner and warn if we're running under a different user

View File

@ -117,8 +117,16 @@ function setHome(newPath) {
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");
const manifestPath = path.resolve(path.join(__dirname, "..", "public", "thelounge.webmanifest"));
// Check if manifest exists, if not, the app most likely was not built
if (!fs.existsSync(manifestPath)) {
log.error(`The client application was not built. Run ${colors.bold("NODE_ENV=production yarn build")} to resolve this.`);
process.exit(1);
}
// Load theme color from the web manifest
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
this.config.themeColor = manifest.theme_color;
// TODO: Remove in future release

View File

@ -41,11 +41,12 @@ describe("Server", function() {
});
it("should serve static content correctly", (done) => {
request(webURL + "manifest.json", (error, response, body) => {
request(webURL + "thelounge.webmanifest", (error, response, body) => {
expect(error).to.be.null;
body = JSON.parse(body);
expect(body.name).to.equal("The Lounge");
expect(response.headers["content-type"]).to.equal("application/manifest+json");
done();
});