Skip to content

Commit f5d4324

Browse files
authored
Merge pull request #8482 from sagemathinc/disable-pwa
frontend: disable PWA install app
2 parents 003cb82 + 0b24740 commit f5d4324

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/packages/hub/manifest.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import { join } from "path";
1010
import { SiteSettingsKeys } from "@cocalc/util/db-schema/site-defaults";
1111
import base_path from "@cocalc/backend/base-path";
1212

13+
// Control PWA installability -- https://github.com/sagemathinc/cocalc/issues/8474
14+
// Keeps theme colors and styling but prevents Chrome's "Install app" prompt
15+
const ENABLE_PWA_INSTALL = false;
16+
1317
interface Custom {
1418
configuration: Record<SiteSettingsKeys, string>;
1519
}
@@ -23,12 +27,11 @@ export function send(res: Response, custom: Custom) {
2327

2428
const base_app = join(base_path, "app");
2529

26-
const manifest = {
30+
const manifest: any = {
2731
name: config.site_name,
2832
short_name: config.site_name,
2933
start_url: `${base_app}?utm_medium=manifest`,
3034
scope: base_path,
31-
display: "minimal-ui",
3235
background_color: "#fbb635",
3336
theme_color: "#4474c0",
3437
description: config.site_description,
@@ -43,5 +46,10 @@ export function send(res: Response, custom: Custom) {
4346
],
4447
};
4548

49+
// Without that display property, browsers won't show the "Install app" prompt
50+
if (ENABLE_PWA_INSTALL) {
51+
manifest.display = "minimal-ui";
52+
}
53+
4654
res.send(JSON.stringify(manifest, null, 2));
4755
}

src/packages/static/src/load.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ const loadContainer = document.getElementById("cocalc-load-container");
1717
if (loadContainer) {
1818
createRoot(loadContainer).render(
1919
<>
20-
<Manifest />
2120
<PreflightCheck />
2221
<StartupBanner />
2322
</>
@@ -32,6 +31,7 @@ const scriptsContainer = document.getElementById("cocalc-scripts-container");
3231
if (scriptsContainer != null) {
3332
createRoot(scriptsContainer).render(
3433
<span>
34+
<Manifest />
3535
<Meta />
3636
<Favicons />
3737
</span>

0 commit comments

Comments
 (0)