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 semver = require('semver');
|
||||||
const settings = require('./Settings');
|
const settings = require('./Settings');
|
||||||
const axios = require('axios');
|
const axios = require('axios');
|
||||||
|
const headers = {
|
||||||
|
'User-Agent': 'Etherpad ' + settings.getEpVersion(),
|
||||||
|
}
|
||||||
let infos;
|
let infos;
|
||||||
|
|
||||||
const loadEtherpadInformations = () =>
|
const loadEtherpadInformations = () =>
|
||||||
axios.get('https://static.etherpad.org/info.json')
|
axios.get('https://static.etherpad.org/info.json', {headers: headers})
|
||||||
.then(async resp => {
|
.then(async resp => {
|
||||||
try {
|
try {
|
||||||
infos = await resp.data;
|
infos = await resp.data;
|
||||||
if (infos === undefined || infos === null) {
|
if (infos === undefined || infos === null) {
|
||||||
await Promise.reject("Could not retrieve current version")
|
await Promise.reject("Could not retrieve current version")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return await Promise.resolve(infos);
|
return await Promise.resolve(infos);
|
||||||
}
|
} catch (err) {
|
||||||
catch (err) {
|
return await Promise.reject(err);
|
||||||
return await Promise.reject(err);
|
}
|
||||||
}
|
})
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
exports.getLatestVersion = () => {
|
exports.getLatestVersion = () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue