Skip to content

Commit 193c531

Browse files
authored
Merge pull request #4855 from Countly/ar2rsawseen/master
Allow extending geojson map through themes
2 parents 7ac2957 + 92896c8 commit 193c531

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

frontend/express/app.js

+11-16
Original file line numberDiff line numberDiff line change
@@ -463,22 +463,17 @@ Promise.all([plugins.dbConnection(countlyConfig), plugins.dbConnection("countly_
463463
app.use(cookieParser());
464464
//server theme images
465465
app.use(function(req, res, next) {
466-
if (req.url.indexOf(countlyConfig.path + '/images/') === 0) {
467-
var urlPath = req.url.replace(countlyConfig.path, "");
468-
var theme = req.cookies.theme || curTheme;
469-
if (theme && theme.length) {
470-
fs.exists(__dirname + '/public/themes/' + theme + urlPath, function(exists) {
471-
if (exists) {
472-
res.sendFile(__dirname + '/public/themes/' + theme + urlPath);
473-
}
474-
else {
475-
next();
476-
}
477-
});
478-
}
479-
else { //serve default location
480-
next();
481-
}
466+
var urlPath = req.url.replace(countlyConfig.path, "");
467+
var theme = req.cookies.theme || curTheme;
468+
if (theme && theme.length && (req.url.indexOf(countlyConfig.path + '/images/') === 0 || req.url.indexOf(countlyConfig.path + '/geodata/') === 0)) {
469+
fs.exists(__dirname + '/public/themes/' + theme + urlPath, function(exists) {
470+
if (exists) {
471+
res.sendFile(__dirname + '/public/themes/' + theme + urlPath);
472+
}
473+
else {
474+
next();
475+
}
476+
});
482477
}
483478
else {
484479
next();

frontend/express/public/themes/map_with_antarctica/geodata/world.geojson

+1
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)