@cocalc/hub
Version:
CoCalc: Backend webserver component
40 lines • 1.58 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;
const path_1 = require("path");
const base_path_1 = __importDefault(require("@cocalc/backend/base-path"));
function send(res, custom) {
const 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");
const base_app = (0, path_1.join)(base_path_1.default, "app");
const 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: config.logo_square ??
"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