Skip to content

Commit 92896c8

Browse files
committed
Allow extending geojson map through themes
1 parent 0644bae commit 92896c8

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
@@ -454,22 +454,17 @@ Promise.all([plugins.dbConnection(countlyConfig), plugins.dbConnection("countly_
454454
app.use(cookieParser());
455455
//server theme images
456456
app.use(function(req, res, next) {
457-
if (req.url.indexOf(countlyConfig.path + '/images/') === 0) {
458-
var urlPath = req.url.replace(countlyConfig.path, "");
459-
var theme = req.cookies.theme || curTheme;
460-
if (theme && theme.length) {
461-
fs.exists(__dirname + '/public/themes/' + theme + urlPath, function(exists) {
462-
if (exists) {
463-
res.sendFile(__dirname + '/public/themes/' + theme + urlPath);
464-
}
465-
else {
466-
next();
467-
}
468-
});
469-
}
470-
else { //serve default location
471-
next();
472-
}
457+
var urlPath = req.url.replace(countlyConfig.path, "");
458+
var theme = req.cookies.theme || curTheme;
459+
if (theme && theme.length && (req.url.indexOf(countlyConfig.path + '/images/') === 0 || req.url.indexOf(countlyConfig.path + '/geodata/') === 0)) {
460+
fs.exists(__dirname + '/public/themes/' + theme + urlPath, function(exists) {
461+
if (exists) {
462+
res.sendFile(__dirname + '/public/themes/' + theme + urlPath);
463+
}
464+
else {
465+
next();
466+
}
467+
});
473468
}
474469
else {
475470
next();

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

+1
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)