Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Commit

Permalink
QMAPS-2491 - Switch burger visibility from userAgent to query paramet…
Browse files Browse the repository at this point in the history
…er rule
  • Loading branch information
Olivier PASCAL committed Feb 14, 2022
1 parent 1137b41 commit 4f168b9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions bin/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,12 @@ function App(config) {
const ogMeta = new require('./middlewares/og_meta')(config);

router.get('/*', redirectUnsupported, fullTextQuery, preFetchPoi, ogMeta, (req, res) => {
const userAgent = req.headers['user-agent'];
const disableMenuRule = config.server.disableBurgerMenu.userAgentRule;
const disableMenuRule = config.server.disableBurgerMenu.clientRule;
const { server: _droppedServerConfig, ...appConfig } = config;
const regexpRule = new RegExp(`[?&]client=${disableMenuRule}`);

let localAppConfig = appConfig;
if (disableMenuRule && userAgent && userAgent.match(disableMenuRule)) {
if (disableMenuRule && regexpRule.test(req.originalUrl)) {
localAppConfig = {
...appConfig,
burgerMenu: {
Expand Down
2 changes: 1 addition & 1 deletion config/default_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ server:
logger:
headersWhitelistEnabled: true
disableBurgerMenu:
userAgentRule: '' # regex, ignored if empty
clientRule: override_by_environment
# NB: `routerBaseUrl` may be different from `system.baseUrl` if a proxy is responsible for rewriting URLs
routerBaseUrl: / # path prefix expected by the express server
useGeoipForInitialPosition: true
Expand Down

0 comments on commit 4f168b9

Please sign in to comment.