smc-hub
Version:
CoCalc: Backend webserver component
40 lines • 1.59 kB
JavaScript
;
/*
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
* License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.send = void 0;
var path_1 = require("path");
var base_path_1 = __importDefault(require("smc-util-node/base-path"));
function send(res, custom) {
var _a;
var config = custom.configuration;
// See https://developer.mozilla.org/en-US/docs/Web/Manifest, which says
// "the response of the manifest file should return Content-Type: application/manifest+json)"
res.header("Content-Type", "application/manifest+json");
var base_app = path_1.join(base_path_1.default, "app");
var manifest = {
name: config.site_name,
short_name: config.site_name,
start_url: base_app + "?utm_medium=manifest",
scope: base_path_1.default,
display: "minimal-ui",
background_color: "#fbb635",
theme_color: "#4474c0",
description: config.site_description,
icons: [
{
src: (_a = config.logo_square) !== null && _a !== void 0 ? _a : "https://storage.googleapis.com/cocalc-extra/cocalc-icon-white-fillin.256px.png",
sizes: "256x256",
type: "image/png",
},
],
};
res.send(JSON.stringify(manifest, null, 2));
}
exports.send = send;
//# sourceMappingURL=manifest.js.map