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/servers/version.ts
Views: 687
1
import { database } from "./database";
2
import { getClients } from "../clients";
3
import getServerSettings from "./server-settings";
4
5
export default async function init() {
6
if (database.is_standby) {
7
return;
8
}
9
const clients = getClients();
10
const settings = await getServerSettings();
11
let version_recommended_browser: number = 0; // first time.
12
const update = () => {
13
if (
14
settings.version["version_recommended_browser"] ==
15
version_recommended_browser
16
) {
17
// version did not change
18
return;
19
}
20
version_recommended_browser =
21
settings.version["version_recommended_browser"];
22
for (const id in clients) {
23
const client = clients[id];
24
if (client.smc_version < version_recommended_browser) {
25
client.push_version_update();
26
}
27
}
28
};
29
update();
30
settings.table.on("change", update);
31
}
32
33