MCPcopy Index your code
hub / github.com/ether/etherpad / loadEtherpadInformations

Function loadEtherpadInformations

src/node/utils/UpdateCheck.ts:18–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16let loggedDisabled = false;
17
18const loadEtherpadInformations = () => {
19 if (lastLoadingTime !== null && Date.now() - lastLoadingTime < updateInterval) {
20 return infos;
21 }
22
23 return fetch(`${settings.updateServer}/info.json`, {headers})
24 .then(async (resp) => {
25 if (!resp.ok) throw new Error(`HTTP ${resp.status} ${resp.statusText}`);
26 infos = await resp.json() as Infos;
27 if (infos === undefined || infos === null) {
28 await Promise.reject("Could not retrieve current version")
29 return
30 }
31
32 lastLoadingTime = Date.now();
33 return infos;
34 })
35 .catch(async (err: Error) => {
36 throw err;
37 });
38}
39
40
41export const getLatestVersion = () => {

Callers 1

needsUpdateFunction · 0.85

Calls 1

nowMethod · 0.80

Tested by

no test coverage detected