Send etherpad version in update check request

This commit is contained in:
Stefan Müller 2023-09-24 19:42:36 +02:00
parent 293bd64522
commit 94ad1a594d

View file

@ -2,10 +2,13 @@
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;
@ -14,8 +17,7 @@ const loadEtherpadInformations = () =>
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);
} }
}) })