CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/hub/manifest.ts
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
// dynamically generate the manifest json file – for html5 web app's
7
8
import { Response } from "express";
9
import { join } from "path";
10
import { SiteSettingsKeys } from "@cocalc/util/db-schema/site-defaults";
11
import base_path from "@cocalc/backend/base-path";
12
13
interface Custom {
14
configuration: Record<SiteSettingsKeys, string>;
15
}
16
17
export function send(res: Response, custom: Custom) {
18
const config = custom.configuration;
19
20
// See https://developer.mozilla.org/en-US/docs/Web/Manifest, which says
21
// "the response of the manifest file should return Content-Type: application/manifest+json)"
22
res.header("Content-Type", "application/manifest+json");
23
24
const base_app = join(base_path, "app");
25
26
const manifest = {
27
name: config.site_name,
28
short_name: config.site_name,
29
start_url: `${base_app}?utm_medium=manifest`,
30
scope: base_path,
31
display: "minimal-ui",
32
background_color: "#fbb635",
33
theme_color: "#4474c0",
34
description: config.site_description,
35
icons: [
36
{
37
src:
38
config.logo_square ??
39
"https://storage.googleapis.com/cocalc-extra/cocalc-icon-white-fillin.256px.png",
40
sizes: "256x256",
41
type: "image/png",
42
},
43
],
44
};
45
46
res.send(JSON.stringify(manifest, null, 2));
47
}
48
49