mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-08 16:05:05 -04:00
Send etherpad version in update check request
This commit is contained in:
parent
293bd64522
commit
94ad1a594d
1 changed files with 16 additions and 14 deletions
|
@ -2,23 +2,25 @@
|
|||
const semver = require('semver');
|
||||
const settings = require('./Settings');
|
||||
const axios = require('axios');
|
||||
const headers = {
|
||||
'User-Agent': 'Etherpad ' + settings.getEpVersion(),
|
||||
}
|
||||
let infos;
|
||||
|
||||
const loadEtherpadInformations = () =>
|
||||
axios.get('https://static.etherpad.org/info.json')
|
||||
.then(async resp => {
|
||||
try {
|
||||
infos = await resp.data;
|
||||
if (infos === undefined || infos === null) {
|
||||
await Promise.reject("Could not retrieve current version")
|
||||
return
|
||||
}
|
||||
return await Promise.resolve(infos);
|
||||
}
|
||||
catch (err) {
|
||||
return await Promise.reject(err);
|
||||
}
|
||||
})
|
||||
axios.get('https://static.etherpad.org/info.json', {headers: headers})
|
||||
.then(async resp => {
|
||||
try {
|
||||
infos = await resp.data;
|
||||
if (infos === undefined || infos === null) {
|
||||
await Promise.reject("Could not retrieve current version")
|
||||
return
|
||||
}
|
||||
return await Promise.resolve(infos);
|
||||
} catch (err) {
|
||||
return await Promise.reject(err);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
exports.getLatestVersion = () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue