fix(deps): update dependency sitemap to v4

Squashed commit of the following:

commit f4dd9cabb21e26fdc21f8413be822ea7c64251f8
Author: Julian Lam <julian@nodebb.org>
Date:   Tue Aug 13 11:33:05 2019 -0400

    fix: resolved breaking changes from sitemap v4 upgrade

commit 9043415ee16dcc27a8dcc2e4479d1bc5e2d1b60e
Merge: e3352b272 72590b346
Author: Julian Lam <julian@nodebb.org>
Date:   Tue Aug 13 11:09:55 2019 -0400

    Merge branch 'master' into renovate/sitemap-4.x

commit e3352b272eb9400bdb00774973181397803765e4
Author: Renovate Bot <bot@renovateapp.com>
Date:   Mon Aug 12 07:59:05 2019 +0000

    fix(deps): update dependency sitemap to v4
v1.18.x
Julian Lam 6 years ago
parent 7a5dbd9ff5
commit d3d677daf2

@ -110,7 +110,7 @@
"semver": "^6.0.0",
"serve-favicon": "^2.4.5",
"sharp": "0.23.0",
"sitemap": "^3.0.0",
"sitemap": "^4.0.0",
"socket.io": "2.2.0",
"socket.io-adapter-cluster": "^1.0.1",
"socket.io-adapter-mongo": "^2.0.1",

@ -1,7 +1,7 @@
'use strict';
var async = require('async');
var sm = require('sitemap');
const { Sitemap } = require('sitemap');
var nconf = require('nconf');
var db = require('./database');
@ -45,7 +45,7 @@ sitemap.getPages = function (callback) {
sitemap.maps.pages &&
Date.now() < parseInt(sitemap.maps.pages.cacheSetTimestamp, 10) + parseInt(sitemap.maps.pages.cacheResetPeriod, 10)
) {
return sitemap.maps.pages.toXML(callback);
return callback(null, sitemap.maps.pages.toXML());
}
var urls = [{
@ -70,13 +70,13 @@ sitemap.getPages = function (callback) {
if (err) {
return callback(err);
}
sitemap.maps.pages = sm.createSitemap({
sitemap.maps.pages = new Sitemap({
hostname: nconf.get('url'),
cacheTime: 1000 * 60 * 60 * 24, // Cached for 24 hours
urls: data.urls,
});
sitemap.maps.pages.toXML(callback);
callback(null, sitemap.maps.pages.toXML());
});
};
@ -85,7 +85,7 @@ sitemap.getCategories = function (callback) {
sitemap.maps.categories &&
Date.now() < parseInt(sitemap.maps.categories.cacheSetTimestamp, 10) + parseInt(sitemap.maps.categories.cacheResetPeriod, 10)
) {
return sitemap.maps.categories.toXML(callback);
return callback(null, sitemap.maps.categories.toXML());
}
var categoryUrls = [];
@ -104,13 +104,13 @@ sitemap.getCategories = function (callback) {
}
});
sitemap.maps.categories = sm.createSitemap({
sitemap.maps.categories = new Sitemap({
hostname: nconf.get('url'),
cacheTime: 1000 * 60 * 60 * 24, // Cached for 24 hours
urls: categoryUrls,
});
sitemap.maps.categories.toXML(callback);
callback(null, sitemap.maps.categories.toXML());
});
};
@ -127,7 +127,7 @@ sitemap.getTopicPage = function (page, callback) {
sitemap.maps.topics[page - 1] &&
Date.now() < parseInt(sitemap.maps.topics[page - 1].cacheSetTimestamp, 10) + parseInt(sitemap.maps.topics[page - 1].cacheResetPeriod, 10)
) {
return sitemap.maps.topics[page - 1].toXML(callback);
return callback(null, sitemap.maps.topics[page - 1].toXML());
}
var topicUrls = [];
@ -158,13 +158,13 @@ sitemap.getTopicPage = function (page, callback) {
}
});
sitemap.maps.topics[page - 1] = sm.createSitemap({
sitemap.maps.topics[page - 1] = new Sitemap({
hostname: nconf.get('url'),
cacheTime: 1000 * 60 * 60, // Cached for 1 hour
urls: topicUrls,
});
sitemap.maps.topics[page - 1].toXML(callback);
callback(null, sitemap.maps.topics[page - 1].toXML());
});
};

Loading…
Cancel
Save