| 16 | let loggedDisabled = false; |
| 17 | |
| 18 | const 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 | |
| 41 | export const getLatestVersion = () => { |